From tim_one@users.sourceforge.net Thu Aug 1 01:59:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 17:59:44 -0700 Subject: [Python-checkins] python/dist/src/Objects listsort.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8860 Added Files: listsort.txt Log Message: Checking in the doc file for "timsort". There's way too much here to stuff into code comments, and lots of it is going to be useful again (but hard to predict exactly which parts of it ...). --- NEW FILE: listsort.txt --- Intro ----- This describes an adaptive, stable, natural mergesort, modestly called timsort (hey, I earned it ). It has supernatural performance on many kinds of partially ordered arrays (less than lg(N!) comparisons needed, and as few as N-1), yet as fast as Python's previous highly tuned samplesort hybrid on random arrays. In a nutshell, the main routine marches over the array once, left to right, alternately identifying the next run, then merging it into the previous runs "intelligently". Everything else is complication for speed, and some hard-won measure of memory efficiency. Comparison with Python's Samplesort Hybrid ------------------------------------------ + timsort can require a temp array containing as many as N//2 pointers, which means as many as 2*N extra bytes on 32-bit boxes. It can be expected to require a temp array this large when sorting random data; on data with significant structure, it may get away without using any extra heap memory. This appears to be the strongest argument against it, but compared to the size of an object, 2 temp bytes worst-case (also expected- case for random data) doesn't scare me much. It turns out that Perl is moving to a stable mergesort, and the code for that appears always to require a temp array with room for at least N pointers. (Note that I wouldn't want to do that even if space weren't an issue; I believe its efforts at memory frugality also save timsort significant pointer-copying costs, and allow it to have a smaller working set.) + Across about four hours of generating random arrays, and sorting them under both methods, samplesort required about 1.5% more comparisons (the program is at the end of this file). + In real life, this may be faster or slower on random arrays than samplesort was, depending on platform quirks. Since it does fewer comparisons on average, it can be expected to do better the more expensive a comparison function is. OTOH, it does more data movement (pointer copying) than samplesort, and that may negate its small comparison advantage (depending on platform quirks) unless comparison is very expensive. + On arrays with many kinds of pre-existing order, this blows samplesort out of the water. It's significantly faster than samplesort even on some cases samplesort was special-casing the snot out of. I believe that lists very often do have exploitable partial order in real life, and this is the strongest argument in favor of timsort (indeed, samplesort's special cases for extreme partial order are appreciated by real users, and timsort goes much deeper than those, in particular naturally covering every case where someone has suggested "and it would be cool if list.sort() had a special case for this too ... and for that ..."). + Here are exact comparison counts across all the tests in sortperf.py, when run with arguments "15 20 1". First the trivial cases, trivial for samplesort because it special-cased them, and trivial for timsort because it naturally works on runs. Within an "n" block, the first line gives the # of compares done by samplesort, the second line by timsort, and the third line is the percentage by which the samplesort count exceeds the timsort count: n \sort /sort =sort ------- ------ ------ ------ 32768 32768 32767 32767 samplesort 32767 32767 32767 timsort 0.00% 0.00% 0.00% (samplesort - timsort) / timsort 65536 65536 65535 65535 65535 65535 65535 0.00% 0.00% 0.00% 131072 131072 131071 131071 131071 131071 131071 0.00% 0.00% 0.00% 262144 262144 262143 262143 262143 262143 262143 0.00% 0.00% 0.00% 524288 524288 524287 524287 524287 524287 524287 0.00% 0.00% 0.00% 1048576 1048576 1048575 1048575 1048575 1048575 1048575 0.00% 0.00% 0.00% The algorithms are effectively identical in these cases, except that timsort does one less compare in \sort. Now for the more interesting cases. lg(n!) is the information-theoretic limit for the best any comparison-based sorting algorithm can do on average (across all permutations). When a method gets significantly below that, it's either astronomically lucky, or is finding exploitable structure in the data. n lg(n!) *sort 3sort +sort ~sort !sort ------- ------- ------ -------- ------- ------- -------- 32768 444255 453084 453604 32908 130484 469132 samplesort 449235 33019 33016 188720 65534 timsort 0.86% 1273.77% -0.33% -30.86% 615.86% %ch from timsort 65536 954037 973111 970464 65686 260019 1004597 963924 65767 65802 377634 131070 0.95% 1375.61% -0.18% -31.15% 666.46% 131072 2039137 2100019 2102708 131232 555035 2161268 2058863 131422 131363 755476 262142 2.00% 1499.97% -0.10% -26.53% 724.46% 262144 4340409 4461471 4442796 262314 1107826 4584316 4380148 262446 262466 1511174 524286 1.86% 1592.84% -0.06% -26.69% 774.39% 524288 9205096 9448146 9368681 524468 2218562 9691553 9285454 524576 524626 3022584 1048574 1.75% 1685.95% -0.03% -26.60% 824.26% 1048576 19458756 19950541 20307955 1048766 4430616 20433371 19621100 1048854 1048933 6045418 2097150 1.68% 1836.20% -0.02% -26.71% 874.34% Discussion of cases: *sort: There's no structure in random data to exploit, so the theoretical limit is lg(n!). Both methods get close to that, and timsort is hugging it (indeed, in a *marginal* sense, it's a spectacular improvement -- there's only about 1% left before hitting the wall, and timsort knows darned well it's doing compares that won't pay on random data -- but so does the samplesort hybrid). For contrast, Hoare's original random-pivot quicksort does about 39% more compares than the limit, and the median-of-3 variant about 19% more. 3sort and !sort: No contest; there's structure in this data, but not of the specific kinds samplesort special-cases. Note that structure in !sort wasn't put there on purpose -- it was crafted as a worst case for a previous quicksort implementation. That timsort nails it came as a surprise to me (although it's obvious in retrospect). +sort: samplesort special-cases this data, and does a few less compares than timsort. However, timsort runs this case significantly faster on all boxes we have timings for, because timsort is in the business of merging runs efficiently, while samplesort does much more data movement in this (for it) special case. ~sort: samplesort's special cases for large masses of equal elements are extremely effective on ~sort's specific data pattern, and timsort just isn't going to get close to that, despite that it's clearly getting a great deal of benefit out of the duplicates (the # of compares is much less than lg(n!)). ~sort has a perfectly uniform distribution of just 4 distinct values, and as the distribution gets more skewed, samplesort's equal-element gimmicks become less effective, while timsort's adaptive strategies find more to exploit; in a database supplied by Kevin Altis, a sort on its highly skewed "on which stock exchange does this company's stock trade?" field ran over twice as fast under timsort. However, despite that timsort does many more comparisons on ~sort, and that on several platforms ~sort runs highly significantly slower under timsort, on other platforms ~sort runs highly significantly faster under timsort. No other kind of data has shown this wild x-platform behavior, and we don't have an explanation for it. The only thing I can think of that could transform what "should be" highly significant slowdowns into highly significant speedups on some boxes are catastrophic cache effects in samplesort. But timsort "should be" slower than samplesort on ~sort, so it's hard to count that it isn't on some boxes as a strike against it . A detailed description of timsort follows. Runs ---- count_run() returns the # of elements in the next run. A run is either "ascending", which means non-decreasing: a0 <= a1 <= a2 <= ... or "descending", which means strictly decreasing: a0 > a1 > a2 > ... Note that a run is always at least 2 long, unless we start at the array's last element. The definition of descending is strict, because the main routine reverses a descending run in-place, transforming a descending run into an ascending run. Reversal is done via the obvious fast "swap elements starting at each end, and converge at the middle" method, and that can violate stability if the slice contains any equal elements. Using a strict definition of descending ensures that a descending run contains distinct elements. If an array is random, it's very unlikely we'll see long runs. If a natural run contains less than minrun elements (see next section), the main loop artificially boosts it to minrun elements, via a stable binary insertion sort applied to the right number of array elements following the short natural run. In a random array, *all* runs are likely to be minrun long as a result. This has two primary good effects: 1. Random data strongly tends then toward perfectly balanced (both runs have the same length) merges, which is the most efficient way to proceed when data is random. 2. Because runs are never very short, the rest of the code doesn't make heroic efforts to shave a few cycles off per-merge overheads. For example, reasonable use of function calls is made, rather than trying to inline everything. Since there are no more than N/minrun runs to begin with, a few "extra" function calls per merge is barely measurable. Computing minrun ---------------- If N < 64, minrun is N. IOW, binary insertion sort is used for the whole array then; it's hard to beat that given the overheads of trying something fancier. When N is a power of 2, testing on random data showed that minrun values of 16, 32, 64 and 128 worked about equally well. At 256 the data-movement cost in binary insertion sort clearly hurt, and at 8 the increase in the number of function calls clearly hurt. Picking *some* power of 2 is important here, so that the merges end up perfectly balanced (see next section). We pick 32 as a good value in the sweet range; picking a value at the low end allows the adaptive gimmicks more opportunity to exploit shorter natural runs. Because sortperf.py only tries powers of 2, it took a long time to notice that 32 isn't a good choice for the general case! Consider N=2112: >>> divmod(2112, 32) (66, 0) >>> If the data is randomly ordered, we're very likely to end up with 66 runs each of length 32. The first 64 of these trigger a sequence of perfectly balanced merges (see next section), leaving runs of lengths 2048 and 64 to merge at the end. The adaptive gimmicks can do that with fewer than 2048+64 compares, but it's still more compares than necessary, and-- mergesort's bugaboo relative to samplesort --a lot more data movement (O(N) copies just to get 64 elements into place). If we take minrun=33 in this case, then we're very likely to end up with 64 runs each of length 33, and then all merges are perfectly balanced. Better! What we want to avoid is picking minrun such that in q, r = divmod(N, minrun) q is a power of 2 and r>0 (then the last merge only gets r elements into place, and r B+C 2. B > C Note that, by induction, #2 implies the lengths of pending runs form a decreasing sequence. #1 implies that, reading the lengths right to left, the pending-run lengths grow at least as fast as the Fibonacci numbers. Therefore the stack can never grow larger than about log_base_phi(N) entries, where phi = (1+sqrt(5))/2 ~= 1.618. Thus a small # of stack slots suffice for very large arrays. If A <= B+C, the smaller of A and C is merged with B (ties favor C, for the freshness-in-cache reason), and the new run replaces the A,B or B,C entries; e.g., if the last 3 entries are A:30 B:20 C:10 then B is merged with C, leaving A:30 BC:30 on the stack. Or if they were A:500 B:400: C:1000 then A is merged with B, leaving AB:900 C:1000 on the stack. In both examples, the stack configuration after the merge still violates invariant #2, and merge_collapse() goes on to continue merging runs until both invariants are satisfied. As an extreme case, suppose we didn't do the minrun gimmick, and natural runs were of lengths 128, 64, 32, 16, 8, 4, 2, and 2. Nothing would get merged until the final 2 was seen, and that would trigger 7 perfectly balanced merges. The thrust of these rules when they trigger merging is to balance the run lengths as closely as possible, while keeping a low bound on the number of runs we have to remember. This is maximally effective for random data, where all runs are likely to be of (artificially forced) length minrun, and then we get a sequence of perfectly balanced merges (with, perhaps, some oddballs at the end). OTOH, one reason this sort is so good for partly ordered data has to do with wildly unbalanced run lengths. Merge Memory ------------ Merging adjacent runs of lengths A and B in-place is very difficult. Theoretical constructions are known that can do it, but they're too difficult and slow for practical use. But if we have temp memory equal to min(A, B), it's easy. If A is smaller (function merge_lo), copy A to a temp array, leave B alone, and then we can do the obvious merge algorithm left to right, from the temp area and B, starting the stores into where A used to live. There's always a free area in the original area comprising a number of elements equal to the number not yet merged from the temp array (trivially true at the start; proceed by induction). The only tricky bit is that if a comparison raises an exception, we have to remember to copy the remaining elements back in from the temp area, lest the array end up with duplicate entries from B. But that's exactly the same thing we need to do if we reach the end of B first, so the exit code is pleasantly common to both the normal and error cases. If B is smaller (function merge_hi, which is merge_lo's "mirror image"), much the same, except that we need to merge right to left, copying B into a temp array and starting the stores at the right end of where B used to live. A refinement: When we're about to merge adjacent runs A and B, we first do a form of binary search (more on that later) to see where B[0] should end up in A. Elements in A preceding that point are already in their final positions, effectively shrinking the size of A. Likewise we also search to see where A[-1] should end up in B, and elements of B after that point can also be ignored. This cuts the amount of temp memory needed by the same amount. These preliminary searches may not pay off, and can be expected *not* to repay their cost if the data is random. But they can win huge in all of time, copying, and memory savings when they do pay, so this is one of the "per-merge overheads" mentioned above that we're happy to endure because there is at most one very short run. It's generally true in this algorithm that we're willing to gamble a little to win a lot, even though the net expectation is negative for random data. Merge Algorithms ---------------- merge_lo() and merge_hi() are where the bulk of the time is spent. merge_lo deals with runs where A <= B, and merge_hi where A > B. They don't know whether the data is clustered or uniform, but a lovely thing about merging is that many kinds of clustering "reveal themselves" by how many times in a row the winning merge element comes from the same run. We'll only discuss merge_lo here; merge_hi is exactly analogous. Merging begins in the usual, obvious way, comparing the first element of A to the first of B, and moving B[0] to the merge area if it's less than A[0], else moving A[0] to the merge area. Call that the "one pair at a time" mode. The only twist here is keeping track of how many times in a row "the winner" comes from the same run. If that count reaches MIN_GALLOP, we switch to "galloping mode". Here we *search* B for where A[0] belongs, and move over all the B's before that point in one chunk to the merge area, then move A[0] to the merge area. Then we search A for where B[0] belongs, and similarly move a slice of A in one chunk. Then back to searching B for where A[0] belongs, etc. We stay in galloping mode until both searches find slices to copy less than MIN_GALLOP elements long, at which point we go back to one-pair- at-a-time mode. Galloping --------- Still without loss of generality, assume A is the shorter run. In galloping mode, we first look for A[0] in B. We do this via "galloping", comparing A[0] in turn to B[0], B[1], B[3], B[7], ..., B[2**j - 1], ..., until finding the k such that B[2**(k-1) - 1] < A[0] <= B[2**k - 1]. This takes at most roughly lg(B) comparisons, and, unlike a straight binary search, favors finding the right spot early in B (more on that later). After finding such a k, the region of uncertainty is reduced to 2**(k-1) - 1 consecutive elements, and a straight binary search requires exactly k-1 additional comparisons to nail it. Then we copy all the B's up to that point in one chunk, and then copy A[0]. Note that no matter where A[0] belongs in B, the combination of galloping + binary search finds it in no more than about 2*lg(B) comparisons. If we did a straight binary search, we could find it in no more than ceiling(lg(B+1)) comparisons -- but straight binary search takes that many comparisons no matter where A[0] belongs. Straight binary search thus loses to galloping unless the run is quite long, and we simply can't guess whether it is in advance. If data is random and runs have the same length, A[0] belongs at B[0] half the time, at B[1] a quarter of the time, and so on: a consecutive winning sub-run in B of length k occurs with probability 1/2**(k+1). So long winning sub-runs are extremely unlikely in random data, and guessing that a winning sub-run is going to be long is a dangerous game. OTOH, if data is lopsided or lumpy or contains many duplicates, long stretches of winning sub-runs are very likely, and cutting the number of comparisons needed to find one from O(B) to O(log B) is a huge win. Galloping compromises by getting out fast if there isn't a long winning sub-run, yet finding such very efficiently when they exist. I first learned about the galloping strategy in a related context; see: "Adaptive Set Intersections, Unions, and Differences" (2000) Erik D. Demaine, Alejandro López-Ortiz, J. Ian Munro and its followup(s). An earlier paper called the same strategy "exponential search": "Optimistic Sorting and Information Theoretic Complexity" Peter McIlroy SODA (Fourth Annual ACM-SIAM Symposium on Discrete Algorithms), pp 467-474, Austin, Texas, 25-27 January 1993. and it probably dates back to an earlier paper by Bentley and Yao. The McIlory paper in particular has good analysis of a mergesort that's probably strongly related to this one in its galloping strategy. Galloping with a Broken Leg --------------------------- So why don't we always gallop? Because it can lose, on two counts: 1. While we're willing to endure small per-run overheads, per-comparison overheads are a different story. Calling Yet Another Function per comparison is expensive, and gallop_left() and gallop_right() are too long-winded for sane inlining. 2. Ignoring function-call overhead, galloping can-- alas --require more comparisons than linear one-at-time search, depending on the data. #2 requires details. If A[0] belongs before B[0], galloping requires 1 compare to determine that, same as linear search, except it costs more to call the gallop function. If A[0] belongs right before B[1], galloping requires 2 compares, again same as linear search. On the third compare, galloping checks A[0] against B[3], and if it's <=, requires one more compare to determine whether A[0] belongs at B[2] or B[3]. That's a total of 4 compares, but if A[0] does belong at B[2], linear search would have discovered that in only 3 compares, and that's a huge loss! Really. It's an increase of 33% in the number of compares needed, and comparisons are expensive in Python. index in B where # compares linear # gallop # binary gallop A[0] belongs search needs compares compares total ---------------- ----------------- -------- -------- ------ 0 1 1 0 1 1 2 2 0 2 2 3 3 1 4 3 4 3 1 4 4 5 4 2 6 5 6 4 2 6 6 7 4 2 6 7 8 4 2 6 8 9 5 3 8 9 10 5 3 8 10 11 5 3 8 11 12 5 3 8 ... In general, if A[0] belongs at B[i], linear search requires i+1 comparisons to determine that, and galloping a total of 2*floor(lg(i))+2 comparisons. The advantage of galloping is unbounded as i grows, but it doesn't win at all until i=6. Before then, it loses twice (at i=2 and i=4), and ties at the other values. At and after i=6, galloping always wins. We can't guess in advance when it's going to win, though, so we do one pair at a time until the evidence seems strong that galloping may pay. MIN_GALLOP is 8 as I type this, and that's pretty strong evidence. However, if the data is random, it simply will trigger galloping mode purely by luck every now and again, and it's quite likely to hit one of the losing cases next. 8 favors protecting against a slowdown on random data at the expense of giving up small wins on lightly clustered data, and tiny marginal wins on highly clustered data (they win huge anyway, and if you're getting a factor of 10 speedup, another percent just isn't worth fighting for). Galloping Complication ---------------------- The description above was for merge_lo. merge_hi has to merge "from the other end", and really needs to gallop starting at the last element in a run instead of the first. Galloping from the first still works, but does more comparisons than it should (this is significant -- I timed it both ways). For this reason, the gallop_left() and gallop_right() functions have a "hint" argument, which is the index at which galloping should begin. So galloping can actually start at any index, and proceed at offsets of 1, 3, 7, 15, ... or -1, -3, -7, -15, ... from the starting index. In the code as I type it's always called with either 0 or n-1 (where n is the # of elements in a run). It's tempting to try to do something fancier, melding galloping with some form of interpolation search; for example, if we're merging a run of length 1 with a run of length 10000, index 5000 is probably a better guess at the final result than either 0 or 9999. But it's unclear how to generalize that intuition usefully, and merging of wildly unbalanced runs already enjoys excellent performance. Comparing Average # of Compares on Random Arrays ------------------------------------------------ Here list.sort() is samplesort, and list.msort() this sort: """ import random from time import clock as now def fill(n): from random import random return [random() for i in xrange(n)] def mycmp(x, y): global ncmp ncmp += 1 return cmp(x, y) def timeit(values, method): global ncmp X = values[:] bound = getattr(X, method) ncmp = 0 t1 = now() bound(mycmp) t2 = now() return t2-t1, ncmp format = "%5s %9.2f %11d" f2 = "%5s %9.2f %11.2f" def drive(): count = sst = sscmp = mst = mscmp = nelts = 0 while True: n = random.randrange(100000) nelts += n x = fill(n) t, c = timeit(x, 'sort') sst += t sscmp += c t, c = timeit(x, 'msort') mst += t mscmp += c count += 1 if count % 10: continue print "count", count, "nelts", nelts print format % ("sort", sst, sscmp) print format % ("msort", mst, mscmp) print f2 % ("", (sst-mst)*1e2/mst, (sscmp-mscmp)*1e2/mscmp) drive() """ I ran this on Windows and kept using the computer lightly while it was running. time.clock() is wall-clock time on Windows, with better than microsecond resolution. samplesort started with a 1.52% #-of-comparisons disadvantage, fell quickly to 1.48%, and then fluctuated within that small range. Here's the last chunk of output before I killed the job: count 2630 nelts 130906543 sort 6110.80 1937887573 msort 6002.78 1909389381 1.80 1.49 We've done nearly 2 billion comparisons apiece at Python speed there, and that's enough . For random arrays of size 2 (yes, there are only 2 interesting ones), samplesort has a 50%(!) comparison disadvantage. This is a consequence of samplesort special-casing at most one ascending run at the start, then falling back to the general case if it doesn't find an ascending run immediately. The consequence is that it ends up using two compares to sort [2, 1]. Gratifyingly, timsort doesn't do any special-casing, so had to be taught how to deal with mixtures of ascending and descending runs efficiently in all cases. From tim_one@users.sourceforge.net Thu Aug 1 03:13:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 19:13:39 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23821/python/objects Modified Files: listobject.c Log Message: Replaced samplesort with a stable, adaptive mergesort. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -d -r2.129 -r2.130 *** listobject.c 29 Jul 2002 14:35:02 -0000 2.129 --- listobject.c 1 Aug 2002 02:13:36 -0000 2.130 *************** *** 756,768 **** } ! /* New quicksort implementation for arrays of object pointers. ! Thanks to discussions with Tim Peters. */ /* Comparison function. Takes care of calling a user-supplied ! comparison function (any callable Python object). Calls the ! standard comparison function, PyObject_RichCompareBool(), if the user- ! supplied function is NULL. ! Returns <0 on error, >0 if x < y, 0 if x >= y. */ [...1316 lines suppressed...] static PyMethodDef list_methods[] = { --- 2012,2016 ---- "L.reverse() -- reverse *IN PLACE*"); PyDoc_STRVAR(sort_doc, ! "L.sort([cmpfunc]) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1"); static PyMethodDef list_methods[] = { *************** *** 1658,1662 **** {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, {"sort", (PyCFunction)listsort, METH_VARARGS, sort_doc}, ! {NULL, NULL} /* sentinel */ }; --- 2024,2028 ---- {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, {"sort", (PyCFunction)listsort, METH_VARARGS, sort_doc}, ! {NULL, NULL} /* sentinel */ }; From tim_one@users.sourceforge.net Thu Aug 1 03:23:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 19:23:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24012 Added Files: test_sort.py Log Message: New test for sorting sanity. Note that this will fail in earlier Pythons, in the stability tests. Bizarre: this takes 11x longer to run if and only if test_longexp is run before it, on my box. The bigger REPS is in test_longexp, the slower this gets. What happens on your box? It's not gc on my box (which is good, because gc isn't a plausible candidate here). The slowdown is massive in the parts of test_sort that implicitly invoke a new-style class's __lt__ or __cmp__ methods. If I boost REPS large enough in test_longexp, even the test_sort tests on an array of size 64 visibly c-r-a-w-l. The relative slowdown is even worse in a debug build. And if I reduce REPS in test_longexp, the slowdown in test_sort goes away. test_longexp does do horrid things to Win98's management of user address space, but I thought I had made that a whole lot better a month or so ago (by overallocating aggressively in the parser). --- NEW FILE: test_sort.py --- from test.test_support import verbose import random nerrors = 0 def check(tag, expected, raw, compare=None): global nerrors if verbose: print " checking", tag orig = raw[:] # save input in case of error if compare: raw.sort(compare) else: raw.sort() if len(expected) != len(raw): print "error in", tag print "length mismatch;", len(expected), len(raw) print expected print orig print raw nerrors += 1 return for i, good in enumerate(expected): maybe = raw[i] if good is not maybe: print "error in", tag print "out of order at index", i, good, maybe print expected print orig print raw nerrors += 1 return # Try a variety of sizes at and around powers of 2, and at powers of 10. sizes = [0] for power in range(1, 10): n = 2 ** power sizes.extend(range(n-1, n+2)) sizes.extend([10, 100, 1000]) class Complains(object): maybe_complain = True def __init__(self, i): self.i = i def __lt__(self, other): if Complains.maybe_complain and random.random() < 0.001: if verbose: print " complaining at", self, other raise RuntimeError return self.i < other.i def __repr__(self): return "Complains(%d)" % self.i class Stable(object): maybe_complain = True def __init__(self, key, i): self.key = key self.index = i def __cmp__(self, other): return cmp(self.key, other.key) def __repr__(self): return "Stable(%d, %d)" % (self.key, self.index) for n in sizes: x = range(n) if verbose: print "Testing size", n s = x[:] check("identity", x, s) s = x[:] s.reverse() check("reversed", x, s) s = x[:] random.shuffle(s) check("random permutation", x, s) y = x[:] y.reverse() s = x[:] check("reversed via function", y, s, lambda a, b: cmp(b, a)) if verbose: print " Checking against an insane comparison function." print " If the implementation isn't careful, this may segfault." s = x[:] s.sort(lambda a, b: int(random.random() * 3) - 1) check("an insane function left some permutation", x, s) x = [Complains(i) for i in x] s = x[:] random.shuffle(s) Complains.maybe_complain = True it_complained = False try: s.sort() except RuntimeError: it_complained = True if it_complained: Complains.maybe_complain = False check("exception during sort left some permutation", x, s) s = [Stable(random.randrange(10), i) for i in xrange(n)] augmented = [(e, e.index) for e in s] augmented.sort() # forced stable because ties broken by index x = [e for e, i in augmented] # a stable sort of s check("stability", x, s) if nerrors: print "Test failed", nerrors elif verbose: print "Test passed -- no errors." From tim_one@users.sourceforge.net Thu Aug 1 03:34:53 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 19:34:53 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.447,1.448 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27743/misc Modified Files: NEWS Log Message: A blurb about the sort implementation. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.447 retrieving revision 1.448 diff -C2 -d -r1.447 -r1.448 *** NEWS 29 Jul 2002 14:27:40 -0000 1.447 --- NEWS 1 Aug 2002 02:34:51 -0000 1.448 *************** *** 7,10 **** --- 7,22 ---- Core and builtins + - list.sort() has a new implementation. While cross-platform results + may vary, and in data-dependent ways, this is much faster on many + kinds of partially ordered lists than the previous implementation, + and reported to be just as fast on randomly ordered lists on + several major platforms. This sort is also stable (if A==B and A + precedes B in the list at the start, A precedes B after the sort too), + 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. + - All standard iterators now ensure that, once StopIteration has been raised, all future calls to next() on the same iterator will also *************** *** 17,24 **** - Ctrl+C handling on Windows has been made more consistent with other platforms. KeyboardInterrupt can now reliably be caught, ! and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will ! interrupt time.sleep() in the main thread, and any child processes ! created via the popen family are also interrupted (as generally happens on for Linux/Unix). [SF bugs 231273, 439992 and 581232] --- 29,36 ---- - Ctrl+C handling on Windows has been made more consistent with other platforms. KeyboardInterrupt can now reliably be caught, ! and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will ! interrupt time.sleep() in the main thread, and any child processes ! created via the popen family are also interrupted (as generally happens on for Linux/Unix). [SF bugs 231273, 439992 and 581232] *************** *** 318,322 **** Build ! - 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 --- 330,334 ---- Build ! - 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 From tim_one@users.sourceforge.net Thu Aug 1 04:10:48 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 31 Jul 2002 20:10:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1222 Modified Files: libstdtypes.tex Log Message: Added new footnote about list.sort() stability. Repaired footnote about using sort() with comparison functions (it made reference to the non- existent "builtin-in function sort()"). BTW, I changed list.sort's docstring to contain the word "stable" -- the easiest way to tell whether a particular Python version's sort *is* stable is to look for "stable" in the docstring. I'm not sure whether to advertise this . Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** libstdtypes.tex 16 Jul 2002 19:53:39 -0000 1.100 --- libstdtypes.tex 1 Aug 2002 03:10:45 -0000 1.101 *************** *** 902,906 **** {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 902,906 ---- {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7), (8)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} *************** *** 948,955 **** than the second argument. Note that this slows the sorting process down considerably; e.g. to sort a list in reverse order it is much ! faster to use calls to the methods \method{sort()} and ! \method{reverse()} than to use the built-in function ! \function{sort()} with a comparison function that reverses the ordering of the elements. \end{description} --- 948,963 ---- than the second argument. Note that this slows the sorting process down considerably; e.g. to sort a list in reverse order it is much ! faster to call method \method{sort()} followed by ! \method{reverse()} than to use method ! \method{sort()} with a comparison function that reverses the ordering of the elements. + + \item[(8)] Whether the \method{sort()} method is stable is not defined by + the language (a sort is stable if it guarantees not to change the + relative order of elements that compare equal). In the C + implementation of Python, sorts were stable only by accident through + Python 2.2. The C implementation of Python 2.3 introduced a stable + \method{sort()} method, but code that intends to be portable across + implementations and versions must not rely on stability. \end{description} From gvanrossum@users.sourceforge.net Thu Aug 1 15:39:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 07:39:27 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.189,1.190 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv972 Modified Files: ACKS Log Message: SF patch 588728 (Nathan Srebro). The __delete__ method wrapper for descriptors was not supported (I added a test, too.) 2.2 bugfix candidate. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** ACKS 19 Jul 2002 18:38:25 -0000 1.189 --- ACKS 1 Aug 2002 14:39:25 -0000 1.190 *************** *** 453,456 **** --- 453,457 ---- Kalle Svensson Hajime Saitou + Nathan Srebro RajGopal Srinivasan Jim St. Pierre From jackjansen@users.sourceforge.net Thu Aug 1 16:07:12 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 08:07:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher MyAppDelegate.m,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory usw-pr-cvs1:/tmp/cvs-serv12870 Modified Files: MyAppDelegate.m Log Message: Only show the UI for selecting options if the ALT key was depressed while dragging or double-clicking the script. Index: MyAppDelegate.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyAppDelegate.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MyAppDelegate.m 29 Jul 2002 21:36:35 -0000 1.1 --- MyAppDelegate.m 1 Aug 2002 15:07:00 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- #import "MyAppDelegate.h" #import "PreferencesWindowController.h" + #import @implementation MyAppDelegate *************** *** 30,39 **** - (BOOL)shouldShowUI { ! // if this call comes before applicationDidFinishLaunching: we do not show a UI ! // for the file. Also, we should terminate immedeately after starting the script. ! if (initial_action_done) ! return YES; initial_action_done = YES; ! should_terminate = YES; return NO; } --- 31,41 ---- - (BOOL)shouldShowUI { ! // if this call comes before applicationDidFinishLaunching: we ! // should terminate immedeately after starting the script. ! if (!initial_action_done) ! should_terminate = YES; initial_action_done = YES; ! if( GetCurrentKeyModifiers() & optionKey ) ! return YES; return NO; } *************** *** 47,63 **** { return NO; - } - - - - (BOOL)application:(NSApplication *)sender xx_openFile:(NSString *)filename - { - initial_action_done = YES; - return YES; - } - - - (BOOL)application:(id)sender xx_openFileWithoutUI:(NSString *)filename - { - initial_action_done = YES; - return YES; } --- 49,52 ---- From gvanrossum@users.sourceforge.net Thu Aug 1 15:39:05 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 07:39:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.149,1.150 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv813 Modified Files: test_descr.py Log Message: SF patch 588728 (Nathan Srebro). The __delete__ method wrapper for descriptors was not supported (I added a test, too.) 2.2 bugfix candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** test_descr.py 23 Jul 2002 19:03:47 -0000 1.149 --- test_descr.py 1 Aug 2002 14:39:03 -0000 1.150 *************** *** 1400,1410 **** class C(object): class computed_attribute(object): ! def __init__(self, get, set=None): self.__get = get self.__set = set def __get__(self, obj, type=None): return self.__get(obj) def __set__(self, obj, value): return self.__set(obj, value) def __init__(self): self.__x = 0 --- 1400,1413 ---- class C(object): class computed_attribute(object): ! def __init__(self, get, set=None, delete=None): self.__get = get self.__set = set + self.__delete = delete def __get__(self, obj, type=None): return self.__get(obj) def __set__(self, obj, value): return self.__set(obj, value) + def __delete__(self, obj): + return self.__delete(obj) def __init__(self): self.__x = 0 *************** *** 1415,1419 **** def __set_x(self, x): self.__x = x ! x = computed_attribute(__get_x, __set_x) a = C() vereq(a.x, 0) --- 1418,1424 ---- def __set_x(self, x): self.__x = x ! def __delete_x(self): ! del self.__x ! x = computed_attribute(__get_x, __set_x, __delete_x) a = C() vereq(a.x, 0) *************** *** 1422,1425 **** --- 1427,1432 ---- vereq(a.x, 10) vereq(a.x, 11) + del a.x + vereq(hasattr(a, 'x'), 0) def newslot(): *************** *** 1734,1739 **** C.x.__set__(a, 100) vereq(C.x.__get__(a), 100) ! ## C.x.__set__(a) ! ## verify(not hasattr(a, "x")) raw = C.__dict__['x'] --- 1741,1746 ---- C.x.__set__(a, 100) vereq(C.x.__get__(a), 100) ! C.x.__delete__(a) ! verify(not hasattr(a, "x")) raw = C.__dict__['x'] From gvanrossum@users.sourceforge.net Thu Aug 1 15:38:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 07:38:56 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.164,2.165 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv706 Modified Files: typeobject.c Log Message: SF patch 588728 (Nathan Srebro). The __delete__ method wrapper for descriptors was not supported (I added a test, too.) 2.2 bugfix candidate. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.164 retrieving revision 2.165 diff -C2 -d -r2.164 -r2.165 *** typeobject.c 30 Jul 2002 00:42:06 -0000 2.164 --- typeobject.c 1 Aug 2002 14:38:53 -0000 2.165 *************** *** 2808,2811 **** --- 2808,2827 ---- return Py_None; } + + static PyObject * + wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) + { + descrsetfunc func = (descrsetfunc)wrapped; + PyObject *obj; + int ret; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + ret = (*func)(self, obj, NULL); + if (ret < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } static PyObject * *************** *** 3884,3887 **** --- 3900,3905 ---- TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set, "descr.__set__(obj, value)"), + TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set, + wrap_descr_delete, "descr.__delete__(obj)"), FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init, "x.__init__(...) initializes x; " From theller@users.sourceforge.net Thu Aug 1 19:24:08 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 01 Aug 2002 11:24:08 -0700 Subject: [Python-checkins] python/nondist/peps pep-0298.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24547 Modified Files: pep-0298.txt Log Message: Renamed everything from 'fixed buffer' to 'locked buffer'. Recommandations on how to implement the interface. Index: pep-0298.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0298.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0298.txt 31 Jul 2002 18:48:36 -0000 1.4 --- pep-0298.txt 1 Aug 2002 18:24:06 -0000 1.5 *************** *** 1,4 **** PEP: 298 ! Title: The Fixed Buffer Interface Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 298 ! Title: The Locked Buffer Interface Version: $Revision$ Last-Modified: $Date$ *************** *** 8,12 **** Created: 26-Jul-2002 Python-Version: 2.3 ! Post-History: 30-Jul-2002 --- 8,12 ---- Created: 26-Jul-2002 Python-Version: 2.3 ! Post-History: 30-Jul-2002, 1-Aug-2002 *************** *** 14,20 **** This PEP proposes an extension to the buffer interface called the ! 'fixed buffer interface'. ! The fixed buffer interface fixes the flaws of the 'old' buffer interface [1] as defined in Python versions up to and including 2.2, and has the following semantics: --- 14,20 ---- This PEP proposes an extension to the buffer interface called the ! 'locked buffer interface'. ! The locked buffer interface avoids the flaws of the 'old' buffer interface [1] as defined in Python versions up to and including 2.2, and has the following semantics: *************** *** 34,38 **** Specification ! The fixed buffer interface exposes new functions which return the size and the pointer to the internal memory block of any python object which chooses to implement this interface. --- 34,38 ---- Specification ! The locked buffer interface exposes new functions which return the size and the pointer to the internal memory block of any python object which chooses to implement this interface. *************** *** 43,55 **** The object must be unlocked again by releasing the buffer if it's ! no longer used by calling another function in the fixed buffer interface. If the object never resizes or reallocates the buffer ! during it's lifetime, this function may be NULL. Failure to call this function (if it is != NULL) is a programming error and may have unexpected results. ! The fixed buffer interface omits the memory segment model which is ! present in the old buffer interface - only a single memory block ! can be exposed. --- 43,55 ---- The object must be unlocked again by releasing the buffer if it's ! no longer used by calling another function in the locked buffer interface. If the object never resizes or reallocates the buffer ! during it's lifetime, this function may be NULL. Failure to call this function (if it is != NULL) is a programming error and may have unexpected results. ! The locked buffer interface omits the memory segment model which ! is present in the old buffer interface - only a single memory ! block can be exposed. *************** *** 58,64 **** Define a new flag in Include/object.h: ! /* PyBufferProcs contains bf_acquirefixedreadbuffer, ! bf_acquirefixedwritebuffer, and bf_releasefixedbuffer */ ! #define Py_TPFLAGS_HAVE_FIXEDBUFFER (1L<<15) --- 58,64 ---- Define a new flag in Include/object.h: ! /* PyBufferProcs contains bf_acquirelockedreadbuffer, ! bf_acquirelockedwritebuffer, and bf_releaselockedbuffer */ ! #define Py_TPFLAGS_HAVE_LOCKEDBUFFER (1L<<15) *************** *** 67,71 **** #define Py_TPFLAGS_DEFAULT ( \ .... ! Py_TPFLAGS_HAVE_FIXEDBUFFER | \ .... 0) --- 67,71 ---- #define Py_TPFLAGS_DEFAULT ( \ .... ! Py_TPFLAGS_HAVE_LOCKEDBUFFER | \ .... 0) *************** *** 75,103 **** Include/object.h: ! typedef size_t (*acquirefixedreadbufferproc)(PyObject *, ! const void **); ! typedef size_t (*acquirefixedwritebufferproc)(PyObject *, ! void **); ! typedef void (*releasefixedbufferproc)(PyObject *); typedef struct { ! getreadbufferproc bf_getreadbuffer; ! getwritebufferproc bf_getwritebuffer; ! getsegcountproc bf_getsegcount; ! getcharbufferproc bf_getcharbuffer; ! /* fixed buffer interface functions */ ! acquirefixedreadbufferproc bf_acquirefixedreadbuffer; ! acquirefixedwritebufferproc bf_acquirefixedwritebuffer; ! releasefixedbufferproc bf_releasefixedbuffer; } PyBufferProcs; ! The new fields are present if the Py_TPFLAGS_HAVE_FIXEDBUFFER flag is set in the object's type. ! The Py_TPFLAGS_HAVE_FIXEDBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. ! The acquirefixedreadbufferproc and acquirefixedwritebufferproc functions return the size in bytes of the memory block on success, and fill in the passed void * pointer on success. If these --- 75,103 ---- Include/object.h: ! typedef size_t (*acquirelockedreadbufferproc)(PyObject *, ! const void **); ! typedef size_t (*acquirelockedwritebufferproc)(PyObject *, ! void **); ! typedef void (*releaselockedbufferproc)(PyObject *); typedef struct { ! getreadbufferproc bf_getreadbuffer; ! getwritebufferproc bf_getwritebuffer; ! getsegcountproc bf_getsegcount; ! getcharbufferproc bf_getcharbuffer; ! /* locked buffer interface functions */ ! acquirelockedreadbufferproc bf_acquirelockedreadbuffer; ! acquirelockedwritebufferproc bf_acquirelockedwritebuffer; ! releaselockedbufferproc bf_releaselockedbuffer; } PyBufferProcs; ! The new fields are present if the Py_TPFLAGS_HAVE_LOCKEDBUFFER flag is set in the object's type. ! The Py_TPFLAGS_HAVE_LOCKEDBUFFER flag implies the Py_TPFLAGS_HAVE_GETCHARBUFFER flag. ! The acquirelockedreadbufferproc and acquirelockedwritebufferproc functions return the size in bytes of the memory block on success, and fill in the passed void * pointer on success. If these *************** *** 108,131 **** If calls to these functions succeed, eventually the buffer must be ! released by a call to the releasefixedbufferproc, supplying the ! original object as argument. The releasefixedbufferproc cannot ! fail. ! Usually these functions aren't called directly, they are called ! through convenience functions declared in Include/abstract.h: ! int PyObject_AquireFixedReadBuffer(PyObject *obj, ! const void **buffer, ! size_t *buffer_len); ! int PyObject_AcquireFixedWriteBuffer(PyObject *obj, ! void **buffer, ! size_t *buffer_len); ! void PyObject_ReleaseFixedBuffer(PyObject *obj); The former two functions return 0 on success, set buffer to the memory location and buffer_len to the length of the memory block ! in bytes. On failure, or if the fixed buffer interface is not implemented by obj, they return -1 and set an exception. --- 108,141 ---- If calls to these functions succeed, eventually the buffer must be ! released by a call to the releaselockedbufferproc, supplying the ! original object as argument. The releaselockedbufferproc cannot ! fail. For objects that actually maintain an internal lock count ! it would be a fatal error if the releaselockedbufferproc function ! would be called too often, leading to a negative lock count. ! Similar to the 'old' buffer interface, any of these functions may ! be set to NULL, but it is strongly recommended to implement the ! releaselockedbufferproc function (even if it does nothing) if any ! of the acquireread/writelockedbufferproc functions are ! implemented, to discourage extension writers from checking for a ! NULL value and not calling it. ! These functions aren't supposed to be called directly, they are ! called through convenience functions declared in ! Include/abstract.h: ! int PyObject_AquireLockedReadBuffer(PyObject *obj, ! const void **buffer, ! size_t *buffer_len); ! int PyObject_AcquireLockedWriteBuffer(PyObject *obj, ! void **buffer, ! size_t *buffer_len); ! ! void PyObject_ReleaseLockedBuffer(PyObject *obj); The former two functions return 0 on success, set buffer to the memory location and buffer_len to the length of the memory block ! in bytes. On failure, or if the locked buffer interface is not implemented by obj, they return -1 and set an exception. *************** *** 147,157 **** Additional Notes/Comments ! Python strings, Unicode strings, mmap objects, and array objects ! would expose the fixed buffer interface. Community Feedback ! Greg Ewing doubts the fixed buffer interface is needed at all, he thinks the normal buffer interface could be used if the pointer is (re)fetched each time it's used. This seems to be dangerous, --- 157,194 ---- Additional Notes/Comments ! Python strings, unicode strings, mmap objects, and array objects ! would expose the locked buffer interface. ! ! mmap and array objects would actually enter a locked state while ! the buffer is active, this is not needed for strings and unicode ! objects. Resizing locked array objects is not allowed and will ! raise an exception. Whether closing a locked mmap object is an ! error or will only be deferred until the lock count reaches zero ! is an implementation detail. ! ! Guido recommends: ! ! But I'm still very concerned that if most built-in types ! (e.g. strings, bytes) don't implement the release ! functionality, it's too easy for an extension to seem to work ! while forgetting to release the buffer. ! ! I recommend that at least some built-in types implement the ! acquire/release functionality with a counter, and assert that ! the counter is zero when the object is deleted -- if the ! assert fails, someone DECREF'ed their reference to the object ! without releasing it. (The rule should be that you must own a ! reference to the object while you've aquired the object.) ! ! For strings that might be impractical because the string ! object would have to grow 4 bytes to hold the counter; but the ! new bytes object (PEP 296) could easily implement the counter, ! and the array object too -- that way there will be plenty of ! opportunity to test proper use of the protocol. Community Feedback ! Greg Ewing doubts the locked buffer interface is needed at all, he thinks the normal buffer interface could be used if the pointer is (re)fetched each time it's used. This seems to be dangerous, *************** *** 167,172 **** Credits - - Scott Gilbert came up with the name 'fixed buffer interface'. --- 204,207 ---- From bwarsaw@users.sourceforge.net Thu Aug 1 19:53:54 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 01 Aug 2002 11:53:54 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.202,1.203 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4918 Modified Files: pep-0000.txt Log Message: Renamed PEP 298... each time the title gets longer by 1 character. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.202 retrieving revision 1.203 diff -C2 -d -r1.202 -r1.203 *** pep-0000.txt 30 Jul 2002 17:04:39 -0000 1.202 --- pep-0000.txt 1 Aug 2002 18:53:52 -0000 1.203 *************** *** 103,107 **** S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Fixed Buffer Interface Heller Finished PEPs (done, implemented in CVS) --- 103,107 ---- S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Locked Buffer Interface Heller Finished PEPs (done, implemented in CVS) *************** *** 287,291 **** S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Fixed Buffer Interface Heller SR 666 Reject Foolish Indentation Creighton --- 287,291 ---- S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg ! S 298 The Locked Buffer Interface Heller SR 666 Reject Foolish Indentation Creighton From gvanrossum@users.sourceforge.net Thu Aug 1 19:50:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 11:50:35 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3353 Modified Files: frameobject.c Log Message: Tim found that once test_longexp has run, test_sort takes very much longer to run than normal. A profiler run showed that this was due to PyFrame_New() taking up an unreasonable amount of time. A little thinking showed that this was due to the while loop clearing the space available for the stack. The solution is to only clear the local variables (and cells and free variables), not the space available for the stack, since anything beyond the stack top is considered to be garbage anyway. Also, use memset() instead of a while loop counting backwards. This should be a time savings for normal code too! (By a probably unmeasurable amount. :-) Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** frameobject.c 20 Apr 2002 04:46:55 -0000 2.62 --- frameobject.c 1 Aug 2002 18:50:33 -0000 2.63 *************** *** 266,271 **** return NULL; } - else - extras = f->ob_size; _Py_NewReference((PyObject *)f); } --- 266,269 ---- *************** *** 318,325 **** f->f_nfreevars = nfrees; ! while (--extras >= 0) ! f->f_localsplus[extras] = NULL; ! f->f_valuestack = f->f_localsplus + (f->f_nlocals + ncells + nfrees); f->f_stacktop = f->f_valuestack; _PyObject_GC_TRACK(f); --- 316,323 ---- f->f_nfreevars = nfrees; ! extras = f->f_nlocals + ncells + nfrees; ! memset(f->f_localsplus, 0, extras * sizeof(f->f_localsplus[0])); ! f->f_valuestack = f->f_localsplus + extras; f->f_stacktop = f->f_valuestack; _PyObject_GC_TRACK(f); From gvanrossum@users.sourceforge.net Thu Aug 1 20:03:45 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 12:03:45 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.149.4.7,1.149.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9014/Misc Modified Files: Tag: release22-maint ACKS Log Message: Backport: SF patch 588728 (Nathan Srebro). The __delete__ method wrapper for descriptors was not supported (I added a test, too.) Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.149.4.7 retrieving revision 1.149.4.8 diff -C2 -d -r1.149.4.7 -r1.149.4.8 *** ACKS 24 Jun 2002 13:25:41 -0000 1.149.4.7 --- ACKS 1 Aug 2002 19:03:42 -0000 1.149.4.8 *************** *** 428,431 **** --- 428,432 ---- Kalle Svensson Hajime Saitou + Nathan Srebro RajGopal Srinivasan Jim St. Pierre From gvanrossum@users.sourceforge.net Thu Aug 1 20:03:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 12:03:46 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.21,2.126.4.22 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9014/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: Backport: SF patch 588728 (Nathan Srebro). The __delete__ method wrapper for descriptors was not supported (I added a test, too.) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.21 retrieving revision 2.126.4.22 diff -C2 -d -r2.126.4.21 -r2.126.4.22 *** typeobject.c 30 Jul 2002 00:57:38 -0000 2.126.4.21 --- typeobject.c 1 Aug 2002 19:03:43 -0000 2.126.4.22 *************** *** 2721,2724 **** --- 2721,2740 ---- return Py_None; } + + static PyObject * + wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) + { + descrsetfunc func = (descrsetfunc)wrapped; + PyObject *obj; + int ret; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + ret = (*func)(self, obj, NULL); + if (ret < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } static PyObject * *************** *** 3776,3779 **** --- 3792,3797 ---- TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set, "descr.__set__(obj, value)"), + TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set, + wrap_descr_delete, "descr.__delete__(obj)"), FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init, "x.__init__(...) initializes x; " From gvanrossum@users.sourceforge.net Thu Aug 1 20:04:14 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 12:04:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.23,1.113.4.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9014/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: Backport: SF patch 588728 (Nathan Srebro). The __delete__ method wrapper for descriptors was not supported (I added a test, too.) Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.23 retrieving revision 1.113.4.24 diff -C2 -d -r1.113.4.23 -r1.113.4.24 *** test_descr.py 11 Jul 2002 18:40:12 -0000 1.113.4.23 --- test_descr.py 1 Aug 2002 19:03:41 -0000 1.113.4.24 *************** *** 1314,1324 **** class C(object): class computed_attribute(object): ! def __init__(self, get, set=None): self.__get = get self.__set = set def __get__(self, obj, type=None): return self.__get(obj) def __set__(self, obj, value): return self.__set(obj, value) def __init__(self): self.__x = 0 --- 1314,1327 ---- class C(object): class computed_attribute(object): ! def __init__(self, get, set=None, delete=None): self.__get = get self.__set = set + self.__delete = delete def __get__(self, obj, type=None): return self.__get(obj) def __set__(self, obj, value): return self.__set(obj, value) + def __delete__(self, obj): + return self.__delete(obj) def __init__(self): self.__x = 0 *************** *** 1329,1333 **** def __set_x(self, x): self.__x = x ! x = computed_attribute(__get_x, __set_x) a = C() vereq(a.x, 0) --- 1332,1338 ---- def __set_x(self, x): self.__x = x ! def __delete_x(self): ! del self.__x ! x = computed_attribute(__get_x, __set_x, __delete_x) a = C() vereq(a.x, 0) *************** *** 1336,1339 **** --- 1341,1346 ---- vereq(a.x, 10) vereq(a.x, 11) + del a.x + vereq(hasattr(a, 'x'), 0) def newslot(): *************** *** 1648,1653 **** C.x.__set__(a, 100) vereq(C.x.__get__(a), 100) ! ## C.x.__set__(a) ! ## verify(not hasattr(a, "x")) raw = C.__dict__['x'] --- 1655,1660 ---- C.x.__set__(a, 100) vereq(C.x.__get__(a), 100) ! C.x.__delete__(a) ! verify(not hasattr(a, "x")) raw = C.__dict__['x'] From gvanrossum@users.sourceforge.net Thu Aug 1 20:05:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 12:05:10 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.59.6.3,2.59.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9581/Objects Modified Files: Tag: release22-maint frameobject.c Log Message: Backport: Tim found that once test_longexp has run, test_sort takes very much longer to run than normal. A profiler run showed that this was due to PyFrame_New() taking up an unreasonable amount of time. A little thinking showed that this was due to the while loop clearing the space available for the stack. The solution is to only clear the local variables (and cells and free variables), not the space available for the stack, since anything beyond the stack top is considered to be garbage anyway. Also, use memset() instead of a while loop counting backwards. This should be a time savings for normal code too! (By a probably unmeasurable amount. :-) Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.59.6.3 retrieving revision 2.59.6.4 diff -C2 -d -r2.59.6.3 -r2.59.6.4 *** frameobject.c 20 Apr 2002 05:07:05 -0000 2.59.6.3 --- frameobject.c 1 Aug 2002 19:05:07 -0000 2.59.6.4 *************** *** 266,271 **** return NULL; } - else - extras = f->ob_size; _Py_NewReference((PyObject *)f); } --- 266,269 ---- *************** *** 318,325 **** f->f_nfreevars = nfrees; ! while (--extras >= 0) ! f->f_localsplus[extras] = NULL; ! f->f_valuestack = f->f_localsplus + (f->f_nlocals + ncells + nfrees); f->f_stacktop = f->f_valuestack; _PyObject_GC_TRACK(f); --- 316,323 ---- f->f_nfreevars = nfrees; ! extras = f->f_nlocals + ncells + nfrees; ! memset(f->f_localsplus, 0, extras * sizeof(f->f_localsplus[0])); ! f->f_valuestack = f->f_localsplus + extras; f->f_stacktop = f->f_valuestack; _PyObject_GC_TRACK(f); From thomas.heller@ion-tof.com Thu Aug 1 20:08:58 2002 From: thomas.heller@ion-tof.com (Thomas Heller) Date: Thu, 1 Aug 2002 21:08:58 +0200 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.202,1.203 References: Message-ID: <044601c2398e$e3d93f40$e000a8c0@thomasnotebook> > Renamed PEP 298... each time the title gets longer by 1 character. Not only the title, also the function names ;-) From andymac@bullseye.apana.org.au Thu Aug 1 10:05:23 2002 From: andymac@bullseye.apana.org.au (Andrew MacIntyre) Date: Thu, 1 Aug 2002 20:05:23 +1100 (edt) Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,NONE,1.1 In-Reply-To: Message-ID: On Wed, 31 Jul 2002 tim_one@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Lib/test > In directory usw-pr-cvs1:/tmp/cvs-serv24012 > > Added Files: > test_sort.py > Log Message: > New test for sorting sanity. Note that this will fail in earlier Pythons, > in the stability tests. > > Bizarre: this takes 11x longer to run if and only if test_longexp is > run before it, on my box. The bigger REPS is in test_longexp, the > slower this gets. What happens on your box? It's not gc on my box > (which is good, because gc isn't a plausible candidate here). > > The slowdown is massive in the parts of test_sort that implicitly > invoke a new-style class's __lt__ or __cmp__ methods. If I boost > REPS large enough in test_longexp, even the test_sort tests on an array > of size 64 visibly c-r-a-w-l. The relative slowdown is even worse in > a debug build. And if I reduce REPS in test_longexp, the slowdown in > test_sort goes away. > > test_longexp does do horrid things to Win98's management of user > address space, but I thought I had made that a whole lot better a month > or so ago (by overallocating aggressively in the parser). Hmmm, perhaps this was the sort of dragon you had in mind when you suggested I persist with PyMalloc'ing the parser on top of your overallocation strategy? It'd be worth a test with either my experimental or "final" patch(es)? Its mind boggling how many small mallocs in PyNode_AddChild() test_longexp generates (853016 total PyNode_AddChild() requests according to my logging harness, all bar 92(!) of which are for the n=1 case). -- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au | Snail: PO Box 370 andymac@pcug.org.au | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From jackjansen@users.sourceforge.net Thu Aug 1 22:12:38 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:12:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app Info.plist,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app In directory usw-pr-cvs1:/tmp/cvs-serv21621 Modified Files: Info.plist Log Message: Python.app no longer advertises that it can handle .py and .pyc files, PythonLauncher.app has taken that responsibility over. Index: Info.plist =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Info.plist,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Info.plist 29 Mar 2002 23:43:21 -0000 1.6 --- Info.plist 1 Aug 2002 21:12:36 -0000 1.7 *************** *** 8,43 **** - CFBundleTypeExtensions - - py - - CFBundleTypeIconFile - PythonSource.icns - CFBundleTypeName - Python Module - CFBundleTypeOSTypes - - TEXT - - CFBundleTypeRole - Shell - - - CFBundleTypeExtensions - - pyc - - CFBundleTypeIconFile - PythonCompiled.icns - CFBundleTypeName - Python Compiled Module - CFBundleTypeOSTypes - - PYC - - CFBundleTypeRole - Shell - - CFBundleTypeOSTypes --- 8,11 ---- From gvanrossum@users.sourceforge.net Thu Aug 1 22:12:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:12:38 -0700 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21902 Modified Files: CGIHTTPServer.py Log Message: Fix for SF bug 570678 (can't flush read-only file on Mac OS X). Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** CGIHTTPServer.py 1 Jun 2002 19:51:15 -0000 1.25 --- CGIHTTPServer.py 1 Aug 2002 21:12:35 -0000 1.26 *************** *** 194,198 **** args.append(decoded_query) nobody = nobody_uid() - self.rfile.flush() # Always flush before forking self.wfile.flush() # Always flush before forking pid = os.fork() --- 194,197 ---- From jackjansen@users.sourceforge.net Thu Aug 1 22:12:38 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:12:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources PythonCompiled.icns,1.1,NONE PythonSource.icns,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources In directory usw-pr-cvs1:/tmp/cvs-serv21621/Resources Removed Files: PythonCompiled.icns PythonSource.icns Log Message: Python.app no longer advertises that it can handle .py and .pyc files, PythonLauncher.app has taken that responsibility over. --- PythonCompiled.icns DELETED --- --- PythonSource.icns DELETED --- From jackjansen@users.sourceforge.net Thu Aug 1 22:14:08 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:14:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher FileSettings.m,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory usw-pr-cvs1:/tmp/cvs-serv22066/PythonLauncher Modified Files: FileSettings.m Log Message: Python.app is now a hidden application, deep in the framework. It will be invoked by PythonLauncher when needed. Also changed the names of various variables in the Makefile to match what the main Makefile has. Index: FileSettings.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/FileSettings.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileSettings.m 31 Jul 2002 13:15:59 -0000 1.2 --- FileSettings.m 1 Aug 2002 21:14:06 -0000 1.3 *************** *** 60,67 **** if ([filetype isEqualToString: @"Python Script"] || [filetype isEqualToString: @"Python Bytecode Document"]) { ! interpreter = @"/usr/local/bin/python"; with_terminal = YES; } else if ([filetype isEqualToString: @"Python GUI Script"]) { ! interpreter = @"/Applications/Python.app/Contents/MacOS/python"; with_terminal = NO; } else { --- 60,67 ---- if ([filetype isEqualToString: @"Python Script"] || [filetype isEqualToString: @"Python Bytecode Document"]) { ! interpreter = @"/Library/Frameworks/Python.framework/Versions/Current/bin/python"; with_terminal = YES; } else if ([filetype isEqualToString: @"Python GUI Script"]) { ! interpreter = @"/Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python"; with_terminal = NO; } else { From jackjansen@users.sourceforge.net Thu Aug 1 22:14:08 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:14:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv22066 Modified Files: Makefile Log Message: Python.app is now a hidden application, deep in the framework. It will be invoked by PythonLauncher when needed. Also changed the names of various variables in the Makefile to match what the main Makefile has. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Makefile 31 Jul 2002 14:46:04 -0000 1.14 --- Makefile 1 Aug 2002 21:14:06 -0000 1.15 *************** *** 4,21 **** # assume user was invoking from Mac/OSX directory and building in source tree ! PYTHONBUILDDIR = ../.. ! PYTHONSRCDIR = ../.. ! INSTALLDIR=/Library/Frameworks/Python.framework/Versions/Current PYTHONAPPSDIR=/Applications/Python ! APPINSTALLDIR=$(PYTHONAPPSDIR)/Python.app # Variables for installing the "normal" unix binaries UNIXBINDIR=/usr/local/bin ! INSTALLED_PYTHON=$(INSTALLDIR)/bin/python INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python # Items more-or-less copied from the main Makefile - VERSION=2.3 DIRMODE=755 INSTALL=/usr/bin/install -c --- 4,21 ---- # assume user was invoking from Mac/OSX directory and building in source tree ! builddir = ../.. ! srcdir = ../.. ! VERSION=2.3 ! prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) PYTHONAPPSDIR=/Applications/Python ! APPINSTALLDIR=$(prefix)/Resources/Python.app # Variables for installing the "normal" unix binaries UNIXBINDIR=/usr/local/bin ! INSTALLED_PYTHON=$(prefix)/bin/python INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python # Items more-or-less copied from the main Makefile DIRMODE=755 INSTALL=/usr/bin/install -c *************** *** 27,36 **** OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ -fno-common -dynamic ! INCLUDES=-I$(PYTHONBUILDDIR) -I$(PYTHONSRCDIR)/Include \ ! -I$(PYTHONSRCDIR)/Mac/Include DEFINES=-DHAVE_CONFIG_H CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) ! LDFLAGS=-F$(PYTHONBUILDDIR) -framework System -framework Python -framework Carbon \ -framework Foundation CC=cc --- 27,35 ---- OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ -fno-common -dynamic ! INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include DEFINES=-DHAVE_CONFIG_H CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) ! LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ -framework Foundation CC=cc *************** *** 39,56 **** DEREZ=/Developer/Tools/DeRez ! OBJECTS=$(PYTHONBUILDDIR)/Mac/Python/macmain.o \ ! $(PYTHONBUILDDIR)/Mac/Python/macgetargv.o ! PYTHON=$(PYTHONBUILDDIR)/python.exe ! APPTEMPLATE=$(PYTHONSRCDIR)/Mac/OSXResources/app APPSUBDIRS=MacOS Resources Resources/English.lproj ! RESOURCEDIR=$(PYTHONSRCDIR)/Mac/Resources RESOURCEFILE=python.rsrc ! RFCONVERTER=$(PYTHONSRCDIR)/Mac/Lib/applesingle.py install_all: install_PythonLauncher install_Python install_IDE install_PythonLauncher: ! cd $(PYTHONSRCDIR)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install --- 38,55 ---- DEREZ=/Developer/Tools/DeRez ! OBJECTS=$(builddir)/Mac/Python/macmain.o \ ! $(builddir)/Mac/Python/macgetargv.o ! PYTHON=$(builddir)/python.exe ! APPTEMPLATE=$(srcdir)/Mac/OSXResources/app APPSUBDIRS=MacOS Resources Resources/English.lproj ! RESOURCEDIR=$(srcdir)/Mac/Resources RESOURCEFILE=python.rsrc ! RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py install_all: install_PythonLauncher install_Python install_IDE install_PythonLauncher: ! cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install *************** *** 103,112 **** install_IDE: $(INSTALLED_PYTHONW) ! $(INSTALLED_PYTHONW) $(PYTHONSRCDIR)/Mac/scripts/BuildApplet.py \ --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ ! $(PYTHONSRCDIR)/Mac/Tools/IDE/PythonIDE.py ! LIBDEST=$(INSTALLDIR)/Mac/Lib ! LIBSRC=$(PYTHONSRCDIR)/Mac/Lib LIBSUBDIRS= \ Carbon \ --- 102,111 ---- install_IDE: $(INSTALLED_PYTHONW) ! $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ ! $(srcdir)/Mac/Tools/IDE/PythonIDE.py ! LIBDEST=$(prefix)/Mac/Lib ! LIBSRC=$(srcdir)/Mac/Lib LIBSUBDIRS= \ Carbon \ *************** *** 123,128 **** mkcwproject/template-carbon \ mkcwproject/template-ppc ! TOOLSDEST=$(INSTALLDIR)/Mac/Tools ! TOOLSSRC=$(PYTHONSRCDIR)/Mac/Tools TOOLSSUBDIRS=IDE installmacsubtree: --- 122,127 ---- mkcwproject/template-carbon \ mkcwproject/template-ppc ! TOOLSDEST=$(prefix)/Mac/Tools ! TOOLSSRC=$(srcdir)/Mac/Tools TOOLSSUBDIRS=IDE installmacsubtree: *************** *** 216,220 **** done ! $(INSTALL_DATA) $(PYTHONSRCDIR)/Mac/OSX/Mac.pth $(INSTALLDIR)/lib/python$(VERSION)/site-packages/ # Put symlinks "python" and "pythonw" in the standard place --- 215,219 ---- done ! $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/ # Put symlinks "python" and "pythonw" in the standard place *************** *** 230,236 **** # directories dontinstallmacsubtree: ! l=`cd $(PYTHONSRCDIR)/Mac/Lib; pwd`; \ ! echo $$l > $(INSTALLDIR)/lib/python$(VERSION)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(INSTALLDIR)/lib/python$(VERSION)/site-packages/Mac.pth pythonforbundle: $(OBJECTS) --- 229,235 ---- # directories dontinstallmacsubtree: ! l=`cd $(srcdir)/Mac/Lib; pwd`; \ ! echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth pythonforbundle: $(OBJECTS) *************** *** 238,245 **** # Rules to build each file in OBJECTS - is there a better way? ! $(PYTHONBUILDDIR)/Mac/Python/macmain.o: $(PYTHONSRCDIR)/Mac/Python/macmain.c ! $(CC) $(CFLAGS) -c $(PYTHONSRCDIR)/Mac/Python/macmain.c -o $@ ! $(PYTHONBUILDDIR)/Mac/Python/macgetargv.o: $(PYTHONSRCDIR)/Mac/Python/macgetargv.c ! $(CC) $(CFLAGS) -c $(PYTHONSRCDIR)/Mac/Python/macgetargv.c -o $@ --- 237,244 ---- # Rules to build each file in OBJECTS - is there a better way? ! $(builddir)/Mac/Python/macmain.o: $(srcdir)/Mac/Python/macmain.c ! $(CC) $(CFLAGS) -c $(srcdir)/Mac/Python/macmain.c -o $@ ! $(builddir)/Mac/Python/macgetargv.o: $(srcdir)/Mac/Python/macgetargv.c ! $(CC) $(CFLAGS) -c $(srcdir)/Mac/Python/macgetargv.c -o $@ From gvanrossum@users.sourceforge.net Thu Aug 1 22:14:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:14:35 -0700 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.20.8.1,1.20.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22640 Modified Files: Tag: release22-maint CGIHTTPServer.py Log Message: Backport: Fix for SF bug 570678 (can't flush read-only file on Mac OS X). Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.20.8.1 retrieving revision 1.20.8.2 diff -C2 -d -r1.20.8.1 -r1.20.8.2 *** CGIHTTPServer.py 22 Feb 2002 13:22:31 -0000 1.20.8.1 --- CGIHTTPServer.py 1 Aug 2002 21:14:33 -0000 1.20.8.2 *************** *** 194,198 **** args.append(decoded_query) nobody = nobody_uid() - self.rfile.flush() # Always flush before forking self.wfile.flush() # Always flush before forking pid = os.fork() --- 194,197 ---- From jackjansen@users.sourceforge.net Thu Aug 1 22:57:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:57:51 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.249,2.250 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2237/Modules Modified Files: posixmodule.c Log Message: - Get _environ through the NSEnviron call in a MacOSX framework. This allows us to completely decouple the framework from the executable, so we can use a two-level namespace. - Do framework builds with a twolevel namespace. - Reorganized the code that creates the minimal framework in the build directory, to make it more robust against incomplete frameworks (from earlier aborted builds, or builds of previous Python versions). Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.249 retrieving revision 2.250 diff -C2 -d -r2.249 -r2.250 *** posixmodule.c 30 Jul 2002 12:27:43 -0000 2.249 --- posixmodule.c 1 Aug 2002 21:57:49 -0000 2.250 *************** *** 277,282 **** /* Return a dictionary corresponding to the POSIX environment table */ ! ! #if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) extern char **environ; #endif /* !_MSC_VER */ --- 277,287 ---- /* Return a dictionary corresponding to the POSIX environment table */ ! #ifdef WITH_NEXT_FRAMEWORK ! /* On Darwin/MacOSX a shared library or framework has no access to ! ** environ directly, we must obtain it with _NSGetEnviron(). ! */ ! #include ! static char **environ; ! #elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) ) extern char **environ; #endif /* !_MSC_VER */ *************** *** 290,293 **** --- 295,302 ---- if (d == NULL) return NULL; + #ifdef WITH_NEXT_FRAMEWORK + if (environ == NULL) + environ = *_NSGetEnviron(); + #endif if (environ == NULL) return d; From jackjansen@users.sourceforge.net Thu Aug 1 22:57:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 Aug 2002 14:57:51 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.338,1.339 configure,1.327,1.328 Makefile.pre.in,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2237 Modified Files: configure.in configure Makefile.pre.in Log Message: - Get _environ through the NSEnviron call in a MacOSX framework. This allows us to completely decouple the framework from the executable, so we can use a two-level namespace. - Do framework builds with a twolevel namespace. - Reorganized the code that creates the minimal framework in the build directory, to make it more robust against incomplete frameworks (from earlier aborted builds, or builds of previous Python versions). Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.338 retrieving revision 1.339 diff -C2 -d -r1.338 -r1.339 *** configure.in 30 Jul 2002 20:19:58 -0000 1.338 --- configure.in 1 Aug 2002 21:57:48 -0000 1.339 *************** *** 821,832 **** case $ac_sys_system/$ac_sys_release in Darwin/1.3*) ! ns_undef_sym='_environ' ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) ! ns_undef_sym='_environ' ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' --- 821,830 ---- case $ac_sys_system/$ac_sys_release in Darwin/1.3*) ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' *************** *** 838,850 **** then OPT="$OPT -fno-common -dynamic" - # -U __environ is needed since bundles don't have access - # to crt0 when built but will always be linked against it # -F. is needed to allow linking to the framework while # in the build location. ! ! case $ac_sys_system/$ac_sys_release in ! Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";; ! Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";; ! esac AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, [Define if you want to produce an OpenStep/Rhapsody framework --- 836,842 ---- then OPT="$OPT -fno-common -dynamic" # -F. is needed to allow linking to the framework while # in the build location. ! LDFLAGS="$LDFLAGS -Wl,-F." AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, [Define if you want to produce an OpenStep/Rhapsody framework Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.327 retrieving revision 1.328 diff -C2 -d -r1.327 -r1.328 *** configure 30 Jul 2002 20:19:56 -0000 1.327 --- configure 1 Aug 2002 21:57:48 -0000 1.328 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.337 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.338 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. *************** *** 8760,8771 **** case $ac_sys_system/$ac_sys_release in Darwin/1.3*) ! ns_undef_sym='_environ' ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) ! ns_undef_sym='_environ' ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' --- 8760,8769 ---- case $ac_sys_system/$ac_sys_release in Darwin/1.3*) ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) ! LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc" LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python' *************** *** 8778,8790 **** then OPT="$OPT -fno-common -dynamic" - # -U __environ is needed since bundles don't have access - # to crt0 when built but will always be linked against it # -F. is needed to allow linking to the framework while # in the build location. ! ! case $ac_sys_system/$ac_sys_release in ! Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";; ! Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";; ! esac cat >>confdefs.h <<\_ACEOF --- 8776,8782 ---- then OPT="$OPT -fno-common -dynamic" # -F. is needed to allow linking to the framework while # in the build location. ! LDFLAGS="$LDFLAGS -Wl,-F." cat >>confdefs.h <<\_ACEOF Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** Makefile.pre.in 30 Jul 2002 19:06:51 -0000 1.90 --- Makefile.pre.in 1 Aug 2002 21:57:49 -0000 1.91 *************** *** 347,355 **** $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM) ! # This rule is here for OPENSTEP/Rhapsody/MacOSX ! $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): $(LIBRARY) $(PYTHONFRAMEWORKDIR) $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ -framework System @LIBTOOL_CRUFT@ # This rule builds the Cygwin Python DLL --- 347,374 ---- $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(LIBC) $(LIBM) ! # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary ! # minimal framework (not including the Lib directory and such) in the current ! # directory. ! RESSRCDIR=$(srcdir)/Mac/OSXResources/framework ! $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \ ! $(LIBRARY) \ ! $(RESSRCDIR)/Info.plist \ ! $(RESSRCDIR)/version.plist \ ! $(RESSRCDIR)/English.lproj/InfoPlist.strings $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ -framework System @LIBTOOL_CRUFT@ + $(INSTALL) -d -m $(DIRMODE) \ + $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj + $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \ + $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist + $(INSTALL_DATA) $(RESSRCDIR)/version.plist \ + $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/version.plist + $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ + $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings + $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current + $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python + $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers + $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources # This rule builds the Cygwin Python DLL *************** *** 743,772 **** --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) - - # Install a MacOSX framework During build (before - # setup.py), make a minimal Python.framework directory structure in the build - # directory. This framework is minimal, it doesn't contain the Lib directory - # and such, but together with some magic in Modules/getpath.c it is good enough - # to run python from the install dir. - - FRAMEWORKDEST=$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) - RESSRCDIR=$(srcdir)/Mac/OSXResources/framework - $(PYTHONFRAMEWORKDIR): $(RESSRCDIR)/Info.plist \ - $(RESSRCDIR)/version.plist \ - $(RESSRCDIR)/English.lproj/InfoPlist.strings - @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ - echo Not configured with --enable-framework; \ - exit 1; \ - else true; \ - fi - $(INSTALL) -d -m $(DIRMODE) $(FRAMEWORKDEST)/Resources/English.lproj - $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKDEST)/Resources/Info.plist - $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKDEST)/Resources/version.plist - $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ - $(FRAMEWORKDEST)/Resources/English.lproj/InfoPlist.strings - $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current - $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python - $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers - $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources # On install, we re-make the framework --- 762,765 ---- From bwarsaw@users.sourceforge.net Thu Aug 1 23:32:36 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 01 Aug 2002 15:32:36 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.203,1.204 pep-0256.txt,1.2,1.3 pep-0257.txt,1.4,1.5 pep-0258.txt,1.2,1.3 pep-0287.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12693 Modified Files: pep-0000.txt pep-0256.txt pep-0257.txt pep-0258.txt pep-0287.txt Log Message: Updates to PEPs 256, 257, 258, 287 by David Goodger. Some of the titles have changed so this includes an update to PEP 0. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.203 retrieving revision 1.204 diff -C2 -d -r1.203 -r1.204 *** pep-0000.txt 1 Aug 2002 18:53:52 -0000 1.203 --- pep-0000.txt 1 Aug 2002 22:32:33 -0000 1.204 *************** *** 75,79 **** S 256 Docstring Processing System Framework Goodger S 257 Docstring Conventions Goodger, van Rossum ! S 258 DPS Generic Implementation Details Goodger S 262 Database of Installed Python Packages Kuchling S 263 Defining Python Source Code Encodings Lemburg --- 75,79 ---- S 256 Docstring Processing System Framework Goodger S 257 Docstring Conventions Goodger, van Rossum ! S 258 Docutils Design Specification Goodger S 262 Database of Installed Python Packages Kuchling S 263 Defining Python Source Code Encodings Lemburg *************** *** 96,100 **** S 284 Integer for-loops Eppstein, Ewing S 286 Enhanced Argument Tuples von Loewis ! S 287 reStructuredText Standard Docstring Format Goodger I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw --- 96,100 ---- S 284 Integer for-loops Eppstein, Ewing S 286 Enhanced Argument Tuples von Loewis ! S 287 reStructuredText Docstring Format Goodger I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw *************** *** 247,251 **** S 256 Docstring Processing System Framework Goodger S 257 Docstring Conventions Goodger, van Rossum ! S 258 DPS Generic Implementation Details Goodger SR 259 Omit printing newline after newline van Rossum SF 260 Simplify xrange() van Rossum --- 247,251 ---- S 256 Docstring Processing System Framework Goodger S 257 Docstring Conventions Goodger, van Rossum ! S 258 Docutils Design Specification Goodger SR 259 Omit printing newline after newline van Rossum SF 260 Simplify xrange() van Rossum *************** *** 276,280 **** SF 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis ! S 287 reStructuredText Standard Docstring Format Goodger SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger --- 276,280 ---- SF 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis ! S 287 reStructuredText Docstring Format Goodger SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger Index: pep-0256.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0256.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0256.txt 5 Jul 2001 19:20:16 -0000 1.2 --- pep-0256.txt 1 Aug 2002 22:32:33 -0000 1.3 *************** *** 3,47 **** Version: $Revision$ Last-Modified: $Date$ ! Author: dgoodger@bigfoot.com (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track - Requires: PEP 257 Docstring Conventions - PEP 258 DPS Generic Implementation Details Created: 01-Jun-2001 ! Post-History: Abstract - Python modules, classes and functions have a string attribute - called __doc__. If the first expression inside the definition is - a literal string, that string is assigned to the __doc__ - attribute, called a documentation string or docstring. It is - often used to summarize the interface of the module, class or - function. - - There is no standard format (markup) for docstrings, nor are there - standard tools for extracting docstrings and transforming them - into useful structured formats (e.g., HTML, DocBook, TeX). Those - tools that do exist are for the most part unmaintained and unused. - The issues surrounding docstring processing have been contentious - and difficult to resolve. - - This PEP proposes a Docstring Processing System (DPS) framework. - It separates out the components (program and conceptual), enabling - the resolution of individual issues either through consensus (one - solution) or through divergence (many). It promotes standard - interfaces which will allow a variety of plug-in components (e.g., - input parsers and output formatters) to be used. - - This PEP presents the concepts of a DPS framework independently of - implementation details. - - - Rationale - Python lends itself to inline documentation. With its built-in ! docstring syntax, a limited form of Literate Programming [2] is easy to do in Python. However, there are no satisfactory standard tools for extracting and processing Python docstrings. The lack --- 3,18 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: goodger@users.sourceforge.net (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track Created: 01-Jun-2001 ! Post-History: 13-Jun-2001 Abstract Python lends itself to inline documentation. With its built-in ! docstring syntax, a limited form of Literate Programming [1]_ is easy to do in Python. However, there are no satisfactory standard tools for extracting and processing Python docstrings. The lack *************** *** 49,167 **** infrastructure; this PEP aims to fill the gap. ! There are standard inline documentation systems for some other ! languages. For example, Perl has POD (plain old documentation) ! and Java has Javadoc, but neither of these mesh with the Pythonic ! way. POD is very explicit, but takes after Perl in terms of ! readability. Javadoc is HTML-centric; except for '@field' tags, ! raw HTML is used for markup. There are also general tools such as ! Autoduck and Web (Tangle & Weave), useful for multiple languages. ! There have been many attempts to write autodocumentation systems ! for Python (not an exhaustive list): - - Marc-Andre Lemburg's doc.py [3] ! - Daniel Larsson's pythondoc & gendoc [4] ! - Doug Hellmann's HappyDoc [5] ! - Laurence Tratt's Crystal [6] ! - Ka-Ping Yee's htmldoc & pydoc [7] (pydoc.py is now part of the Python ! standard library; see below) ! - Tony Ibbs' docutils [8] ! These systems, each with different goals, have had varying degrees ! of success. A problem with many of the above systems was ! over-ambition. They provided a self-contained set of components: a ! docstring extraction system, an input parser, an internal ! processing system and one or more output formatters. Inevitably, ! one or more components had serious shortcomings, preventing the ! system from being adopted as a standard tool. ! Throughout the existence of the Python Documentation Special ! Interest Group (Doc-SIG) [9], consensus on a single standard ! docstring format has never been reached. A lightweight, implicit ! markup has been sought, for the following reasons (among others): ! 1. Docstrings written within Python code are available from within ! the interactive interpreter, and can be 'print'ed. Thus the ! use of plaintext for easy readability. ! 2. Programmers want to add structure to their docstrings, without ! sacrificing raw docstring readability. Unadorned plaintext ! cannot be transformed ('up-translated') into useful structured ! formats. - 3. Explicit markup (like XML or TeX) has been widely considered - unreadable by the uninitiated. ! 4. Implicit markup is aesthetically compatible with the clean and ! minimalist Python syntax. ! Early on, variants of Setext (Structure Enhanced Text) [10], ! including Digital Creation's StructuredText [11], were proposed ! for Python docstring formatting. Hereafter we will collectively ! call these variants 'STexts'. Although used by some (including in ! most of the above-listed autodocumentation tools), these markup ! schemes have failed to become standard because: ! - STexts have been incomplete: lacking 'essential' constructs that ! people want to use in their docstrings, STexts are rendered less ! than ideal. Note that these 'essential' constructs are not ! universal; everyone has their own requirements. ! - STexts have been sometimes surprising: bits of text are marked ! up unexpectedly, leading to user frustration. ! - SText implementations have been buggy. ! - Some STexts have have had no formal specification except for the ! implementation itself. A buggy implementation meant a buggy ! spec, and vice-versa. ! - There has been no mechanism to get around the SText markup rules ! when a markup character is used in a non-markup context. ! Recognizing the deficiencies of STexts, some people have proposed ! using explicit markup of some kind. There have been proposals for ! using XML, HTML, TeX, POD, and Javadoc at one time or another. ! Proponents of STexts have vigorously opposed these proposals, and ! the debates have continued off and on for at least five years. It has become clear (to this author, at least) that the "all or ! nothing" approach cannot succeed, since no all-encompassing ! proposal could possibly be agreed upon by all interested parties. ! A modular component approach, where components may be multiply ! implemented, is the only chance at success. By separating out the ! issues, we can form consensus more easily (smaller fights ;-), and ! accept divergence more readily. Each of the components of a docstring processing system should be developed independently. A 'best of breed' system should be ! chosen and/or developed and eventually included in Python's ! standard library. ! Pydoc & Other Existing Systems ! Pydoc is part of the Python 2.1 standard library. It extracts and ! displays docstrings from within the Python interactive ! interpreter, from the shell command line, and from a GUI window ! into a web browser (HTML). In the case of GUI/HTML, except for ! some heuristic hyperlinking of identifier names, no formatting of ! the docstrings is done. They are presented within

! tags to avoid unwanted line wrapping. Unfortunately, the result ! is not pretty. The functionality proposed in this PEP could be added to or used ! by pydoc when serving HTML pages. However, the proposed docstring ! processing system's functionality is much more than pydoc needs ! (in its current form). Either an independent tool will be ! developed (which pydoc may or may not use), or pydoc could be ! expanded to encompass this functionality and *become* the ! docstring processing system (or one such system). That decision ! is beyond the scope of this PEP. Similarly for other existing docstring processing systems, their --- 20,154 ---- infrastructure; this PEP aims to fill the gap. ! The issues surrounding docstring processing have been contentious ! and difficult to resolve. This PEP proposes a generic Docstring ! Processing System (DPS) framework, which separates out the ! components (program and conceptual), enabling the resolution of ! individual issues either through consensus (one solution) or ! through divergence (many). It promotes standard interfaces which ! will allow a variety of plug-in components (input context readers, ! markup parsers, and output format writers) to be used. ! The concepts of a DPS framework are presented independently of ! implementation details. ! Roadmap to the Doctring PEPs ! There are many aspects to docstring processing. The "Docstring ! PEPs" have broken up the issues in order to deal with each of them ! in isolation, or as close as possible. The individual aspects and ! associated PEPs are as follows: ! * Docstring syntax. PEP 287, reStructuredText Docstring Format, ! proposes a syntax for Python docstrings, PEPs, and other uses. ! * Docstring semantics consist of at least two aspects: ! - Conventions: the high-level structure of docstrings. Dealt ! with in PEP 257, Docstring Conventions. ! - Methodology: rules for the informational content of ! docstrings. Not addressed. ! * Processing mechanisms. This PEP outlines the high-level issues ! and specification of an abstract docstring processing system ! (DPS). PEP 258, Docutils Design Specification, is an overview ! of the design and implementation of one DPS under development. ! * Output styles: developers want the documentation generated from ! their source code to look good, and there are many different ! ideas about what that means. PEP 258 touches on "Stylist ! Transforms". This aspect of docstring processing has yet to be ! fully explored. ! By separating out the issues, we can form consensus more easily ! (smaller fights ;-), and accept divergence more readily. ! Rationale ! There are standard inline documentation systems for some other ! languages. For example, Perl has POD [2]_ and Java has Javadoc ! [3]_, but neither of these mesh with the Pythonic way. POD syntax ! is very explicit, but takes after Perl in terms of readability. ! Javadoc is HTML-centric; except for '@field' tags, raw HTML is ! used for markup. There are also general tools such as Autoduck ! [4]_ and Web (Tangle & Weave) [5]_, useful for multiple languages. ! There have been many attempts to write auto-documentation systems ! for Python (not an exhaustive list): ! - Marc-Andre Lemburg's doc.py [6]_ ! - Daniel Larsson's pythondoc & gendoc [7]_ ! - Doug Hellmann's HappyDoc [8]_ ! - Laurence Tratt's Crystal [9]_ ! - Ka-Ping Yee's htmldoc & pydoc [10]_ (pydoc.py is now part of the ! Python standard library; see below) ! ! - Tony Ibbs' docutils [11]_ ! ! - Edward Loper's STminus formalization and related efforts [12]_ ! ! These systems, each with different goals, have had varying degrees ! of success. A problem with many of the above systems was ! over-ambition combined with inflexibility. They provided a ! self-contained set of components: a docstring extraction system, a ! markup parser, an internal processing system and one or more ! output format writers with a fixed style. Inevitably, one or more ! aspects of each system had serious shortcomings, and they were not ! easily extended or modified, preventing them from being adopted as ! standard tools. It has become clear (to this author, at least) that the "all or ! nothing" approach cannot succeed, since no monolithic ! self-contained system could possibly be agreed upon by all ! interested parties. A modular component approach designed for ! extension, where components may be multiply implemented, may be ! the only chance for success. Standard inter-component APIs will ! make the DPS components comprehensible without requiring detailed ! knowledge of the whole, lowering the barrier for contributions, ! and ultimately resulting in a rich and varied system. Each of the components of a docstring processing system should be developed independently. A 'best of breed' system should be ! chosen, either merged from existing systems, and/or developed ! anew. This system should be included in Python's standard ! library. ! PyDoc & Other Existing Systems ! PyDoc became part of the Python standard library as of release ! 2.1. It extracts and displays docstrings from within the Python ! interactive interpreter, from the shell command line, and from a ! GUI window into a web browser (HTML). Although a very useful ! tool, PyDoc has several deficiencies, including: ! ! - In the case of the GUI/HTML, except for some heuristic ! hyperlinking of identifier names, no formatting of the ! docstrings is done. They are presented within

! tags to avoid unwanted line wrapping. Unfortunately, the result ! is not attractive. ! ! - PyDoc extracts docstrings and structural information (class ! identifiers, method signatures, etc.) from imported module ! objects. There are security issues involved with importing ! untrusted code. Also, information from the source is lost when ! importing, such as comments, "additional docstrings" (string ! literals in non-docstring contexts; see PEP 258 [13]_), and the ! order of definitions. The functionality proposed in this PEP could be added to or used ! by PyDoc when serving HTML pages. The proposed docstring ! processing system's functionality is much more than PyDoc needs in ! its current form. Either an independent tool will be developed ! (which PyDoc may or may not use), or PyDoc could be expanded to ! encompass this functionality and *become* the docstring processing ! system (or one such system). That decision is beyond the scope of ! this PEP. Similarly for other existing docstring processing systems, their *************** *** 183,190 **** - First line is a one-line synopsis. ! PEP 257, Docstring Conventions[12], documents these issues. ! 2. Docstring processing system generic implementation details. ! Documents issues such as: - High-level spec: what a DPS does. --- 170,178 ---- - First line is a one-line synopsis. ! PEP 257, Docstring Conventions [14]_, documents some of these ! issues. ! 2. Docstring processing system design specification. Documents ! issues such as: - High-level spec: what a DPS does. *************** *** 192,257 **** - Command-line interface for executable script. ! - System Python API - Docstring extraction rules. ! - Input parser API. ! - Intermediate internal data structure: output from input parser, ! input to output formatter. ! - Output formatter API. ! - Output management. These issues are applicable to any docstring processing system ! implementation. PEP 258, DPS Generic Implementation ! Details[13], documents these issues. 3. Docstring processing system implementation. ! 4. Input markup specifications: docstring syntax. 5. Input parser implementations. ! 6. Output formats (HTML, XML, TeX, DocBook, info, etc.). ! ! 7. Output formatter implementations. ! ! Components 1, 2, and 3 will be the subject of individual companion ! PEPs, although they may be merged into this PEP once consensus is ! reached. If there is only one implementation, PEPs for components ! 2 & 3 can be combined. Multiple PEPs will be necessary for each ! of components 4, 5, 6, and 7. An alternative to the PEP mechanism ! may be used instead, since these are not directly related to the ! Python language. ! The following diagram shows an overview of the framework. ! Interfaces are indicated by double-borders. The ASCII diagram is ! very wide; please turn off line wrapping to view it: ! +========================+ ! | Command-Line Interface | ! +========================+ ! | Executable Script | ! +------------------------+ ! | ! | calls ! v ! +===========================================+ returns +---------+ ! | System Python API |==========>| output | ! +--------+ +===========================================+ | objects | ! _ writes | Python | reads | Docstring Processing System | +---------+ ! / \ ==============>| module |<===========| | ! \_/ +--------+ | input | transformation, | output | +--------+ ! | +-------------+ follows | docstring | integration, | object | writes | output | ! --+-- consults | docstring |<-----------| extraction | linking | management |===========>| files | ! | --------->| conventions | +============+=====+=====+=====+============+ +--------+ ! / \ +-------------+ | parser API | | formatter API | ! / \ +-------------+ +===========+======+ +======+===========+ +--------+ ! author consults | markup | implements | input | intermediate | output | implements | output | ! --------->| syntax spec |<-----------| parser | data structure | formatter |----------->| format | ! +-------------+ +-----------+-------------------+-----------+ +--------+ --- 180,228 ---- - Command-line interface for executable script. ! - System Python API. - Docstring extraction rules. ! - Readers, which encapsulate the input context . ! - Parsers. ! - Document tree: the intermediate internal data structure. The ! output of the Parser and Reader, and the input to the Writer ! all share the same data structure. ! - Transforms, which modify the document tree. ! ! - Writers for output formats. ! ! - Distributors, which handle output management (one file, many ! files, or objects in memory). These issues are applicable to any docstring processing system ! implementation. PEP 258, Docutils Design Specification [13 ]_, ! documents these issues. 3. Docstring processing system implementation. ! 4. Input markup specifications: docstring syntax. PEP 287, ! reStructuredText Docstring Format [15]_, proposes a standard ! syntax. 5. Input parser implementations. ! 6. Input context readers ("modes": Python source code, PEP, ! standalone text file, email, etc.) and implementations. ! 7. Stylists: certain input context readers may have associated ! stylists which allow for a variety of output document styles. + 8. Output formats (HTML, XML, TeX, DocBook, info, etc.) and writer + implementations. ! Components 1, 2/3, and 4/5 are the subject of individual companion ! PEPs. If there is another implementation of the framework or ! syntax/parser, additional PEPs may be required. Multiple ! implementations of each of components 6 and 7 will be required; ! the PEP mechanism may be overkill for these components. *************** *** 259,296 **** A SourceForge project has been set up for this work at ! http://docstring.sf.net. References and Footnotes ! [1] PEP 236, Docstring Format, Zadka ! http://www.python.org/peps/pep-0216.html ! [2] http://www.literateprogramming.com/ ! [3] http://www.lemburg.com/files/python/SoftwareDescriptions.html#doc.py ! [4] http://starship.python.net/crew/danilo/pythondoc/ ! [5] http://happydoc.sf.net/ ! [6] http://www.btinternet.com/~tratt/comp/python/crystal/index.html ! [7] http://www.lfw.org/python/ ! [8] http://homepage.ntlworld.com/tibsnjoan/docutils/ ! [9] http://www.python.org/sigs/doc-sig/ ! [10] http://www.bsdi.com/setext/ ! [11] http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage/ ! [12] PEP 257, Docstring Conventions, Goodger, Van Rossum ! http://www.python.org/peps/pep-0257.html ! [13] PEP 258, DPS Generic Implementation Details, Goodger http://www.python.org/peps/pep-0258.html Copyright --- 230,274 ---- A SourceForge project has been set up for this work at ! http://docutils.sourceforge.net/. References and Footnotes ! [1] http://www.literateprogramming.com/ ! [2] Perl "Plain Old Documentation" ! http://www.perldoc.com/perl5.6/pod/perlpod.html ! [3] http://java.sun.com/j2se/javadoc/ ! [4] http://www.helpmaster.com/hlp-developmentaids-autoduck.htm ! [5] http://www-cs-faculty.stanford.edu/~knuth/cweb.html ! [6] http://www.lemburg.com/files/python/SoftwareDescriptions.html#doc.py ! [7] http://starship.python.net/crew/danilo/pythondoc/ ! [8] http://happydoc.sourceforge.net/ ! [9] http://www.btinternet.com/~tratt/comp/python/crystal/ ! [10] http://www.python.org/doc/current/lib/module-pydoc.html ! [11] http://homepage.ntlworld.com/tibsnjoan/docutils/ ! [12] http://www.cis.upenn.edu/~edloper/pydoc/ ! [13] PEP 258, Docutils Design Specification, Goodger http://www.python.org/peps/pep-0258.html + [14] PEP 257, Docstring Conventions, Goodger, Van Rossum + http://www.python.org/peps/pep-0257.html + + [15] PEP 287, reStructuredText Docstring Format, Goodger + http://www.python.org/peps/pep-0287.html + + [16] http://www.python.org/sigs/doc-sig/ + Copyright *************** *** 301,310 **** Acknowledgements ! This document borrows text from PEP 216, Docstring Format by Moshe ! Zadka[1]. It is intended as a reorganization of PEP 216 and its ! approach. ! ! This document also borrows ideas from the archives of the Python ! Doc-SIG. Thanks to all members past & present. --- 279,284 ---- Acknowledgements ! This document borrows ideas from the archives of the Python ! Doc-SIG [16]_. Thanks to all members past & present. *************** *** 313,315 **** --- 287,291 ---- mode: indented-text indent-tabs-mode: nil + fill-column: 70 + sentence-end-double-space: t End: Index: pep-0257.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0257.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0257.txt 5 Jul 2001 19:20:16 -0000 1.4 --- pep-0257.txt 1 Aug 2002 22:32:33 -0000 1.5 *************** *** 3,10 **** Version: $Revision$ Last-Modified: $Date$ ! Author: dgoodger@bigfoot.com (David Goodger), ! guido@digicool.com (Guido van Rossum) Discussions-To: doc-sig@python.org ! Status: Draft Type: Informational Created: 29-May-2001 --- 3,10 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: goodger@users.sourceforge.net (David Goodger), ! guido@python.org (Guido van Rossum) Discussions-To: doc-sig@python.org ! Status: Active Type: Informational Created: 29-May-2001 *************** *** 33,39 **** If you violate the conventions, the worst you'll get is some dirty ! looks. But some software (such as the Docstring Processing System ! [1]) will be aware of the conventions, so following them will get ! you the best results. --- 33,39 ---- If you violate the conventions, the worst you'll get is some dirty ! looks. But some software (such as the Docutils docstring ! processing system [1] [2]) will be aware of the conventions, so ! following them will get you the best results. *************** *** 44,48 **** A docstring is a string literal that occurs as the first statement ! in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object. --- 44,48 ---- A docstring is a string literal that occurs as the first statement ! in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object. *************** *** 53,75 **** of the __init__.py file in the package directory. ! String literals occuring elsewhere in Python code may also act as ! documentation. They are not recognized by the Python bytecode compiler and are not accessible as runtime object attributes (i.e. not assigned to __doc__), but two types of extra docstrings ! are recognized by software tools: ! 1. String literals occuring immediately after a simple assignment at the top level of a module, class, or __init__ method are called "attribute docstrings". ! 2. String literals occuring immediately after another docstring are called "additional docstrings". ! Please see PEP 258 "DPS Generic Implementation Details" [2] for a detailed description of attribute and additional docstrings. For consistency, always use """triple double quotes""" around docstrings. Use r"""raw triple double quotes""" if you use any ! backslashes in your docstrings. There are two forms of docstrings: one-liners and multi-line --- 53,78 ---- of the __init__.py file in the package directory. ! String literals occurring elsewhere in Python code may also act as ! documentation. They are not recognized by the Python bytecode compiler and are not accessible as runtime object attributes (i.e. not assigned to __doc__), but two types of extra docstrings ! may be extracted by software tools: ! 1. String literals occurring immediately after a simple assignment at the top level of a module, class, or __init__ method are called "attribute docstrings". ! 2. String literals occurring immediately after another docstring are called "additional docstrings". ! Please see PEP 258 "Docutils Design Specification" [2] for a detailed description of attribute and additional docstrings. + XXX Mention docstrings of 2.2 properties. + For consistency, always use """triple double quotes""" around docstrings. Use r"""raw triple double quotes""" if you use any ! backslashes in your docstrings. For Unicode docstrings, use ! u"""Unicode triple-quoted strings""". There are two forms of docstrings: one-liners and multi-line *************** *** 88,92 **** ... ! Notes: - Triple quotes are used even though the string fits on one line. --- 91,95 ---- ... ! Notes: - Triple quotes are used even though the string fits on one line. *************** *** 99,114 **** - The docstring is a phrase ending in a period. It prescribes the ! function's effect as a command ("Do this", "Return that"), not ! as a description: e.g. don't write "Returns the pathname ..." - The one-line docstring should NOT be a "signature" reiterating ! the function parameters (which can be obtained by introspection). Don't do:: ! def function(a, b): """function(a, b) -> list""" ! This type of docstring is only appropriate for C functions (such ! as built-ins), where introspection is not possible. Multi-line Docstrings --- 102,126 ---- - The docstring is a phrase ending in a period. It prescribes the ! function or method's effect as a command ("Do this", "Return ! that"), not as a description: e.g. don't write "Returns the ! pathname ..." - The one-line docstring should NOT be a "signature" reiterating ! the function/method parameters (which can be obtained by introspection). Don't do:: ! def function(a, b): """function(a, b) -> list""" ! This type of docstring is only appropriate for C functions (such ! as built-ins), where introspection is not possible. However, ! the nature of the *return value* cannot be determined by ! introspection, so it should be mentioned. The preferred form ! for such a docstring would be something like:: ! ! def function(a, b): ! """Do X and return a list.""" ! ! (Of course "Do X" should be replaced by a useful description!) Multi-line Docstrings *************** *** 119,123 **** elaborate description. The summary line may be used by automatic indexing tools; it is important that it fits on one line and is ! separated from the rest of the docstring by a blank line. The entire docstring is indented the same as the quotes at its --- 131,137 ---- elaborate description. The summary line may be used by automatic indexing tools; it is important that it fits on one line and is ! separated from the rest of the docstring by a blank line. The ! summary line may be on the same line as the opening quotes or on ! the next line. The entire docstring is indented the same as the quotes at its *************** *** 133,141 **** line, and the docstring needs to be offset from the first method by a blank line; for symmetry, put a blank line between the class ! header and the docstring. Docstrings documenting functions ! generally don't have this requirement, unless the function's body ! is written as a number of blank-line separated sections -- in this ! case, treat the docstring as another section, and precede it with ! a blank line. The docstring of a script (a stand-alone program) should be usable --- 147,155 ---- line, and the docstring needs to be offset from the first method by a blank line; for symmetry, put a blank line between the class ! header and the docstring. Docstrings documenting functions or ! methods generally don't have this requirement, unless the function ! or method's body is written as a number of blank-line separated ! sections -- in this case, treat the docstring as another section, ! and precede it with a blank line. The docstring of a script (a stand-alone program) should be usable *************** *** 153,157 **** by the module, with a one-line summary of each. (These summaries generally give less detail than the summary line in the object's ! docstring.) The docstring for a package (i.e., the docstring of the package's __init__.py module) should also list the modules and subpackages exported by the package. --- 167,171 ---- by the module, with a one-line summary of each. (These summaries generally give less detail than the summary line in the object's ! docstring.) The docstring for a package (i.e., the docstring of the package's __init__.py module) should also list the modules and subpackages exported by the package. *************** *** 184,197 **** case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument ! names. It is best to list each argument on a separate line. For example:: def complex(real=0.0, imag=0.0): """Form a complex number. ! Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) ! """ if imag == 0.0 and real == 0.0: return complex_zero --- 198,211 ---- case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument ! names. It is best to list each argument on a separate line. For example:: def complex(real=0.0, imag=0.0): """Form a complex number. ! Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) ! """ if imag == 0.0 and real == 0.0: return complex_zero *************** *** 209,213 **** http://www.python.org/peps/pep-0256.html ! [2] PEP 258, DPS Generic Implementation Details, Goodger http://www.python.org/peps/pep-0258.html --- 223,227 ---- http://www.python.org/peps/pep-0256.html ! [2] PEP 258, Docutils Design Specification, Goodger http://www.python.org/peps/pep-0258.html *************** *** 215,220 **** Life. ! [4] PEP 8, Style Guide for Python Code, van Rossum, Warsaw ! http://www.python.org/peps/pep-0008.html [5] http://www.python.org/sigs/doc-sig/ --- 229,233 ---- Life. ! [4] http://www.python.org/doc/essays/styleguide.html [5] http://www.python.org/sigs/doc-sig/ *************** *** 229,233 **** The "Specification" text comes mostly verbatim from the Python ! Style Guide by Guido van Rossum [4]. This document borrows ideas from the archives of the Python --- 242,246 ---- The "Specification" text comes mostly verbatim from the Python ! Style Guide essay by Guido van Rossum [4]. This document borrows ideas from the archives of the Python *************** *** 239,241 **** --- 252,256 ---- mode: indented-text indent-tabs-mode: nil + fill-column: 70 + sentence-end-double-space: t End: Index: pep-0258.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0258.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0258.txt 5 Jul 2001 19:20:16 -0000 1.2 --- pep-0258.txt 1 Aug 2002 22:32:33 -0000 1.3 *************** *** 1,39 **** PEP: 258 ! Title: DPS Generic Implementation Details Version: $Revision$ Last-Modified: $Date$ ! Author: dgoodger@bigfoot.com (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track Created: 31-May-2001 ! Post-History: [...1168 lines suppressed...] ! This document borrows ideas from the archives of the Python Doc-SIG ! [2]. Thanks to all members past & present. --- 912,917 ---- Acknowledgements ! This document borrows ideas from the archives of the Python ! Doc-SIG [12]. Thanks to all members past & present. *************** *** 356,358 **** --- 920,924 ---- mode: indented-text indent-tabs-mode: nil + fill-column: 70 + sentence-end-double-space: t End: Index: pep-0287.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0287.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0287.txt 1 Apr 2002 16:01:53 -0000 1.2 --- pep-0287.txt 1 Aug 2002 22:32:33 -0000 1.3 *************** *** 1,4 **** PEP: 287 ! Title: reStructuredText Standard Docstring Format Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 287 ! Title: reStructuredText Docstring Format Version: $Revision$ Last-Modified: $Date$ *************** *** 8,12 **** Type: Informational Created: 25-Mar-2002 ! Post-History: Replaces: 216 --- 8,12 ---- Type: Informational Created: 25-Mar-2002 ! Post-History: 02-Apr-2002 Replaces: 216 *************** *** 14,27 **** Abstract ! This PEP proposes that the reStructuredText [1]_ markup be adopted ! as the standard markup format for plaintext documentation in ! Python docstrings, and (optionally) for PEPs and ancillary ! documents as well. reStructuredText is a rich and extensible yet ! easy-to-read, what-you-see-is-what-you-get plaintext markup ! syntax. Only the low-level syntax of docstrings is addressed here. This ! PEP is not concerned with docstring semantics or processing at ! all. --- 14,81 ---- Abstract ! When plaintext hasn't been expressive enough for inline ! documentation, Python programmers have sought out a format for ! docstrings. This PEP proposes that the reStructuredText markup ! [1]_ be adopted as a standard markup format for structured ! plaintext documentation in Python docstrings, and for PEPs and ! ancillary documents as well. reStructuredText is a rich and ! extensible yet easy-to-read, what-you-see-is-what-you-get ! plaintext markup syntax. Only the low-level syntax of docstrings is addressed here. This ! PEP is not concerned with docstring semantics or processing at all ! (see PEP 256 for a "Roadmap to the Doctring PEPs"). Nor is it an ! attempt to deprecate pure plaintext docstrings, which are always ! going to be legitimate. The reStructuredText markup is an ! alternative for those who want more expressive docstrings. ! ! ! Benefits ! ! Programmers are by nature a lazy breed. We reuse code with ! functions, classes, modules, and subsystems. Through its ! docstring syntax, Python allows us to document our code from ! within. The "holy grail" of the Python Documentation Special ! Interest Group (Doc-SIG) [2]_ has been a markup syntax and toolset ! to allow auto-documentation, where the docstrings of Python ! systems can be extracted in context and processed into useful, ! high-quality documentation for multiple purposes. ! ! Document markup languages have three groups of customers: the ! authors who write the documents, the software systems that process ! the data, and the readers, who are the final consumers and the ! most important group. Most markups are designed for the authors ! and software systems; readers are only meant to see the processed ! form, either on paper or via browser software. ReStructuredText ! is different: it is intended to be easily readable in source form, ! without prior knowledge of the markup. ReStructuredText is ! entirely readable in plaintext format, and many of the markup ! forms match common usage (e.g., ``*emphasis*``), so it reads quite ! naturally. Yet it is rich enough to produce complex documents, ! and extensible so that there are few limits. Of course, to write ! reStructuredText documents some prior knowledge is required. ! ! The reStructuredText parser is available now. The Docutils ! project is at the point where standalone reStructuredText ! documents can be converted to HTML; other output format writers ! will become available over time. Work is progressing on a Python ! source "Reader" which will implement auto-documentation from ! docstrings. Authors of existing auto-documentation tools are ! encouraged to integrate the reStructuredText parser into their ! projects, or better yet, to join forces to produce a world-class ! toolset for the Python standard library. ! ! Tools will become available in the near future, which will allow ! programmers to generate HTML for online help, XML for multiple ! purposes, and eventually PDF, DocBook, and LaTeX for printed ! documentation, essentially "for free" from the existing ! docstrings. The adoption of a standard will, at the very least, ! benefit docstring processing tools by preventing further ! "reinventing the wheel". ! ! Eventually PyDoc, the one existing standard auto-documentation ! tool, could have reStructuredText support added. In the interim ! it will have no problem with reStructuredText markup, since it ! treats all docstrings as preformatted plaintext. *************** *** 29,38 **** These are the generally accepted goals for a docstring format, as ! discussed in the Python Documentation Special Interest Group ! (Doc-SIG) [2]_: ! 1. It must be easy to type with any standard text editor. ! 2. It must be readable to the casual observer. 3. It must not need to contain information which can be deduced --- 83,91 ---- These are the generally accepted goals for a docstring format, as ! discussed in the Doc-SIG: ! 1. It must be readable in source form by the casual observer. ! 2. It must be easy to type with any standard text editor. 3. It must not need to contain information which can be deduced *************** *** 45,63 **** docstrings, without feeling hampered by the markup language. - [[Are these in fact the goals of the Doc-SIG members? Anything to - add?]] - reStructuredText meets and exceeds all of these goals, and sets ! its own goals as well, even more stringent. See "Features" below. The goals of this PEP are as follows: ! 1. To establish a standard docstring format by attaining ! "accepted" status (Python community consensus; BDFL ! pronouncement). Once reStructuredText is a Python standard, ! all effort can be focused on tools instead of arguing for a ! standard. Python needs a standard set of documentation tools. ! 2. To address any related concerns raised by the Python community. 3. To encourage community support. As long as multiple competing --- 98,119 ---- docstrings, without feeling hampered by the markup language. reStructuredText meets and exceeds all of these goals, and sets ! its own goals as well, even more stringent. See ! "Docstring-Significant Features" below. The goals of this PEP are as follows: ! 1. To establish reStructuredText as a standard structured ! plaintext format for docstrings (inline documentation of Python ! modules and packages), PEPs, README-type files and other ! standalone documents. "Accepted" status will be sought through ! Python community consensus and eventual BDFL pronouncement. ! Please note that reStructuredText is being proposed as *a* ! standard, not *the only* standard. Its use will be entirely ! optional. Those who don't want to use it need not. ! ! 2. To solicit and address any related concerns raised by the ! Python community. 3. To encourage community support. As long as multiple competing *************** *** 70,115 **** forces and work on a joint/merged/common implementation. ! 5. (Optional.) To adopt reStructuredText as the standard markup ! for PEPs. One or both of the following strategies may be ! applied: ! a) Keep the existing PEP section structure constructs (one-line ! section headers, indented body text). Subsections can ! either be forbidden or supported with underlined headers in ! the indented body text. ! b) Replace the PEP section structure constructs with the ! reStructuredText syntax. Section headers will require ! underlines, subsections will be supported out of the box, ! and body text need not be indented (except for block ! quotes). ! Support for RFC 2822 headers will be added to the ! reStructuredText parser (unambiguous given a specific context: ! the first contiguous block of a PEP document). It may be ! desired to concretely specify what over/underline styles are ! allowed for PEP section headers, for uniformity. ! 6. (Optional.) To adopt reStructuredText as the standard markup ! for README-type files and other standalone documents in the ! Python distribution. Rationale ! The __doc__ attribute is called a documentation string, or ! docstring. It is often used to summarize the interface of the ! module, class or function. The lack of a standard syntax for ! docstrings has hampered the development of standard tools for ! extracting docstrings and transforming them into documentation in ! standard formats (e.g., HTML, DocBook, TeX). There have been a ! number of proposed markup formats and variations, and many tools ! tied to these proposals, but without a standard docstring format ! they have failed to gain a strong following and/or floundered ! half-finished. ! ! The adoption of a standard will, at the very least, benefit ! docstring processing tools by preventing further "reinventing the ! wheel". Throughout the existence of the Doc-SIG, consensus on a single --- 126,163 ---- forces and work on a joint/merged/common implementation. ! Once reStructuredText is a Python standard, effort can be focused ! on tools instead of arguing for a standard. Python needs a ! standard set of documentation tools. ! With regard to PEPs, one or both of the following strategies may ! be applied: ! a) Keep the existing PEP section structure constructs (one-line ! section headers, indented body text). Subsections can either ! be forbidden, or supported with reStructuredText-style ! underlined headers in the indented body text. ! b) Replace the PEP section structure constructs with the ! reStructuredText syntax. Section headers will require ! underlines, subsections will be supported out of the box, ! and body text need not be indented (except for block ! quotes). ! Support for RFC 2822 headers has been added to the ! reStructuredText parser for PEPs (unambiguous given a specific ! context: the first contiguous block of the document). It may be ! desired to concretely specify what over/underline styles are ! allowed for PEP section headers, for uniformity. Rationale ! The lack of a standard syntax for docstrings has hampered the ! development of standard tools for extracting and converting ! docstrings into documentation in standard formats (e.g., HTML, ! DocBook, TeX). There have been a number of proposed markup ! formats and variations, and many tools tied to these proposals, ! but without a standard docstring format they have failed to gain a ! strong following and/or floundered half-finished. Throughout the existence of the Doc-SIG, consensus on a single *************** *** 119,128 **** 1. Docstrings written within Python code are available from within ! the interactive interpreter, and can be 'print'ed. Thus the use of plaintext for easy readability. 2. Programmers want to add structure to their docstrings, without sacrificing raw docstring readability. Unadorned plaintext ! cannot be transformed ('up-translated') into useful structured formats. --- 167,176 ---- 1. Docstrings written within Python code are available from within ! the interactive interpreter, and can be "print"ed. Thus the use of plaintext for easy readability. 2. Programmers want to add structure to their docstrings, without sacrificing raw docstring readability. Unadorned plaintext ! cannot be transformed ("up-translated") into useful structured formats. *************** *** 133,137 **** minimalist Python syntax. ! Proposed alternatives have included: - XML [3]_, SGML [4]_, DocBook [5]_, HTML [6]_, XHTML [7]_ --- 181,190 ---- minimalist Python syntax. ! Many alternative markups for docstrings have been proposed on the ! Doc-SIG over the years; a representative sample is listed below. ! Each is briefly analyzed in terms of the goals stated above. ! Please note that this is *not* intended to be an exclusive list of ! all existing markup systems; there are many other markups ! (Texinfo, Doxygen, TIM, YODL, AFT, ...) which are not mentioned. - XML [3]_, SGML [4]_, DocBook [5]_, HTML [6]_, XHTML [7]_ *************** *** 139,157 **** XML and SGML are explicit, well-formed meta-languages suitable for all kinds of documentation. XML is a variant of SGML. They ! are best used behind the scenes, because they are verbose, ! difficult to type, and too cluttered to read comfortably as ! source. DocBook, HTML, and XHTML are all applications of SGML ! and/or XML, and all share the same basic syntax and the same ! shortcomings. - TeX [8]_ ! TeX is similar to XML/SGML in that it's explicit, not very easy ! to write, and not easy for the uninitiated to read. - Perl POD [9]_ ! Most Perl modules are documented in a format called POD -- Plain ! Old Documentation. This is an easy-to-type, very low level format with strong integration with the Perl parser. Many tools exist to turn POD documentation into other formats: info, HTML --- 192,210 ---- XML and SGML are explicit, well-formed meta-languages suitable for all kinds of documentation. XML is a variant of SGML. They ! are best used behind the scenes, because to untrained eyes they ! are verbose, difficult to type, and too cluttered to read ! comfortably as source. DocBook, HTML, and XHTML are all ! applications of SGML and/or XML, and all share the same basic ! syntax and the same shortcomings. - TeX [8]_ ! TeX is similar to XML/SGML in that it's explicit, but not very ! easy to write, and not easy for the uninitiated to read. - Perl POD [9]_ ! Most Perl modules are documented in a format called POD (Plain ! Old Documentation). This is an easy-to-type, very low level format with strong integration with the Perl parser. Many tools exist to turn POD documentation into other formats: info, HTML *************** *** 164,171 **** document the code. A program to extract these, and turn them into HTML documentation is called javadoc, and is part of the ! standard Java distribution. However, the only output format ! that is supported is HTML, and JavaDoc has a very intimate ! relationship with HTML, using HTML tags for most markup. Thus ! it shares the readability problems of HTML. - Setext [11]_, StructuredText [12]_ --- 217,223 ---- document the code. A program to extract these, and turn them into HTML documentation is called javadoc, and is part of the ! standard Java distribution. However, JavaDoc has a very ! intimate relationship with HTML, using HTML tags for most ! markup. Thus it shares the readability problems of HTML. - Setext [11]_, StructuredText [12]_ *************** *** 174,178 **** including Zope Corp's StructuredText, were proposed for Python docstring formatting. Hereafter these variants will ! collectively be call 'STexts'. STexts have the advantage of being easy to read without special knowledge, and relatively easy to write. --- 226,230 ---- including Zope Corp's StructuredText, were proposed for Python docstring formatting. Hereafter these variants will ! collectively be called "STexts". STexts have the advantage of being easy to read without special knowledge, and relatively easy to write. *************** *** 189,193 **** - STexts have been sometimes surprising. Bits of text are ! marked up unexpectedly, leading to user frustration. - SText implementations have been buggy. --- 241,246 ---- - STexts have been sometimes surprising. Bits of text are ! unexpectedly interpreted as being marked up, leading to user ! frustration. - SText implementations have been buggy. *************** *** 199,202 **** --- 252,256 ---- - There has been no mechanism to get around the SText markup rules when a markup character is used in a non-markup context. + In other words, no way to escape markup. Proponents of implicit STexts have vigorously opposed proposals *************** *** 208,234 **** ! Features ! ! Rather than repeating or summarizing the extensive ! reStructuredText spec, please read the originals available from ! http://structuredtext.sourceforge.net/spec/ (.txt & .html files). ! Reading the documents in following order is recommended: ! - An Introduction to reStructuredText [13]_ ! - Problems With StructuredText [14]_ (optional, if you've used ! StructuredText; it explains many markup decisions made) ! - reStructuredText Markup Specification [15]_ ! - A Record of reStructuredText Syntax Alternatives [16]_ (explains ! markup decisions made independently of StructuredText) - reStructuredText Directives [17]_ ! There is also a "Quick reStructuredText" user reference [18]_. ! A summary of features addressing often-raised docstring markup ! concerns follows: - A markup escaping mechanism. --- 262,290 ---- ! Specification ! The specification and user documentaton for reStructuredText is ! quite extensive. Rather than repeating or summarizing it all ! here, links to the originals are provided. ! Please first take a look at "A ReStructuredText Primer" [13]_, a ! short and gentle introduction. The "Quick reStructuredText" user ! reference [14]_ quickly summarizes all of the markup constructs. ! For complete and extensive details, please refer to the following ! documents: ! - An Introduction to reStructuredText [15]_ ! - reStructuredText Markup Specification [16]_ - reStructuredText Directives [17]_ ! In addition, "Problems With StructuredText" [18]_ explains many ! markup decisions made with regards to StructuredText, and "A ! Record of reStructuredText Syntax Alternatives" [19]_ records ! markup decisions made independently. ! ! Docstring-Significant Features - A markup escaping mechanism. *************** *** 289,292 **** --- 345,350 ---- """ + Keep data fresher longer. + Extend `Storer`. Class attribute `instances` keeps track of the number of `Keeper` objects instantiated. *************** *** 341,347 **** "bibliographic field lists" (representing document metadata such as author, date, and version) and extension attributes for ! directives (see below). They may be used to implement docstring ! semantics, such as identifying parameters, exceptions raised, ! etc.; such usage is beyond the scope of this PEP. A modified RFC 2822 syntax is used, with a colon *before* as --- 399,406 ---- "bibliographic field lists" (representing document metadata such as author, date, and version) and extension attributes for ! directives (see below). They may be used to implement ! methodologies (docstring semantics), such as identifying ! parameters, exceptions raised, etc.; such usage is beyond the ! scope of this PEP. A modified RFC 2822 syntax is used, with a colon *before* as *************** *** 359,367 **** Standard RFC 2822 header syntax cannot be used for this construct because it is ambiguous. A word followed by a colon ! at the beginning of a line is common in written text. However, ! with the addition of a well-defined context, such as when a ! field list invariably occurs at the beginning of a document ! (e.g., PEPs and email messages), standard RFC 2822 header syntax ! can be used. - Markup extensibility: directives and substitutions. --- 418,422 ---- Standard RFC 2822 header syntax cannot be used for this construct because it is ambiguous. A word followed by a colon ! at the beginning of a line is common in written text. - Markup extensibility: directives and substitutions. *************** *** 382,386 **** The |biohazard| symbol must be used on containers used to dispose of medical waste. ! .. |biohazard| image:: biohazard.png --- 437,441 ---- The |biohazard| symbol must be used on containers used to dispose of medical waste. ! .. |biohazard| image:: biohazard.png *************** *** 406,428 **** Questions & Answers ! Q: Is reStructuredText rich enough? ! A: Yes, it is for most people. If it lacks some construct that is ! require for a specific application, it can be added via the ! directive mechanism. If a common construct has been overlooked and a suitably readable syntax can be found, it can be added to the specification and parser. ! Q: Is reStructuredText *too* rich? ! A: No. ! Since the very beginning, whenever a markup syntax has been ! proposed on the Doc-SIG, someone has complained about the lack ! of support for some construct or other. The reply was often ! something like, "These are docstrings we're talking about, and ! docstrings shouldn't have complex markup." The problem is that ! a construct that seems superfluous to one person may be ! absolutely essential to another. reStructuredText takes the opposite approach: it provides a --- 461,484 ---- Questions & Answers ! 1. Is reStructuredText rich enough? ! Yes, it is for most people. If it lacks some construct that is ! required for a specific application, it can be added via the ! directive mechanism. If a useful and common construct has been overlooked and a suitably readable syntax can be found, it can be added to the specification and parser. ! 2. Is reStructuredText *too* rich? ! For specific applications or individuals, perhaps. In general, ! no. ! Since the very beginning, whenever a docstring markup syntax ! has been proposed on the Doc-SIG, someone has complained about ! the lack of support for some construct or other. The reply was ! often something like, "These are docstrings we're talking ! about, and docstrings shouldn't have complex markup." The ! problem is that a construct that seems superfluous to one ! person may be absolutely essential to another. reStructuredText takes the opposite approach: it provides a *************** *** 434,441 **** simply omitted by convention. ! Q: Why not use indentation for section structure, like StructuredText does? Isn't it more "Pythonic"? ! A: Guido van Rossum wrote the following in a 2001-06-13 Doc-SIG post: --- 490,497 ---- simply omitted by convention. ! 3. Why not use indentation for section structure, like StructuredText does? Isn't it more "Pythonic"? ! Guido van Rossum wrote the following in a 2001-06-13 Doc-SIG post: *************** *** 456,473 **** See "Section Structure via Indentation" in "Problems With ! StructuredText" [14 ]_ for further elaboration. ! Q: Why use reStructuredText for PEPs? What's wrong with the existing standard? ! A: The existing standard for PEPs is very limited in terms of general expressibility, and referencing is especially lacking for such a reference-rich document type. PEPs are currently converted into HTML, but the results (mostly monospaced text) are less than attractive, and most of the value-added potential ! of HTML is untapped. ! Making reStructuredText the standard markup for PEPs will ! enable much richer expression, including support for section structure, inline markup, graphics, and tables. In several PEPs there are ASCII graphics diagrams, which are all that --- 512,529 ---- See "Section Structure via Indentation" in "Problems With ! StructuredText" [18 ]_ for further elaboration. ! 4. Why use reStructuredText for PEPs? What's wrong with the existing standard? ! The existing standard for PEPs is very limited in terms of general expressibility, and referencing is especially lacking for such a reference-rich document type. PEPs are currently converted into HTML, but the results (mostly monospaced text) are less than attractive, and most of the value-added potential ! of HTML (especially inline hyperlinks) is untapped. ! Making reStructuredText a standard markup for PEPs will enable ! much richer expression, including support for section structure, inline markup, graphics, and tables. In several PEPs there are ASCII graphics diagrams, which are all that *************** *** 498,502 **** Abstract ! This PEP proposes a adding frungible doodads [1] to the core. It extends PEP 9876 [2] via the BCA [3] mechanism. --- 554,558 ---- Abstract ! This PEP proposes adding frungible doodads [1] to the core. It extends PEP 9876 [2] via the BCA [3] mechanism. *************** *** 504,508 **** References and Footnotes ! [1] http://www.doodads.org/frungible.html [2] PEP 9876, Let's Hope We Never Get Here --- 560,564 ---- References and Footnotes ! [1] http://www.example.org/ [2] PEP 9876, Let's Hope We Never Get Here *************** *** 519,532 **** ======== ! This PEP proposes a adding `frungible doodads`_ to the ! core. It extends PEP 9876 [#pep9876] via the BCA [#] ! mechanism. ! .. _frungible doodads: ! http://www.doodads.org/frungible.html ! .. [#pep9876] `PEP 9876`__, Let's Hope We Never Get Here ! __ http://www.python.org/peps/pep-9876.html .. [#] "Bogus Complexity Addition" --- 575,589 ---- ======== ! This PEP proposes adding `frungible doodads`_ to the core. ! It extends PEP 9876 [#pep9876]_ via the BCA [#]_ mechanism. ! ... ! ! References & Footnotes ! ====================== ! .. _frungible doodads: http://www.example.org/ ! .. [#pep9876] PEP 9876, Let's Hope We Never Get Here .. [#] "Bogus Complexity Addition" *************** *** 544,548 **** referenced from multiple places in the document without additional definitions. When converted to HTML, references ! will be replaced with inline hyperlinks (HTML tags). The two footnotes are automatically numbered, so they will always stay in sync. The first footnote also contains an internal --- 601,605 ---- referenced from multiple places in the document without additional definitions. When converted to HTML, references ! will be replaced with inline hyperlinks (HTML tags). The two footnotes are automatically numbered, so they will always stay in sync. The first footnote also contains an internal *************** *** 557,582 **** It extends PEP 9876 [PEP9876]_ ... ! .. [PEP9876] `PEP 9876`_, Let's Hope We Never Get Here Footnotes are numbered, whereas citations use text for their references. ! Q: Wouldn't it be better to keep the docstring and PEP proposals separate? ! A: The PEP markup proposal is an option to this PEP. It may be ! removed if it is deemed that there is no need for PEP markup. ! The PEP markup proposal could be made into a separate PEP if ! necessary. If accepted, PEP 1, PEP Purpose and Guidelines [19]_, ! and PEP 9, Sample PEP Template [20]_ will be updated. It seems natural to adopt a single consistent markup standard ! for all uses of plaintext in Python. ! Q: The existing pep2html.py script converts the existing PEP format to HTML. How will the new-format PEPs be converted to HTML? ! A: One of the deliverables of the Docutils project [21]_ will be a new version of pep2html.py with integrated reStructuredText parsing. The Docutils project will support PEPs with a "PEP --- 614,639 ---- It extends PEP 9876 [PEP9876]_ ... ! .. [PEP9876] PEP 9876, Let's Hope We Never Get Here Footnotes are numbered, whereas citations use text for their references. ! 5. Wouldn't it be better to keep the docstring and PEP proposals separate? ! The PEP markup proposal may be removed if it is deemed that ! there is no need for PEP markup, or it could be made into a ! separate PEP. If accepted, PEP 1, PEP Purpose and Guidelines ! [20]_, and PEP 9, Sample PEP Template [21]_ will be updated. It seems natural to adopt a single consistent markup standard ! for all uses of structured plaintext in Python, and to propose ! it all in one place. ! 6. The existing pep2html.py script converts the existing PEP format to HTML. How will the new-format PEPs be converted to HTML? ! One of the deliverables of the Docutils project [22]_ will be a new version of pep2html.py with integrated reStructuredText parsing. The Docutils project will support PEPs with a "PEP *************** *** 584,608 **** pep2html.py (auto-recognition of PEP & RFC references). ! Q: Who's going to convert the existing PEPs to reStructuredText? ! A: A call for volunteers will be put out to the Doc-SIG and ! greater Python communities. If insufficient volunteers are ! forthcoming, I (David Goodger) will convert the documents ! myself, perhaps with some level of automation. A transitional ! system whereby both old and new standards can coexist will be ! easy to implement (and I pledge to implement it if necessary). ! Q: Why use reStructuredText for README and other ancillary files? ! A: The same reasoning used for PEPs above applies to README and ! other ancillary files. By adopting a standard markup, these ! files can be converted to attractive cross-referenced HTML and ! put up on python.org. Developers of Python projects can also ! take advantage of this facility for their own documentation. ! References and Footnotes ! [1] http://structuredtext.sourceforge.net/ [2] http://www.python.org/sigs/doc-sig/ --- 641,734 ---- pep2html.py (auto-recognition of PEP & RFC references). ! 7. Who's going to convert the existing PEPs to reStructuredText? ! PEP authors or volunteers may convert existing PEPs if they ! like, but there is no requirement to do so. The ! reStructuredText-based PEPs will coexist with the old PEP ! standard. The pep2html.py mentioned in answer 6 will process ! both old and new standards. ! 8. Why use reStructuredText for README and other ancillary files? ! The reasoning given for PEPs in answer 4 above also applies to ! README and other ancillary files. By adopting a standard ! markup, these files can be converted to attractive ! cross-referenced HTML and put up on python.org. Developers of ! Python projects can also take advantage of this facility for ! their own documentation. + 9. Won't the superficial similarity to existing markup conventions + cause problems, and result in people writing invalid markup + (and not noticing, because the plaintext looks natural)? How + forgiving is reStructuredText of "not quite right" markup? ! There will be some mis-steps, as there would be when moving ! from one programming language to another. As with any ! language, proficiency grows with experience. Luckily, ! reStructuredText is a very little language indeed. ! As with any syntax, there is the possibility of syntax errors. ! It is expected that a user will run the processing system over ! their input and check the output for correctness. ! ! In a strict sense, the reStructuredText parser is very ! unforgiving (as it should be; "In the face of ambiguity, refuse ! the temptation to guess" [23]_ applies to parsing markup as ! well as computer languages). Here's design goal 3 from "An ! Introduction to reStructuredText" [15 ]_: ! ! Unambiguous. The rules for markup must not be open for ! interpretation. For any given input, there should be one ! and only one possible output (including error output). ! ! While unforgiving, at the same time the parser does try to be ! helpful by producing useful diagnostic output ("system ! messages"). The parser reports problems, indicating their ! level of severity (from least to most: debug, info, warning, ! error, severe). The user or the client software can decide on ! reporting thresholds; they can ignore low-level problems or ! cause high-level problems to bring processing to an immediate ! halt. Problems are reported during the parse as well as ! included in the output, often with two-way links between the ! source of the problem and the system message explaining it. ! ! 10. Will the docstrings in the Python standard library modules be ! converted to reStructuredText? ! ! No. Python's library reference documentation is maintained ! separately from the source. Docstrings in the Python standard ! library should not try to duplicate the library reference ! documentation. The current policy for docstrings in the ! Python standard library is that they should be no more than ! concise hints, simple and markup-free (although many *do* ! contain ad-hoc implicit markup). ! ! 11. I want to write all my strings in Unicode. Will anything ! break? ! ! The parser fully supports Unicode. Docutils supports ! arbitrary input encodings. ! ! 12. Why does the community need a new structured text design? ! ! The existing structured text designs are deficient, for the ! reasons given in "Rationale" above. reStructuredText aims to ! be a complete markup syntax, within the limitations of the ! "readable plaintext" medium. ! ! 13. What is wrong with existing documentation methodologies? ! ! What existing methodologies? For Python docstrings, there is ! **no** official standard markup format, let alone a ! documentation methodology, akin to JavaDoc. The question of ! methodology is at a much higher level than syntax (which this ! PEP addresses). It is potentially much more controversial and ! difficult to resolve, and is intentionally left out of this ! discussion. ! ! ! References & Footnotes ! ! [1] http://docutils.sourceforge.net/spec/rst.html [2] http://www.python.org/sigs/doc-sig/ *************** *** 628,658 **** [12] http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage ! [13] An Introduction to reStructuredText ! http://structuredtext.sourceforge.net/spec/introduction.txt ! [14] Problems with StructuredText ! http://structuredtext.sourceforge.net/spec/problems.txt ! [15] reStructuredText Markup Specification ! http://structuredtext.sourceforge.net/spec/reStructuredText.txt ! [16] A Record of reStructuredText Syntax Alternatives ! http://structuredtext.sourceforge.net/spec/alternatives.txt [17] reStructuredText Directives ! http://structuredtext.sourceforge.net/spec/directives.txt ! [18] Quick reStructuredText ! http://structuredtext.sourceforge.net/docs/quickref.html ! [19] PEP 1, PEP Guidelines, Warsaw, Hylton http://www.python.org/peps/pep-0001.html ! [20] PEP 9, Sample PEP Template, Warsaw http://www.python.org/peps/pep-0009.html ! [21] http://docutils.sourceforge.net/ ! [22] PEP 216, Docstring Format, Zadka http://www.python.org/peps/pep-0216.html --- 754,791 ---- [12] http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage ! [13] A ReStructuredText Primer ! http://docutils.sourceforge.net/docs/rst/quickstart.html ! [14] Quick reStructuredText ! http://docutils.sourceforge.net/docs/rst/quickref.html ! [15] An Introduction to reStructuredText ! http://docutils.sourceforge.net/spec/rst/introduction.html ! [16] reStructuredText Markup Specification ! http://docutils.sourceforge.net/spec/rst/reStructuredText.html [17] reStructuredText Directives ! http://docutils.sourceforge.net/spec/rst/directives.html ! [18] Problems with StructuredText ! http://docutils.sourceforge.net/spec/rst/problems.html ! [19] A Record of reStructuredText Syntax Alternatives ! http://docutils.sourceforge.net/spec/rst/alternatives.html ! ! [20] PEP 1, PEP Guidelines, Warsaw, Hylton http://www.python.org/peps/pep-0001.html ! [21] PEP 9, Sample PEP Template, Warsaw http://www.python.org/peps/pep-0009.html ! [22] http://docutils.sourceforge.net/ ! [23] From "The Zen of Python (by Tim Peters)" ! (http://www.python.org/doc/Humor.html#zen or just ! "``import this``" in Python) ! ! [24] PEP 216, Docstring Format, Zadka http://www.python.org/peps/pep-0216.html *************** *** 665,672 **** Acknowledgements ! Some text is borrowed from PEP 216, Docstring Format, by Moshe ! Zadka [22]_. ! Special thanks to all members past & present of the Python Doc-SIG. --- 798,806 ---- Acknowledgements ! Some text is borrowed from PEP 216, Docstring Format [24]_, by ! Moshe Zadka. ! Special thanks to all members past & present of the Python ! Doc-SIG. From montanaro@users.sourceforge.net Fri Aug 2 03:19:49 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 01 Aug 2002 19:19:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9276 Modified Files: test_socket.py Log Message: modify testGetServByName so it tries a few different protocols. In this day and age of rampant computer breakins I imagine there are plenty of systems with telnet disabled. Successful check of at least one getservbyname() call is required for success Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** test_socket.py 31 Jul 2002 16:08:40 -0000 1.47 --- test_socket.py 2 Aug 2002 02:19:46 -0000 1.48 *************** *** 261,269 **** """Testing getservbyname().""" if hasattr(socket, 'getservbyname'): ! socket.getservbyname('telnet', 'tcp') ! try: ! socket.getservbyname('telnet', 'udp') ! except socket.error: ! pass def testDefaultTimeout(self): --- 261,281 ---- """Testing getservbyname().""" if hasattr(socket, 'getservbyname'): ! # try a few protocols - not everyone has telnet enabled ! found = 0 ! for proto in ("telnet", "ssh", "www", "ftp"): ! try: ! socket.getservbyname(proto, 'tcp') ! found = 1 ! break ! except socket.error: ! pass ! try: ! socket.getservbyname(proto, 'udp') ! found = 1 ! break ! except socket.error: ! pass ! if not found: ! raise socket.error def testDefaultTimeout(self): From mhammond@users.sourceforge.net Fri Aug 2 03:27:14 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 01 Aug 2002 19:27:14 -0700 Subject: [Python-checkins] python/dist/src/PC WinMain.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv10555/PC Modified Files: WinMain.c Log Message: Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches. Index: WinMain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/WinMain.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WinMain.c 24 Apr 2001 05:16:29 -0000 1.7 --- WinMain.c 2 Aug 2002 02:27:12 -0000 1.8 *************** *** 6,11 **** #include "Python.h" - extern int Py_Main(int, char **); - int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */ --- 6,9 ---- From mhammond@users.sourceforge.net Fri Aug 2 03:27:14 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 01 Aug 2002 19:27:14 -0700 Subject: [Python-checkins] python/dist/src/Include pythonrun.h,2.51,2.52 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv10555/Include Modified Files: pythonrun.h Log Message: Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches. Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** pythonrun.h 29 Jul 2002 13:42:06 -0000 2.51 --- pythonrun.h 2 Aug 2002 02:27:12 -0000 2.52 *************** *** 79,82 **** --- 79,85 ---- DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *); + /* Bootstrap */ + PyAPI_FUNC(int) Py_Main(int argc, char **argv); + /* In getpath.c */ PyAPI_FUNC(char *) Py_GetProgramFullPath(void); From mhammond@users.sourceforge.net Fri Aug 2 03:27:16 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Thu, 01 Aug 2002 19:27:16 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.78,2.79 audioop.c,1.48,1.49 binascii.c,2.36,2.37 cmathmodule.c,2.31,2.32 cPickle.c,2.91,2.92 cryptmodule.c,2.13,2.14 cStringIO.c,2.36,2.37 dbmmodule.c,2.31,2.32 dlmodule.c,2.22,2.23 errnomodule.c,2.17,2.18 fcntlmodule.c,2.35,2.36 flmodule.c,1.50,1.51 fpectlmodule.c,2.16,2.17 fpetestmodule.c,2.7,2.8 gdbmmodule.c,2.34,2.35 grpmodule.c,2.18,2.19 imageop.c,2.27,2.28 main.c,1.66,1.67 mathmodule.c,2.68,2.69 md5module.c,2.32,2.33 mpzmodule.c,2.44,2.45 operator.c,2.21,2.22 pcremodule.c,2.32,2.33 posixmodule.c,2.250,2.251 pwdmodule.c,1.34,1.35 python.c,2.6,2.7 readline.c,2.51,2.52 regexmodule.c,1.48,1.49 resource.c,2.26,2.27 rgbimgmodule.c,2.25,2.26 rotormodule.c,2.36,2.37 shamodule.c,2.20,2.21 signalmodule.c,2.70,2.71 socketmodule.c,1.238,1.239 stropmodule.c,2.89,2.90 structmodule.c,2.55,2.56 symtablemodule.c,1.5,1.6 syslogmodule.c,2.18,2.19 termios.c,2.35,2.36 threadmodule.c,2.51,2.52 timemodule.c,2.130,2.131 timingmodule.c,2.10,2.11 xreadlinesmodule.c,1.11,1.12 xxmodule.c,2.30,2.31 xxsubtype.c,2.16,2.17 _codecsmodule.c,2.12,2.13 _cursesmodule.c,2.65,2.66 _curses_panel.c,1.12,1.13 _localemodule.c,2.34,2.35 _ssl.c,1.7,1.8 _weakref.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10555/Modules Modified Files: arraymodule.c audioop.c binascii.c cmathmodule.c cPickle.c cryptmodule.c cStringIO.c dbmmodule.c dlmodule.c errnomodule.c fcntlmodule.c flmodule.c fpectlmodule.c fpetestmodule.c gdbmmodule.c grpmodule.c imageop.c main.c mathmodule.c md5module.c mpzmodule.c operator.c pcremodule.c posixmodule.c pwdmodule.c python.c readline.c regexmodule.c resource.c rgbimgmodule.c rotormodule.c shamodule.c signalmodule.c socketmodule.c stropmodule.c structmodule.c symtablemodule.c syslogmodule.c termios.c threadmodule.c timemodule.c timingmodule.c xreadlinesmodule.c xxmodule.c xxsubtype.c _codecsmodule.c _cursesmodule.c _curses_panel.c _localemodule.c _ssl.c _weakref.c Log Message: Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -d -r2.78 -r2.79 *** arraymodule.c 29 Jul 2002 14:35:03 -0000 2.78 --- arraymodule.c 2 Aug 2002 02:27:12 -0000 2.79 *************** *** 1909,1913 **** ! DL_EXPORT(void) initarray(void) { --- 1909,1913 ---- ! PyMODINIT_FUNC initarray(void) { Index: audioop.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/audioop.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** audioop.c 17 Jan 2002 23:15:58 -0000 1.48 --- audioop.c 2 Aug 2002 02:27:13 -0000 1.49 *************** *** 1370,1374 **** }; ! DL_EXPORT(void) initaudioop(void) { --- 1370,1374 ---- }; ! PyMODINIT_FUNC initaudioop(void) { Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** binascii.c 2 Jul 2002 22:24:50 -0000 2.36 --- binascii.c 2 Aug 2002 02:27:13 -0000 2.37 *************** *** 1314,1318 **** PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII"); ! DL_EXPORT(void) initbinascii(void) { --- 1314,1318 ---- PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII"); ! PyMODINIT_FUNC initbinascii(void) { Index: cmathmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cmathmodule.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** cmathmodule.c 17 Jul 2002 16:30:36 -0000 2.31 --- cmathmodule.c 2 Aug 2002 02:27:13 -0000 2.32 *************** *** 392,396 **** }; ! DL_EXPORT(void) initcmath(void) { --- 392,396 ---- }; ! PyMODINIT_FUNC initcmath(void) { Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -d -r2.91 -r2.92 *** cPickle.c 18 Jul 2002 20:58:57 -0000 2.91 --- cPickle.c 2 Aug 2002 02:27:13 -0000 2.92 *************** *** 4790,4797 **** } ! #ifndef DL_EXPORT /* declarations for DLL import/export */ ! #define DL_EXPORT(RTYPE) RTYPE #endif ! DL_EXPORT(void) initcPickle(void) { --- 4790,4797 ---- } ! #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ ! #define PyMODINIT_FUNC void #endif ! PyMODINIT_FUNC initcPickle(void) { Index: cryptmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cryptmodule.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** cryptmodule.c 13 Jun 2002 20:32:49 -0000 2.13 --- cryptmodule.c 2 Aug 2002 02:27:13 -0000 2.14 *************** *** 38,42 **** }; ! DL_EXPORT(void) initcrypt(void) { --- 38,42 ---- }; ! PyMODINIT_FUNC initcrypt(void) { Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** cStringIO.c 13 Jun 2002 20:32:48 -0000 2.36 --- cStringIO.c 2 Aug 2002 02:27:13 -0000 2.37 *************** *** 702,709 **** }; ! #ifndef DL_EXPORT /* declarations for DLL import/export */ ! #define DL_EXPORT(RTYPE) RTYPE #endif ! DL_EXPORT(void) initcStringIO(void) { PyObject *m, *d, *v; --- 702,709 ---- }; ! #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ ! #define PyMODINIT_FUNC void #endif ! PyMODINIT_FUNC initcStringIO(void) { PyObject *m, *d, *v; Index: dbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dbmmodule.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** dbmmodule.c 17 Jul 2002 16:30:36 -0000 2.31 --- dbmmodule.c 2 Aug 2002 02:27:13 -0000 2.32 *************** *** 340,344 **** }; ! DL_EXPORT(void) initdbm(void) { PyObject *m, *d, *s; --- 340,344 ---- }; ! PyMODINIT_FUNC initdbm(void) { PyObject *m, *d, *s; Index: dlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dlmodule.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** dlmodule.c 17 Jul 2002 16:30:36 -0000 2.22 --- dlmodule.c 2 Aug 2002 02:27:13 -0000 2.23 *************** *** 210,214 **** } ! DL_EXPORT(void) initdl(void) { --- 210,214 ---- } ! PyMODINIT_FUNC initdl(void) { Index: errnomodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/errnomodule.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** errnomodule.c 13 Jun 2002 20:32:49 -0000 2.17 --- errnomodule.c 2 Aug 2002 02:27:13 -0000 2.18 *************** *** 58,62 **** e.g. os.strerror(2) could return 'No such file or directory'."); ! DL_EXPORT(void) initerrno(void) { --- 58,62 ---- e.g. os.strerror(2) could return 'No such file or directory'."); ! PyMODINIT_FUNC initerrno(void) { Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** fcntlmodule.c 13 Jun 2002 20:32:49 -0000 2.35 --- fcntlmodule.c 2 Aug 2002 02:27:13 -0000 2.36 *************** *** 463,467 **** } ! DL_EXPORT(void) initfcntl(void) { --- 463,467 ---- } ! PyMODINIT_FUNC initfcntl(void) { Index: flmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/flmodule.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** flmodule.c 17 Jul 2002 16:30:36 -0000 1.50 --- flmodule.c 2 Aug 2002 02:27:13 -0000 1.51 *************** *** 2127,2131 **** }; ! DL_EXPORT(void) initfl(void) { --- 2127,2131 ---- }; ! PyMODINIT_FUNC initfl(void) { Index: fpectlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fpectlmodule.c,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** fpectlmodule.c 1 Feb 2002 15:46:29 -0000 2.16 --- fpectlmodule.c 2 Aug 2002 02:27:13 -0000 2.17 *************** *** 87,91 **** static PyObject *fpe_error; ! DL_EXPORT(void) initfpectl(void); static PyObject *turnon_sigfpe (PyObject *self,PyObject *args); static PyObject *turnoff_sigfpe (PyObject *self,PyObject *args); --- 87,91 ---- static PyObject *fpe_error; ! PyMODINIT_FUNC initfpectl(void); static PyObject *turnon_sigfpe (PyObject *self,PyObject *args); static PyObject *turnoff_sigfpe (PyObject *self,PyObject *args); *************** *** 250,254 **** } ! DL_EXPORT(void) initfpectl(void) { PyObject *m, *d; --- 250,254 ---- } ! PyMODINIT_FUNC initfpectl(void) { PyObject *m, *d; Index: fpetestmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fpetestmodule.c,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -d -r2.7 -r2.8 *** fpetestmodule.c 17 Jan 2002 23:15:58 -0000 2.7 --- fpetestmodule.c 2 Aug 2002 02:27:13 -0000 2.8 *************** *** 45,49 **** static PyObject *fpe_error; ! DL_EXPORT(void) initfpetest(void); static PyObject *test(PyObject *self,PyObject *args); static double db0(double); --- 45,49 ---- static PyObject *fpe_error; ! PyMODINIT_FUNC initfpetest(void); static PyObject *test(PyObject *self,PyObject *args); static double db0(double); *************** *** 173,177 **** } ! DL_EXPORT(void) initfpetest(void) { PyObject *m, *d; --- 173,177 ---- } ! PyMODINIT_FUNC initfpetest(void) { PyObject *m, *d; Index: gdbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gdbmmodule.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** gdbmmodule.c 17 Jul 2002 16:30:36 -0000 2.34 --- gdbmmodule.c 2 Aug 2002 02:27:13 -0000 2.35 *************** *** 505,509 **** }; ! DL_EXPORT(void) initgdbm(void) { PyObject *m, *d, *s; --- 505,509 ---- }; ! PyMODINIT_FUNC initgdbm(void) { PyObject *m, *d, *s; Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** grpmodule.c 13 Jun 2002 20:32:49 -0000 2.18 --- grpmodule.c 2 Aug 2002 02:27:13 -0000 2.19 *************** *** 157,161 **** ! DL_EXPORT(void) initgrp(void) { --- 157,161 ---- ! PyMODINIT_FUNC initgrp(void) { Index: imageop.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/imageop.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** imageop.c 2 Apr 2002 18:26:33 -0000 2.27 --- imageop.c 2 Aug 2002 02:27:13 -0000 2.28 *************** *** 697,701 **** ! DL_EXPORT(void) initimageop(void) { --- 697,701 ---- ! PyMODINIT_FUNC initimageop(void) { Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** main.c 28 Jul 2002 13:53:05 -0000 1.66 --- main.c 2 Aug 2002 02:27:13 -0000 1.67 *************** *** 106,110 **** /* Main program */ ! DL_EXPORT(int) Py_Main(int argc, char **argv) { --- 106,110 ---- /* Main program */ ! int Py_Main(int argc, char **argv) { Index: mathmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mathmodule.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** mathmodule.c 13 Jun 2002 20:32:50 -0000 2.68 --- mathmodule.c 2 Aug 2002 02:27:13 -0000 2.69 *************** *** 335,339 **** "mathematical functions defined by the C standard."); ! DL_EXPORT(void) initmath(void) { --- 335,339 ---- "mathematical functions defined by the C standard."); ! PyMODINIT_FUNC initmath(void) { Index: md5module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/md5module.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** md5module.c 17 Jul 2002 16:49:03 -0000 2.32 --- md5module.c 2 Aug 2002 02:27:13 -0000 2.33 *************** *** 254,258 **** /* Initialize this module. */ ! DL_EXPORT(void) initmd5(void) { --- 254,258 ---- /* Initialize this module. */ ! PyMODINIT_FUNC initmd5(void) { Index: mpzmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** mpzmodule.c 17 Jul 2002 16:30:37 -0000 2.44 --- mpzmodule.c 2 Aug 2002 02:27:13 -0000 2.45 *************** *** 1645,1649 **** /* Initialize this module. */ ! DL_EXPORT(void) initmpz(void) { --- 1645,1649 ---- /* Initialize this module. */ ! PyMODINIT_FUNC initmpz(void) { Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** operator.c 13 Jun 2002 20:32:50 -0000 2.21 --- operator.c 2 Aug 2002 02:27:13 -0000 2.22 *************** *** 220,224 **** /* Initialization function for the module (*must* be called initoperator) */ ! DL_EXPORT(void) initoperator(void) { --- 220,224 ---- /* Initialization function for the module (*must* be called initoperator) */ ! PyMODINIT_FUNC initoperator(void) { Index: pcremodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pcremodule.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** pcremodule.c 17 Jul 2002 16:30:37 -0000 2.32 --- pcremodule.c 2 Aug 2002 02:27:13 -0000 2.33 *************** *** 611,615 **** /* Initialization function for the module (*must* be called initpcre) */ ! DL_EXPORT(void) initpcre(void) { --- 611,615 ---- /* Initialization function for the module (*must* be called initpcre) */ ! PyMODINIT_FUNC initpcre(void) { Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.250 retrieving revision 2.251 diff -C2 -d -r2.250 -r2.251 *** posixmodule.c 1 Aug 2002 21:57:49 -0000 2.250 --- posixmodule.c 2 Aug 2002 02:27:13 -0000 2.251 *************** *** 3212,3215 **** --- 3212,3216 ---- PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; + DWORD dwProcessFlags = 0; /* no NEW_CONSOLE by default for Ctrl+C handling */ char *s1,*s2, *s3 = " /c "; const char *szConsoleSpawn = "w9xpopen.exe"; *************** *** 3304,3307 **** --- 3305,3318 ---- s3, cmdstring); + /* Not passing CREATE_NEW_CONSOLE has been known to + cause random failures on win9x. Specifically a + dialog: + "Your program accessed mem currently in use at xxx" + and a hopeful warning about the stability of your + system. + Cost is Ctrl+C wont kill children, but anyone + who cares can have a go! + */ + dwProcessFlags |= CREATE_NEW_CONSOLE; } } *************** *** 3329,3333 **** NULL, TRUE, ! 0, /* no new console so Ctrl+C kills child too */ NULL, NULL, --- 3340,3344 ---- NULL, TRUE, ! dwProcessFlags, NULL, NULL, *************** *** 6747,6751 **** #endif ! DL_EXPORT(void) INITFUNC(void) { --- 6758,6762 ---- #endif ! PyMODINIT_FUNC INITFUNC(void) { Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** pwdmodule.c 13 Jun 2002 20:32:51 -0000 1.34 --- pwdmodule.c 2 Aug 2002 02:27:13 -0000 1.35 *************** *** 158,162 **** }; ! DL_EXPORT(void) initpwd(void) { --- 158,162 ---- }; ! PyMODINIT_FUNC initpwd(void) { Index: python.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/python.c,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -d -r2.6 -r2.7 *** python.c 22 Jul 2000 23:57:55 -0000 2.6 --- python.c 2 Aug 2002 02:27:13 -0000 2.7 *************** *** 3,8 **** #include "Python.h" - extern DL_EXPORT(int) Py_Main(int, char **); - int main(int argc, char **argv) --- 3,6 ---- Index: readline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** readline.c 13 Jun 2002 20:32:52 -0000 2.51 --- readline.c 2 Aug 2002 02:27:13 -0000 2.52 *************** *** 653,657 **** "Importing this module enables command line editing using GNU readline."); ! DL_EXPORT(void) initreadline(void) { --- 653,657 ---- "Importing this module enables command line editing using GNU readline."); ! PyMODINIT_FUNC initreadline(void) { Index: regexmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/regexmodule.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** regexmodule.c 27 Apr 2002 18:44:31 -0000 1.48 --- regexmodule.c 2 Aug 2002 02:27:13 -0000 1.49 *************** *** 643,647 **** }; ! DL_EXPORT(void) initregex(void) { --- 643,647 ---- }; ! PyMODINIT_FUNC initregex(void) { Index: resource.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** resource.c 13 Jun 2002 20:32:52 -0000 2.26 --- resource.c 2 Aug 2002 02:27:13 -0000 2.27 *************** *** 211,215 **** /* Module initialization */ ! DL_EXPORT(void) initresource(void) { --- 211,215 ---- /* Module initialization */ ! PyMODINIT_FUNC initresource(void) { Index: rgbimgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/rgbimgmodule.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** rgbimgmodule.c 31 Mar 2002 15:27:00 -0000 2.25 --- rgbimgmodule.c 2 Aug 2002 02:27:13 -0000 2.26 *************** *** 752,756 **** ! DL_EXPORT(void) initrgbimg(void) { --- 752,756 ---- ! PyMODINIT_FUNC initrgbimg(void) { Index: rotormodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/rotormodule.c,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** rotormodule.c 17 Jul 2002 16:49:03 -0000 2.36 --- rotormodule.c 2 Aug 2002 02:27:13 -0000 2.37 *************** *** 616,620 **** ! DL_EXPORT(void) initrotor(void) { --- 616,620 ---- ! PyMODINIT_FUNC initrotor(void) { Index: shamodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/shamodule.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** shamodule.c 17 Jul 2002 16:30:37 -0000 2.20 --- shamodule.c 2 Aug 2002 02:27:13 -0000 2.21 *************** *** 526,530 **** #define insint(n,v) { PyModule_AddIntConstant(m,n,v); } ! DL_EXPORT(void) initsha(void) { --- 526,530 ---- #define insint(n,v) { PyModule_AddIntConstant(m,n,v); } ! PyMODINIT_FUNC initsha(void) { Index: signalmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/signalmodule.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** signalmodule.c 30 Jun 2002 15:26:09 -0000 2.70 --- signalmodule.c 2 Aug 2002 02:27:13 -0000 2.71 *************** *** 470,474 **** the first is the signal number, the second is the interrupted stack frame."); ! DL_EXPORT(void) initsignal(void) { --- 470,474 ---- the first is the signal number, the second is the interrupted stack frame."); ! PyMODINIT_FUNC initsignal(void) { Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.238 retrieving revision 1.239 diff -C2 -d -r1.238 -r1.239 *** socketmodule.c 28 Jul 2002 16:10:31 -0000 1.238 --- socketmodule.c 2 Aug 2002 02:27:13 -0000 1.239 *************** *** 3009,3013 **** for documentation."); ! DL_EXPORT(void) init_socket(void) { --- 3009,3013 ---- for documentation."); ! PyMODINIT_FUNC init_socket(void) { Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -d -r2.89 -r2.90 *** stropmodule.c 13 Jun 2002 20:32:53 -0000 2.89 --- stropmodule.c 2 Aug 2002 02:27:13 -0000 2.90 *************** *** 1204,1208 **** ! DL_EXPORT(void) initstrop(void) { --- 1204,1208 ---- ! PyMODINIT_FUNC initstrop(void) { Index: structmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** structmodule.c 13 Jun 2002 20:32:53 -0000 2.55 --- structmodule.c 2 Aug 2002 02:27:13 -0000 2.56 *************** *** 1500,1504 **** /* Module initialization */ ! DL_EXPORT(void) initstruct(void) { --- 1500,1504 ---- /* Module initialization */ ! PyMODINIT_FUNC initstruct(void) { Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** symtablemodule.c 6 Dec 2001 14:34:58 -0000 1.5 --- symtablemodule.c 2 Aug 2002 02:27:13 -0000 1.6 *************** *** 44,48 **** }; ! DL_EXPORT(void) init_symtable(void) { --- 44,48 ---- }; ! PyMODINIT_FUNC init_symtable(void) { Index: syslogmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/syslogmodule.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** syslogmodule.c 1 Apr 2002 14:53:37 -0000 2.18 --- syslogmodule.c 2 Aug 2002 02:27:13 -0000 2.19 *************** *** 156,160 **** /* Initialization function for the module */ ! DL_EXPORT(void) initsyslog(void) { --- 156,160 ---- /* Initialization function for the module */ ! PyMODINIT_FUNC initsyslog(void) { Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** termios.c 13 Jun 2002 20:32:53 -0000 2.35 --- termios.c 2 Aug 2002 02:27:13 -0000 2.36 *************** *** 893,897 **** ! DL_EXPORT(void) PyInit_termios(void) { --- 893,897 ---- ! PyMODINIT_FUNC PyInit_termios(void) { Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** threadmodule.c 17 Jul 2002 16:30:37 -0000 2.51 --- threadmodule.c 2 Aug 2002 02:27:13 -0000 2.52 *************** *** 361,365 **** will block until another thread unlocks it. Deadlocks may ensue."); ! DL_EXPORT(void) initthread(void) { --- 361,365 ---- will block until another thread unlocks it. Deadlocks may ensue."); ! PyMODINIT_FUNC initthread(void) { Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -d -r2.130 -r2.131 *** timemodule.c 19 Jul 2002 17:06:47 -0000 2.130 --- timemodule.c 2 Aug 2002 02:27:13 -0000 2.131 *************** *** 621,625 **** ! DL_EXPORT(void) inittime(void) { --- 621,625 ---- ! PyMODINIT_FUNC inittime(void) { Index: timingmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timingmodule.c,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** timingmodule.c 31 Mar 2002 14:57:24 -0000 2.10 --- timingmodule.c 2 Aug 2002 02:27:13 -0000 2.11 *************** *** 53,57 **** ! DL_EXPORT(void) inittiming(void) { (void)Py_InitModule("timing", timing_methods); --- 53,57 ---- ! PyMODINIT_FUNC inittiming(void) { (void)Py_InitModule("timing", timing_methods); Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** xreadlinesmodule.c 17 Jul 2002 16:30:37 -0000 1.11 --- xreadlinesmodule.c 2 Aug 2002 02:27:13 -0000 1.12 *************** *** 169,173 **** }; ! DL_EXPORT(void) initxreadlines(void) { --- 169,173 ---- }; ! PyMODINIT_FUNC initxreadlines(void) { Index: xxmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** xxmodule.c 17 Jul 2002 16:49:03 -0000 2.30 --- xxmodule.c 2 Aug 2002 02:27:13 -0000 2.31 *************** *** 219,223 **** /* Initialization function for the module (*must* be called initxx) */ ! DL_EXPORT(void) initxx(void) { --- 219,223 ---- /* Initialization function for the module (*must* be called initxx) */ ! PyMODINIT_FUNC initxx(void) { Index: xxsubtype.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxsubtype.c,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** xxsubtype.c 17 Jul 2002 16:30:37 -0000 2.16 --- xxsubtype.c 2 Aug 2002 02:27:13 -0000 2.17 *************** *** 264,268 **** }; ! DL_EXPORT(void) initxxsubtype(void) { --- 264,268 ---- }; ! PyMODINIT_FUNC initxxsubtype(void) { Index: _codecsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_codecsmodule.c,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -d -r2.12 -r2.13 *** _codecsmodule.c 30 Jun 2002 15:26:09 -0000 2.12 --- _codecsmodule.c 2 Aug 2002 02:27:13 -0000 2.13 *************** *** 704,708 **** }; ! DL_EXPORT(void) init_codecs(void) { --- 704,708 ---- }; ! PyMODINIT_FUNC init_codecs(void) { Index: _cursesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** _cursesmodule.c 30 Jan 2002 15:39:28 -0000 2.65 --- _cursesmodule.c 2 Aug 2002 02:27:13 -0000 2.66 *************** *** 2475,2479 **** /* Initialization function for the module */ ! DL_EXPORT(void) init_curses(void) { --- 2475,2479 ---- /* Initialization function for the module */ ! PyMODINIT_FUNC init_curses(void) { Index: _curses_panel.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_curses_panel.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _curses_panel.c 31 Mar 2002 14:55:17 -0000 1.12 --- _curses_panel.c 2 Aug 2002 02:27:13 -0000 1.13 *************** *** 446,450 **** /* Initialization function for the module */ ! DL_EXPORT(void) init_curses_panel(void) { --- 446,450 ---- /* Initialization function for the module */ ! PyMODINIT_FUNC init_curses_panel(void) { Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** _localemodule.c 14 Jul 2002 22:14:18 -0000 2.34 --- _localemodule.c 2 Aug 2002 02:27:13 -0000 2.35 *************** *** 650,654 **** }; ! DL_EXPORT(void) init_locale(void) { --- 650,654 ---- }; ! PyMODINIT_FUNC init_locale(void) { Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _ssl.c 28 Jul 2002 09:57:45 -0000 1.7 --- _ssl.c 2 Aug 2002 02:27:13 -0000 1.8 *************** *** 474,478 **** for documentation."); ! DL_EXPORT(void) init_ssl(void) { --- 474,478 ---- for documentation."); ! PyMODINIT_FUNC init_ssl(void) { Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _weakref.c 13 Jun 2002 20:32:47 -0000 1.16 --- _weakref.c 2 Aug 2002 02:27:13 -0000 1.17 *************** *** 110,114 **** ! DL_EXPORT(void) init_weakref(void) { --- 110,114 ---- ! PyMODINIT_FUNC init_weakref(void) { From tim.one@comcast.net Fri Aug 2 05:31:34 2002 From: tim.one@comcast.net (Tim Peters) Date: Fri, 02 Aug 2002 00:31:34 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,NONE,1.1 In-Reply-To: Message-ID: [Andrew MacIntyre, on the test_longexp + test_sort slowdown mystery] > Hmmm, perhaps this was the sort of dragon you had in mind when you > suggested I persist with PyMalloc'ing the parser on top of your > overallocation strategy? It is, but turns out it was a different dragon (a semantically invisible but pragmatically deadly glitch in PyFrame_New()). > It'd be worth a test with either my experimental or "final" patch(es)? Although I didn't mention it, system malloc/free were pretty much ruled out early because the slowdown persisted in a debug build (pymalloc takes over the PyMem_xyz API too in the debug build, but not in the release build). > Its mind boggling how many small mallocs in PyNode_AddChild() > test_longexp generates (853016 total PyNode_AddChild() requests > according to my logging harness, all bar 92(!) of which are for the > n=1 case). For a truly mind boggling experience, try writing down the source code it's compiling on a sheet of paper (OK, mayber a ream ), and compile it by hand. I expect this kind of node abuse to find relief as Jeremy moves the compiler toward a more abstract syntax tree; right now we've got a tree as concrete as they get. For each of the int literals in the test_longexp generated list, we dutifully record the whole path thru the grammar: test -> and_test -> not_test -> comparison -> expr -> xor_expr -> and_expr -> shift_expr -> arith_expr -> term -> factor -> power -> atom -> NUMBER That's 13 1-child nodes per "2", and there are REPS=65580 instances of this. Multiply to get 852540, 99.94% of the total you counted. An abstract syntax tree can think of a "2" as being more a number than an exercise in linear linked lists . From tim_one@users.sourceforge.net Fri Aug 2 06:46:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 01 Aug 2002 22:46:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test sortperf.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28185/python/Lib/test Modified Files: sortperf.py Log Message: New test %sort. This takes a sorted list, picks 1% of the list positions at random, and replaces the elements at those positions with new random values. I was pleasantly surprised by how fast this goes! It's hard to conceive of an algorithm that could special-case for this effectively. Plus it's exactly what happens if a burst of gamma rays corrupts your sorted database on disk . i 2**i *sort ... %sort 15 32768 0.18 ... 0.03 16 65536 0.24 ... 0.04 17 131072 0.53 ... 0.08 18 262144 1.17 ... 0.16 19 524288 2.56 ... 0.35 20 1048576 5.54 ... 0.77 Index: sortperf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/sortperf.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sortperf.py 21 Jul 2002 17:37:03 -0000 1.10 --- sortperf.py 2 Aug 2002 05:46:09 -0000 1.11 *************** *** 77,80 **** --- 77,81 ---- 3sort: ascending, then 3 random exchanges +sort: ascending, then 10 random at the end + %sort: ascending, then randomly replace 1% of the elements w/ random values ~sort: many duplicates =sort: all equal *************** *** 82,86 **** """ ! cases = tuple([ch + "sort" for ch in r"*\/3+~=!"]) fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) --- 83,87 ---- """ ! cases = tuple([ch + "sort" for ch in r"*\/3+%~=!"]) fmt = ("%2s %7s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) *************** *** 106,109 **** --- 107,115 ---- L[-10:] = [random.random() for dummy in range(10)] doit(L) # +sort + + # Replace 1% of the elements at random. + for dummy in xrange(n // 100): + L[random.randrange(n)] = random.random() + doit(L) # %sort # Arrange for lots of duplicates. From jackjansen@users.sourceforge.net Fri Aug 2 12:03:24 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 04:03:24 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib EasyDialogs.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6827 Modified Files: EasyDialogs.py Log Message: Slightly better error message in case of missing resources. Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/EasyDialogs.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** EasyDialogs.py 26 Jun 2002 15:14:48 -0000 1.37 --- EasyDialogs.py 2 Aug 2002 11:03:19 -0000 1.38 *************** *** 51,55 **** d = GetNewDialog(id, -1) if not d: ! print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(2) --- 51,55 ---- d = GetNewDialog(id, -1) if not d: ! print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" return h = d.GetDialogItemAsControl(2) *************** *** 82,86 **** d = GetNewDialog(id, -1) if not d: ! print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) --- 82,86 ---- d = GetNewDialog(id, -1) if not d: ! print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" return h = d.GetDialogItemAsControl(3) *************** *** 122,126 **** d = GetNewDialog(id, -1) if not d: ! print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) --- 122,126 ---- d = GetNewDialog(id, -1) if not d: ! print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" return h = d.GetDialogItemAsControl(3) *************** *** 164,168 **** d = GetNewDialog(id, -1) if not d: ! print "Can't get DLOG resource with id =", id return # Button assignments: --- 164,168 ---- d = GetNewDialog(id, -1) if not d: ! print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" return # Button assignments: *************** *** 394,398 **** d = GetNewDialog(id, -1) if not d: ! print "Can't get DLOG resource with id =", id return # h = d.GetDialogItemAsControl(3) --- 394,398 ---- d = GetNewDialog(id, -1) if not d: ! print "EasyDialogs: Can't get DLOG resource with id =", id, " (missing resource file?)" return # h = d.GetDialogItemAsControl(3) From jackjansen@users.sourceforge.net Fri Aug 2 12:12:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 04:12:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib argvemulator.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8418 Added Files: argvemulator.py Log Message: Construct a sys.argv from the initial AppleEvent sent by the finder during startup of a program. This module will replace the C code in macgetargv.c so we can get rid of the special macmain.c for OSX Python.app. --- NEW FILE: argvemulator.py --- """argvemulator - create sys.argv from OSA events. Used by applets that want unix-style arguments. """ import sys import traceback from Carbon import AE from Carbon.AppleEvents import * from Carbon import Evt from Carbon.Events import * import aetools class ArgvCollector: """A minimal FrameWork.Application-like class""" def __init__(self): self.quitting = 0 self.ae_handlers = {} self.installaehandler('aevt', 'oapp', self.open_app) self.installaehandler('aevt', 'open', self.open_file) def installaehandler(self, classe, type, callback): AE.AEInstallEventHandler(classe, type, self.callback_wrapper) self.ae_handlers[(classe, type)] = callback def close(self): for classe, type in self.ae_handlers.keys(): AE.AERemoveEventHandler(classe, type) def mainloop(self, mask = highLevelEventMask, timeout = 1*60): stoptime = Evt.TickCount() + timeout while not self.quitting and Evt.TickCount() < stoptime: self.dooneevent(mask, timeout) self.close() def _quit(self): self.quitting = 1 def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): got, event = Evt.WaitNextEvent(mask, timeout) if got: self.lowlevelhandler(event) def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: try: AE.AEProcessAppleEvent(event) except AE.Error, err: msg = "High Level Event: %s %s" % \ (`hex(message)`, `hex(h | (v<<16))`) print 'AE error: ', err print 'in', msg traceback.print_exc() return else: print "Unhandled event:", event def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _function = self.ae_handlers[(_class, '****')] elif self.ae_handlers.has_key(('****', '****')): _function = self.ae_handlers[('****', '****')] else: raise 'Cannot happen: AE callback without handler', (_class, _type) # XXXX Do key-to-name mapping here _parameters['_attributes'] = _attributes _parameters['_class'] = _class _parameters['_type'] = _type if _parameters.has_key('----'): _object = _parameters['----'] del _parameters['----'] # The try/except that used to be here can mask programmer errors. # Let the program crash, the programmer can always add a **args # to the formal parameter list. rv = apply(_function, (_object,), _parameters) else: #Same try/except comment as above rv = apply(_function, (), _parameters) if rv == None: aetools.packevent(_reply, {}) else: aetools.packevent(_reply, {'----':rv}) def open_app(self, **args): self._quit() def open_file(self, _object=None, **args): for alias in _object: fss = alias.Resolve()[0] pathname = fss.as_pathname() sys.argv.append(pathname) self._quit() def other(self, _object=None, _class=None, _type=None, **args): print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ArgvCollector().mainloop() print "sys.argv=", sys.argv From jackjansen@users.sourceforge.net Fri Aug 2 12:24:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 04:24:14 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12041 Modified Files: Makefile.pre.in Log Message: Replaced python.app target with osxapps (it builds more than one .app nowadays) and fixed it to work. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** Makefile.pre.in 1 Aug 2002 21:57:49 -0000 1.91 --- Makefile.pre.in 2 Aug 2002 11:24:11 -0000 1.92 *************** *** 797,803 **** # Build Python executable that can run GUI code. Another MacOSX pseudo # target. ! python.app: ! $(MAKE) -f $(srcdir)/Mac/OSX/Makefile install installmacsubtree \ ! PYTHONSRCDIR=$(srcdir) PYTHONBUILDDIR=. # Build the toplevel Makefile --- 797,803 ---- # Build Python executable that can run GUI code. Another MacOSX pseudo # target. ! osxapps: ! $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree install_all \ ! srcdir=$(srcdir) builddir=. # Build the toplevel Makefile From jackjansen@users.sourceforge.net Fri Aug 2 13:56:23 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 05:56:23 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib argvemulator.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11849 Modified Files: argvemulator.py Log Message: - Remove -psn-xxxx argument added by the Finder. - "Open Document" appleevent is "odoc", not "open". Index: argvemulator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/argvemulator.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** argvemulator.py 2 Aug 2002 11:12:15 -0000 1.1 --- argvemulator.py 2 Aug 2002 12:56:21 -0000 1.2 *************** *** 18,23 **** self.quitting = 0 self.ae_handlers = {} self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'open', self.open_file) def installaehandler(self, classe, type, callback): --- 18,26 ---- self.quitting = 0 self.ae_handlers = {} + # Remove the funny -psn_xxx_xxx argument + if sys.argv[0][:4] == '-psn': + del sys.argv[0] self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'odoc', self.open_file) def installaehandler(self, classe, type, callback): From bwarsaw@users.sourceforge.net Fri Aug 2 14:46:14 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 02 Aug 2002 06:46:14 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.204,1.205 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv22973 Modified Files: pep-0000.txt Log Message: Some PEP classification updates suggested by David Goodger. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -d -r1.204 -r1.205 *** pep-0000.txt 1 Aug 2002 22:32:33 -0000 1.204 --- pep-0000.txt 2 Aug 2002 13:46:12 -0000 1.205 *************** *** 49,52 **** --- 49,53 ---- IF 248 Python Database API Specification v1.0 Lemburg IF 249 Python Database API Specification v2.0 Lemburg + I 257 Docstring Conventions Goodger, van Rossum IF 272 API for Block Encryption Algorithms v1.0 Kuchling I 290 Code Migration and Modernization Hettinger *************** *** 74,78 **** S 254 Making Classes Look More Like Types van Rossum S 256 Docstring Processing System Framework Goodger - S 257 Docstring Conventions Goodger, van Rossum S 258 Docutils Design Specification Goodger S 262 Database of Installed Python Packages Kuchling --- 75,78 ---- *************** *** 96,100 **** S 284 Integer for-loops Eppstein, Ewing S 286 Enhanced Argument Tuples von Loewis ! S 287 reStructuredText Docstring Format Goodger I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw --- 96,100 ---- S 284 Integer for-loops Eppstein, Ewing S 286 Enhanced Argument Tuples von Loewis ! I 287 reStructuredText Docstring Format Goodger I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw *************** *** 246,250 **** SF 255 Simple Generators Schemenauer, et al S 256 Docstring Processing System Framework Goodger ! S 257 Docstring Conventions Goodger, van Rossum S 258 Docutils Design Specification Goodger SR 259 Omit printing newline after newline van Rossum --- 246,250 ---- SF 255 Simple Generators Schemenauer, et al S 256 Docstring Processing System Framework Goodger ! I 257 Docstring Conventions Goodger, van Rossum S 258 Docutils Design Specification Goodger SR 259 Omit printing newline after newline van Rossum *************** *** 276,280 **** SF 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis ! S 287 reStructuredText Docstring Format Goodger SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger --- 276,280 ---- SF 285 Adding a bool type van Rossum S 286 Enhanced Argument Tuples von Loewis ! I 287 reStructuredText Docstring Format Goodger SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger From jackjansen@users.sourceforge.net Fri Aug 2 15:04:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:04:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib buildtools.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3006 Modified Files: buildtools.py Log Message: - Slightly better error message in case of syntax errors in the script. - The applet .rsrc file should be called python.rsrc, it is not based on the applet name. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** buildtools.py 20 Jun 2002 20:42:07 -0000 1.13 --- buildtools.py 2 Aug 2002 14:04:15 -0000 1.14 *************** *** 84,89 **** try: code = compile(text, filename, "exec") ! except (SyntaxError, EOFError): ! raise BuildError, "Syntax error in script %s" % `filename` # Set the destination file name. Note that basename --- 84,91 ---- try: code = compile(text, filename, "exec") ! except SyntaxError, arg: ! raise BuildError, "Syntax error in script %s: %s" % (filename, arg) ! except EOFError: ! raise BuildError, "End-of-file in script %s" % (filename,) # Set the destination file name. Note that basename *************** *** 342,346 **** progress.label("Copy resources...") progress.set(20) ! resfilename = '%s.rsrc' % shortname try: output = Res.FSOpenResourceFile( --- 344,348 ---- progress.label("Copy resources...") progress.set(20) ! resfilename = 'python.rsrc' # XXXX later: '%s.rsrc' % shortname try: output = Res.FSOpenResourceFile( From jackjansen@users.sourceforge.net Fri Aug 2 15:04:44 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:04:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib MiniAEFrame.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3539 Modified Files: MiniAEFrame.py Log Message: Got rid of a couple of OS9-isms. Index: MiniAEFrame.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/MiniAEFrame.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MiniAEFrame.py 25 Aug 2001 12:06:56 -0000 1.2 --- MiniAEFrame.py 2 Aug 2002 14:04:42 -0000 1.3 *************** *** 83,87 **** raise KeyboardInterrupt, "Command-period" if c == 'q': ! MacOS.OutputSeen() self.quitting = 1 return --- 83,88 ---- raise KeyboardInterrupt, "Command-period" if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() self.quitting = 1 return *************** *** 99,108 **** Menu.OpenDeskAcc(name) elif id == self.quitid and item == 1: ! MacOS.OutputSeen() self.quitting = 1 Menu.HiliteMenu(0) return # Anything not handled is passed to Python/SIOUX ! MacOS.HandleEvent(event) def getabouttext(self): --- 100,113 ---- Menu.OpenDeskAcc(name) elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() self.quitting = 1 Menu.HiliteMenu(0) return # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event def getabouttext(self): From jackjansen@users.sourceforge.net Fri Aug 2 15:11:25 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:11:25 -0700 Subject: [Python-checkins] python/dist/src/Include pymactoolbox.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv4439/Include Modified Files: pymactoolbox.h Log Message: Added one call to Py_Main(), for OSX framework builds only, that will get the actual script to run in case we are running from an applet. If we are indeed running an applet we skip the normal option processing leaving it all to the applet code. This allows us to get use the normal python binary in the Python.app bundle, giving us all the normal command line options through PythonLauncher while still allowing Python.app to be used as the template for building applets. Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used on OSX anymore. Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymactoolbox.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pymactoolbox.h 5 Nov 2001 14:39:22 -0000 1.4 --- pymactoolbox.h 2 Aug 2002 14:11:22 -0000 1.5 *************** *** 35,39 **** PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert fsspec->path */ ! /* ** These conversion routines are defined in mactoolboxglue.c itself. --- 35,41 ---- PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert fsspec->path */ ! #ifdef WITH_NEXT_FRAMEWORK ! extern char *PyMac_GetAppletScriptFile(void); /* Return applet script file or NULL */ ! #endif /* ** These conversion routines are defined in mactoolboxglue.c itself. From jackjansen@users.sourceforge.net Fri Aug 2 15:11:25 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:11:25 -0700 Subject: [Python-checkins] python/dist/src/Modules main.c,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv4439/Modules Modified Files: main.c Log Message: Added one call to Py_Main(), for OSX framework builds only, that will get the actual script to run in case we are running from an applet. If we are indeed running an applet we skip the normal option processing leaving it all to the applet code. This allows us to get use the normal python binary in the Python.app bundle, giving us all the normal command line options through PythonLauncher while still allowing Python.app to be used as the template for building applets. Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used on OSX anymore. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** main.c 2 Aug 2002 02:27:13 -0000 1.67 --- main.c 2 Aug 2002 14:11:23 -0000 1.68 *************** *** 136,139 **** --- 136,155 ---- PySys_ResetWarnOptions(); + #if defined(WITH_NEXT_FRAMEWORK) + /* If we are running from a framework it could be that we are actually + ** the main program for an applet. If so, the next call will return the + ** filename that we are supposed to run. + */ + filename = PyMac_GetAppletScriptFile(); + if (filename != NULL) { + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "%s: can't open file '%s'\n", + argv[0], filename); + exit(2); + } + } + /* Skip option-processing if we are an applet */ + if (filename == NULL) + #endif while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { if (c == 'c') { *************** *** 262,266 **** unbuffered = 1; ! if (command == NULL && _PyOS_optind < argc && strcmp(argv[_PyOS_optind], "-") != 0) { --- 278,282 ---- unbuffered = 1; ! if (command == NULL && filename == NULL && _PyOS_optind < argc && strcmp(argv[_PyOS_optind], "-") != 0) { From jackjansen@users.sourceforge.net Fri Aug 2 15:11:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:11:26 -0700 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv4439/Python Modified Files: mactoolboxglue.c Log Message: Added one call to Py_Main(), for OSX framework builds only, that will get the actual script to run in case we are running from an applet. If we are indeed running an applet we skip the normal option processing leaving it all to the applet code. This allows us to get use the normal python binary in the Python.app bundle, giving us all the normal command line options through PythonLauncher while still allowing Python.app to be used as the template for building applets. Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used on OSX anymore. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mactoolboxglue.c 4 Dec 2001 01:11:32 -0000 1.9 --- mactoolboxglue.c 2 Aug 2002 14:11:23 -0000 1.10 *************** *** 176,179 **** --- 176,267 ---- #endif /* TARGET_API_MAC_OSX */ + + #ifdef WITH_NEXT_FRAMEWORK + /* + ** In a bundle, find a file "resourceName" of type "resourceType". Return the + ** full pathname in "resourceURLCstr". + */ + static int + locateResourcePy(CFStringRef resourceType, CFStringRef resourceName, char *resourceURLCStr, int length) + { + CFBundleRef mainBundle = NULL; + CFURLRef URL, absoluteURL; + CFStringRef filenameString, filepathString; + CFIndex size, i; + CFArrayRef arrayRef = NULL; + int success = 0; + + #if TARGET_API_MAC_OSX + CFURLPathStyle thePathStyle = kCFURLPOSIXPathStyle; + #else + CFURLPathStyle thePathStyle = kCFURLHFSPathStyle; + #endif + + /* Get a reference to our main bundle */ + mainBundle = CFBundleGetMainBundle(); + + /* If we are running inside a bundle, look through it. Otherwise, do nothing. */ + if (mainBundle) { + + /* Look for py files in the main bundle by type */ + arrayRef = CFBundleCopyResourceURLsOfType( mainBundle, + resourceType, + NULL ); + + /* See if there are any filename matches */ + size = CFArrayGetCount(arrayRef); + for (i = 0; i < size; i++) { + URL = CFArrayGetValueAtIndex(arrayRef, i); + filenameString = CFURLCopyLastPathComponent(URL); + if (CFStringCompare(filenameString, resourceName, 0) == kCFCompareEqualTo) { + /* We found a match, get the file's full path */ + absoluteURL = CFURLCopyAbsoluteURL(URL); + filepathString = CFURLCopyFileSystemPath(absoluteURL, thePathStyle); + CFRelease(absoluteURL); + + /* Copy the full path into the caller's character buffer */ + success = CFStringGetCString(filepathString, resourceURLCStr, length, + kCFStringEncodingMacRoman); + + CFRelease(filepathString); + } + CFRelease(filenameString); + } + CFRelease(arrayRef); + } + return success; + } + + /* + ** iff we are running in a .app framework then we could be + ** the main program for an applet. In that case, return the + ** script filename for the applet. + ** Otherwise return NULL. + */ + char * + PyMac_GetAppletScriptFile(void) + { + static char scriptpath[1024]; + + /* First we see whether we have __rawmain__.py and run that if it + ** is there. This is used for applets that want sys.argv to be + ** unix-like: __rawmain__ will construct it (from the initial appleevent) + ** and then call __main__.py. + */ + if (locateResourcePy(CFSTR("py"), CFSTR("__rawmain__.py"), scriptpath, 1024)) { + return scriptpath; + } else if (locateResourcePy(CFSTR("pyc"), CFSTR("__rawmain__.pyc"), scriptpath, 1024)) { + return scriptpath; + } else if (locateResourcePy(CFSTR("py"), CFSTR("__main__.py"), scriptpath, 1024)) { + return scriptpath; + } else if (locateResourcePy(CFSTR("pyc"), CFSTR("__main__.pyc"), scriptpath, 1024)) { + return scriptpath; + } + return NULL; + } + + #endif + + /* Convert a 4-char string object argument to an OSType value */ int From jackjansen@users.sourceforge.net Fri Aug 2 15:11:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:11:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.15,1.16 README,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv4439/Mac/OSX Modified Files: Makefile README Log Message: Added one call to Py_Main(), for OSX framework builds only, that will get the actual script to run in case we are running from an applet. If we are indeed running an applet we skip the normal option processing leaving it all to the applet code. This allows us to get use the normal python binary in the Python.app bundle, giving us all the normal command line options through PythonLauncher while still allowing Python.app to be used as the template for building applets. Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used on OSX anymore. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Makefile 1 Aug 2002 21:14:06 -0000 1.15 --- Makefile 2 Aug 2002 14:11:24 -0000 1.16 *************** *** 38,44 **** DEREZ=/Developer/Tools/DeRez - OBJECTS=$(builddir)/Mac/Python/macmain.o \ - $(builddir)/Mac/Python/macgetargv.o - PYTHON=$(builddir)/python.exe APPTEMPLATE=$(srcdir)/Mac/OSXResources/app --- 38,41 ---- *************** *** 54,58 **** pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install ! install_Python: pythonforbundle @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ if test ! -d $$i; then \ --- 51,55 ---- pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install ! install_Python: $(PYTHON) @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ if test ! -d $$i; then \ *************** *** 92,96 **** done; \ done ! $(INSTALL_PROGRAM) $(STRIPFLAG) pythonforbundle $(APPINSTALLDIR)/Contents/MacOS/python # Create a temporary version of the resources here $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc --- 89,93 ---- done; \ done ! $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python # Create a temporary version of the resources here $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc *************** *** 232,244 **** echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \ echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth - - pythonforbundle: $(OBJECTS) - $(LD) $(LDFLAGS) $(OBJECTS) -o pythonforbundle - - # Rules to build each file in OBJECTS - is there a better way? - $(builddir)/Mac/Python/macmain.o: $(srcdir)/Mac/Python/macmain.c - $(CC) $(CFLAGS) -c $(srcdir)/Mac/Python/macmain.c -o $@ - - $(builddir)/Mac/Python/macgetargv.o: $(srcdir)/Mac/Python/macgetargv.c - $(CC) $(CFLAGS) -c $(srcdir)/Mac/Python/macgetargv.c -o $@ - --- 229,230 ---- Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README 9 Dec 2001 23:17:38 -0000 1.3 --- README 2 Aug 2002 14:11:24 -0000 1.4 *************** *** 1,34 **** ! This directory contains a Makefile that will create a proof-of-concept ! Mac OS X application for Python. The process is far from streamlined, ! and it will definitely change in future releases of Python, but I wanted to ! include this in the current distribution so people could play with it. ! ! To create a fullblown Python.app proceed as follows. ! 1. In the main Python source directory configure python with ! configure --enable-framework ! 2. Do a "make clean" if you did a previous build, then "make". ! 3. Install this as a framework with "make frameworkinstall". This puts a Python ! framework into /Library/Frameworks. ! 4. Come back here (Mac/OSX) and build and install the application, ! with "make install". ! 5. It is probably a good idea to add the Mac-specific modules to the framework, ! with "make installmacsubtree". This puts a MacPython lib directory into ! sys.prefix/Mac/Lib. Again, this is a temporary measure. ! 6. To actually find the Lib directory installed in step 5 you add a line ! to your site.py file (the one in /Library/Frameworks/....): ! sys.path.append(os.path.join(sys.prefix, 'Mac/Lib')) ! You are now done. In your Applications you should have a "Python", with the icon ! being a falling 16 Ton weight with a shadow under it. You can drop Python scripts ! on this and the will be run, in a full-windowing environment. Note that you ! do not get sys.stdin, and that sys.stdout goes to the console (Use ! Applications/Utilities/Console to see it). - For some reason the application only accepts files with TEXT type, not straight unix - typeless files. Something to take note of is that the ".rsrc" files in the distribution are not actually resource files, they're AppleSingle encoded resource files. ! Jack Jansen, jack@oratrix.com, 11-Sep-01. \ No newline at end of file --- 1,29 ---- ! 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. 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 ! in the sequence ! 1. configure --enable-framework ! 2. make ! 3. make frameworkinstall ! 4. make osxapps ! The interesting targets in the makefile are: ! installmacsubtree - explained above, ! dontinstallmacsubtree - Put only a .pth file into the framework (pointing to this ! sourcetree), which may be easier for development, ! install_all - install all three .app applications, ! install_Python - install the hidden interpreter .app into the framework, ! install_PythonLauncher - install the user-visible script launch helper ! install_IDE - install the IDE ! installunixprograms - install symlinks/scripts mimicking normal unix Python into ! /usr/local. Something to take note of is that the ".rsrc" files in the distribution are not actually resource files, they're AppleSingle encoded resource files. ! Jack Jansen, jack@oratrix.com, 02-Aug-02 \ No newline at end of file From mwh@users.sourceforge.net Fri Aug 2 14:55:53 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 02 Aug 2002 06:55:53 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.99,1.100 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv29336 Modified Files: setup.py Log Message: Fix for [ 589427 ] standard include paths on command line Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** setup.py 8 Jul 2002 21:39:36 -0000 1.99 --- setup.py 2 Aug 2002 13:55:50 -0000 1.100 *************** *** 231,238 **** add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') ! add_dir_to_list(self.compiler.library_dirs, ! sysconfig.get_config_var("LIBDIR")) ! add_dir_to_list(self.compiler.include_dirs, ! sysconfig.get_config_var("INCLUDEDIR")) try: --- 231,239 ---- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') ! if os.path.normpath(sys.prefix) != '/usr': ! add_dir_to_list(self.compiler.library_dirs, ! sysconfig.get_config_var("LIBDIR")) ! add_dir_to_list(self.compiler.include_dirs, ! sysconfig.get_config_var("INCLUDEDIR")) try: From guido@python.org Fri Aug 2 15:36:54 2002 From: guido@python.org (Guido van Rossum) Date: Fri, 02 Aug 2002 10:36:54 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,NONE,1.1 In-Reply-To: Your message of "Fri, 02 Aug 2002 00:31:34 EDT." References: Message-ID: <200208021436.g72Eata29781@pcp02138704pcs.reston01.va.comcast.net> > For a truly mind boggling experience, try writing down the source > code it's compiling on a sheet of paper (OK, mayber a ream ), > and compile it by hand. I expect this kind of node abuse to find > relief as Jeremy moves the compiler toward a more abstract syntax > tree; right now we've got a tree as concrete as they get. Hah! Jeremy's compiler uses the existing parser, so the concrete parse tree is still built, before the compiler reduces it to something simpler. I'm not aware of plans to replace the parser yet, although I agree that it should be done eventually. --Guido van Rossum (home page: http://www.python.org/~guido/) From jeremy@alum.mit.edu Fri Aug 2 15:42:35 2002 From: jeremy@alum.mit.edu (Jeremy Hylton) Date: Fri, 2 Aug 2002 10:42:35 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,NONE,1.1 In-Reply-To: <200208021436.g72Eata29781@pcp02138704pcs.reston01.va.comcast.net> References: <200208021436.g72Eata29781@pcp02138704pcs.reston01.va.comcast.net> Message-ID: <15690.39515.321238.169538@slothrop.zope.com> >>>>> "GvR" == Guido van Rossum writes: >> For a truly mind boggling experience, try writing down the source >> code it's compiling on a sheet of paper (OK, mayber a ream >> ), and compile it by hand. I expect this kind of node >> abuse to find relief as Jeremy moves the compiler toward a more >> abstract syntax tree; right now we've got a tree as concrete as >> they get. GvR> Hah! Jeremy's compiler uses the existing parser, so the GvR> concrete parse tree is still built, before the compiler reduces GvR> it to something simpler. GvR> I'm not aware of plans to replace the parser yet, although I GvR> agree that it should be done eventually. Indeed. One thing at a time :-). Jeremy From jackjansen@users.sourceforge.net Fri Aug 2 15:54:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:54:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib argvemulator.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26055 Modified Files: argvemulator.py Log Message: Oops, the -psn stuff is in argv[1], of course. Index: argvemulator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/argvemulator.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** argvemulator.py 2 Aug 2002 12:56:21 -0000 1.2 --- argvemulator.py 2 Aug 2002 14:54:46 -0000 1.3 *************** *** 19,24 **** self.ae_handlers = {} # Remove the funny -psn_xxx_xxx argument ! if sys.argv[0][:4] == '-psn': ! del sys.argv[0] self.installaehandler('aevt', 'oapp', self.open_app) self.installaehandler('aevt', 'odoc', self.open_file) --- 19,24 ---- self.ae_handlers = {} # Remove the funny -psn_xxx_xxx argument ! if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': ! del sys.argv[1] self.installaehandler('aevt', 'oapp', self.open_app) self.installaehandler('aevt', 'odoc', self.open_file) From jackjansen@users.sourceforge.net Fri Aug 2 15:57:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 07:57:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib appletrawmain.py,NONE,1.1 buildtools.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26419 Modified Files: buildtools.py Added Files: appletrawmain.py Log Message: Final step in making applets first-class citizens: if the applet wants argv emulation (i.e. if the end user drops files and folders on the applets these will show up in sys.argv) BuildApplet will add the required code to the applet bundle, in __rawmain__.pyc. This code is compiled from appletrawmain.py, it creates sys.argv, cleans up most of the mess and executes either __main__.py or __main__.pyc. --- NEW FILE: appletrawmain.py --- # Emulate sys.argv and run __main__.py or __main__.pyc in an environment that # is as close to "normal" as possible. # # This script is put into __rawmain__.pyc for applets that need argv # emulation, by BuildApplet and friends. # import argvemulator import os import sys import marshal # # Create sys.argv # argvemulator.ArgvCollector().mainloop() # # Find the realy main program to run # _dir = os.path.split(sys.argv[0])[0] __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): # # Setup something resembling a normal environment and go. # sys.argv[0] = __file__ del argvemulator, os, sys, _dir execfile(__file__) else: __file__ = os.path.join(_dir, '__main__.pyc') if os.path.exists(__file__): # # If we have only a .pyc file we read the code object from that # sys.argv[0] = __file__ _fp = open(__file__, 'rb') _fp.read(8) __code__ = marshal.load(_fp) # # Again, we create an almost-normal environment (only __code__ is # funny) and go. # del argvemulator, os, sys, marshal, _dir, _fp exec __code__ else: sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0]) sys.exit(1) Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** buildtools.py 2 Aug 2002 14:04:15 -0000 1.14 --- buildtools.py 2 Aug 2002 14:57:43 -0000 1.15 *************** *** 399,402 **** --- 399,412 ---- else: pycname = '__main__.pyc' + # And we also create __rawmain__.pyc + outputfilename = os.path.join(destname, 'Contents', 'Resources', '__rawmain__.pyc') + if progress: + progress.label('Creating __rawmain__.pyc') + progress.inc(0) + rawsourcefile = os.path.join(sys.prefix, 'Mac', 'Lib', 'appletrawmain.py') + rawsource = open(rawsourcefile, 'rU').read() + rawcode = compile(rawsource, rawsourcefile, 'exec') + writepycfile(rawcode, outputfilename) + outputfilename = os.path.join(destname, 'Contents', 'Resources', pycname) if progress: From jackjansen@users.sourceforge.net Fri Aug 2 16:31:27 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 08:31:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib appletrawmain.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7678 Modified Files: appletrawmain.py Log Message: Hmm, in some cases we don't seem to get our scriptname in argv[0]. Cater for that by working from sys.executable. Index: appletrawmain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/appletrawmain.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** appletrawmain.py 2 Aug 2002 14:57:43 -0000 1.1 --- appletrawmain.py 2 Aug 2002 15:31:25 -0000 1.2 *************** *** 11,21 **** # # Create sys.argv # argvemulator.ArgvCollector().mainloop() # ! # Find the realy main program to run # - _dir = os.path.split(sys.argv[0])[0] __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): --- 11,32 ---- # + # Make sure we have an argv[0], and make _dir point to the Resources + # directory. + # + if not sys.argv or sys.argv[0][:1] == '-': + # Insert our (guessed) name. + _dir = os.path.split(sys.executable)[0] # removes "python" + _dir = os.path.split(_dir)[0] # Removes "MacOS" + _dir = os.path.join(_dir, 'Resources') + sys.argv.insert(0, '__rawmain__') + else: + _dir = os.path.split(sys.argv[0])[0] + # # Create sys.argv # argvemulator.ArgvCollector().mainloop() # ! # Find the real main program to run # __file__ = os.path.join(_dir, '__main__.py') if os.path.exists(__file__): From jackjansen@users.sourceforge.net Fri Aug 2 16:32:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 08:32:14 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv8072 Modified Files: Makefile Log Message: Also create BuildApplet. It's useful enough as a standalone application. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Makefile 2 Aug 2002 14:11:24 -0000 1.16 --- Makefile 2 Aug 2002 15:32:12 -0000 1.17 *************** *** 45,49 **** RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py ! install_all: install_PythonLauncher install_Python install_IDE install_PythonLauncher: --- 45,49 ---- RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py ! install_all: install_PythonLauncher install_Python install_IDE install_BuildApplet install_PythonLauncher: *************** *** 102,105 **** --- 102,110 ---- --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py + + install_BuildApplet: $(INSTALLED_PYTHONW) + $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ + --output $(PYTHONAPPSDIR)/BuildApplet.app \ + $(srcdir)/Mac/scripts/BuildApplet.py LIBDEST=$(prefix)/Mac/Lib From montanaro@users.sourceforge.net Fri Aug 2 16:52:33 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 Aug 2002 08:52:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15812 Modified Files: test_socket.py Log Message: testGetServByName shouldn't check for getservbyname - the socket module should always have it. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_socket.py 2 Aug 2002 02:19:46 -0000 1.48 --- test_socket.py 2 Aug 2002 15:52:30 -0000 1.49 *************** *** 260,281 **** def testGetServByName(self): """Testing getservbyname().""" ! if hasattr(socket, 'getservbyname'): ! # try a few protocols - not everyone has telnet enabled ! found = 0 ! for proto in ("telnet", "ssh", "www", "ftp"): ! try: ! socket.getservbyname(proto, 'tcp') ! found = 1 ! break ! except socket.error: ! pass ! try: ! socket.getservbyname(proto, 'udp') ! found = 1 ! break ! except socket.error: ! pass ! if not found: ! raise socket.error def testDefaultTimeout(self): --- 260,280 ---- def testGetServByName(self): """Testing getservbyname().""" ! # try a few protocols - not everyone has telnet enabled ! found = 0 ! for proto in ("telnet", "ssh", "www", "ftp"): ! try: ! socket.getservbyname(proto, 'tcp') ! found = 1 ! break ! except socket.error: ! pass ! try: ! socket.getservbyname(proto, 'udp') ! found = 1 ! break ! except socket.error: ! pass ! if not found: ! raise socket.error def testDefaultTimeout(self): From gvanrossum@users.sourceforge.net Fri Aug 2 17:44:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 09:44:34 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2201 Added Files: heapq.py Log Message: Adding the heap queue algorithm, per discussion in python-dev last week. --- NEW FILE: heapq.py --- """Heap queue algorithm (a.k.a. priority queue). Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. Usage: heap = [] # creates an empty heap heappush(heap, item) # pushes a new item on the heap item = heappop(heap) # pops the smallest item from the heap item = heap[0] # smallest item on the heap without popping it Our API differs from textbook heap algorithms as follows: - We use 0-based indexing. This makes the relationship between the index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses 0-based indexing. - Our heappop() method returns the smallest item, not the largest. These two make it possible to view the heap as a regular Python list without surprises: heap[0] is the smallest item, and heap.sort() maintains the heap invariant! """ __about__ = """Heap queues [explanation by François Pinard] Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. The strange invariant above is meant to be an efficient memory representation for a tournament. The numbers below are `k', not a[k]: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In an usual binary tournament we see in sports, each cell is the winner over the two cells it tops, and we can trace the winner down the tree to see all opponents s/he had. However, in many computer applications of such tournaments, we do not need to trace the history of a winner. To be more memory efficient, when a winner is promoted, we try to replace it by something else at a lower level, and the rule becomes that a cell and the two cells it tops contain three different items, but the top cell "wins" over the two topped cells. If this heap invariant is protected at all time, index 0 is clearly the overall winner. The simplest algorithmic way to remove it and find the "next" winner is to move some loser (let's say cell 30 in the diagram above) into the 0 position, and then percolate this new 0 down the tree, exchanging values, until the invariant is re-established. This is clearly logarithmic on the total number of items in the tree. By iterating over all items, you get an O(n ln n) sort. A nice feature of this sort is that you can efficiently insert new items while the sort is going on, provided that the inserted items are not "better" than the last 0'th element you extracted. This is especially useful in simulation contexts, where the tree holds all incoming events, and the "win" condition means the smallest scheduled time. When an event schedule other events for execution, they are scheduled into the future, so they can easily go into the heap. So, a heap is a good structure for implementing schedulers (this is what I used for my MIDI sequencer :-). Various structures for implementing schedulers have been extensively studied, and heaps are good for this, as they are reasonably speedy, the speed is almost constant, and the worst case is not much different than the average case. However, there are other representations which are more efficient overall, yet the worst cases might be terrible. Heaps are also very useful in big disk sorts. You most probably all know that a big sort implies producing "runs" (which are pre-sorted sequences, which size is usually related to the amount of CPU memory), followed by a merging passes for these runs, which merging is often very cleverly organised[1]. It is very important that the initial sort produces the longest runs possible. Tournaments are a good way to that. If, using all the memory available to hold a tournament, you replace and percolate items that happen to fit the current run, you'll produce runs which are twice the size of the memory for random input, and much better for input fuzzily ordered. Moreover, if you output the 0'th item on disk and get an input which may not fit in the current tournament (because the value "wins" over the last output value), it cannot fit in the heap, so the size of the heap decreases. The freed memory could be cleverly reused immediately for progressively building a second heap, which grows at exactly the same rate the first heap is melting. When the first heap completely vanishes, you switch heaps and start a new run. Clever and quite effective! In a word, heaps are useful memory structures to know. I use them in a few applications, and I think it is good to keep a `heap' module around. :-) -------------------- [1] The disk balancing algorithms which are current, nowadays, are more annoying than clever, and this is a consequence of the seeking capabilities of the disks. On devices which cannot seek, like big tape drives, the story was quite different, and one had to be very clever to ensure (far in advance) that each tape movement will be the most effective possible (that is, will best participate at "progressing" the merge). Some tapes were even able to read backwards, and this was also used to avoid the rewinding time. Believe me, real good tape sorts were quite spectacular to watch! >From all times, sorting has always been a Great Art! :-) """ def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" pos = len(heap) heap.append(None) while pos: parentpos = (pos - 1) / 2 parent = heap[parentpos] if item >= parent: break heap[pos] = parent pos = parentpos heap[pos] = item def heappop(heap): """Pop the smallest item off the heap, maintaining the heap invariant.""" endpos = len(heap) - 1 if endpos <= 0: return heap.pop() returnitem = heap[0] item = heap.pop() pos = 0 while 1: child2pos = (pos + 1) * 2 child1pos = child2pos - 1 if child2pos < endpos: child1 = heap[child1pos] child2 = heap[child2pos] if item <= child1 and item <= child2: break if child1 < child2: heap[pos] = child1 pos = child1pos continue heap[pos] = child2 pos = child2pos continue if child1pos < endpos: child1 = heap[child1pos] if child1 < item: heap[pos] = child1 pos = child1pos break heap[pos] = item return returnitem if __name__ == "__main__": # Simple sanity test heap = [] data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] for item in data: heappush(heap, item) sort = [] while heap: sort.append(heappop(heap)) print sort From gvanrossum@users.sourceforge.net Fri Aug 2 17:50:26 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 09:50:26 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.190,1.191 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv4944 Modified Files: ACKS Log Message: Add Kevin O'Connor, author of the heapq code. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** ACKS 1 Aug 2002 14:39:25 -0000 1.190 --- ACKS 2 Aug 2002 16:50:24 -0000 1.191 *************** *** 347,350 **** --- 347,351 ---- Jeffrey Ollie Nigel O'Brian + Kevin O'Connor Tim O'Malley Denis S. Otkidach From gvanrossum@users.sourceforge.net Fri Aug 2 17:51:00 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 09:51:00 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5201 Modified Files: heapq.py Log Message: Add Kevin O'Connor, author of the heapq code. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** heapq.py 2 Aug 2002 16:44:32 -0000 1.1 --- heapq.py 2 Aug 2002 16:50:58 -0000 1.2 *************** *** 26,29 **** --- 26,31 ---- """ + # Code by Kevin O'Connor + __about__ = """Heap queues From montanaro@users.sourceforge.net Fri Aug 2 18:10:14 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 Aug 2002 10:10:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_whichdb.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12271 Added Files: test_whichdb.py Log Message: regression test for the whichdb module --- NEW FILE: test_whichdb.py --- #! /usr/bin/env python """Test script for the whichdb module based on test_anydbm.py """ import os import test.test_support import unittest import whichdb import anydbm import tempfile import glob _fname = tempfile.mktemp() def _delete_files(): # we don't know the precise name the underlying database uses # so we use glob to locate all names for f in glob.glob(_fname + "*"): try: os.unlink(f) except OSError: pass class WhichDBTestCase(unittest.TestCase): # Actual test methods are added to namespace # after class definition. def __init__(self, *args): unittest.TestCase.__init__(self, *args) def tearDown(self): _delete_files() def setUp(self): _delete_files() for name in anydbm._names: # we define a new test method for each # candidate database module. try: mod = __import__(name) except ImportError: continue def test_whichdb_name(self,name=name,mod=mod): """Check whether whichdb correctly guesses module name for databases opened with module mod. """ f = mod.open(_fname, 'c') f["1"] = "1" f.close() self.assertEqual(name, whichdb.whichdb(_fname)) setattr(WhichDBTestCase,"test_whichdb_%s" % name, test_whichdb_name) def test_main(): try: test.test_support.run_unittest(WhichDBTestCase) finally: _delete_files() if __name__ == "__main__": test_main() From montanaro@users.sourceforge.net Fri Aug 2 18:12:18 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 Aug 2002 10:12:18 -0700 Subject: [Python-checkins] python/dist/src/Lib whichdb.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12999 Modified Files: whichdb.py Log Message: catch the situation where Berkeley DB is used to emulate dbm(3) library functions. In this case, calling dbm.open("foo", "c") actually creates a file named "foo.db". Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** whichdb.py 24 Oct 2001 20:33:34 -0000 1.12 --- whichdb.py 2 Aug 2002 17:12:15 -0000 1.13 *************** *** 2,5 **** --- 2,15 ---- import os + import struct + + try: + import dbm + _dbmerror = dbm.error + except ImportError: + dbm = None + # just some sort of valid exception which might be raised in the + # dbm test + _dbmerror = IOError def whichdb(filename): *************** *** 16,21 **** """ - import struct - # Check for dbm first -- this has a .pag and a .dir file try: --- 26,29 ---- *************** *** 26,30 **** return "dbm" except IOError: ! pass # Check for dumbdbm next -- this has a .dir and and a .dat file --- 34,51 ---- return "dbm" except IOError: ! # some dbm emulations based on Berkeley DB generate a .db file ! # some do not, but they should be caught by the dbhash checks ! try: ! f = open(filename + os.extsep + "db", "rb") ! f.close() ! # guarantee we can actually open the file using dbm ! # kind of overkill, but since we are dealing with emulations ! # it seems like a prudent step ! if dbm is not None: ! d = dbm.open(filename) ! d.close() ! return "dbm" ! except (IOError, _dbmerror): ! pass # Check for dumbdbm next -- this has a .dir and and a .dat file From montanaro@users.sourceforge.net Fri Aug 2 18:13:03 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 Aug 2002 10:13:03 -0700 Subject: [Python-checkins] python/dist/src/Modules dbmmodule.c,2.32,2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13190 Modified Files: dbmmodule.c Log Message: add #include branch for compilation with Berkeley DB Index: dbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dbmmodule.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** dbmmodule.c 2 Aug 2002 02:27:13 -0000 2.32 --- dbmmodule.c 2 Aug 2002 17:13:01 -0000 2.33 *************** *** 22,25 **** --- 22,28 ---- #include static char *which_dbm = "GNU gdbm"; + #elif defined(HAVE_BERKDB_H) + #include + static char *which_dbm = "Berkeley DB"; #else #error "No ndbm.h available!" From montanaro@users.sourceforge.net Fri Aug 2 18:20:48 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 Aug 2002 10:20:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgzip.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15962 Modified Files: libgzip.tex Log Message: indicate that 'b' is added to the mode flag if not given Index: libgzip.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgzip.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libgzip.tex 9 Aug 2001 07:21:56 -0000 1.14 --- libgzip.tex 2 Aug 2002 17:20:46 -0000 1.15 *************** *** 42,47 **** whether the file will be read or written. The default is the mode of \var{fileobj} if discernible; otherwise, the default is \code{'rb'}. ! Be aware that only the \code{'rb'}, \code{'ab'}, and \code{'wb'} ! values should be used for cross-platform portability. The \var{compresslevel} argument is an integer from \code{1} to --- 42,47 ---- whether the file will be read or written. The default is the mode of \var{fileobj} if discernible; otherwise, the default is \code{'rb'}. ! If not given, the 'b' flag will be added to the mode to ensure the ! file is opened in binary mode for cross-platform portability. The \var{compresslevel} argument is an integer from \code{1} to From jhylton@users.sourceforge.net Fri Aug 2 18:53:01 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 02 Aug 2002 10:53:01 -0700 Subject: [Python-checkins] python/dist/src/Python newcompile.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26163/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Extend compiler to handle for and while loops and if statements, including break and continue. Add fblock support -- a block on the frame for loops and try/excepts as opposed to a basic block in the compiler. Add compiler_error() helper to raise SyntaxError. Fix many small bugs and typos to allow compilation without (much) warning. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** newcompile.c 9 Jul 2002 13:24:45 -0000 1.1.2.1 --- newcompile.c 2 Aug 2002 17:52:59 -0000 1.1.2.2 *************** *** 7,10 **** --- 7,24 ---- #include "opcode.h" + /* fblockinfo tracks the current frame block. + + A frame block is used to handle loops, try/except, and try/finally. + It's called a frame block to distinguish it from a basic block in the + compiler IR. + */ + + enum fblocktype { LOOP, EXCEPT, FINALLY_TRY, FINALLY_END }; + + struct fblockinfo { + enum fblocktype fb_type; + int fb_block; + }; + struct compiler { const char *c_filename; *************** *** 22,42 **** struct basicblock c_exit; struct basicblock **c_blocks; }; ! static void ! compiler_free(struct compiler *c) ! { ! int i; ! if (c->c_st) ! PySymtable_Free(c->c_st); ! if (c->c_future) ! PyMem_Free((void *)c->c_future); ! for (i = 0; i < c->c_nblocks; i++) ! free((void *)c->c_blocks[i]); ! if (c->c_blocks) ! free((void *)c->c_blocks); ! } PyCodeObject * --- 36,67 ---- struct basicblock c_exit; struct basicblock **c_blocks; + + int c_nfblocks; + struct fblockinfo c_fblock[CO_MAXBLOCKS]; + + int c_lineno; }; ! static int compiler_enter_scope(struct compiler *, identifier, void *); ! static int compiler_exit_scope(struct compiler *, identifier, void *); ! static void compiler_free(struct compiler *); ! static PyCodeObject *compiler_get_code(struct compiler *); ! static int compiler_new_block(struct compiler *); ! static int compiler_next_instr(struct compiler *, int); ! static int compiler_addop(struct compiler *, int); ! static int compiler_addop_o(struct compiler *, int, PyObject *); ! static int compiler_addop_i(struct compiler *, int, int); ! static void compiler_use_block(struct compiler *, int); ! static int compiler_use_new_block(struct compiler *); ! static int compiler_error(struct compiler *, const char *); ! static int compiler_mod(struct compiler *, mod_ty); ! static int compiler_visit_stmt(struct compiler *, stmt_ty); ! static int compiler_visit_expr(struct compiler *, expr_ty); ! static int compiler_visit_arguments(struct compiler *, arguments_ty); ! static int compiler_visit_slice(struct compiler *, slice_ty); + static int compiler_push_fblock(struct compiler *, enum fblocktype, int); + static void compiler_pop_fblock(struct compiler *, enum fblocktype, int); PyCodeObject * *************** *** 44,48 **** { struct compiler c; - PyCodeObject *co; c.c_filename = filename; --- 69,72 ---- *************** *** 56,60 **** } ! c.c_st = PySymtable_Build(mod, filename, flags); if (c.c_st == NULL) goto error; --- 80,84 ---- } ! c.c_st = PySymtable_Build(mod, filename, c.c_future); if (c.c_st == NULL) goto error; *************** *** 68,71 **** --- 92,111 ---- } + static void + compiler_free(struct compiler *c) + { + int i; + + if (c->c_st) + PySymtable_Free(c->c_st); + if (c->c_future) + PyMem_Free((void *)c->c_future); + for (i = 0; i < c->c_nblocks; i++) + free((void *)c->c_blocks[i]); + if (c->c_blocks) + free((void *)c->c_blocks); + } + + static int compiler_enter_scope(struct compiler *c, identifier name, void *key) *************** *** 84,88 **** } assert(PySymtableEntry_Check(v)); ! c->c_symbols = v; c->c_nblocks = 0; --- 124,128 ---- } assert(PySymtableEntry_Check(v)); ! c->c_symbols = (PySymtableEntryObject *)v; c->c_nblocks = 0; *************** *** 111,114 **** --- 151,158 ---- } + /* Allocate a new block and return its index in c_blocks. + Returns 0 on error. + */ + static int compiler_new_block(struct compiler *c) *************** *** 135,139 **** } ! /* Note: returns -1 on failure */ static int compiler_next_instr(struct compiler *c, int block) --- 179,204 ---- } ! static void ! compiler_use_block(struct compiler *c, int block) ! { ! assert(block < c->c_nblocks); ! c->c_curblock = block; ! } ! ! static int ! compiler_use_new_block(struct compiler *c) ! { ! int block = compiler_new_block(c); ! if (!block) ! return 0; ! c->c_curblock = block; ! return block; ! } ! ! /* Returns the offset of the next instruction in the current block's ! b_instr array. Resizes the b_instr as necessary. ! Returns -1 on failure. ! */ ! static int compiler_next_instr(struct compiler *c, int block) *************** *** 142,146 **** assert(block < c->c_nblocks); b = c->c_blocks[block]; ! if (b->b_ioffset == b->b_ialloc) { void *ptr; int newsize; --- 207,211 ---- assert(block < c->c_nblocks); b = c->c_blocks[block]; ! if (b->b_iused == b->b_ialloc) { void *ptr; int newsize; *************** *** 153,159 **** c->c_blocks[block] = (struct basicblock *)ptr; } ! return b->b_ioffset++; } static int compiler_addop(struct compiler *c, int opcode) --- 218,228 ---- c->c_blocks[block] = (struct basicblock *)ptr; } ! return b->b_iused++; } + /* Add an opcode with no argument. + Returns 0 on failure, 1 on success. + */ + static int compiler_addop(struct compiler *c, int opcode) *************** *** 167,170 **** --- 236,243 ---- } + /* Add an opcode with a PyObject * argument. + Returns 0 on failure, 1 on success. + */ + static int compiler_addop_o(struct compiler *c, int opcode, PyObject *o) *************** *** 175,179 **** if (off < 0) return 0; ! i = c->c_blocks[c->c_curblock]; i->i_opcode = i->i_opcode; i->i_arg = o; --- 248,252 ---- if (off < 0) return 0; ! i = &c->c_blocks[c->c_curblock]->b_instr[off]; i->i_opcode = i->i_opcode; i->i_arg = o; *************** *** 181,184 **** --- 254,261 ---- } + /* Add an opcode with an integer argument. + Returns 0 on failure, 1 on success. + */ + static int compiler_addop_i(struct compiler *c, int opcode, int oparg) *************** *** 189,193 **** if (off < 0) return 0; ! i = c->c_blocks[c->c_curblock]; i->i_opcode = i->i_opcode; i->i_oparg = oparg; --- 266,270 ---- if (off < 0) return 0; ! i = &c->c_blocks[c->c_curblock]->b_instr[off]; i->i_opcode = i->i_opcode; i->i_oparg = oparg; *************** *** 195,201 **** } ! /* VISIT and VISIT_SEQ takes an ASDL type as their second argument. They use ! the ASDL name to synthesize the name of the C type and the visit function. ! */ #define ADDOP(C, OP) { \ --- 272,279 ---- } ! #define NEW_BLOCK(C) { \ ! if (!compiler_use_new_block((C))) \ ! return 0; \ ! } #define ADDOP(C, OP) { \ *************** *** 214,217 **** --- 292,299 ---- } + /* VISIT and VISIT_SEQ takes an ASDL type as their second argument. They use + the ASDL name to synthesize the name of the C type and the visit function. + */ + #define VISIT(C, TYPE, V) {\ if (!compiler_visit_ ## TYPE((C), (V))) \ *************** *** 249,253 **** { PyCodeObject *co; ! assert(s->kind == Function_kind); if (s->v.FunctionDef.args->defaults) --- 331,335 ---- { PyCodeObject *co; ! assert(s->kind == FunctionDef_kind); if (s->v.FunctionDef.args->defaults) *************** *** 274,278 **** dest = false; if (s->v.Print.dest) { ! VISIT(C, EXPR, s->v.Print.dest); dest = true; } --- 356,360 ---- dest = false; if (s->v.Print.dest) { ! VISIT(c, expr, s->v.Print.dest); dest = true; } *************** *** 280,289 **** if (dest) { ADDOP(c, DUP_TOP); ! VISIT(c, expr, asdl_get_seq(s->v.Print.values, i)); ADDOP(c, ROT_TWO); ADDOP(c, PRINT_ITEM_TO); } else { ! VISIT(c, expr, asdl_get_seq(s->v.Print.values, i)); ADDOP(c, PRINT_ITEM); } --- 362,373 ---- if (dest) { ADDOP(c, DUP_TOP); ! VISIT(c, expr, ! (expr_ty)asdl_seq_get(s->v.Print.values, i)); ADDOP(c, ROT_TWO); ADDOP(c, PRINT_ITEM_TO); } else { ! VISIT(c, expr, ! (expr_ty)asdl_seq_get(s->v.Print.values, i)); ADDOP(c, PRINT_ITEM); } *************** *** 291,297 **** if (s->v.Print.nl) { if (dest) ! ADDOP(c, PRINT_NEWLINE_TO); else ! ADDOP(c, PRINT_NEWLINE); } else if (dest) --- 375,381 ---- if (s->v.Print.nl) { if (dest) ! ADDOP(c, PRINT_NEWLINE_TO) else ! ADDOP(c, PRINT_NEWLINE) } else if (dest) *************** *** 301,317 **** static int ! compiler_function(struct compiler *c, stmt_ty s) { ! int i, n; assert(s->kind == If_kind); } static int ! compiler_stmt(struct compiler *c, stmt_ty s) { int i, n; ! switch (s->kind) { case FunctionDef_kind: --- 385,532 ---- static int ! compiler_if(struct compiler *c, stmt_ty s) { ! int end, next, elif = 1; assert(s->kind == If_kind); + end = compiler_new_block(c); + if (!end) + return 0; + while (elif) { + next = compiler_new_block(c); + if (!next) + return 0; + VISIT(c, expr, s->v.If.test); + ADDOP_I(c, JUMP_IF_FALSE, next); + NEW_BLOCK(c); + ADDOP(c, POP_TOP); + VISIT_SEQ(c, stmt, s->v.If.body); + ADDOP_I(c, JUMP_FORWARD, end); + compiler_use_block(c, next); + ADDOP(c, POP_TOP); + if (s->v.If.orelse) { + stmt_ty t = asdl_seq_get(s->v.If.orelse, 0); + if (t->kind == If_kind) { + elif = 1; + s = t; + c->c_lineno = t->lineno; + } + } + if (!elif) + VISIT_SEQ(c, stmt, s->v.If.orelse); + } + compiler_use_block(c, end); + return 1; + } + + static int + compiler_for(struct compiler *c, stmt_ty s) + { + int start, cleanup, end; + + start = compiler_new_block(c); + cleanup = compiler_new_block(c); + end = compiler_new_block(c); + if (!(start && end && cleanup)) + return 0; + ADDOP_I(c, SETUP_LOOP, end); + if (!compiler_push_fblock(c, LOOP, start)) + return 0; + VISIT(c, expr, s->v.For.iter); + ADDOP(c, GET_ITER); + compiler_use_block(c, start); + ADDOP_I(c, FOR_ITER, cleanup); + VISIT(c, expr, s->v.For.target); + VISIT_SEQ(c, stmt, s->v.For.body); + ADDOP_I(c, JUMP_ABSOLUTE, start); + compiler_use_block(c, cleanup); + ADDOP(c, POP_BLOCK); + compiler_pop_fblock(c, LOOP, start); + VISIT_SEQ(c, stmt, s->v.For.orelse); + compiler_use_block(c, end); + return 1; + } + + static int + compiler_while(struct compiler *c, stmt_ty s) + { + int loop, orelse, end; + loop = compiler_new_block(c); + end = compiler_new_block(c); + if (!(loop && end)) + return 0; + if (s->v.While.orelse) { + orelse = compiler_new_block(c); + if (!orelse) + return 0; + } + else + orelse = -1; + + ADDOP_I(c, SETUP_LOOP, end); + compiler_use_block(c, loop); + if (!compiler_push_fblock(c, LOOP, loop)) + return 0; + VISIT(c, expr, s->v.While.test); + ADDOP_I(c, JUMP_IF_FALSE, orelse == -1 ? end : orelse); + NEW_BLOCK(c); + ADDOP(c, POP_TOP); + VISIT_SEQ(c, stmt, s->v.While.body); + ADDOP_I(c, JUMP_ABSOLUTE, loop); + + /* XXX should the two POP instructions be in a separate block + if there is no else clause ? + */ + if (orelse == -1) + compiler_use_block(c, end); + else + compiler_use_block(c, orelse); + ADDOP(c, POP_TOP); + ADDOP(c, POP_BLOCK); + compiler_pop_fblock(c, LOOP, loop); + if (orelse != -1) + VISIT_SEQ(c, stmt, s->v.While.orelse); + compiler_use_block(c, end); + + return 1; + } + + static int + compiler_continue(struct compiler *c) + { + int i; + if (!c->c_nfblocks) + return compiler_error(c, "'continue' outside loop"); + i = c->c_nfblocks - 1; + switch (c->c_fblock[i].fb_type) { + case LOOP: + ADDOP_I(c, JUMP_ABSOLUTE, c->c_fblock[i].fb_block); + NEW_BLOCK(c); + break; + case EXCEPT: + case FINALLY_TRY: + while (--i > 0 && c->c_fblock[i].fb_type != LOOP) + ; + if (i == -1) + return compiler_error(c, "'continue' outside loop"); + ADDOP_I(c, CONTINUE_LOOP, c->c_fblock[i].fb_block); + NEW_BLOCK(c); + break; + case FINALLY_END: + return compiler_error(c, + "'continue' not allowed in 'finally' block"); + break; + } + + return 1; } static int ! compiler_visit_stmt(struct compiler *c, stmt_ty s) { int i, n; ! ! c->c_lineno = s->lineno; /* XXX this isn't right */ switch (s->kind) { case FunctionDef_kind: *************** *** 338,344 **** VISIT(c, expr, s->v.Assign.value); for (i = 0; i < n; i++) { ! if (i < n - 1) ADDOP(c, DUP_TOP); ! VISIT(c, expr, asdl_get_seq(s->v.Assign.targets, i)); } break; --- 553,560 ---- VISIT(c, expr, s->v.Assign.value); for (i = 0; i < n; i++) { ! if (i < n - 1) ADDOP(c, DUP_TOP); ! VISIT(c, expr, ! (expr_ty)asdl_seq_get(s->v.Assign.targets, i)); } break; *************** *** 349,354 **** --- 565,572 ---- break; case For_kind: + return compiler_for(c, s); break; case While_kind: + return compiler_if(c, s); break; case If_kind: *************** *** 357,367 **** case Raise_kind: if (s->v.Raise.type) { ! VISIT(st, expr, s->v.Raise.type); n++; if (s->v.Raise.inst) { ! VISIT(st, expr, s->v.Raise.inst); n++; if (s->v.Raise.tback) { ! VISIT(st, expr, s->v.Raise.tback); n++; } --- 575,585 ---- case Raise_kind: if (s->v.Raise.type) { ! VISIT(c, expr, s->v.Raise.type); n++; if (s->v.Raise.inst) { ! VISIT(c, expr, s->v.Raise.inst); n++; if (s->v.Raise.tback) { ! VISIT(c, expr, s->v.Raise.tback); n++; } *************** *** 381,391 **** break; case Exec_kind: ! VISIT(st, expr, s->v.Exec.body); if (s->v.Exec.globals) { ! VISIT(st, expr, s->v.Exec.globals); ! if (s->v.Exec.locals) ! VISIT(st, expr, s->v.Exec.locals); ! else ADDOP(c, DUP_TOP); } else { ADDOP_O(c, LOAD_CONST, Py_None); --- 599,610 ---- break; case Exec_kind: ! VISIT(c, expr, s->v.Exec.body); if (s->v.Exec.globals) { ! VISIT(c, expr, s->v.Exec.globals); ! if (s->v.Exec.locals) { ! VISIT(c, expr, s->v.Exec.locals); ! } else { ADDOP(c, DUP_TOP); + } } else { ADDOP_O(c, LOAD_CONST, Py_None); *************** *** 398,411 **** case Expr_kind: VISIT(c, expr, s->v.Expr.value); ! if (c->c_interactive) ADDOP(c, PRINT_EXPR); ! else ADDOP(c, DUP_TOP); break; case Pass_kind: break; case Break_kind: break; case Continue_kind: break; } --- 617,636 ---- case Expr_kind: VISIT(c, expr, s->v.Expr.value); ! if (c->c_interactive) { ADDOP(c, PRINT_EXPR); ! } ! else { ADDOP(c, DUP_TOP); + } break; case Pass_kind: break; case Break_kind: + if (!c->c_nfblocks) + return compiler_error(c, "'break' outside loop"); + ADDOP(c, BREAK_LOOP); break; case Continue_kind: + compiler_continue(c); break; } *************** *** 426,433 **** return UNARY_NEGATIVE; } } static int ! binop(operator_ty op) { switch (op) { --- 651,659 ---- return UNARY_NEGATIVE; } + return 0; } static int ! binop(struct compiler *c, operator_ty op) { switch (op) { *************** *** 439,443 **** return BINARY_MULTIPLY; case Div: ! if (c->c_flags & CO_FUTURE_DIVISION) return BINARY_TRUE_DIVIDE; else --- 665,669 ---- return BINARY_MULTIPLY; case Div: ! if (c->c_flags->cf_flags & CO_FUTURE_DIVISION) return BINARY_TRUE_DIVIDE; else *************** *** 460,463 **** --- 686,690 ---- return BINARY_FLOOR_DIVIDE; } + return 0; } *************** *** 473,477 **** VISIT(c, expr, e->v.BinOp.left); VISIT(c, expr, e->v.BinOp.right); ! ADDOP(c, binop(e->v.BinOp.op)); break; case UnaryOp_kind: --- 700,704 ---- VISIT(c, expr, e->v.BinOp.left); VISIT(c, expr, e->v.BinOp.right); ! ADDOP(c, binop(c, e->v.BinOp.op)); break; case UnaryOp_kind: *************** *** 532,537 **** break; case Name_kind: - compiler_add_def(c, e->v.Name.id, - e->v.Name.ctx == Load ? USE : DEF_LOCAL); break; /* child nodes of List and Tuple will have expr_context set */ --- 759,762 ---- *************** *** 546,547 **** --- 771,821 ---- } + static int + compiler_push_fblock(struct compiler *c, enum fblocktype t, int b) + { + struct fblockinfo *f; + if (c->c_nfblocks >= CO_MAXBLOCKS) + return 0; + f = &c->c_fblock[c->c_nfblocks++]; + f->fb_type = t; + f->fb_block = b; + return 1; + } + + static void + compiler_pop_fblock(struct compiler *c, enum fblocktype t, int b) + { + assert(c->c_nfblocks > 0); + c->c_nfblocks--; + assert(c->c_fblock[c->c_nfblocks].fb_type == t); + assert(c->c_fblock[c->c_nfblocks].fb_block == b); + } + + /* Raises a SyntaxError and returns 0. + If something goes wrong, a different exception may be raised. + */ + + static int + compiler_error(struct compiler *c, const char *errstr) + { + PyObject *loc; + PyObject *u, *v; + + loc = PyErr_ProgramText(c->c_filename, c->c_lineno); + if (!loc) { + Py_INCREF(Py_None); + loc = Py_None; + } + u = Py_BuildValue("(ziOO)", c->c_filename, c->c_lineno, Py_None, loc); + if (!u) + goto exit; + v = Py_BuildValue("(zO)", errstr, u); + if (!v) + goto exit; + PyErr_SetObject(PyExc_SyntaxError, v); + exit: + Py_DECREF(loc); + Py_XDECREF(u); + Py_XDECREF(v); + return 0; + } From gvanrossum@users.sourceforge.net Fri Aug 2 19:03:26 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 11:03:26 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,NONE,1.1 lib.tex,1.202,1.203 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31025 Modified Files: lib.tex Added Files: libheapq.tex Log Message: Add docs for heapq.py. --- NEW FILE: libheapq.tex --- \section{\module{heapq} --- Heap queue algorithm} \declaremodule{standard}{heapq} \modulesynopsis{Heap queue algorithm (a.k.a. priority queue).} \sectionauthor{Guido van Rossum}{guido@python.org} % Implementation contributed by Kevin O'Connor % Theoretical explanation by François Pinard This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm. \versionadded{2.3} Heaps are arrays for which \code{\var{heap}[\var{k}] <= \var{heap}[2*\var{k}+1]} and \code{\var{heap}[\var{k}] <= \var{heap}[2*\var{k}+2]} for all \var{k}, counting elements from zero. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that \code{\var{heap}[0]} is always its smallest element. The API below differs from textbook heap algorithms in two aspects: (a) We use zero-based indexing. This makes the relationship between the index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses zero-based indexing. (b) Our pop method returns the smallest item, not the largest. These two make it possible to view the heap as a regular Python list without surprises: \code{\var{heap}[0]} is the smallest item, and \code{\var{heap}.sort()} maintains the heap invariant! To create a heap, use a list initialized to \code{[]}. The following functions are provided: \begin{funcdesc}{heappush}{heap, item} Push the value \var{item} onto the \var{heap}, maintaining the heap invariant. \end{funcdesc} \begin{funcdesc}{heappop}{heap} Pop and return the smallest item from the \var{heap}, maintaining the heap invariant. \end{funcdesc} Example of use: \begin{verbatim} >>> from heapq import heappush, heappop >>> heap = [] >>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] >>> for item in data: ... heappush(heap, item) ... >>> sorted = [] >>> while heap: ... sorted.append(heappop(heap)) ... >>> print sorted [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> data.sort() >>> print data == sorted True >>> \end{verbatim} \subsection{Theory} (This explanation is due to François Pinard. The Python code for this module was contributed by Kevin O'Connor.) Heaps are arrays for which \code{a[\var{k}] <= a[2*\var{k}+1]} and \code{a[\var{k}] <= a[2*\var{k}+2]} for all \var{k}, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that \code{a[0]} is always its smallest element. The strange invariant above is meant to be an efficient memory representation for a tournament. The numbers below are \var{k}, not \code{a[\var{k}]}: \begin{verbatim} 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 \end{verbatim} In the tree above, each cell \var{k} is topping \code{2*\var{k}+1} and \code{2*\var{k}+2}. In an usual binary tournament we see in sports, each cell is the winner over the two cells it tops, and we can trace the winner down the tree to see all opponents s/he had. However, in many computer applications of such tournaments, we do not need to trace the history of a winner. To be more memory efficient, when a winner is promoted, we try to replace it by something else at a lower level, and the rule becomes that a cell and the two cells it tops contain three different items, but the top cell "wins" over the two topped cells. If this heap invariant is protected at all time, index 0 is clearly the overall winner. The simplest algorithmic way to remove it and find the "next" winner is to move some loser (let's say cell 30 in the diagram above) into the 0 position, and then percolate this new 0 down the tree, exchanging values, until the invariant is re-established. This is clearly logarithmic on the total number of items in the tree. By iterating over all items, you get an O(n log n) sort. A nice feature of this sort is that you can efficiently insert new items while the sort is going on, provided that the inserted items are not "better" than the last 0'th element you extracted. This is especially useful in simulation contexts, where the tree holds all incoming events, and the "win" condition means the smallest scheduled time. When an event schedule other events for execution, they are scheduled into the future, so they can easily go into the heap. So, a heap is a good structure for implementing schedulers (this is what I used for my MIDI sequencer :-). Various structures for implementing schedulers have been extensively studied, and heaps are good for this, as they are reasonably speedy, the speed is almost constant, and the worst case is not much different than the average case. However, there are other representations which are more efficient overall, yet the worst cases might be terrible. Heaps are also very useful in big disk sorts. You most probably all know that a big sort implies producing "runs" (which are pre-sorted sequences, which size is usually related to the amount of CPU memory), followed by a merging passes for these runs, which merging is often very cleverly organised\footnote{The disk balancing algorithms which are current, nowadays, are more annoying than clever, and this is a consequence of the seeking capabilities of the disks. On devices which cannot seek, like big tape drives, the story was quite different, and one had to be very clever to ensure (far in advance) that each tape movement will be the most effective possible (that is, will best participate at "progressing" the merge). Some tapes were even able to read backwards, and this was also used to avoid the rewinding time. Believe me, real good tape sorts were quite spectacular to watch! >From all times, sorting has always been a Great Art! :-)}. It is very important that the initial sort produces the longest runs possible. Tournaments are a good way to that. If, using all the memory available to hold a tournament, you replace and percolate items that happen to fit the current run, you'll produce runs which are twice the size of the memory for random input, and much better for input fuzzily ordered. Moreover, if you output the 0'th item on disk and get an input which may not fit in the current tournament (because the value "wins" over the last output value), it cannot fit in the heap, so the size of the heap decreases. The freed memory could be cleverly reused immediately for progressively building a second heap, which grows at exactly the same rate the first heap is melting. When the first heap completely vanishes, you switch heaps and start a new run. Clever and quite effective! In a word, heaps are useful memory structures to know. I use them in a few applications, and I think it is good to keep a `heap' module around. :-) Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.202 retrieving revision 1.203 diff -C2 -d -r1.202 -r1.203 *** lib.tex 3 Jul 2002 18:36:38 -0000 1.202 --- lib.tex 2 Aug 2002 18:03:23 -0000 1.203 *************** *** 121,124 **** --- 121,125 ---- \input{libwhrandom} \input{libbisect} + \input{libheapq} \input{libarray} \input{libcfgparser} From fdrake@users.sourceforge.net Fri Aug 2 19:20:37 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 Aug 2002 11:20:37 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.87,1.88 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv4346 Modified Files: Makefile.deps Log Message: Add heapq module docs to the dependency information. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** Makefile.deps 3 Jul 2002 18:36:38 -0000 1.87 --- Makefile.deps 2 Aug 2002 18:20:34 -0000 1.88 *************** *** 262,265 **** --- 262,266 ---- lib/libpopen2.tex \ lib/libbisect.tex \ + lib/libheapq.tex \ lib/libmimetypes.tex \ lib/libsmtplib.tex \ From gvanrossum@users.sourceforge.net Fri Aug 2 19:05:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 11:05:23 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.448,1.449 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31646 Modified Files: NEWS Log Message: Adding the heap queue algorithm, per discussion in python-dev last week. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.448 retrieving revision 1.449 diff -C2 -d -r1.448 -r1.449 *** NEWS 1 Aug 2002 02:34:51 -0000 1.448 --- NEWS 2 Aug 2002 18:05:20 -0000 1.449 *************** *** 202,205 **** --- 202,209 ---- Library + - New "algorithms" module: heapq, implements a heap queue. Thanks to + Kevin O'Connor for the code and François Pinard for an entertaining + write-up explaining the theory and practical uses of heaps. + - New encoding for the Palm OS character set: palmos. From bwarsaw@users.sourceforge.net Fri Aug 2 19:06:01 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 02 Aug 2002 11:06:01 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.205,1.206 pep-0296.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31867 Modified Files: pep-0000.txt pep-0296.txt Log Message: PEP 296 gets renamed after a suggestion by Guido and approval by Scott Gilbert. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.205 retrieving revision 1.206 diff -C2 -d -r1.205 -r1.206 *** pep-0000.txt 2 Aug 2002 13:46:12 -0000 1.205 --- pep-0000.txt 2 Aug 2002 18:05:59 -0000 1.206 *************** *** 101,105 **** S 293 Codec Error Handling Callbacks Dörwald S 294 Type Names in the types Module Tirosh ! S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg S 298 The Locked Buffer Interface Heller --- 101,105 ---- 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 S 297 Support for System Upgrades Lemburg S 298 The Locked Buffer Interface Heller *************** *** 285,289 **** S 294 Type Names in the types Module Tirosh SR 295 Interpretation of multiline string constants Koltsov ! S 296 The Buffer Problem Gilbert S 297 Support for System Upgrades Lemburg S 298 The Locked Buffer Interface Heller --- 285,289 ---- S 294 Type Names in the types Module Tirosh SR 295 Interpretation of multiline string constants Koltsov ! S 296 Adding a bytes Object Type Gilbert S 297 Support for System Upgrades Lemburg S 298 The Locked Buffer Interface Heller Index: pep-0296.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0296.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0296.txt 22 Jul 2002 21:03:34 -0000 1.1 --- pep-0296.txt 2 Aug 2002 18:05:59 -0000 1.2 *************** *** 1,4 **** PEP: 296 ! Title: The Buffer Problem Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 296 ! Title: Adding a bytes Object Type Version: $Revision$ Last-Modified: $Date$ From gvanrossum@users.sourceforge.net Fri Aug 2 19:29:55 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 11:29:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7557 Added Files: test_heapq.py Log Message: Adding the heap queue algorithm, per discussion in python-dev last week. --- NEW FILE: test_heapq.py --- """Unittests for heapq.""" from test.test_support import verify, vereq, verbose, TestFailed from heapq import heappush, heappop import random def check_invariant(heap): # Check the heap invariant. for pos, item in enumerate(heap): parentpos = (pos+1)/2 - 1 if parentpos >= 0: verify(heap[parentpos] <= item) def test_main(): # 1) Push 100 random numbers and pop them off, verifying all's OK. heap = [] data = [] check_invariant(heap) for i in range(256): item = random.random() data.append(item) heappush(heap, item) check_invariant(heap) results = [] while heap: item = heappop(heap) check_invariant(heap) results.append(item) data_sorted = data[:] data_sorted.sort() vereq(data_sorted, results) # 2) Check that the invariant holds for a sorted array check_invariant(results) # 3) Naive "N-best" algorithm heap = [] for item in data: heappush(heap, item) if len(heap) > 10: heappop(heap) heap.sort() vereq(heap, data_sorted[-10:]) # Make user happy if verbose: print "All OK" if __name__ == "__main__": test_main() From fdrake@users.sourceforge.net Fri Aug 2 19:30:24 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 Aug 2002 11:30:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.96,1.97 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv7823 Modified Files: python.sty Log Message: Add a comment showing how one of the macros should be used. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** python.sty 2 Jul 2002 20:32:50 -0000 1.96 --- python.sty 2 Aug 2002 18:30:22 -0000 1.97 *************** *** 805,808 **** --- 805,809 ---- \newcommand{\infinity}{\ensuremath{\infty}} \newcommand{\plusminus}{\ensuremath{\pm}} + % \menuselection{Start \sub Programs \sub Python} \newcommand{\menuselection}[1]{{\def\sub{ \ensuremath{>} }#1}} From tim_one@users.sourceforge.net Fri Aug 2 20:16:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 12:16:46 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27148/python/Lib Modified Files: heapq.py Log Message: Don't use true division where int division was intended. For that matter, don't use division at all. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** heapq.py 2 Aug 2002 16:50:58 -0000 1.2 --- heapq.py 2 Aug 2002 19:16:44 -0000 1.3 *************** *** 127,131 **** heap.append(None) while pos: ! parentpos = (pos - 1) / 2 parent = heap[parentpos] if item >= parent: --- 127,131 ---- heap.append(None) while pos: ! parentpos = (pos - 1) >> 1 parent = heap[parentpos] if item >= parent: From tim_one@users.sourceforge.net Fri Aug 2 20:16:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 12:16:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27148/python/Lib/test Modified Files: test_heapq.py Log Message: Don't use true division where int division was intended. For that matter, don't use division at all. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_heapq.py 2 Aug 2002 18:29:53 -0000 1.1 --- test_heapq.py 2 Aug 2002 19:16:44 -0000 1.2 *************** *** 9,13 **** # Check the heap invariant. for pos, item in enumerate(heap): ! parentpos = (pos+1)/2 - 1 if parentpos >= 0: verify(heap[parentpos] <= item) --- 9,13 ---- # Check the heap invariant. for pos, item in enumerate(heap): ! parentpos = ((pos+1) >> 1) - 1 if parentpos >= 0: verify(heap[parentpos] <= item) From tim_one@users.sourceforge.net Fri Aug 2 20:41:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 12:41:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6386/python/Lib/test Modified Files: test_heapq.py Log Message: check_invariant(): Use the same child->parent "formula" used by heapq.py. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_heapq.py 2 Aug 2002 19:16:44 -0000 1.2 --- test_heapq.py 2 Aug 2002 19:41:54 -0000 1.3 *************** *** 9,14 **** # Check the heap invariant. for pos, item in enumerate(heap): ! parentpos = ((pos+1) >> 1) - 1 ! if parentpos >= 0: verify(heap[parentpos] <= item) --- 9,14 ---- # Check the heap invariant. for pos, item in enumerate(heap): ! if pos: # pos 0 has no parent ! parentpos = (pos-1) >> 1 verify(heap[parentpos] <= item) From tim_one@users.sourceforge.net Fri Aug 2 20:45:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 12:45:39 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8393/python/Lib Modified Files: heapq.py Log Message: heappop(): Use "while True" instead of "while 1". Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** heapq.py 2 Aug 2002 19:16:44 -0000 1.3 --- heapq.py 2 Aug 2002 19:45:37 -0000 1.4 *************** *** 143,147 **** item = heap.pop() pos = 0 ! while 1: child2pos = (pos + 1) * 2 child1pos = child2pos - 1 --- 143,147 ---- item = heap.pop() pos = 0 ! while True: child2pos = (pos + 1) * 2 child1pos = child2pos - 1 From fdrake@users.sourceforge.net Fri Aug 2 20:46:45 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 Aug 2002 12:46:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8938 Modified Files: libheapq.tex Log Message: Minor markup changes. Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libheapq.tex 2 Aug 2002 18:03:24 -0000 1.1 --- libheapq.tex 2 Aug 2002 19:46:42 -0000 1.2 *************** *** 4,15 **** \declaremodule{standard}{heapq} \modulesynopsis{Heap queue algorithm (a.k.a. priority queue).} \sectionauthor{Guido van Rossum}{guido@python.org} ! % Implementation contributed by Kevin O'Connor ! % Theoretical explanation by François Pinard This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm. - \versionadded{2.3} Heaps are arrays for which --- 4,16 ---- \declaremodule{standard}{heapq} \modulesynopsis{Heap queue algorithm (a.k.a. priority queue).} + \moduleauthor{Kevin O'Connor}{} \sectionauthor{Guido van Rossum}{guido@python.org} ! % Theoretical explanation: ! \sectionauthor{Fran\c cois Pinard}{} ! \versionadded{2.3} This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm. Heaps are arrays for which From tim_one@users.sourceforge.net Fri Aug 2 21:09:17 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 13:09:17 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18014/python/Lib Modified Files: heapq.py Log Message: heappop(): Added comments; simplified and sped the code. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** heapq.py 2 Aug 2002 19:45:37 -0000 1.4 --- heapq.py 2 Aug 2002 20:09:14 -0000 1.5 *************** *** 143,167 **** item = heap.pop() pos = 0 ! while True: ! child2pos = (pos + 1) * 2 ! child1pos = child2pos - 1 ! if child2pos < endpos: ! child1 = heap[child1pos] ! child2 = heap[child2pos] ! if item <= child1 and item <= child2: ! break ! if child1 < child2: ! heap[pos] = child1 ! pos = child1pos ! continue ! heap[pos] = child2 ! pos = child2pos ! continue ! if child1pos < endpos: ! child1 = heap[child1pos] ! if child1 < item: ! heap[pos] = child1 ! pos = child1pos ! break heap[pos] = item return returnitem --- 143,165 ---- item = heap.pop() pos = 0 ! # Sift item into position, down from the root, moving the smaller ! # child up, until finding pos such that item <= pos's children. ! childpos = 2*pos + 1 # leftmost child position ! while childpos < endpos: ! # Set childpos and child to reflect smaller child. ! child = heap[childpos] ! rightpos = childpos + 1 ! if rightpos < endpos: ! rightchild = heap[rightpos] ! if rightchild < child: ! childpos = rightpos ! child = rightchild ! # If item is no larger than smaller child, we're done, else ! # move the smaller child up. ! if item <= child: ! break ! heap[pos] = child ! pos = childpos ! childpos = 2*pos + 1 heap[pos] = item return returnitem From fdrake@users.sourceforge.net Fri Aug 2 21:17:17 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 Aug 2002 13:17:17 -0700 Subject: [Python-checkins] python/dist/src/Modules _weakref.c,1.15,1.15.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21750/Modules Modified Files: Tag: release22-maint _weakref.c Log Message: Fix ref(), proxy() docstrings, based on comments from David Abrahams. Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.15 retrieving revision 1.15.8.1 diff -C2 -d -r1.15 -r1.15.8.1 *** _weakref.c 23 Oct 2001 21:12:47 -0000 1.15 --- _weakref.c 2 Aug 2002 20:17:14 -0000 1.15.8.1 *************** *** 59,65 **** static char weakref_ref__doc__[] = ! "new(object[, callback]) -- create a weak reference to 'object';\n" "when 'object' is finalized, 'callback' will be called and passed\n" ! "a reference to 'object'."; static PyObject * --- 59,66 ---- static char weakref_ref__doc__[] = ! "ref(object[, callback]) -- create a weak reference to 'object';\n" "when 'object' is finalized, 'callback' will be called and passed\n" ! "a reference to the weak reference object when 'object' is about\n" ! "to be finalized."; static PyObject * *************** *** 80,84 **** "proxy(object[, callback]) -- create a proxy object that weakly\n" "references 'object'. 'callback', if given, is called with a\n" ! "reference to the proxy when it is about to be finalized."; static PyObject * --- 81,85 ---- "proxy(object[, callback]) -- create a proxy object that weakly\n" "references 'object'. 'callback', if given, is called with a\n" ! "reference to the proxy when 'object' is about to be finalized."; static PyObject * From fdrake@users.sourceforge.net Fri Aug 2 21:23:42 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 Aug 2002 13:23:42 -0700 Subject: [Python-checkins] python/dist/src/Modules _weakref.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24667/Modules Modified Files: _weakref.c Log Message: Fix ref(), proxy() docstrings, based on comments from David Abrahams. Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** _weakref.c 2 Aug 2002 02:27:13 -0000 1.17 --- _weakref.c 2 Aug 2002 20:23:40 -0000 1.18 *************** *** 59,65 **** PyDoc_STRVAR(weakref_ref__doc__, ! "new(object[, callback]) -- create a weak reference to 'object';\n" "when 'object' is finalized, 'callback' will be called and passed\n" ! "a reference to 'object'."); static PyObject * --- 59,66 ---- PyDoc_STRVAR(weakref_ref__doc__, ! "ref(object[, callback]) -- create a weak reference to 'object';\n" "when 'object' is finalized, 'callback' will be called and passed\n" ! "a reference to the weak reference object when 'object' is about\n" ! "to be finalized."); static PyObject * *************** *** 80,84 **** "proxy(object[, callback]) -- create a proxy object that weakly\n" "references 'object'. 'callback', if given, is called with a\n" ! "reference to the proxy when it is about to be finalized."); static PyObject * --- 81,85 ---- "proxy(object[, callback]) -- create a proxy object that weakly\n" "references 'object'. 'callback', if given, is called with a\n" ! "reference to the proxy when 'object' is about to be finalized."); static PyObject * From gvanrossum@users.sourceforge.net Fri Aug 2 21:23:58 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 13:23:58 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24770 Modified Files: heapq.py Log Message: Add a PEP-263-style encoding turd^H^H^H^Hdeclaration, because there's a c-cedilla in one of the docstrings. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** heapq.py 2 Aug 2002 20:09:14 -0000 1.5 --- heapq.py 2 Aug 2002 20:23:56 -0000 1.6 *************** *** 1,2 **** --- 1,4 ---- + # -*- coding: Latin-1 -*- + """Heap queue algorithm (a.k.a. priority queue). From jackjansen@users.sourceforge.net Fri Aug 2 22:04:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 14:04:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv9972 Modified Files: Makefile Log Message: When building the IDE check that waste is available, to forestall surprises later (the IDE won't work without waste). Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Makefile 2 Aug 2002 15:32:12 -0000 1.17 --- Makefile 2 Aug 2002 21:04:46 -0000 1.18 *************** *** 99,102 **** --- 99,107 ---- install_IDE: $(INSTALLED_PYTHONW) + @if $(INSTALLED_PYTHONW) -c "import waste"; then ; else \ + echo PythonIDE needs the \"waste\" extension module; \ + echo See Mac/OSX/README for details; \ + exit 1; \ + fi $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ From jackjansen@users.sourceforge.net Fri Aug 2 22:05:19 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 14:05:19 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX pythonw.sh,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv10273 Modified Files: pythonw.sh Log Message: Updated for the new path to Python.app. Index: pythonw.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/pythonw.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pythonw.sh 29 Mar 2002 14:15:22 -0000 1.1 --- pythonw.sh 2 Aug 2002 21:05:16 -0000 1.2 *************** *** 1,2 **** #!/bin/sh ! exec /Applications/Python.app/Contents/MacOS/python $@ --- 1,2 ---- #!/bin/sh ! exec /Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python $@ From jackjansen@users.sourceforge.net Fri Aug 2 22:45:29 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 14:45:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv24167 Modified Files: README Log Message: Added a lot more information on framework builds, the various .app's, etc. Still not enough, probably, but better than what we had. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 2 Aug 2002 14:11:24 -0000 1.4 --- README 2 Aug 2002 21:45:27 -0000 1.5 *************** *** 1,2 **** --- 1,52 ---- + Building and using a framework-based Python on Mac OS X. + -------------------------------------------------------- + + This document provides a quick introduction to framework-based Python. + It is rather terse and probably incomplete, please send me feedback. + + 1. Why would I want a framework Python in stead of a normal static Python? + -------------------------------------------------------------------------- + + 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? + ------------------------------------------------------------------ + + In everyday use there is no difference, except that things are stored in + a different place. If you look in /Library/Frameworks/Python.framework + you will see lots of relative symlinks, see the Apple documentation for + details. If you are used to a normal unix Python file layout go down to + Versions/Current and you will see the familiar bin and lib directories. + + 3. Do I need extra packages? + ---------------------------- + + 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. + + 4. How do I build a framework Python? + ------------------------------------- + This directory contains a Makefile that will create a couple of python-related applications (fullblown OSX .app applications, that is) in /Applications/Python, *************** *** 11,14 **** --- 61,94 ---- 3. make frameworkinstall 4. make osxapps + 5. [optional] in Mac/OSX do "make installunixprograms", see below. + + This sequence will put the framework in /Library/Framework/Python.framework and + the applications in /Applications/Python. Building in another place, for instance + $HOME/Library/Frameworks if you have no admin privileges on your machine, has only + been tested very lightly. + + 5. What do all these programs do? + --------------------------------- + + PythonIDE.app is an integrated development environment for Python: editor, + debugger, etc. + + 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. + + If you install the commandline scripts /usr/local/bin/python and pythonw these + can be used to run non-GUI and GUI python scripts from the command line, respectively. + + 6. Odds and ends. + ----------------- The interesting targets in the makefile are: *************** *** 22,29 **** installunixprograms - install symlinks/scripts mimicking normal unix Python into /usr/local. ! Something to take note of is that the ".rsrc" files in the distribution are not ! actually resource files, they're AppleSingle encoded resource files. Jack Jansen, jack@oratrix.com, 02-Aug-02 --- 102,114 ---- installunixprograms - install symlinks/scripts mimicking normal unix Python into /usr/local. ! ! 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, 02-Aug-02 From tim_one@users.sourceforge.net Fri Aug 2 22:48:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 14:48:08 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23987/python/Lib Modified Files: heapq.py Log Message: Hmm! I thought I checked this in before! Oh well. Added new heapify() function, which transforms an arbitrary list into a heap in linear time; that's a fundamental tool for using heaps in real life . Added heapyify() test. Added a "less naive" N-best algorithm to the test suite, and noted that this could actually go much faster (building on heapify()) if we had max-heaps instead of min-heaps (the iterative method is appropriate when all the data isn't known in advance, but when it is known in advance the tradeoffs get murkier). Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** heapq.py 2 Aug 2002 20:23:56 -0000 1.6 --- heapq.py 2 Aug 2002 21:48:06 -0000 1.7 *************** *** 14,17 **** --- 14,18 ---- item = heappop(heap) # pops the smallest item from the heap item = heap[0] # smallest item on the heap without popping it + heapify(heap) # transform list into a heap, in-place, in linear time Our API differs from textbook heap algorithms as follows: *************** *** 137,149 **** heap[pos] = item ! def heappop(heap): ! """Pop the smallest item off the heap, maintaining the heap invariant.""" ! endpos = len(heap) - 1 ! if endpos <= 0: ! return heap.pop() ! returnitem = heap[0] ! item = heap.pop() ! pos = 0 ! # Sift item into position, down from the root, moving the smaller # child up, until finding pos such that item <= pos's children. childpos = 2*pos + 1 # leftmost child position --- 138,148 ---- heap[pos] = item ! # The child indices of heap index pos are already heaps, and we want to make ! # a heap at index pos too. ! def _siftdown(heap, pos): ! endpos = len(heap) ! assert pos < endpos ! item = heap[pos] ! # Sift item into position, down from pos, moving the smaller # child up, until finding pos such that item <= pos's children. childpos = 2*pos + 1 # leftmost child position *************** *** 165,169 **** --- 164,189 ---- childpos = 2*pos + 1 heap[pos] = item + + def heappop(heap): + """Pop the smallest item off the heap, maintaining the heap invariant.""" + lastelt = heap.pop() # raises appropriate IndexError if heap is empty + if heap: + returnitem = heap[0] + heap[0] = lastelt + _siftdown(heap, 0) + else: + returnitem = lastelt return returnitem + + def heapify(heap): + """Transform list heap into a heap, in-place, in O(len(heap)) time.""" + n = len(heap) + # Transform bottom-up. The largest index there's any point to looking at + # is the largest with a child index in-range, so must have 2*i + 1 < n, + # or i < (n-1)/2. If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so + # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is + # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. + for i in xrange(n//2 - 1, -1, -1): + _siftdown(heap, i) if __name__ == "__main__": From tim_one@users.sourceforge.net Fri Aug 2 22:48:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 14:48:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23987/python/Lib/test Modified Files: test_heapq.py Log Message: Hmm! I thought I checked this in before! Oh well. Added new heapify() function, which transforms an arbitrary list into a heap in linear time; that's a fundamental tool for using heaps in real life . Added heapyify() test. Added a "less naive" N-best algorithm to the test suite, and noted that this could actually go much faster (building on heapify()) if we had max-heaps instead of min-heaps (the iterative method is appropriate when all the data isn't known in advance, but when it is known in advance the tradeoffs get murkier). Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_heapq.py 2 Aug 2002 19:41:54 -0000 1.3 --- test_heapq.py 2 Aug 2002 21:48:06 -0000 1.4 *************** *** 3,7 **** from test.test_support import verify, vereq, verbose, TestFailed ! from heapq import heappush, heappop import random --- 3,7 ---- from test.test_support import verify, vereq, verbose, TestFailed ! from heapq import heappush, heappop, heapify import random *************** *** 38,41 **** --- 38,59 ---- heappush(heap, item) if len(heap) > 10: + heappop(heap) + heap.sort() + vereq(heap, data_sorted[-10:]) + # 4) Test heapify. + for size in range(30): + heap = [random.random() for dummy in range(size)] + heapify(heap) + check_invariant(heap) + # 5) Less-naive "N-best" algorithm, much faster (if len(data) is big + # enough ) than sorting all of data. However, if we had a max + # heap instead of a min heap, it would go much faster still via + # heapify'ing all of data (linear time), then doing 10 heappops + # (10 log-time steps). + heap = data[:10] + heapify(heap) + for item in data[10:]: + if item > heap[0]: # this gets rarer and rarer the longer we run + heappush(heap, item) heappop(heap) heap.sort() From jackjansen@users.sourceforge.net Fri Aug 2 22:46:42 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 14:46:42 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv24557 Modified Files: Makefile Log Message: Build the IDE last, as it may fail because of waste missing. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Makefile 2 Aug 2002 21:04:46 -0000 1.18 --- Makefile 2 Aug 2002 21:46:40 -0000 1.19 *************** *** 45,49 **** RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py ! install_all: install_PythonLauncher install_Python install_IDE install_BuildApplet install_PythonLauncher: --- 45,49 ---- RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py ! install_all: install_PythonLauncher install_Python install_BuildApplet install_IDE install_PythonLauncher: From gvanrossum@users.sourceforge.net Fri Aug 2 23:01:40 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 02 Aug 2002 15:01:40 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29086 Modified Files: heapq.py Log Message: Augment credits. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** heapq.py 2 Aug 2002 21:48:06 -0000 1.7 --- heapq.py 2 Aug 2002 22:01:37 -0000 1.8 *************** *** 29,33 **** """ ! # Code by Kevin O'Connor __about__ = """Heap queues --- 29,33 ---- """ ! # Original code by Kevin O'Connor, augmented by Tim Peters __about__ = """Heap queues From jackjansen@users.sourceforge.net Fri Aug 2 23:18:08 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 15:18:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/iconsrc PythonWSource.psd,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/iconsrc In directory usw-pr-cvs1:/tmp/cvs-serv2062/Python/Mac/OSXResources/iconsrc Added Files: PythonWSource.psd Log Message: An icon for .pyw files. Yes, it's lousy, I know.... --- NEW FILE: PythonWSource.psd --- (This appears to be a binary file; contents omitted.) From jackjansen@users.sourceforge.net Fri Aug 2 23:32:43 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 15:32:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory usw-pr-cvs1:/tmp/cvs-serv5982/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: Added an icon for .pyw files. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** project.pbxproj 31 Jul 2002 14:45:08 -0000 1.3 --- project.pbxproj 2 Aug 2002 22:32:41 -0000 1.4 *************** *** 230,233 **** --- 230,234 ---- F58D4A3B02F1F94B01000102, F58D4A3C02F1F94B01000102, + F5449B4B02FB3F7E01000102, 2A37F4B9FDCFA73011CA2CEA, 2A37F4B6FDCFA73011CA2CEA, *************** *** 348,351 **** --- 349,354 ---- pyw + CFBundleTypeIconFile + PythonWSource.icns CFBundleTypeName Python GUI Script *************** *** 425,428 **** --- 428,432 ---- F58D4A3F02F1F94B01000102, F5A4C13F02F203F701000102, + F5449B4C02FB3F7E01000102, ); isa = PBXResourcesBuildPhase; *************** *** 521,524 **** --- 525,539 ---- F52A90D002EB5C6A01000102 = { fileRef = F52A90CE02EB5C6A01000102; + isa = PBXBuildFile; + settings = { + }; + }; + F5449B4B02FB3F7E01000102 = { + isa = PBXFileReference; + path = PythonWSource.icns; + refType = 4; + }; + F5449B4C02FB3F7E01000102 = { + fileRef = F5449B4B02FB3F7E01000102; isa = PBXBuildFile; settings = { From jackjansen@users.sourceforge.net Fri Aug 2 23:32:43 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 Aug 2002 15:32:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher PythonWSource.icns,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory usw-pr-cvs1:/tmp/cvs-serv5982 Added Files: PythonWSource.icns Log Message: Added an icon for .pyw files. --- NEW FILE: PythonWSource.icns --- (This appears to be a binary file; contents omitted.) From tim_one@users.sourceforge.net Sat Aug 3 03:11:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 19:11:28 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18315/python/lib Modified Files: heapq.py Log Message: Minor fiddling, including a simple class to implement a heap iterator in the test file. I have docs for heapq.heapify ready to check in, but Jack appears to have left behind a stale lock in the Doc/lib directory. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** heapq.py 2 Aug 2002 22:01:37 -0000 1.8 --- heapq.py 3 Aug 2002 02:11:24 -0000 1.9 *************** *** 14,18 **** item = heappop(heap) # pops the smallest item from the heap item = heap[0] # smallest item on the heap without popping it ! heapify(heap) # transform list into a heap, in-place, in linear time Our API differs from textbook heap algorithms as follows: --- 14,18 ---- item = heappop(heap) # pops the smallest item from the heap item = heap[0] # smallest item on the heap without popping it ! heapify(x) # transforms list into a heap, in-place, in linear time Our API differs from textbook heap algorithms as follows: *************** *** 176,182 **** return returnitem ! def heapify(heap): ! """Transform list heap into a heap, in-place, in O(len(heap)) time.""" ! n = len(heap) # Transform bottom-up. The largest index there's any point to looking at # is the largest with a child index in-range, so must have 2*i + 1 < n, --- 176,182 ---- return returnitem ! def heapify(x): ! """Transform list into a heap, in-place, in O(len(heap)) time.""" ! n = len(x) # Transform bottom-up. The largest index there's any point to looking at # is the largest with a child index in-range, so must have 2*i + 1 < n, *************** *** 185,189 **** # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. for i in xrange(n//2 - 1, -1, -1): ! _siftdown(heap, i) if __name__ == "__main__": --- 185,189 ---- # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. for i in xrange(n//2 - 1, -1, -1): ! _siftdown(x, i) if __name__ == "__main__": From tim_one@users.sourceforge.net Sat Aug 3 03:11:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 19:11:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18315/python/lib/test Modified Files: test_heapq.py Log Message: Minor fiddling, including a simple class to implement a heap iterator in the test file. I have docs for heapq.heapify ready to check in, but Jack appears to have left behind a stale lock in the Doc/lib directory. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_heapq.py 2 Aug 2002 21:48:06 -0000 1.4 --- test_heapq.py 3 Aug 2002 02:11:26 -0000 1.5 *************** *** 13,16 **** --- 13,30 ---- verify(heap[parentpos] <= item) + # An iterator returning a heap's elements, smallest-first. + class heapiter(object): + def __init__(self, heap): + self.heap = heap + + def next(self): + try: + return heappop(self.heap) + except IndexError: + raise StopIteration + + def __iter__(self): + return self + def test_main(): # 1) Push 100 random numbers and pop them off, verifying all's OK. *************** *** 48,52 **** # 5) Less-naive "N-best" algorithm, much faster (if len(data) is big # enough ) than sorting all of data. However, if we had a max ! # heap instead of a min heap, it would go much faster still via # heapify'ing all of data (linear time), then doing 10 heappops # (10 log-time steps). --- 62,66 ---- # 5) Less-naive "N-best" algorithm, much faster (if len(data) is big # enough ) than sorting all of data. However, if we had a max ! # heap instead of a min heap, it could go faster still via # heapify'ing all of data (linear time), then doing 10 heappops # (10 log-time steps). *************** *** 54,62 **** heapify(heap) for item in data[10:]: ! if item > heap[0]: # this gets rarer and rarer the longer we run heappush(heap, item) ! heappop(heap) ! heap.sort() ! vereq(heap, data_sorted[-10:]) # Make user happy if verbose: --- 68,75 ---- heapify(heap) for item in data[10:]: ! if item > heap[0]: # this gets rarer the longer we run ! heappop(heap) # we know heap[0] isn't in best 10 anymore heappush(heap, item) ! vereq(list(heapiter(heap)), data_sorted[-10:]) # Make user happy if verbose: From tim_one@users.sourceforge.net Sat Aug 3 03:17:43 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 19:17:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19566/lib/test Modified Files: test_sort.py Log Message: Remove cut 'n paste silliness. Index: test_sort.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sort.py 1 Aug 2002 02:23:06 -0000 1.1 --- test_sort.py 3 Aug 2002 02:17:41 -0000 1.2 *************** *** 60,65 **** class Stable(object): - maybe_complain = True - def __init__(self, key, i): self.key = key --- 60,63 ---- From tim_one@users.sourceforge.net Sat Aug 3 03:28:26 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 Aug 2002 19:28:26 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.130,2.131 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21510 Modified Files: listobject.c Log Message: SF bug 590366: Small typo in listsort:ParseTuple The PyArg_ParseTuple() error string still said "msort". Changed to "sort". Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -d -r2.130 -r2.131 *** listobject.c 1 Aug 2002 02:13:36 -0000 2.130 --- listobject.c 3 Aug 2002 02:28:24 -0000 2.131 *************** *** 1620,1624 **** assert(self != NULL); if (args != NULL) { ! if (!PyArg_ParseTuple(args, "|O:msort", &compare)) return NULL; } --- 1620,1624 ---- assert(self != NULL); if (args != NULL) { ! if (!PyArg_ParseTuple(args, "|O:sort", &compare)) return NULL; } From tim_one@users.sourceforge.net Sat Aug 3 10:56:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 02:56:54 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26147/python/Lib Modified Files: heapq.py Log Message: Large code rearrangement to use better algorithms, in the sense of needing substantially fewer array-element compares. This is best practice as of Kntuh Volume 3 Ed 2, and the code is actually simpler this way (although the key idea may be counter-intuitive at first glance! breaking out of a loop early loses when it costs more to try to get out early than getting out early saves). Also added a comment block explaining the difference and giving some real counts; demonstrating that heapify() is more efficient than repeated heappush(); and emphasizing the obvious point thatlist.sort() is more efficient if what you really want to do is sort. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** heapq.py 3 Aug 2002 02:11:24 -0000 1.9 --- heapq.py 3 Aug 2002 09:56:52 -0000 1.10 *************** *** 127,167 **** def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" ! pos = len(heap) ! heap.append(None) ! while pos: ! parentpos = (pos - 1) >> 1 ! parent = heap[parentpos] ! if item >= parent: ! break ! heap[pos] = parent ! pos = parentpos ! heap[pos] = item ! ! # The child indices of heap index pos are already heaps, and we want to make ! # a heap at index pos too. ! def _siftdown(heap, pos): ! endpos = len(heap) ! assert pos < endpos ! item = heap[pos] ! # Sift item into position, down from pos, moving the smaller ! # child up, until finding pos such that item <= pos's children. ! childpos = 2*pos + 1 # leftmost child position ! while childpos < endpos: ! # Set childpos and child to reflect smaller child. ! child = heap[childpos] ! rightpos = childpos + 1 ! if rightpos < endpos: ! rightchild = heap[rightpos] ! if rightchild < child: ! childpos = rightpos ! child = rightchild ! # If item is no larger than smaller child, we're done, else ! # move the smaller child up. ! if item <= child: ! break ! heap[pos] = child ! pos = childpos ! childpos = 2*pos + 1 ! heap[pos] = item def heappop(heap): --- 127,132 ---- def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" ! heap.append(item) ! _siftdown(heap, 0, len(heap)-1) def heappop(heap): *************** *** 171,175 **** returnitem = heap[0] heap[0] = lastelt ! _siftdown(heap, 0) else: returnitem = lastelt --- 136,140 ---- returnitem = heap[0] heap[0] = lastelt ! _siftup(heap, 0) else: returnitem = lastelt *************** *** 185,189 **** # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. for i in xrange(n//2 - 1, -1, -1): ! _siftdown(x, i) if __name__ == "__main__": --- 150,229 ---- # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. for i in xrange(n//2 - 1, -1, -1): ! _siftup(x, i) ! ! # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos ! # is the index of a leaf with a possibly out-of-order value. Restore the ! # heap invariant. ! def _siftdown(heap, startpos, pos): ! newitem = heap[pos] ! # Follow the path to the root, moving parents down until finding a place ! # newitem fits. ! while pos > startpos: ! parentpos = (pos - 1) >> 1 ! parent = heap[parentpos] ! if parent <= newitem: ! break ! heap[pos] = parent ! pos = parentpos ! heap[pos] = newitem ! ! # The child indices of heap index pos are already heaps, and we want to make ! # a heap at index pos too. We do this by bubbling the smaller child of ! # pos up (and so on with that child's children, etc) until hitting a leaf, ! # then using _siftdown to move the oddball originally at index pos into place. ! # ! # We *could* break out of the loop as soon as we find a pos where newitem <= ! # both its children, but turns out that's not a good idea, and despite that ! # many books write the algorithm that way. During a heap pop, the last array ! # element is sifted in, and that tends to be large, so that comparing it ! # against values starting from the root usually doesn't pay (= usually doesn't ! # get us out of the loop early). See Knuth, Volume 3, where this is ! # explained and quantified in an exercise. ! # ! # Cutting the # of comparisons is important, since these routines have no ! # way to extract "the priority" from an array element, so that intelligence ! # is likely to be hiding in custom __cmp__ methods, or in array elements ! # storing (priority, record) tuples. Comparisons are thus potentially ! # expensive. ! # ! # On random arrays of length 1000, making this change cut the number of ! # comparisons made by heapify() a little, and those made by exhaustive ! # heappop() a lot, in accord with theory. Here are typical results from 3 ! # runs (3 just to demonstrate how small the variance is): ! # ! # Compares needed by heapify Compares needed by 1000 heapppops ! # -------------------------- --------------------------------- ! # 1837 cut to 1663 14996 cut to 8680 ! # 1855 cut to 1659 14966 cut to 8678 ! # 1847 cut to 1660 15024 cut to 8703 ! # ! # Building the heap by using heappush() 1000 times instead required ! # 2198, 2148, and 2219 compares: heapify() is more efficient, when ! # you can use it. ! # ! # The total compares needed by list.sort() on the same lists were 8627, ! # 8627, and 8632 (this should be compared to the sum of heapify() and ! # heappop() compares): list.sort() is (unsurprisingly!) more efficent ! # for sorting. ! ! def _siftup(heap, pos): ! endpos = len(heap) ! startpos = pos ! newitem = heap[pos] ! # Bubble up the smaller child until hitting a leaf. ! childpos = 2*pos + 1 # leftmost child position ! while childpos < endpos: ! # Set childpos to index of smaller child. ! rightpos = childpos + 1 ! if rightpos < endpos and heap[rightpos] < heap[childpos]: ! childpos = rightpos ! # Move the smaller child up. ! heap[pos] = heap[childpos] ! pos = childpos ! childpos = 2*pos + 1 ! # The leaf at pos is empty now. Put newitem there, and and bubble it up ! # to its final resting place (by sifting its parents down). ! heap[pos] = newitem ! _siftdown(heap, startpos, pos) if __name__ == "__main__": From tim_one@users.sourceforge.net Sat Aug 3 11:10:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 03:10:12 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29493/python/Lib Modified Files: heapq.py Log Message: Added new heapreplace(heap, item) function, to pop (and return) the currently-smallest value, and add item, in one gulp. See the second N-Best algorithm in the test suite for a natural use. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** heapq.py 3 Aug 2002 09:56:52 -0000 1.10 --- heapq.py 3 Aug 2002 10:10:10 -0000 1.11 *************** *** 15,18 **** --- 15,20 ---- item = heap[0] # smallest item on the heap without popping it heapify(x) # transforms list into a heap, in-place, in linear time + item = heapreplace(heap, item) # pops and returns smallest item, and adds + # new item; the heap size is unchanged Our API differs from textbook heap algorithms as follows: *************** *** 140,143 **** --- 142,161 ---- returnitem = lastelt return returnitem + + def heapreplace(heap, item): + """Pop and return the current smallest value, and add the new item. + + This is more efficient than heappop() followed by heappush(), and can be + more appropriate when using a fixed-size heap. Note that the value + returned may be larger than item! That constrains reasonable uses of + this routine. + """ + + if heap: + returnitem = heap[0] + heap[0] = item + _siftup(heap, 0) + return returnitem + heap.pop() # raise IndexError def heapify(x): From tim_one@users.sourceforge.net Sat Aug 3 11:10:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 03:10:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29493/python/Lib/test Modified Files: test_heapq.py Log Message: Added new heapreplace(heap, item) function, to pop (and return) the currently-smallest value, and add item, in one gulp. See the second N-Best algorithm in the test suite for a natural use. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_heapq.py 3 Aug 2002 02:11:26 -0000 1.5 --- test_heapq.py 3 Aug 2002 10:10:10 -0000 1.6 *************** *** 3,7 **** from test.test_support import verify, vereq, verbose, TestFailed ! from heapq import heappush, heappop, heapify import random --- 3,7 ---- from test.test_support import verify, vereq, verbose, TestFailed ! from heapq import heappush, heappop, heapify, heapreplace import random *************** *** 69,74 **** for item in data[10:]: if item > heap[0]: # this gets rarer the longer we run ! heappop(heap) # we know heap[0] isn't in best 10 anymore ! heappush(heap, item) vereq(list(heapiter(heap)), data_sorted[-10:]) # Make user happy --- 69,73 ---- for item in data[10:]: if item > heap[0]: # this gets rarer the longer we run ! heapreplace(heap, item) vereq(list(heapiter(heap)), data_sorted[-10:]) # Make user happy From pierslauder@users.sourceforge.net Sat Aug 3 12:14:46 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Sat, 03 Aug 2002 04:14:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8427/dist/src/Lib/test Modified Files: test_imaplib.py Log Message: revert to version 1.2 Index: test_imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imaplib.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_imaplib.py 31 Jul 2002 16:42:33 -0000 1.7 --- test_imaplib.py 3 Aug 2002 11:14:43 -0000 1.8 *************** *** 2,11 **** import time ! timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), ! '"18-May-2033 05:33:20 +0200"', '"18-May-2033 13:33:20 +1000"'] ! check = timevalues[2] for t in timevalues: ! if check <> imaplib.Internaldate2tuple('INTERNALDATE ' + imaplib.Time2Internaldate(t)): ! print 'incorrect result when converting', `t` --- 2,12 ---- import time ! # We can check only that it successfully produces a result, ! # not the correctness of the result itself, since the result ! # depends on the timezone the machine is in. ! timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), ! "18-May-2033 05:33:20 +0200"] for t in timevalues: ! imaplib.Time2Internaldate(t) From mwh@users.sourceforge.net Sat Aug 3 17:16:24 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Sat, 03 Aug 2002 09:16:24 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7361 Modified Files: setup.py Log Message: Another fix for: [ 589427 ] standard include paths on command line _ssl still got /usr/include on the command line. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** setup.py 2 Aug 2002 13:55:50 -0000 1.100 --- setup.py 3 Aug 2002 16:16:22 -0000 1.101 *************** *** 398,402 **** depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) ! ssl_incs = find_file('openssl/ssl.h', inc_dirs, ['/usr/local/ssl/include', '/usr/contrib/ssl/include/' --- 398,402 ---- depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) ! ssl_incs = find_file('openssl/ssl.h', self.compiler.include_dirs, ['/usr/local/ssl/include', '/usr/contrib/ssl/include/' From mwh@users.sourceforge.net Sat Aug 3 17:39:25 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Sat, 03 Aug 2002 09:39:25 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12446 Modified Files: setup.py Log Message: Revert last checkin. Man, that was stupid. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** setup.py 3 Aug 2002 16:16:22 -0000 1.101 --- setup.py 3 Aug 2002 16:39:22 -0000 1.102 *************** *** 398,402 **** depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) ! ssl_incs = find_file('openssl/ssl.h', self.compiler.include_dirs, ['/usr/local/ssl/include', '/usr/contrib/ssl/include/' --- 398,402 ---- depends = ['socketmodule.h']) ) # Detect SSL support for the socket module (via _ssl) ! ssl_incs = find_file('openssl/ssl.h', inc_dirs, ['/usr/local/ssl/include', '/usr/contrib/ssl/include/' From tim_one@users.sourceforge.net Sat Aug 3 19:02:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 11:02:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv307/python/Doc/lib Modified Files: libheapq.tex Log Message: Document new heapify() function. Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libheapq.tex 2 Aug 2002 19:46:42 -0000 1.2 --- libheapq.tex 3 Aug 2002 18:02:09 -0000 1.3 *************** *** 26,30 **** index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses zero-based indexing. ! (b) Our pop method returns the smallest item, not the largest. These two make it possible to view the heap as a regular Python list --- 26,32 ---- index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses zero-based indexing. ! (b) Our pop method returns the smallest item, not the largest (called a ! "min heap" in textbooks; a "max heap" is more common in texts because ! of its suitability for in-place sorting). These two make it possible to view the heap as a regular Python list *************** *** 32,36 **** \code{\var{heap}.sort()} maintains the heap invariant! ! To create a heap, use a list initialized to \code{[]}. The following functions are provided: --- 34,39 ---- \code{\var{heap}.sort()} maintains the heap invariant! ! To create a heap, use a list initialized to \code{[]}, or you can ! transform a populated list into a heap via function \function{heapify()}. The following functions are provided: *************** *** 46,49 **** --- 49,56 ---- \end{funcdesc} + \begin{funcdesc}{heapify}{x} + Transform list \var{x} into a heap, in-place, in linear time. + \end{funcdesc} + Example of use: *************** *** 54,62 **** >>> for item in data: ... heappush(heap, item) ! ... >>> sorted = [] >>> while heap: ... sorted.append(heappop(heap)) ! ... >>> print sorted [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] --- 61,69 ---- >>> for item in data: ... heappush(heap, item) ! ... >>> sorted = [] >>> while heap: ... sorted.append(heappop(heap)) ! ... >>> print sorted [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] *************** *** 64,68 **** >>> print data == sorted True ! >>> \end{verbatim} --- 71,75 ---- >>> print data == sorted True ! >>> \end{verbatim} From tim_one@users.sourceforge.net Sat Aug 3 19:53:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 11:53:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12767/lib Modified Files: libheapq.tex Log Message: Document new heapreplace() function. Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libheapq.tex 3 Aug 2002 18:02:09 -0000 1.3 --- libheapq.tex 3 Aug 2002 18:53:28 -0000 1.4 *************** *** 53,56 **** --- 53,65 ---- \end{funcdesc} + \begin{funcdesc}{heapreplace}{heap, item} + Pop and return the smallest item from the \var{heap}, and also push + the new \var{item}. The heap size doesn't change. + This is more efficient than \function{heappop()} followed + by \function{heappush()}, and can be more appropriate when using + a fixed-size heap. Note that the value returned may be larger + than \var{item}! That constrains reasonable uses of this routine. + \end{funcdesc} + Example of use: From tim_one@users.sourceforge.net Sat Aug 3 20:20:19 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 12:20:19 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18759/python/Lib Modified Files: heapq.py Log Message: _siftup(): __le__ is now the only comparison operator used on array elements. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** heapq.py 3 Aug 2002 10:10:10 -0000 1.11 --- heapq.py 3 Aug 2002 19:20:16 -0000 1.12 *************** *** 234,238 **** # Set childpos to index of smaller child. rightpos = childpos + 1 ! if rightpos < endpos and heap[rightpos] < heap[childpos]: childpos = rightpos # Move the smaller child up. --- 234,238 ---- # Set childpos to index of smaller child. rightpos = childpos + 1 ! if rightpos < endpos and heap[rightpos] <= heap[childpos]: childpos = rightpos # Move the smaller child up. From jackjansen@users.sourceforge.net Sat Aug 3 21:49:12 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 03 Aug 2002 13:49:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib macostools.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4670 Modified Files: macostools.py Log Message: Mkdirs() failed when provided with unix pathnames. Fixed. Index: macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macostools.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** macostools.py 10 Mar 2002 19:28:02 -0000 1.14 --- macostools.py 3 Aug 2002 20:49:10 -0000 1.15 *************** *** 56,60 **** return head, tail = os.path.split(dst) ! if not ':' in head: head = head + ':' mkdirs(head) --- 56,60 ---- return head, tail = os.path.split(dst) ! if os.sep == ':' and not ':' in head: head = head + ':' mkdirs(head) From loewis@users.sourceforge.net Sat Aug 3 22:38:29 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 Aug 2002 14:38:29 -0700 Subject: [Python-checkins] python/dist/src README,1.150,1.151 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv14786 Modified Files: README Log Message: Document that --enable-shared puts PIC objects into the static libpython. Fixes #589429. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** README 31 Jul 2002 09:55:25 -0000 1.150 --- README 3 Aug 2002 21:38:27 -0000 1.151 *************** *** 643,647 **** into a shared library, which can then be used by the interpreter executable, and by applications embedding Python. To enable this feature, ! configure with --enable-shared. --- 643,653 ---- into a shared library, which can then be used by the interpreter executable, and by applications embedding Python. To enable this feature, ! configure with --enable-shared. ! ! If you do so, a static library will be created in addition to the ! shared library, which uses the same object files as the shared library ! In particular, the library likely object files using ! position-independent code (PIC) if PIC flags are needed for the shared ! library. From akuchling@users.sourceforge.net Sun Aug 4 02:20:07 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat, 03 Aug 2002 18:20:07 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv26702 Modified Files: whatsnew23.tex Log Message: Add two reminders Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** whatsnew23.tex 28 Jul 2002 20:29:03 -0000 1.41 --- whatsnew23.tex 4 Aug 2002 01:20:05 -0000 1.42 *************** *** 18,21 **** --- 18,25 ---- % Bug #580462: changes to GC API % + % heapq module + % + % MacOS framework-related changes (section of its own, probably) + % %\section{Introduction \label{intro}} From aimacintyre@users.sourceforge.net Sun Aug 4 07:17:10 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 03 Aug 2002 23:17:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils emxccompiler.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv4526 Modified Files: emxccompiler.py Log Message: add parameter missing following Jeremy's compiler class refactoring Index: emxccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/emxccompiler.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** emxccompiler.py 18 Jun 2002 18:46:44 -0000 1.5 --- emxccompiler.py 4 Aug 2002 06:17:08 -0000 1.6 *************** *** 77,81 **** # __init__ () ! def _compile(self, obj, src, ext, cc_args, extra_postargs): if ext == '.rc': # gcc requires '.rc' compiled to binary ('.res') files !!! --- 77,81 ---- # __init__ () ! def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): if ext == '.rc': # gcc requires '.rc' compiled to binary ('.res') files !!! From aimacintyre@users.sourceforge.net Sun Aug 4 07:21:27 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 03 Aug 2002 23:21:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils emxccompiler.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv5140 Modified Files: emxccompiler.py Log Message: - comment improvement - implement viable library search routine for EMX Index: emxccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/emxccompiler.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** emxccompiler.py 4 Aug 2002 06:17:08 -0000 1.6 --- emxccompiler.py 4 Aug 2002 06:21:25 -0000 1.7 *************** *** 178,182 **** # -- Miscellaneous methods ----------------------------------------- ! # overwrite the one from CCompiler to support rc and res-files def object_filenames (self, source_filenames, --- 178,183 ---- # -- Miscellaneous methods ----------------------------------------- ! # override the object_filenames method from CCompiler to ! # support rc and res-files def object_filenames (self, source_filenames, *************** *** 204,207 **** --- 205,231 ---- # object_filenames () + + # override the find_library_file method from UnixCCompiler + # to deal with file naming/searching differences + def find_library_file(self, dirs, lib, debug=0): + shortlib = '%s.lib' % lib + longlib = 'lib%s.lib' % lib # this form very rare + + # get EMX's default library directory search path + try: + emx_dirs = os.environ['LIBRARY_PATH'].split(';') + except KeyError: + emx_dirs = [] + + for dir in dirs + emx_dirs: + shortlibp = os.path.join(dir, shortlib) + longlibp = os.path.join(dir, longlib) + if os.path.exists(shortlibp): + return shortlibp + elif os.path.exists(longlibp): + return longlibp + + # Oops, didn't find it in *any* of 'dirs' + return None # class EMXCCompiler From aimacintyre@users.sourceforge.net Sun Aug 4 07:26:52 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 03 Aug 2002 23:26:52 -0700 Subject: [Python-checkins] python/dist/src/Parser acceler.c,2.18,2.19 node.c,2.19,2.20 parsetok.c,2.31,2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv5790 Modified Files: acceler.c node.c parsetok.c Log Message: SF patch #578297: Change the parser and compiler to use PyMalloc. Only the files implementing processes that will request memory allocations small enough for PyMalloc to be a win have been changed, which are:- - Python/compile.c - Parser/acceler.c - Parser/node.c - Parser/parsetok.c This augments the aggressive overallocation strategy implemented by Tim Peters in PyNode_AddChild() [Parser/node.c], in reducing the impact of platform malloc()/realloc()/free() corner case behaviour. Such corner cases are known to be triggered by test_longexp and test_import. Jeremy Hylton, in accepting this patch, recommended this as a bugfix candidate for 2.2. While the changes to Python/compile.c and Parser/node.c backport easily (and could go in), the changes to Parser/acceler.c and Parser/parsetok.c require other not insignificant changes as a result of the differences in the memory APIs between 2.3 and 2.2, which I'm not in a position to work through at the moment. This is a pity, as the Parser/parsetok.c changes are the most important after the Parser/node.c changes, due to the size of the memory requests involved and their frequency. Index: acceler.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/acceler.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** acceler.c 11 Jul 2002 15:43:37 -0000 2.18 --- acceler.c 4 Aug 2002 06:26:49 -0000 2.19 *************** *** 45,49 **** for (j = 0; j < d->d_nstates; j++, s++) { if (s->s_accel) ! PyMem_DEL(s->s_accel); s->s_accel = NULL; } --- 45,49 ---- for (j = 0; j < d->d_nstates; j++, s++) { if (s->s_accel) ! PyObject_FREE(s->s_accel); s->s_accel = NULL; } *************** *** 69,73 **** int nl = g->g_ll.ll_nlabels; s->s_accept = 0; ! accel = PyMem_NEW(int, nl); for (k = 0; k < nl; k++) accel[k] = -1; --- 69,73 ---- int nl = g->g_ll.ll_nlabels; s->s_accept = 0; ! accel = (int *) PyObject_MALLOC(nl * sizeof(int)); for (k = 0; k < nl; k++) accel[k] = -1; *************** *** 125,129 **** if (k < nl) { int i; ! s->s_accel = PyMem_NEW(int, nl-k); if (s->s_accel == NULL) { fprintf(stderr, "no mem to add parser accelerators\n"); --- 125,129 ---- if (k < nl) { int i; ! s->s_accel = (int *) PyObject_MALLOC((nl-k) * sizeof(int)); if (s->s_accel == NULL) { fprintf(stderr, "no mem to add parser accelerators\n"); *************** *** 135,138 **** s->s_accel[i] = accel[k]; } ! PyMem_DEL(accel); } --- 135,138 ---- s->s_accel[i] = accel[k]; } ! PyObject_FREE(accel); } Index: node.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/node.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** node.c 15 Jul 2002 17:58:03 -0000 2.19 --- node.c 4 Aug 2002 06:26:49 -0000 2.20 *************** *** 8,12 **** PyNode_New(int type) { ! node *n = PyMem_NEW(node, 1); if (n == NULL) return NULL; --- 8,12 ---- PyNode_New(int type) { ! node *n = (node *) PyObject_MALLOC(1 * sizeof(node)); if (n == NULL) return NULL; *************** *** 93,97 **** if (current_capacity < required_capacity) { n = n1->n_child; ! PyMem_RESIZE(n, node, required_capacity); if (n == NULL) return E_NOMEM; --- 93,98 ---- if (current_capacity < required_capacity) { n = n1->n_child; ! n = (node *) PyObject_REALLOC(n, ! required_capacity * sizeof(node)); if (n == NULL) return E_NOMEM; *************** *** 117,121 **** if (n != NULL) { freechildren(n); ! PyMem_DEL(n); } } --- 118,122 ---- if (n != NULL) { freechildren(n); ! PyObject_FREE(n); } } *************** *** 128,133 **** freechildren(CHILD(n, i)); if (n->n_child != NULL) ! PyMem_DEL(n->n_child); if (STR(n) != NULL) ! PyMem_DEL(STR(n)); } --- 129,134 ---- freechildren(CHILD(n, i)); if (n->n_child != NULL) ! PyObject_FREE(n->n_child); if (STR(n) != NULL) ! PyObject_FREE(STR(n)); } Index: parsetok.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/parsetok.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** parsetok.c 9 Jul 2002 09:23:27 -0000 2.31 --- parsetok.c 4 Aug 2002 06:26:49 -0000 2.32 *************** *** 134,138 **** started = 1; len = b - a; /* XXX this may compute NULL - NULL */ ! str = PyMem_NEW(char, len + 1); if (str == NULL) { fprintf(stderr, "no mem for next token\n"); --- 134,138 ---- started = 1; len = b - a; /* XXX this may compute NULL - NULL */ ! str = (char *) PyObject_MALLOC(len + 1); if (str == NULL) { fprintf(stderr, "no mem for next token\n"); *************** *** 158,162 **** &(err_ret->expected))) != E_OK) { if (err_ret->error != E_DONE) ! PyMem_DEL(str); break; } --- 158,162 ---- &(err_ret->expected))) != E_OK) { if (err_ret->error != E_DONE) ! PyObject_FREE(str); break; } *************** *** 179,183 **** if (tok->buf != NULL) { size_t len = tok->inp - tok->buf; ! err_ret->text = PyMem_NEW(char, len + 1); if (err_ret->text != NULL) { if (len > 0) --- 179,183 ---- if (tok->buf != NULL) { size_t len = tok->inp - tok->buf; ! err_ret->text = (char *) PyObject_MALLOC(len + 1); if (err_ret->text != NULL) { if (len > 0) From aimacintyre@users.sourceforge.net Sun Aug 4 07:28:23 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 03 Aug 2002 23:28:23 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.248,2.249 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv6008 Modified Files: compile.c Log Message: SF patch #578297: Change the parser and compiler to use PyMalloc. Only the files implementing processes that will request memory allocations small enough for PyMalloc to be a win have been changed, which are:- - Python/compile.c - Parser/acceler.c - Parser/node.c - Parser/parsetok.c This augments the aggressive overallocation strategy implemented by Tim Peters in PyNode_AddChild() [Parser/node.c], in reducing the impact of platform malloc()/realloc()/free() corner case behaviour. Such corner cases are known to be triggered by test_longexp and test_import. Jeremy Hylton, in accepting this patch, recommended this as a bugfix candidate for 2.2. While the changes to Python/compile.c and Parser/node.c backport easily (and could go in), the changes to Parser/acceler.c and Parser/parsetok.c require other not insignificant changes as a result of the differences in the memory APIs between 2.3 and 2.2, which I'm not in a position to work through at the moment. This is a pity, as the Parser/parsetok.c changes are the most important after the Parser/node.c changes, due to the size of the memory requests involved and their frequency. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.248 retrieving revision 2.249 diff -C2 -d -r2.248 -r2.249 *** compile.c 25 Jul 2002 06:18:42 -0000 2.248 --- compile.c 4 Aug 2002 06:28:21 -0000 2.249 *************** *** 720,724 **** Py_XDECREF(c->c_lnotab); if (c->c_future) ! PyMem_Free((void *)c->c_future); } --- 720,724 ---- Py_XDECREF(c->c_lnotab); if (c->c_future) ! PyObject_FREE((void *)c->c_future); } *************** *** 2021,2025 **** } if (childtype == MINUS) { ! char *s = PyMem_Malloc(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); --- 2021,2025 ---- } if (childtype == MINUS) { ! char *s = PyObject_MALLOC(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); *************** *** 2029,2033 **** s[0] = '-'; strcpy(s + 1, STR(pnum)); ! PyMem_Free(STR(pnum)); STR(pnum) = s; } --- 2029,2033 ---- s[0] = '-'; strcpy(s + 1, STR(pnum)); ! PyObject_FREE(STR(pnum)); STR(pnum) = s; } *************** *** 4117,4121 **** st = symtable_init(); if (st == NULL) { ! PyMem_Free((void *)ff); return NULL; } --- 4117,4121 ---- st = symtable_init(); if (st == NULL) { ! PyObject_FREE((void *)ff); return NULL; } *************** *** 4130,4134 **** return st; fail: ! PyMem_Free((void *)ff); st->st_future = NULL; PySymtable_Free(st); --- 4130,4134 ---- return st; fail: ! PyObject_FREE((void *)ff); st->st_future = NULL; PySymtable_Free(st); *************** *** 4723,4727 **** struct symtable *st; ! st = (struct symtable *)PyMem_Malloc(sizeof(struct symtable)); if (st == NULL) return NULL; --- 4723,4727 ---- struct symtable *st; ! st = (struct symtable *)PyObject_MALLOC(sizeof(struct symtable)); if (st == NULL) return NULL; *************** *** 4750,4754 **** Py_XDECREF(st->st_stack); Py_XDECREF(st->st_cur); ! PyMem_Free((void *)st); } --- 4750,4754 ---- Py_XDECREF(st->st_stack); Py_XDECREF(st->st_cur); ! PyObject_FREE((void *)st); } From tim_one@users.sourceforge.net Sun Aug 4 07:53:20 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 Aug 2002 23:53:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_imaplib.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9500/python/Lib/test Modified Files: test_imaplib.py Log Message: I don't know what's going on with this test, but the last change from Piers obviously couldn't have passed on any platform. Fiddling it so it works (for a meaning of "works" no stronger than "doesn't fail" ). Index: test_imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imaplib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_imaplib.py 3 Aug 2002 11:14:43 -0000 1.8 --- test_imaplib.py 4 Aug 2002 06:53:18 -0000 1.9 *************** *** 7,11 **** timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), ! "18-May-2033 05:33:20 +0200"] for t in timevalues: --- 7,11 ---- timevalues = [2000000000, 2000000000.0, time.localtime(2000000000), ! '"18-May-2033 05:33:20 +0200"'] for t in timevalues: From aimacintyre@users.sourceforge.net Sun Aug 4 08:26:01 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sun, 04 Aug 2002 00:26:01 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.449,1.450 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv14499 Modified Files: NEWS Log Message: OS/2 EMX now supported Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.449 retrieving revision 1.450 diff -C2 -d -r1.449 -r1.450 *** NEWS 2 Aug 2002 18:05:20 -0000 1.449 --- NEWS 4 Aug 2002 07:25:58 -0000 1.450 *************** *** 453,456 **** --- 453,458 ---- - AtheOS is now supported. + - the EMX runtime environment on OS/2 is now supported. + - GNU/Hurd is now supported. From loewis@users.sourceforge.net Sun Aug 4 09:20:26 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 01:20:26 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21958 Modified Files: cPickle.c Log Message: Add recursion counter for pickling. Fixes #576084. 2.2 bugfix candidate (may cause RuntimeError for applications that currently work fine). Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -d -r2.92 -r2.93 *** cPickle.c 2 Aug 2002 02:27:13 -0000 2.92 --- cPickle.c 4 Aug 2002 08:20:23 -0000 2.93 *************** *** 277,280 **** --- 277,281 ---- 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; *************** *** 1868,1871 **** --- 1869,1878 ---- 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) { *************** *** 2093,2096 **** --- 2100,2104 ---- finally: + self->nesting--; Py_XDECREF(py_ob_id); Py_XDECREF(__reduce__); *************** *** 2315,2318 **** --- 2323,2327 ---- self->bin = bin; self->fast = 0; + self->nesting = 0; self->fast_container = 0; self->fast_memo = NULL; From loewis@users.sourceforge.net Sun Aug 4 09:24:51 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 01:24:51 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.71,2.72 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22513 Modified Files: pyexpat.c Log Message: Add trace_frame. Fixes #534864. Backported to 2.2. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.71 retrieving revision 2.72 diff -C2 -d -r2.71 -r2.72 *** pyexpat.c 19 Jul 2002 22:03:03 -0000 2.71 --- pyexpat.c 4 Aug 2002 08:24:49 -0000 2.72 *************** *** 265,268 **** --- 265,295 ---- } + static int + trace_frame(PyThreadState *tstate, PyFrameObject *f, int code, PyObject *val) + { + int result = 0; + if (!tstate->use_tracing || tstate->tracing) + return 0; + if (tstate->c_profilefunc != NULL) { + tstate->tracing++; + result = tstate->c_profilefunc(tstate->c_profileobj, + f, code , val); + tstate->use_tracing = ((tstate->c_tracefunc != NULL) + || (tstate->c_profilefunc != NULL)); + tstate->tracing--; + if (result) + return result; + } + if (tstate->c_tracefunc != NULL) { + tstate->tracing++; + result = tstate->c_tracefunc(tstate->c_traceobj, + f, code , val); + tstate->use_tracing = ((tstate->c_tracefunc != NULL) + || (tstate->c_profilefunc != NULL)); + tstate->tracing--; + } + return result; + } + static PyObject* call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args) *************** *** 274,277 **** --- 301,305 ---- if (c == NULL) return NULL; + f = PyFrame_New( tstate, /*back*/ *************** *** 283,289 **** --- 311,327 ---- return NULL; tstate->frame = f; + if (trace_frame(tstate, f, PyTrace_CALL, Py_None)) { + Py_DECREF(f); + return NULL; + } res = PyEval_CallObject(func, args); if (res == NULL && tstate->curexc_traceback == NULL) PyTraceBack_Here(f); + else { + if (trace_frame(tstate, f, PyTrace_RETURN, res)) { + Py_XDECREF(res); + res = NULL; + } + } tstate->frame = f->f_back; Py_DECREF(f); From loewis@users.sourceforge.net Sun Aug 4 09:26:51 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 01:26:51 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.57,2.57.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22813 Modified Files: Tag: release22-maint pyexpat.c Log Message: Add trace_frame. Fixes #534864. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.57 retrieving revision 2.57.6.1 diff -C2 -d -r2.57 -r2.57.6.1 *** pyexpat.c 8 Dec 2001 18:02:57 -0000 2.57 --- pyexpat.c 4 Aug 2002 08:26:49 -0000 2.57.6.1 *************** *** 353,356 **** --- 353,383 ---- } + static int + trace_frame(PyThreadState *tstate, PyFrameObject *f, int code, PyObject *val) + { + int result = 0; + if (!tstate->use_tracing || tstate->tracing) + return 0; + if (tstate->c_profilefunc != NULL) { + tstate->tracing++; + result = tstate->c_profilefunc(tstate->c_profileobj, + f, code , val); + tstate->use_tracing = ((tstate->c_tracefunc != NULL) + || (tstate->c_profilefunc != NULL)); + tstate->tracing--; + if (result) + return result; + } + if (tstate->c_tracefunc != NULL) { + tstate->tracing++; + result = tstate->c_tracefunc(tstate->c_traceobj, + f, code , val); + tstate->use_tracing = ((tstate->c_tracefunc != NULL) + || (tstate->c_profilefunc != NULL)); + tstate->tracing--; + } + return result; + } + static PyObject* call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args) *************** *** 362,365 **** --- 389,393 ---- if (c == NULL) return NULL; + f = PyFrame_New( tstate, /*back*/ *************** *** 371,377 **** --- 399,415 ---- return NULL; tstate->frame = f; + if (trace_frame(tstate, f, PyTrace_CALL, Py_None)) { + Py_DECREF(f); + return NULL; + } res = PyEval_CallObject(func, args); if (res == NULL && tstate->curexc_traceback == NULL) PyTraceBack_Here(f); + else { + if (trace_frame(tstate, f, PyTrace_RETURN, res)) { + Py_XDECREF(res); + res = NULL; + } + } tstate->frame = f->f_back; Py_DECREF(f); From loewis@users.sourceforge.net Sun Aug 4 13:38:52 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 05:38:52 -0700 Subject: [Python-checkins] python/dist/src configure,1.328,1.329 configure.in,1.339,1.340 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2977 Modified Files: configure configure.in Log Message: Always link libpython.so with LIBS. Fixes #589422. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.328 retrieving revision 1.329 diff -C2 -d -r1.328 -r1.329 *** configure 1 Aug 2002 21:57:48 -0000 1.328 --- configure 4 Aug 2002 12:38:49 -0000 1.329 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.338 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. --- 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. *************** *** 9002,9014 **** # library (with --enable-shared). # For platforms on which shared libraries are not allowed to have unresolved ! # symbols, this must be set to $(LIBS) (expanded by make). echo "$as_me:$LINENO: checking SHLIBS" >&5 echo $ECHO_N "checking SHLIBS... $ECHO_C" >&6 case "$ac_sys_system" in - atheos*) - SHLIBS='$(LIBS)';; *) ! SHLIBS='';; esac echo "$as_me:$LINENO: result: $SHLIBS" >&5 --- 9002,9016 ---- # library (with --enable-shared). # For platforms on which shared libraries are not allowed to have unresolved ! # symbols, this must be set to $(LIBS) (expanded by make). We do this even ! # if it is not required, since it creates a dependency of the shared library ! # to LIBS. This, in turn, means that applications linking the shared libpython ! # don't need to link LIBS explicitly. The default should be only changed ! # on systems where this approach causes problems. echo "$as_me:$LINENO: checking SHLIBS" >&5 echo $ECHO_N "checking SHLIBS... $ECHO_C" >&6 case "$ac_sys_system" in *) ! SHLIBS='$(LIBS)';; esac echo "$as_me:$LINENO: result: $SHLIBS" >&5 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.339 retrieving revision 1.340 diff -C2 -d -r1.339 -r1.340 *** configure.in 1 Aug 2002 21:57:48 -0000 1.339 --- configure.in 4 Aug 2002 12:38:50 -0000 1.340 *************** *** 1044,1055 **** # library (with --enable-shared). # For platforms on which shared libraries are not allowed to have unresolved ! # symbols, this must be set to $(LIBS) (expanded by make). AC_SUBST(SHLIBS) AC_MSG_CHECKING(SHLIBS) case "$ac_sys_system" in - atheos*) - SHLIBS='$(LIBS)';; *) ! SHLIBS='';; esac AC_MSG_RESULT($SHLIBS) --- 1044,1057 ---- # library (with --enable-shared). # For platforms on which shared libraries are not allowed to have unresolved ! # symbols, this must be set to $(LIBS) (expanded by make). We do this even ! # if it is not required, since it creates a dependency of the shared library ! # to LIBS. This, in turn, means that applications linking the shared libpython ! # don't need to link LIBS explicitly. The default should be only changed ! # on systems where this approach causes problems. AC_SUBST(SHLIBS) AC_MSG_CHECKING(SHLIBS) case "$ac_sys_system" in *) ! SHLIBS='$(LIBS)';; esac AC_MSG_RESULT($SHLIBS) From holdenweb@users.sourceforge.net Sun Aug 4 16:27:27 2002 From: holdenweb@users.sourceforge.net (holdenweb@users.sourceforge.net) Date: Sun, 04 Aug 2002 08:27:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libasynchat.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6285 Modified Files: libasynchat.tex Log Message: Remove a syntax error in the example, spotted by Walter Hofman. Index: libasynchat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasynchat.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libasynchat.tex 3 Jul 2002 18:36:39 -0000 1.1 --- libasynchat.tex 4 Aug 2002 15:27:25 -0000 1.2 *************** *** 236,240 **** if self.reading_headers: self.reading_headers = False ! self.parse_headers("".join(self.ibuffer) self.ibuffer = [] if self.op.upper() == "POST": --- 236,240 ---- if self.reading_headers: self.reading_headers = False ! self.parse_headers("".join(self.ibuffer)) self.ibuffer = [] if self.op.upper() == "POST": From loewis@users.sourceforge.net Sun Aug 4 18:23:02 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:23:02 -0700 Subject: [Python-checkins] python/dist/src/Lib getopt.py,1.22,1.23 inspect.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32660 Modified Files: getopt.py inspect.py Log Message: Add encoding declaration. Index: getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getopt.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** getopt.py 26 Jul 2002 11:34:49 -0000 1.22 --- getopt.py 4 Aug 2002 17:22:59 -0000 1.23 *************** *** 1,2 **** --- 1,3 ---- + # -*- coding: iso-8859-1 -*- """Parser for command line options. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** inspect.py 2 Jun 2002 18:55:56 -0000 1.36 --- inspect.py 4 Aug 2002 17:22:59 -0000 1.37 *************** *** 1,2 **** --- 1,3 ---- + # -*- coding: iso-8859-1 -*- """Get useful information from live Python objects. From loewis@users.sourceforge.net Sun Aug 4 18:28:36 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:28:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py,1.20,1.21 test_unicode.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1651a/test Modified Files: test_sax.py test_unicode.py Log Message: Add encoding declaration. Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_sax.py 23 Jul 2002 19:04:00 -0000 1.20 --- test_sax.py 4 Aug 2002 17:28:33 -0000 1.21 *************** *** 1,3 **** ! # regression test for SAX 2.0 # $Id$ --- 1,3 ---- ! # regression test for SAX 2.0 -*- coding: iso-8859-1 -*- # $Id$ Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** test_unicode.py 23 Jul 2002 19:04:08 -0000 1.59 --- test_unicode.py 4 Aug 2002 17:28:33 -0000 1.60 *************** *** 1,2 **** --- 1,3 ---- + # -*- coding: iso-8859-1 -*- """ Test script for the Unicode implementation. From loewis@users.sourceforge.net Sun Aug 4 18:29:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:54 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv1805 Modified Files: Makefile.pre.in Log Message: Patch #534304: Implement phase 1 of PEP 263. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** Makefile.pre.in 2 Aug 2002 11:24:11 -0000 1.92 --- Makefile.pre.in 4 Aug 2002 17:29:52 -0000 1.93 *************** *** 191,203 **** Parser/parser.o \ Parser/parsetok.o \ - Parser/tokenizer.o \ Parser/bitset.o \ Parser/metagrammar.o ! PARSER_OBJS= $(POBJS) Parser/myreadline.o PGOBJS= \ Objects/obmalloc.o \ Python/mysnprintf.o \ Parser/firstsets.o \ Parser/grammar.o \ --- 191,203 ---- Parser/parser.o \ Parser/parsetok.o \ Parser/bitset.o \ Parser/metagrammar.o ! PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o PGOBJS= \ Objects/obmalloc.o \ Python/mysnprintf.o \ + Parser/tokenizer_pgen.o \ Parser/firstsets.o \ Parser/grammar.o \ *************** *** 434,437 **** --- 434,439 ---- $(srcdir)/Include/grammar.h Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c + + Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c From loewis@users.sourceforge.net Sun Aug 4 18:29:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:54 -0700 Subject: [Python-checkins] python/dist/src/Grammar Grammar,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Grammar In directory usw-pr-cvs1:/tmp/cvs-serv1805/Grammar Modified Files: Grammar Log Message: Patch #534304: Implement phase 1 of PEP 263. Index: Grammar =================================================================== RCS file: /cvsroot/python/python/dist/src/Grammar/Grammar,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Grammar 24 May 2002 15:47:06 -0000 1.47 --- Grammar 4 Aug 2002 17:29:52 -0000 1.48 *************** *** 103,104 **** --- 103,107 ---- testlist1: test (',' test)* + + # not used in grammar, but may appear in "node" passed from Parser to Compiler + encoding_decl: NAME From loewis@users.sourceforge.net Sun Aug 4 18:29:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv1805/Doc/ref Modified Files: ref2.tex Log Message: Patch #534304: Implement phase 1 of PEP 263. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ref2.tex 18 Jun 2002 19:17:14 -0000 1.37 --- ref2.tex 4 Aug 2002 17:29:52 -0000 1.38 *************** *** 8,16 **** \index{token} ! Python uses the 7-bit \ASCII{} character set for program text and string ! literals. 8-bit characters may be used in string literals and comments ! but their interpretation is platform dependent; the proper way to ! insert 8-bit characters in string literals is by using octal or ! hexadecimal escape sequences. The run-time character set depends on the I/O devices connected to the --- 8,19 ---- \index{token} ! Python uses the 7-bit \ASCII{} character set for program text. ! \versionadded[An encoding declaration can be used to indicate that ! string literals and comments use an encoding different from ASCII.]{2.3} ! For compatibility with older versions, Python only warns if it finds ! 8-bit characters; those warnings should be corrected by either declaring ! an explicit encoding, or using escape sequences if those bytes are binary ! data, instead of characters. ! The run-time character set depends on the I/O devices connected to the *************** *** 69,72 **** --- 72,106 ---- \index{hash character} + + \subsection{Encoding declarations\label{encodings}} + + If a comment in the first or second line of the Python script matches + the regular expression "coding[=:]\s*([\w-_.]+)", this comment is + processed as an encoding declaration; the first group of this + expression names the encoding of the source code file. The recommended + forms of this expression are + + \begin{verbatim} + # -*- coding: -*- + \end{verbatim} + + which is recognized also by GNU Emacs, and + + \begin{verbatim} + # vim:fileencoding= + \end{verbatim} + + which is recognized by Bram Moolenar's VIM. In addition, if the first + bytes of the file are the UTF-8 signature ($'\xef\xbb\xbf'$), the + declared file encoding is UTF-8 (this is supported, among others, by + Microsoft's notepad.exe). + + If an encoding is declared, the encoding name must be recognized by + Python. % XXX there should be a list of supported encodings. + The encoding is used for all lexical analysis, in particular to find + the end of a string, and to interpret the contents of Unicode literals. + 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}} From loewis@users.sourceforge.net Sun Aug 4 18:29:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:54 -0700 Subject: [Python-checkins] python/dist/src/Include errcode.h,2.14,2.15 graminit.h,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv1805/Include Modified Files: errcode.h graminit.h Log Message: Patch #534304: Implement phase 1 of PEP 263. Index: errcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/errcode.h,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** errcode.h 1 Sep 2000 23:29:26 -0000 2.14 --- errcode.h 4 Aug 2002 17:29:52 -0000 2.15 *************** *** 26,29 **** --- 26,30 ---- #define E_TOODEEP 20 /* Too many indentation levels */ #define E_DEDENT 21 /* No matching outer block for dedent */ + #define E_DECODE 22 /* Error in decoding into Unicode */ #ifdef __cplusplus Index: graminit.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/graminit.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** graminit.h 24 May 2002 15:47:06 -0000 2.19 --- graminit.h 4 Aug 2002 17:29:52 -0000 2.20 *************** *** 66,67 **** --- 66,68 ---- #define list_if 321 #define testlist1 322 + #define encoding_decl 323 From loewis@users.sourceforge.net Sun Aug 4 18:29:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:54 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.450,1.451 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv1805/Misc Modified Files: NEWS Log Message: Patch #534304: Implement phase 1 of PEP 263. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.450 retrieving revision 1.451 diff -C2 -d -r1.450 -r1.451 *** NEWS 4 Aug 2002 07:25:58 -0000 1.450 --- NEWS 4 Aug 2002 17:29:52 -0000 1.451 *************** *** 7,10 **** --- 7,12 ---- Core and builtins + - Encoding declarations (PEP 263, phase 1) have been implemented. + - list.sort() has a new implementation. While cross-platform results may vary, and in data-dependent ways, this is much faster on many From loewis@users.sourceforge.net Sun Aug 4 18:29:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:55 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.261,2.262 compile.c,2.249,2.250 graminit.c,2.33,2.34 pythonrun.c,2.164,2.165 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1805/Python Modified Files: bltinmodule.c compile.c graminit.c pythonrun.c Log Message: Patch #534304: Implement phase 1 of PEP 263. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.261 retrieving revision 2.262 diff -C2 -d -r2.261 -r2.262 *** bltinmodule.c 30 Jun 2002 15:26:10 -0000 2.261 --- bltinmodule.c 4 Aug 2002 17:29:52 -0000 2.262 *************** *** 1366,1373 **** } } - PyMem_FREE(s); - return result; - } - if (v != NULL) { f = PySys_GetObject("stdout"); if (f == NULL) { --- 1366,1369 ---- *************** *** 1375,1382 **** --- 1371,1389 ---- return NULL; } + PyFile_SoftSpace(f, 0); + PyMem_FREE(s); + return result; + } + f = PySys_GetObject("stdout"); + if (f == NULL) { + PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + return NULL; + } + if (v != NULL) { if (Py_FlushLine() != 0 || PyFile_WriteObject(v, f, Py_PRINT_RAW) != 0) return NULL; } + PyFile_SoftSpace(f, 0); f = PySys_GetObject("stdin"); if (f == NULL) { Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.249 retrieving revision 2.250 diff -C2 -d -r2.249 -r2.250 *** compile.c 4 Aug 2002 06:28:21 -0000 2.249 --- compile.c 4 Aug 2002 17:29:52 -0000 2.250 *************** *** 486,489 **** --- 486,490 ---- struct symtable *c_symtable; /* pointer to module symbol table */ PyFutureFeatures *c_future; /* pointer to module's __future__ */ + char *c_encoding; /* source encoding (a borrowed reference) */ }; *************** *** 1183,1186 **** --- 1184,1204 ---- static PyObject * + decode_utf8(char **sPtr, char *end, char* encoding) + { + PyObject *u, *v; + char *s, *t; + t = s = *sPtr; + /* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */ + while (s < end && (*s & 0x80)) s++; + *sPtr = s; + u = PyUnicode_DecodeUTF8(t, s - t, NULL); + if (u == NULL) + return NULL; + v = PyUnicode_AsEncodedString(u, encoding, NULL); + Py_DECREF(u); + return v; + } + + static PyObject * parsestr(struct compiling *com, char *s) { *************** *** 1194,1197 **** --- 1212,1217 ---- int quote = first; int rawmode = 0; + char* encoding = ((com == NULL) ? NULL : com->c_encoding); + int need_encoding; int unicode = 0; *************** *** 1231,1240 **** #ifdef Py_USING_UNICODE if (unicode || Py_UnicodeFlag) { if (rawmode) ! v = PyUnicode_DecodeRawUnicodeEscape( ! s, len, NULL); else ! v = PyUnicode_DecodeUnicodeEscape( ! s, len, NULL); if (v == NULL) PyErr_SyntaxLocation(com->c_filename, com->c_lineno); --- 1251,1305 ---- #ifdef Py_USING_UNICODE if (unicode || Py_UnicodeFlag) { + PyObject *u, *w; + if (encoding == NULL) { + buf = s; + u = NULL; + } else if (strcmp(encoding, "iso-8859-1") == 0) { + buf = s; + u = NULL; + } else { + /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ + u = PyString_FromStringAndSize((char *)NULL, len * 4); + if (u == NULL) + return NULL; + p = buf = PyString_AsString(u); + end = s + len; + while (s < end) { + if (*s == '\\') { + *p++ = *s++; + if (*s & 0x80) { + strcpy(p, "u005c"); + p += 5; + } + } + if (*s & 0x80) { /* XXX inefficient */ + char *r; + int rn, i; + w = decode_utf8(&s, end, "utf-16-be"); + if (w == NULL) { + Py_DECREF(u); + return NULL; + } + r = PyString_AsString(w); + rn = PyString_Size(w); + assert(rn % 2 == 0); + for (i = 0; i < rn; i += 2) { + sprintf(p, "\\u%02x%02x", + r[i + 0] & 0xFF, + r[i + 1] & 0xFF); + p += 6; + } + Py_DECREF(w); + } else { + *p++ = *s++; + } + } + len = p - buf; + } if (rawmode) ! v = PyUnicode_DecodeRawUnicodeEscape(buf, len, NULL); else ! v = PyUnicode_DecodeUnicodeEscape(buf, len, NULL); ! Py_XDECREF(u); if (v == NULL) PyErr_SyntaxLocation(com->c_filename, com->c_lineno); *************** *** 1243,1249 **** } #endif ! if (rawmode || strchr(s, '\\') == NULL) ! return PyString_FromStringAndSize(s, len); ! v = PyString_FromStringAndSize((char *)NULL, len); if (v == NULL) return NULL; --- 1308,1328 ---- } #endif ! need_encoding = (encoding != NULL && ! strcmp(encoding, "utf-8") != 0 && ! strcmp(encoding, "iso-8859-1") != 0); ! if (rawmode || strchr(s, '\\') == NULL) { ! if (need_encoding) { ! PyObject* u = PyUnicode_DecodeUTF8(s, len, NULL); ! if (u == NULL) ! return NULL; ! v = PyUnicode_AsEncodedString(u, encoding, NULL); ! Py_DECREF(u); ! return v; ! } else { ! return PyString_FromStringAndSize(s, len); ! } ! } ! v = PyString_FromStringAndSize((char *)NULL, /* XXX 4 is enough? */ ! need_encoding ? len * 4 : len); if (v == NULL) return NULL; *************** *** 1252,1256 **** while (s < end) { if (*s != '\\') { ! *p++ = *s++; continue; } --- 1331,1349 ---- while (s < end) { if (*s != '\\') { ! ORDINAL: ! if (need_encoding && (*s & 0x80)) { ! char *r; ! int rn; ! PyObject* w = decode_utf8(&s, end, encoding); ! if (w == NULL) ! return NULL; ! r = PyString_AsString(w); ! rn = PyString_Size(w); ! memcpy(p, r, rn); ! p += rn; ! Py_DECREF(w); ! } else { ! *p++ = *s++; ! } continue; } *************** *** 1321,1326 **** default: *p++ = '\\'; ! *p++ = s[-1]; ! break; } } --- 1414,1419 ---- default: *p++ = '\\'; ! s--; ! goto ORDINAL; } } *************** *** 4150,4153 **** --- 4243,4252 ---- if (!com_init(&sc, filename)) return NULL; + if (TYPE(n) == encoding_decl) { + sc.c_encoding = STR(n); + n = CHILD(n, 0); + } else { + sc.c_encoding = NULL; + } if (base) { sc.c_private = base->c_private; *************** *** 4158,4161 **** --- 4257,4264 ---- sc.c_nested = 1; sc.c_flags |= base->c_flags & PyCF_MASK; + if (base->c_encoding != NULL) { + assert(sc.c_encoding == NULL); + sc.c_encoding = base->c_encoding; + } } else { sc.c_private = NULL; Index: graminit.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/graminit.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -d -r2.33 -r2.34 *** graminit.c 24 May 2002 15:47:06 -0000 2.33 --- graminit.c 4 Aug 2002 17:29:52 -0000 2.34 *************** *** 1464,1468 **** {2, arcs_66_1}, }; ! static dfa dfas[67] = { {256, "single_input", 0, 3, states_0, "\004\030\001\000\000\000\124\360\213\011\162\000\002\000\140\210\244\005\001"}, --- 1464,1478 ---- {2, arcs_66_1}, }; ! static arc arcs_67_0[1] = { ! {12, 1}, ! }; ! static arc arcs_67_1[1] = { ! {0, 1}, ! }; ! static state states_67[2] = { ! {1, arcs_67_0}, ! {1, arcs_67_1}, ! }; ! static dfa dfas[68] = { {256, "single_input", 0, 3, states_0, "\004\030\001\000\000\000\124\360\213\011\162\000\002\000\140\210\244\005\001"}, *************** *** 1599,1604 **** {322, "testlist1", 0, 2, states_66, "\000\020\001\000\000\000\000\000\000\000\000\000\002\000\140\210\244\005\000"}, }; ! static label labels[148] = { {0, "EMPTY"}, {256, 0}, --- 1609,1616 ---- {322, "testlist1", 0, 2, states_66, "\000\020\001\000\000\000\000\000\000\000\000\000\002\000\140\210\244\005\000"}, + {323, "encoding_decl", 0, 2, states_67, + "\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, }; ! static label labels[149] = { {0, "EMPTY"}, {256, 0}, *************** *** 1749,1757 **** {319, 0}, {321, 0}, }; grammar _PyParser_Grammar = { ! 67, dfas, ! {148, labels}, 256 }; --- 1761,1770 ---- {319, 0}, {321, 0}, + {323, 0}, }; grammar _PyParser_Grammar = { ! 68, dfas, ! {149, labels}, 256 }; Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.164 retrieving revision 2.165 diff -C2 -d -r2.164 -r2.165 *** pythonrun.c 9 Jul 2002 18:22:55 -0000 2.164 --- pythonrun.c 4 Aug 2002 17:29:52 -0000 2.165 *************** *** 1222,1225 **** --- 1222,1226 ---- { PyObject *v, *w, *errtype; + PyObject* u = NULL; char *msg = NULL; errtype = PyExc_SyntaxError; *************** *** 1273,1276 **** --- 1274,1288 ---- msg = "too many levels of indentation"; break; + case E_DECODE: { /* XXX */ + PyThreadState* tstate = PyThreadState_Get(); + PyObject* value = tstate->curexc_value; + if (value != NULL) { + u = PyObject_Repr(value); + if (u != NULL) { + msg = PyString_AsString(u); + break; + } + } + } default: fprintf(stderr, "error=%d\n", err->error); *************** *** 1279,1282 **** --- 1291,1295 ---- } w = Py_BuildValue("(sO)", msg, v); + Py_XDECREF(u); Py_XDECREF(v); PyErr_SetObject(errtype, w); From loewis@users.sourceforge.net Sun Aug 4 18:29:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:29:54 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer_pgen.c,NONE,2.1 parsetok.c,2.32,2.33 tokenizer.c,2.54,2.55 tokenizer.h,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv1805/Parser Modified Files: parsetok.c tokenizer.c tokenizer.h Added Files: tokenizer_pgen.c Log Message: Patch #534304: Implement phase 1 of PEP 263. --- NEW FILE: tokenizer_pgen.c --- #define PGEN #include "tokenizer.c" Index: parsetok.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/parsetok.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** parsetok.c 4 Aug 2002 06:26:49 -0000 2.32 --- parsetok.c 4 Aug 2002 17:29:52 -0000 2.33 *************** *** 9,12 **** --- 9,13 ---- #include "parsetok.h" #include "errcode.h" + #include "graminit.h" int Py_TabcheckFlag; *************** *** 46,51 **** } if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->filename = filename ? filename : ""; tok->altwarning = (tok->filename != NULL); if (Py_TabcheckFlag >= 2) --- 47,52 ---- } + tok->filename = filename ? filename : ""; if (Py_TabcheckFlag || Py_VerboseFlag) { tok->altwarning = (tok->filename != NULL); if (Py_TabcheckFlag >= 2) *************** *** 79,84 **** return NULL; } if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->filename = filename; tok->altwarning = (filename != NULL); if (Py_TabcheckFlag >= 2) --- 80,85 ---- return NULL; } + tok->filename = filename; if (Py_TabcheckFlag || Py_VerboseFlag) { tok->altwarning = (filename != NULL); if (Py_TabcheckFlag >= 2) *************** *** 186,189 **** --- 187,197 ---- } } + } else if (tok->encoding != NULL) { + node* r = PyNode_New(encoding_decl); + r->n_str = tok->encoding; + r->n_nchildren = 1; + r->n_child = n; + tok->encoding = NULL; + n = r; } Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -d -r2.54 -r2.55 *** tokenizer.c 14 Apr 2002 20:12:41 -0000 2.54 --- tokenizer.c 4 Aug 2002 17:29:52 -0000 2.55 *************** *** 6,13 **** --- 6,22 ---- #include + #include #include "tokenizer.h" #include "errcode.h" + #ifndef PGEN + #include "unicodeobject.h" + #include "stringobject.h" + #include "fileobject.h" + #include "codecs.h" + #include "abstract.h" + #endif /* PGEN */ + extern char *PyOS_Readline(char *); /* Return malloc'ed string including trailing \n; *************** *** 115,121 **** --- 124,537 ---- tok->alttabsize = 1; tok->altindstack[0] = 0; + tok->decoding_state = 0; + tok->decoding_erred = 0; + tok->read_coding_spec = 0; + tok->issued_encoding_warning = 0; + tok->encoding = NULL; + tok->decoding_readline = NULL; + tok->decoding_buffer = NULL; return tok; } + #ifdef PGEN + + static char * + decoding_fgets(char *s, int size, struct tok_state *tok) + { + return fgets(s, size, tok->fp); + } + + static int + decoding_feof(struct tok_state *tok) + { + return feof(tok->fp); + } + + static const char * + decode_str(const char *str, struct tok_state *tok) + { + return str; + } + + #else /* PGEN */ + + static char * + error_ret(struct tok_state *tok) /* XXX */ + { + tok->decoding_erred = 1; + if (tok->fp != NULL && tok->buf != NULL) /* see PyTokenizer_Free */ + PyMem_DEL(tok->buf); + tok->buf = NULL; + return NULL; /* as if it were EOF */ + } + + static char * + new_string(const char *s, int len) + { + char* result = PyMem_NEW(char, len + 1); + if (result != NULL) { + memcpy(result, s, len); + result[len] = '\0'; + } + return result; + } + + static char * + get_normal_name(char *s) /* for utf-8 and latin-1 */ + { + char buf[13]; + int i; + for (i = 0; i < 12; i++) { + int c = s[i]; + if (c == '\0') break; + else if (c == '_') buf[i] = '-'; + else buf[i] = tolower(c); + } + buf[i] = '\0'; + if (strcmp(buf, "utf-8") == 0 || + strncmp(buf, "utf-8-", 6) == 0) return "utf-8"; + else if (strcmp(buf, "latin-1") == 0 || + strcmp(buf, "iso-8859-1") == 0 || + strcmp(buf, "iso-latin-1") == 0 || + strncmp(buf, "latin-1-", 8) == 0 || + strncmp(buf, "iso-8859-1-", 11) == 0 || + strncmp(buf, "iso-latin-1-", 12) == 0) return "iso-8859-1"; + else return s; + } + + /* Return the coding spec in S, or NULL if none is found. */ + + static char * + get_coding_spec(const char *s, int size) + { + int i; + for (i = 0; i < size - 6; i++) { /* XXX inefficient search */ + const char* t = s + i; + if (strncmp(t, "coding", 6) == 0) { + const char* begin = NULL; + t += 6; + if (t[0] != ':' && t[0] != '=') + continue; + do { + t++; + } while (t[0] == '\x20' || t[0] == '\t'); + + begin = t; + while (isalnum(t[0]) || t[0] == '-' || t[0] == '_' || + t[0] == '.') + t++; + + if (begin < t) { + char* r = new_string(begin, t - begin); + char* q = get_normal_name(r); + if (r != q) { + assert(strlen(r) >= strlen(q)); + strcpy(r, q); + } + return r; + } + } + } + return NULL; + } + + /* Check whether the line contains a coding spec. If it does, + invoke the set_readline function for the new encoding. + This function receives the tok_state and the new encoding. + Return 1 on success, 0 on failure. */ + + static int + check_coding_spec(const char* line, int size, struct tok_state *tok, + int set_readline(struct tok_state *, const char *)) + { + int r = 1; + char* cs = get_coding_spec(line, size); + if (cs != NULL) { + tok->read_coding_spec = 1; + if (tok->encoding == NULL) { + assert(tok->decoding_state == 1); /* raw */ + if (strcmp(cs, "utf-8") == 0 || + strcmp(cs, "iso-8859-1") == 0) { + tok->encoding = cs; + } else { + r = set_readline(tok, cs); + if (r) { + tok->encoding = cs; + tok->decoding_state = -1; + } + } + } else { /* then, compare cs with BOM */ + r = (strcmp(tok->encoding, cs) == 0); + PyMem_DEL(cs); + } + } + return r; + } + + /* See whether the file starts with a BOM. If it does, + invoke the set_readline function with the new encoding. + Return 1 on success, 0 on failure. */ + + static int + check_bom(int get_char(struct tok_state *), + void unget_char(int, struct tok_state *), + int set_readline(struct tok_state *, const char *), + struct tok_state *tok) + { + int ch = get_char(tok); + tok->decoding_state = 1; + if (ch == EOF) { + return 1; + } else if (ch == 0xEF) { + ch = get_char(tok); if (ch != 0xBB) goto NON_BOM; + ch = get_char(tok); if (ch != 0xBF) goto NON_BOM; + #if 0 + /* Disable support for UTF-16 BOMs until a decision + is made whether this needs to be supported. */ + } else if (ch == 0xFE) { + ch = get_char(tok); if (ch != 0xFF) goto NON_BOM; + if (!set_readline(tok, "utf-16-be")) return 0; + tok->decoding_state = -1; + } else if (ch == 0xFF) { + ch = get_char(tok); if (ch != 0xFE) goto NON_BOM; + if (!set_readline(tok, "utf-16-le")) return 0; + tok->decoding_state = -1; + #endif + } else { + unget_char(ch, tok); + return 1; + } + tok->encoding = new_string("utf-8", 5); /* resulting is in utf-8 */ + return 1; + NON_BOM: + /* any token beginning with '\xEF', '\xFE', '\xFF' is a bad token */ + unget_char(0xFF, tok); /* XXX this will cause a syntax error */ + return 1; + } + + /* Read a line of text from TOK into S, using the stream in TOK. + Return NULL on failure, else S. */ + + static char * + fp_readl(char *s, int size, struct tok_state *tok) + { + PyObject* utf8; + PyObject* buf = tok->decoding_buffer; + if (buf == NULL) { + buf = PyObject_CallObject(tok->decoding_readline, NULL); + if (buf == NULL) return error_ret(tok); + } else { + tok->decoding_buffer = NULL; + } + utf8 = PyUnicode_AsUTF8String(buf); + Py_DECREF(buf); + if (utf8 == NULL) return error_ret(tok); + else { + const char* str = PyString_AsString(utf8); + assert(strlen(str) < size); /* XXX */ + strcpy(s, str); + Py_DECREF(utf8); + if (s[0] == '\0') return NULL; /* EOF */ + return s; + } + } + + /* Set the readline function for TOK to a StreamReader's + readline function. The StreamReader is named ENC. + + This function is called from check_bom and check_coding_spec. + + ENC is usually identical to the future value of tok->encoding, + except for the (currently unsupported) case of UTF-16. + + Return 1 on success, 0 on failure. */ + + static int + fp_setreadl(struct tok_state *tok, const char* enc) + { + PyObject *reader, *stream, *readline; + + stream = PyFile_FromFile(tok->fp, tok->filename, "rb", NULL); + if (stream == NULL) return 0; + + reader = PyCodec_StreamReader(enc, stream, NULL); + Py_DECREF(stream); + if (reader == NULL) return 0; + + readline = PyObject_GetAttrString(reader, "readline"); + Py_DECREF(reader); + if (readline == NULL) return 0; + + tok->decoding_readline = readline; + return 1; + } + + /* Fetch the next byte from TOK. */ + + static int fp_getc(struct tok_state *tok) { + return getc(tok->fp); + } + + /* Unfetch the last byte back into TOK. */ + + static void fp_ungetc(int c, struct tok_state *tok) { + ungetc(c, tok->fp); + } + + /* Read a line of input from TOK. Determine encoding + if necessary. */ + + static char * + decoding_fgets(char *s, int size, struct tok_state *tok) + { + char *line; + int warn = 0, badchar = 0; + for (;;) + if (tok->decoding_state < 0) { + /* We already have a codec associated with + this input. */ + line = fp_readl(s, size, tok); + break; + } else if (tok->decoding_state > 0) { + /* We want a 'raw' read. */ + line = Py_UniversalNewlineFgets(s, size, + tok->fp, NULL); + warn = 1; + break; + } else { + /* We have not yet determined the encoding. + If an encoding is found, use the file-pointer + reader functions from now on. */ + if (!check_bom(fp_getc, fp_ungetc, fp_setreadl, tok)) + return error_ret(tok); + assert(tok->decoding_state != 0); + } + if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) { + if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) { + return error_ret(tok); + } + } + #ifndef PGEN + if (warn && line && !tok->issued_encoding_warning && !tok->encoding) { + unsigned char *c; + for (c = line; *c; c++) + if (*c > 127) { + badchar = *c; + break; + } + } + if (badchar) { + char buf[200]; + sprintf(buf, "Non-ASCII character '\\x%.2x', " + "but no declared encoding", badchar); + PyErr_WarnExplicit(PyExc_DeprecationWarning, + buf, tok->filename, tok->lineno, + NULL, NULL); + tok->issued_encoding_warning = 1; + } + #endif + return line; + } + + static int + decoding_feof(struct tok_state *tok) + { + if (tok->decoding_state >= 0) { + return feof(tok->fp); + } else { + PyObject* buf = tok->decoding_buffer; + if (buf == NULL) { + buf = PyObject_CallObject(tok->decoding_readline, NULL); + if (buf == NULL) { + error_ret(tok); + return 1; + } else { + tok->decoding_buffer = buf; + } + } + return PyObject_Length(buf) == 0; + } + } + + /* Fetch a byte from TOK, using the string buffer. */ + + static int buf_getc(struct tok_state *tok) { + return *tok->str++; + } + + /* Unfetch a byte from TOK, using the string buffer. */ + + static void buf_ungetc(int c, struct tok_state *tok) { + tok->str--; + assert(*tok->str == c); /* tok->cur may point to read-only segment */ + } + + /* Set the readline function for TOK to ENC. For the string-based + tokenizer, this means to just record the encoding. */ + + static int buf_setreadl(struct tok_state *tok, const char* enc) { + tok->enc = enc; + return 1; + } + + /* Return a UTF-8 encoding Python string object from the + C byte string STR, which is encoded with ENC. */ + + static PyObject * + translate_into_utf8(const char* str, const char* enc) { + PyObject *utf8; + PyObject* buf = PyUnicode_Decode(str, strlen(str), enc, NULL); + if (buf == NULL) + return NULL; + utf8 = PyUnicode_AsUTF8String(buf); + Py_DECREF(buf); + return utf8; + } + + /* Decode a byte string STR for use as the buffer of TOK. + Look for encoding declarations inside STR, and record them + inside TOK. */ + + static const char * + decode_str(const char *str, struct tok_state *tok) + { + PyObject* utf8 = NULL; + const char *s; + int lineno = 0; + tok->enc = NULL; + tok->str = str; + if (!check_bom(buf_getc, buf_ungetc, buf_setreadl, tok)) + return NULL; + str = tok->str; /* string after BOM if any */ + assert(r); + if (tok->enc != NULL) { + utf8 = translate_into_utf8(str, tok->enc); + if (utf8 == NULL) + return NULL; + str = PyString_AsString(utf8); + } + for (s = str;; s++) { + if (*s == '\0') break; + else if (*s == '\n') { + lineno++; + if (lineno == 2) break; + } + } + tok->enc = NULL; + if (!check_coding_spec(str, s - str, tok, buf_setreadl)) + return NULL; + if (tok->enc != NULL) { + assert(utf8 == NULL); + utf8 = translate_into_utf8(str, tok->enc); + if (utf8 == NULL) + return NULL; + str = PyString_AsString(utf8); + } + assert(tok->decoding_buffer == NULL); + tok->decoding_buffer = utf8; /* CAUTION */ + return str; + } + + #endif /* PGEN */ /* Set up tokenizer for string */ *************** *** 127,130 **** --- 543,549 ---- if (tok == NULL) return NULL; + str = (char *)decode_str(str, tok); + if (str == NULL) + return NULL; tok->buf = tok->cur = tok->end = tok->inp = str; return tok; *************** *** 158,161 **** --- 577,584 ---- PyTokenizer_Free(struct tok_state *tok) { + if (tok->encoding != NULL) + PyMem_DEL(tok->encoding); + Py_XDECREF(tok->decoding_readline); + Py_XDECREF(tok->decoding_buffer); if (tok->fp != NULL && tok->buf != NULL) PyMem_DEL(tok->buf); *************** *** 247,252 **** tok->end = tok->buf + BUFSIZ; } ! if (Py_UniversalNewlineFgets(tok->buf, (int)(tok->end - tok->buf), ! tok->fp, NULL) == NULL) { tok->done = E_EOF; done = 1; --- 670,675 ---- tok->end = tok->buf + BUFSIZ; } ! if (decoding_fgets(tok->buf, (int)(tok->end - tok->buf), ! tok) == NULL) { tok->done = E_EOF; done = 1; *************** *** 260,264 **** else { cur = tok->cur - tok->buf; ! if (feof(tok->fp)) { tok->done = E_EOF; done = 1; --- 683,687 ---- else { cur = tok->cur - tok->buf; ! if (decoding_feof(tok)) { tok->done = E_EOF; done = 1; *************** *** 286,292 **** tok->start = curstart < 0 ? NULL : tok->buf + curstart; ! if (Py_UniversalNewlineFgets(tok->inp, (int)(tok->end - tok->inp), ! tok->fp, NULL) == NULL) { /* Last line does not end in \n, fake one */ --- 709,715 ---- tok->start = curstart < 0 ? NULL : tok->buf + curstart; ! if (decoding_fgets(tok->inp, (int)(tok->end - tok->inp), ! tok) == NULL) { /* Last line does not end in \n, fake one */ *************** *** 507,513 **** /* Get next token, after space stripping etc. */ ! int ! PyTokenizer_Get(register struct tok_state *tok, char **p_start, ! char **p_end) { register int c; --- 930,935 ---- /* Get next token, after space stripping etc. */ ! static int ! tok_get(register struct tok_state *tok, char **p_start, char **p_end) { register int c; *************** *** 916,919 **** --- 1338,1351 ---- } + int + PyTokenizer_Get(struct tok_state *tok, char **p_start, char **p_end) + { + int result = tok_get(tok, p_start, p_end); + if (tok->decoding_erred) { + result = ERRORTOKEN; + tok->done = E_DECODE; + } + return result; + } #ifdef Py_DEBUG Index: tokenizer.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** tokenizer.h 1 Sep 2000 23:29:28 -0000 2.16 --- tokenizer.h 4 Aug 2002 17:29:52 -0000 2.17 *************** *** 5,8 **** --- 5,9 ---- #endif + #include "object.h" /* Tokenizer interface */ *************** *** 39,42 **** --- 40,53 ---- int alttabsize; /* Alternate tab spacing */ int altindstack[MAXINDENT]; /* Stack of alternate indents */ + /* Stuff for PEP 0263 */ + int decoding_state; /* -1:decoding, 0:init, 1:raw */ + int decoding_erred; /* whether erred in decoding */ + int read_coding_spec; /* whether 'coding:...' has been read */ + int issued_encoding_warning; /* whether non-ASCII warning was issued */ + char *encoding; + PyObject *decoding_readline; /* codecs.open(...).readline */ + PyObject *decoding_buffer; + const char* enc; + const char* str; }; From tim_one@users.sourceforge.net Sun Aug 4 18:47:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:47:29 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.131,2.132 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4644/python/Objects Modified Files: listobject.c Log Message: Sped the usual case for sorting by calling PyObject_RichCompareBool directly when no comparison function is specified. This saves a layer of function call on every compare then. Measured speedups: i 2**i *sort \sort /sort 3sort +sort %sort ~sort =sort !sort 15 32768 12.5% 0.0% 0.0% 100.0% 0.0% 50.0% 100.0% 100.0% -50.0% 16 65536 8.7% 0.0% 0.0% 0.0% 0.0% 0.0% 12.5% 0.0% 0.0% 17 131072 8.0% 25.0% 0.0% 25.0% 0.0% 14.3% 5.9% 0.0% 0.0% 18 262144 6.3% -10.0% 12.5% 11.1% 0.0% 6.3% 5.6% 12.5% 0.0% 19 524288 5.3% 5.9% 0.0% 5.6% 0.0% 5.9% 5.4% 0.0% 2.9% 20 1048576 5.3% 2.9% 2.9% 5.1% 2.8% 1.3% 5.9% 2.9% 4.2% The best indicators are those that take significant time (larger i), and where sort doesn't do very few compares (so *sort and ~sort benefit most reliably). The large numbers are due to roundoff noise combined with platform variability; e.g., the 14.3% speedup for %sort at i=17 reflects a printed elapsed time of 0.18 seconds falling to 0.17, but a change in the last digit isn't really meaningful (indeed, if it really took 0.175 seconds, one electron having a lazy nanosecond could shift it to either value ). Similarly the 25% at 3sort i=17 was a meaningless change from 0.05 to 0.04. However, almost all the "meaningless changes" were in the same direction, which is good. The before-and-after times for *sort are clearest: before after 0.18 0.16 0.25 0.23 0.54 0.50 1.18 1.11 2.57 2.44 5.58 5.30 Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.131 retrieving revision 2.132 diff -C2 -d -r2.131 -r2.132 *** listobject.c 3 Aug 2002 02:28:24 -0000 2.131 --- listobject.c 4 Aug 2002 17:47:26 -0000 2.132 *************** *** 761,767 **** /* Comparison function. Takes care of calling a user-supplied ! * comparison function (any callable Python object). Calls the ! * standard comparison function, PyObject_RichCompareBool(), if the user- ! * supplied function is NULL. * Returns -1 on error, 1 if x < y, 0 if x >= y. */ --- 761,767 ---- /* Comparison function. Takes care of calling a user-supplied ! * comparison function (any callable Python object), which must not be ! * NULL (use the ISLT macro if you don't know, or call PyObject_RichCompareBool ! * with Py_LT if you know it's NULL). * Returns -1 on error, 1 if x < y, 0 if x >= y. */ *************** *** 773,779 **** int i; ! if (compare == NULL) ! return PyObject_RichCompareBool(x, y, Py_LT); ! /* Call the user's comparison function and translate the 3-way * result into true or false (or error). --- 773,777 ---- int i; ! assert(compare != NULL); /* Call the user's comparison function and translate the 3-way * result into true or false (or error). *************** *** 801,809 **** } ! /* Compare X to Y via islt(). Goto "fail" if the comparison raises an error. Else "k" is set to true iff X. X and Y are PyObject*s. */ ! #define IFLT(X, Y) if ((k = islt(X, Y, compare)) < 0) goto fail; \ if (k) --- 799,816 ---- } ! /* If COMPARE is NULL, calls PyObject_RichCompareBool with Py_LT, else calls ! * islt. This avoids a layer of function call in the usual case, and ! * sorting does many comparisons. ! * Returns -1 on error, 1 if x < y, 0 if x >= y. ! */ ! #define ISLT(X, Y, COMPARE) ((COMPARE) == NULL ? \ ! PyObject_RichCompareBool(X, Y, Py_LT) : \ ! islt(X, Y, COMPARE)) ! ! /* Compare X to Y via "<". Goto "fail" if the comparison raises an error. Else "k" is set to true iff X. X and Y are PyObject*s. */ ! #define IFLT(X, Y) if ((k = ISLT(X, Y, compare)) < 0) goto fail; \ if (k) *************** *** 1242,1246 **** */ for (;;) { ! k = islt(*pb, *pa, compare); if (k) { if (k < 0) --- 1249,1253 ---- */ for (;;) { ! k = ISLT(*pb, *pa, compare); if (k) { if (k < 0) *************** *** 1370,1374 **** */ for (;;) { ! k = islt(*pb, *pa, compare); if (k) { if (k < 0) --- 1377,1381 ---- */ for (;;) { ! k = ISLT(*pb, *pa, compare); if (k) { if (k < 0) *************** *** 1684,1687 **** --- 1691,1695 ---- } #undef IFLT + #undef ISLT int From tim_one@users.sourceforge.net Sun Aug 4 18:56:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:56:44 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv7455/python/Parser Modified Files: tokenizer.c Log Message: Squash compiler wng about signed-vs-unsigned mismatch. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** tokenizer.c 4 Aug 2002 17:29:52 -0000 2.55 --- tokenizer.c 4 Aug 2002 17:56:42 -0000 2.56 *************** *** 329,333 **** else { const char* str = PyString_AsString(utf8); ! assert(strlen(str) < size); /* XXX */ strcpy(s, str); Py_DECREF(utf8); --- 329,333 ---- else { const char* str = PyString_AsString(utf8); ! assert(strlen(str) < (size_t)size); /* XXX */ strcpy(s, str); Py_DECREF(utf8); From tim_one@users.sourceforge.net Sun Aug 4 18:58:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 04 Aug 2002 10:58:36 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv7727/python/Parser Modified Files: tokenizer.c Log Message: Repaired a fatal compiler error in the debug build: it's not clear what this was trying to assert, but the name it referenced didn't exist. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** tokenizer.c 4 Aug 2002 17:56:42 -0000 2.56 --- tokenizer.c 4 Aug 2002 17:58:34 -0000 2.57 *************** *** 504,508 **** return NULL; str = tok->str; /* string after BOM if any */ ! assert(r); if (tok->enc != NULL) { utf8 = translate_into_utf8(str, tok->enc); --- 504,508 ---- return NULL; str = tok->str; /* string after BOM if any */ ! assert(str); if (tok->enc != NULL) { utf8 = translate_into_utf8(str, tok->enc); From loewis@users.sourceforge.net Sun Aug 4 19:28:46 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 11:28:46 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv14354 Modified Files: tokenizer.c Log Message: Group statements properly. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -d -r2.57 -r2.58 *** tokenizer.c 4 Aug 2002 17:58:34 -0000 2.57 --- tokenizer.c 4 Aug 2002 18:28:44 -0000 2.58 *************** *** 320,324 **** if (buf == NULL) { buf = PyObject_CallObject(tok->decoding_readline, NULL); ! if (buf == NULL) return error_ret(tok); } else { tok->decoding_buffer = NULL; --- 320,325 ---- if (buf == NULL) { buf = PyObject_CallObject(tok->decoding_readline, NULL); ! if (buf == NULL) ! return error_ret(tok); } else { tok->decoding_buffer = NULL; *************** *** 326,330 **** utf8 = PyUnicode_AsUTF8String(buf); Py_DECREF(buf); ! if (utf8 == NULL) return error_ret(tok); else { const char* str = PyString_AsString(utf8); --- 327,332 ---- utf8 = PyUnicode_AsUTF8String(buf); Py_DECREF(buf); ! if (utf8 == NULL) ! return error_ret(tok); else { const char* str = PyString_AsString(utf8); *************** *** 353,365 **** stream = PyFile_FromFile(tok->fp, tok->filename, "rb", NULL); ! if (stream == NULL) return 0; reader = PyCodec_StreamReader(enc, stream, NULL); Py_DECREF(stream); ! if (reader == NULL) return 0; readline = PyObject_GetAttrString(reader, "readline"); Py_DECREF(reader); ! if (readline == NULL) return 0; tok->decoding_readline = readline; --- 355,370 ---- stream = PyFile_FromFile(tok->fp, tok->filename, "rb", NULL); ! if (stream == NULL) ! return 0; reader = PyCodec_StreamReader(enc, stream, NULL); Py_DECREF(stream); ! if (reader == NULL) ! return 0; readline = PyObject_GetAttrString(reader, "readline"); Py_DECREF(reader); ! if (readline == NULL) ! return 0; tok->decoding_readline = readline; *************** *** 387,391 **** char *line; int warn = 0, badchar = 0; ! for (;;) if (tok->decoding_state < 0) { /* We already have a codec associated with --- 392,396 ---- char *line; int warn = 0, badchar = 0; ! for (;;) { if (tok->decoding_state < 0) { /* We already have a codec associated with *************** *** 407,410 **** --- 412,416 ---- assert(tok->decoding_state != 0); } + } if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) { if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) { From loewis@users.sourceforge.net Sun Aug 4 21:10:31 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 13:10:31 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.58,2.59 tokenizer.h,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv6376/Parser Modified Files: tokenizer.c tokenizer.h Log Message: Make pgen compile with pydebug. Duplicate normalized names, as it may be longer than the old string. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** tokenizer.c 4 Aug 2002 18:28:44 -0000 2.58 --- tokenizer.c 4 Aug 2002 20:10:29 -0000 2.59 *************** *** 129,134 **** --- 129,136 ---- tok->issued_encoding_warning = 0; tok->encoding = NULL; + #ifndef PGEN tok->decoding_readline = NULL; tok->decoding_buffer = NULL; + #endif return tok; } *************** *** 226,231 **** char* q = get_normal_name(r); if (r != q) { ! assert(strlen(r) >= strlen(q)); ! strcpy(r, q); } return r; --- 228,233 ---- char* q = get_normal_name(r); if (r != q) { ! PyMem_DEL(r); ! r = new_string(q, strlen(q)); } return r; *************** *** 585,590 **** --- 587,594 ---- if (tok->encoding != NULL) PyMem_DEL(tok->encoding); + #ifndef PGEN Py_XDECREF(tok->decoding_readline); Py_XDECREF(tok->decoding_buffer); + #endif if (tok->fp != NULL && tok->buf != NULL) PyMem_DEL(tok->buf); Index: tokenizer.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.h,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** tokenizer.h 4 Aug 2002 17:29:52 -0000 2.17 --- tokenizer.h 4 Aug 2002 20:10:29 -0000 2.18 *************** *** 46,51 **** --- 46,53 ---- int issued_encoding_warning; /* whether non-ASCII warning was issued */ char *encoding; + #ifndef PGEN PyObject *decoding_readline; /* codecs.open(...).readline */ PyObject *decoding_buffer; + #endif const char* enc; const char* str; From jhylton@users.sourceforge.net Sun Aug 4 21:53:35 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 Aug 2002 13:53:35 -0700 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.9.18.2,2.9.18.3 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv16625/Include Modified Files: Tag: ast-branch symtable.h Log Message: Revise names. PySymtableEntry(Object) -> PySTEntry(Object): Just too much typing. scope_ty -> block_ty: It describes the type of the block. Scope will get used for local, global, free, etc. Add PyST_GetScope() used by compiler to determine global vs local vs ... Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9.18.2 retrieving revision 2.9.18.3 diff -C2 -d -r2.9.18.2 -r2.9.18.3 *** symtable.h 9 Jul 2002 13:22:00 -0000 2.9.18.2 --- symtable.h 4 Aug 2002 20:53:33 -0000 2.9.18.3 *************** *** 5,10 **** #endif ! typedef enum _scope_type { FunctionScope, ClassScope, ModuleScope } ! scope_ty; struct _symtable_entry; --- 5,10 ---- #endif ! typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } ! block_ty; struct _symtable_entry; *************** *** 17,21 **** PyObject *st_stack; /* stack of namespace info */ PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ ! int st_nscopes; /* number of scopes */ int st_errors; /* number of errors */ char *st_private; /* name of current class or NULL */ --- 17,21 ---- PyObject *st_stack; /* stack of namespace info */ PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ ! int st_nblocks; /* number of blocks */ int st_errors; /* number of errors */ char *st_private; /* name of current class or NULL */ *************** *** 26,52 **** typedef struct _symtable_entry { PyObject_HEAD ! PyObject *ste_id; /* int: key in st_symbols) */ ! PyObject *ste_symbols; /* dict: name to flags) */ ! PyObject *ste_name; /* string: name of scope */ PyObject *ste_varnames; /* list of variable names */ PyObject *ste_children; /* list of child ids */ ! scope_ty ste_type; /* module, class, or function */ ! int ste_lineno; /* first line of scope */ int ste_optimized; /* true if namespace can't be optimized */ ! int ste_nested; /* true if scope is nested */ ! int ste_child_free; /* true if a child scope has free variables, including free refs to globals */ int ste_generator; /* true if namespace is a generator */ int ste_opt_lineno; /* lineno of last exec or import * */ struct symtable *ste_table; ! } PySymtableEntryObject; ! extern DL_IMPORT(PyTypeObject) PySymtableEntry_Type; ! #define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type) ! extern DL_IMPORT(PySymtableEntryObject *) \ ! PySymtableEntry_New(struct symtable *, identifier, scope_ty, void *, ! int); DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); --- 26,52 ---- typedef struct _symtable_entry { PyObject_HEAD ! PyObject *ste_id; /* int: key in st_symbols */ ! PyObject *ste_symbols; /* dict: name to flags */ ! PyObject *ste_name; /* string: name of block */ PyObject *ste_varnames; /* list of variable names */ PyObject *ste_children; /* list of child ids */ ! block_ty ste_type; /* module, class, or function */ ! int ste_lineno; /* first line of block */ int ste_optimized; /* true if namespace can't be optimized */ ! int ste_nested; /* true if block is nested */ ! int ste_child_free; /* true if a child block has free variables, including free refs to globals */ int ste_generator; /* true if namespace is a generator */ int ste_opt_lineno; /* lineno of last exec or import * */ struct symtable *ste_table; ! } PySTEntryObject; ! extern DL_IMPORT(PyTypeObject) PySTEntry_Type; ! #define PySTEntry_Check(op) ((op)->ob_type == &PySTEntry_Type) ! extern DL_IMPORT(PySTEntryObject *) \ ! PySTEntry_New(struct symtable *, identifier, block_ty, void *, int); ! DL_IMPORT(int) PyST_GetScope(PyObject *, PyObject *); DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); *************** *** 65,69 **** #define DEF_DOUBLESTAR 2<<4 /* parameter is star-star arg */ #define DEF_INTUPLE 2<<5 /* name defined in tuple in parameters */ ! #define DEF_FREE 2<<6 /* name used but not defined in nested scope */ #define DEF_FREE_GLOBAL 2<<7 /* free variable is actually implicit global */ #define DEF_FREE_CLASS 2<<8 /* free variable from class's method */ --- 65,69 ---- #define DEF_DOUBLESTAR 2<<4 /* parameter is star-star arg */ #define DEF_INTUPLE 2<<5 /* name defined in tuple in parameters */ ! #define DEF_FREE 2<<6 /* name used but not defined in nested block */ #define DEF_FREE_GLOBAL 2<<7 /* free variable is actually implicit global */ #define DEF_FREE_CLASS 2<<8 /* free variable from class's method */ *************** *** 72,80 **** #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) ! #define LOCAL 1 ! #define GLOBAL_EXPLICIT 2 ! #define GLOBAL_IMPLICIT 3 ! #define FREE 4 ! #define CELL 5 #define OPT_IMPORT_STAR 1 --- 72,83 ---- #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) ! /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol ! table. GLOBAL is returned from PyST_GetScope() for either of them. ! It is stored in ste_symbols at bits 12-14. ! */ ! #define SCOPE_OFF 11 ! #define SCOPE_MASK 7 ! const int LOCAL = 1, GLOBAL_EXPLICIT = 2, GLOBAL_IMPLICIT = 3, FREE = 4, ! CELL = 5; #define OPT_IMPORT_STAR 1 From jhylton@users.sourceforge.net Sun Aug 4 21:54:07 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 Aug 2002 13:54:07 -0700 Subject: [Python-checkins] python/dist/src/Parser Python.asdl,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv16768/Parser Modified Files: Tag: ast-branch Python.asdl Log Message: typo Index: Python.asdl =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/Python.asdl,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** Python.asdl 9 Jul 2002 13:19:53 -0000 1.1.2.2 --- Python.asdl 4 Aug 2002 20:54:05 -0000 1.1.2.3 *************** *** 47,51 **** attributes (int lineno) ! -- BoolOp() can yuse left & right? expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) --- 47,51 ---- attributes (int lineno) ! -- BoolOp() can use left & right? expr = BoolOp(boolop op, expr* values) | BinOp(expr left, operator op, expr right) From montanaro@users.sourceforge.net Sun Aug 4 22:03:37 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:03:37 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.320,2.321 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19551 Modified Files: ceval.c Log Message: small speedup for constant and name access see sf #506436 Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.320 retrieving revision 2.321 diff -C2 -d -r2.320 -r2.321 *** ceval.c 17 Jul 2002 16:57:13 -0000 2.320 --- ceval.c 4 Aug 2002 21:03:35 -0000 2.321 *************** *** 495,498 **** --- 495,500 ---- PyCodeObject *co; unsigned char *first_instr; + PyObject *names; + PyObject *consts; #ifdef LLTRACE int lltrace; *************** *** 513,518 **** /* Code access macros */ ! #define GETCONST(i) (GETITEM(co->co_consts, (i))) ! #define GETNAMEV(i) (GETITEM(co->co_names, (i))) #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) --- 515,519 ---- /* Code access macros */ ! #define GETNAMEV(i) (GETITEM(names, (i))) #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) *************** *** 576,579 **** --- 577,582 ---- tstate->frame = f; co = f->f_code; + names = co->co_names; + consts = co->co_consts; fastlocals = f->f_localsplus; freevars = f->f_localsplus + f->f_nlocals; *************** *** 754,758 **** case LOAD_CONST: ! x = GETCONST(oparg); Py_INCREF(x); PUSH(x); --- 757,761 ---- case LOAD_CONST: ! x = GETITEM(consts, oparg); Py_INCREF(x); PUSH(x); From jhylton@users.sourceforge.net Sun Aug 4 22:12:26 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:12:26 -0700 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.3,2.10.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv21555/Python Modified Files: Tag: ast-branch symtable.c Log Message: Implement analysis of scope information for PySymtable_Analyze(). The results are accessible from PyST_GetScope(). A comment explains the details of the analysis; it seems much cleaner than the old implementation in compile.c, which tried to do everything in a single pass. The analysis is incomplete because it (probably) does not handle the case where a free variable is bound in a scope that declares the name global. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.3 retrieving revision 2.10.8.4 diff -C2 -d -r2.10.8.3 -r2.10.8.4 *** symtable.c 9 Jul 2002 13:22:01 -0000 2.10.8.3 --- symtable.c 4 Aug 2002 21:12:15 -0000 2.10.8.4 *************** *** 6,14 **** #include "structmember.h" ! PySymtableEntryObject * ! PySymtableEntry_New(struct symtable *st, identifier name, scope_ty scope, ! void *key, int lineno) { ! PySymtableEntryObject *ste = NULL; PyObject *k, *v; --- 6,14 ---- #include "structmember.h" ! PySTEntryObject * ! PySTEntry_New(struct symtable *st, identifier name, block_ty block, ! void *key, int lineno) { ! PySTEntryObject *ste = NULL; PyObject *k, *v; *************** *** 19,30 **** v = PyDict_GetItem(st->st_symbols, k); if (v) { ! assert(PySymtableEntry_Check(v)); Py_DECREF(k); Py_INCREF(v); ! return (PySymtableEntryObject *)v; } ! ste = (PySymtableEntryObject *)PyObject_New(PySymtableEntryObject, ! &PySymtableEntry_Type); ste->ste_table = st; ste->ste_id = k; --- 19,30 ---- v = PyDict_GetItem(st->st_symbols, k); if (v) { ! assert(PySTEntry_Check(v)); Py_DECREF(k); Py_INCREF(v); ! return (PySTEntryObject *)v; } ! ste = (PySTEntryObject *)PyObject_New(PySTEntryObject, ! &PySTEntry_Type); ste->ste_table = st; ste->ste_id = k; *************** *** 48,52 **** ste->ste_children = v; ! ste->ste_type = scope; ste->ste_optimized = 0; ste->ste_opt_lineno = 0; --- 48,52 ---- ste->ste_children = v; ! ste->ste_type = block; ste->ste_optimized = 0; ste->ste_opt_lineno = 0; *************** *** 56,60 **** ste->ste_nested = 0; else if (st->st_cur->ste_nested ! || st->st_cur->ste_type == FunctionScope) ste->ste_nested = 1; else --- 56,60 ---- ste->ste_nested = 0; else if (st->st_cur->ste_nested ! || st->st_cur->ste_type == FunctionBlock) ste->ste_nested = 1; else *************** *** 73,77 **** static PyObject * ! ste_repr(PySymtableEntryObject *ste) { char buf[256]; --- 73,77 ---- static PyObject * ! ste_repr(PySTEntryObject *ste) { char buf[256]; *************** *** 80,90 **** "", PyString_AS_STRING(ste->ste_name), ! PyInt_AS_LONG(ste->ste_id), ! ste->ste_lineno); return PyString_FromString(buf); } static void ! ste_dealloc(PySymtableEntryObject *ste) { ste->ste_table = NULL; --- 80,89 ---- "", PyString_AS_STRING(ste->ste_name), ! PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); return PyString_FromString(buf); } static void ! ste_dealloc(PySTEntryObject *ste) { ste->ste_table = NULL; *************** *** 97,101 **** } ! #define OFF(x) offsetof(PySymtableEntryObject, x) static PyMemberDef ste_memberlist[] = { --- 96,100 ---- } ! #define OFF(x) offsetof(PySTEntryObject, x) static PyMemberDef ste_memberlist[] = { *************** *** 112,120 **** }; ! PyTypeObject PySymtableEntry_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "symtable entry", ! sizeof(PySymtableEntryObject), 0, (destructor)ste_dealloc, /* tp_dealloc */ --- 111,119 ---- }; ! PyTypeObject PySTEntry_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "symtable entry", ! sizeof(PySTEntryObject), 0, (destructor)ste_dealloc, /* tp_dealloc */ *************** *** 154,160 **** }; ! static int symtable_enter_scope(struct symtable *st, identifier name, ! scope_ty scope, void *ast, int lineno); ! static int symtable_exit_scope(struct symtable *st, void *ast); static int symtable_visit_stmt(struct symtable *st, stmt_ty s); static int symtable_visit_expr(struct symtable *st, expr_ty s); --- 153,159 ---- }; ! static int symtable_enter_block(struct symtable *st, identifier name, ! block_ty block, void *ast, int lineno); ! static int symtable_exit_block(struct symtable *st, void *ast); static int symtable_visit_stmt(struct symtable *st, stmt_ty s); static int symtable_visit_expr(struct symtable *st, expr_ty s); *************** *** 216,220 **** st->st_filename = filename; st->st_future = future; ! symtable_enter_scope(st, GET_IDENTIFIER(top), ModuleScope, (void *)mod, 0); /* Any other top-level initialization? */ --- 215,219 ---- st->st_filename = filename; st->st_future = future; ! symtable_enter_block(st, GET_IDENTIFIER(top), ModuleBlock, (void *)mod, 0); /* Any other top-level initialization? */ *************** *** 228,251 **** } } ! symtable_exit_scope(st, (void *)mod); return st; } ! /* symtable_enter_scope() gets a reference via PySymtableEntry_New(). ! This reference is released when the scope is exited, via the DECREF ! in symtable_exit_scope(). */ static int ! symtable_exit_scope(struct symtable *st, void *ast) { int end; - if (st->st_pass == 1) - symtable_update_free_vars(st); Py_DECREF(st->st_cur); end = PyList_GET_SIZE(st->st_stack) - 1; ! st->st_cur = (PySymtableEntryObject *)PyList_GET_ITEM(st->st_stack, end); if (PySequence_DelItem(st->st_stack, end) < 0) --- 227,479 ---- } } ! symtable_exit_block(st, (void *)mod); return st; } + int + PySTEntry_GetScope(PySTEntryObject *ste, PyObject *name) + { + PyObject *v; + int flags; ! v = PyDict_GetItem(ste->ste_symbols, name); ! if (!v) ! return 0; ! assert(PyInt_Check(v)); ! flags = PyInt_AS_LONG(v); ! flags = (flags >> SCOPE_OFF) & SCOPE_MASK; ! return flags; ! } ! ! ! /* Analyze raw symbol information to determine scope of each name. ! ! The next several functions are helpers for PySymtable_Analyze(), ! which determines whether a name is local, global, or free. In addition, ! it determines which local variables are cell variables; they provide ! bindings that are used for free variables in enclosed blocks. ! ! There are also two kinds of free variables, implicit and explicit. An ! explicit global is declared with the global statement. An implicit ! global is a free variable for which the compiler has found no binding ! in an enclosing function scope. The implicit global is either a global ! or a builtin. Python's module and class blocks use the xxx_NAME opcodes ! to handle these names to implement slightly odd semantics. In such a ! block, the name is treated as global until it is assigned to; then it ! is treated as a local. ! ! The symbol table requires two passes to determine the scope of each name. ! The first pass collects raw facts from the AST: the name is a parameter ! here, the name is used by not defined here, etc. The second pass analyzes ! these facts during a pass over the PySTEntryObjects created during pass 1. ! ! When a function is entered during the second pass, the parent passes ! the set of all name bindings visible to its children. These bindings ! are used to determine if the variable is free or an implicit global. ! After doing the local analysis, it analyzes each of its child blocks ! using an updated set of name bindings. ! ! The children update the free variable set. If a local variable is free ! in a child, the variable is marked as a cell. The current function must ! provide runtime storage for the variable that may outlive the function's ! frame. Cell variables are removed from the free set before the analyze ! function returns to its parent. ! ! The sets of bound and free variables are implemented as dictionaries ! mapping strings to None. ! */ ! ! #define SET_SCOPE(DICT, NAME, I) { \ ! PyObject *o = PyInt_FromLong(I); \ ! if (!o) \ ! return 0; \ ! if (PyDict_SetItem((DICT), (NAME), o) < 0) \ ! return 0; \ ! } ! ! /* XXX handle this: ! def f(x): ! global y ! def g(): ! return x + y ! so that y is a global ! */ ! ! int ! analyze_name(PyObject *dict, PyObject *name, int flags, PyObject *bound, ! PyObject *local, PyObject *free) ! { ! if (flags & DEF_GLOBAL) { ! if (flags & DEF_PARAM) ! return 0; /* can't declare a parameter as global */ ! SET_SCOPE(dict, name, GLOBAL_EXPLICIT); ! return 1; ! } ! if (flags & DEF_BOUND) { ! SET_SCOPE(dict, name, LOCAL); ! if (PyDict_SetItem(local, name, Py_None) < 0) ! return 0; ! return 1; ! } ! if (bound && PyDict_GetItem(bound, name)) { ! SET_SCOPE(dict, name, FREE); ! if (PyDict_SetItem(free, name, Py_None) < 0) ! return 0; ! return 1; ! } ! else { ! SET_SCOPE(dict, name, GLOBAL_IMPLICIT); ! return 1; ! } ! return 0; /* Can't get here */ ! } ! ! #undef SET_SCOPE ! ! /* If a name is defined in free and also in locals, then this block ! provides the binding for the free variable. The name should be ! marked CELL in this block and removed from the free list. ! ! Note that the current block's free variables are included in free. ! That's safe because no name can be free and local in the same scope. ! */ ! ! int ! analyze_cells(PyObject *scope, PyObject *free) ! { ! PyObject *name, *v, *w; ! int flags, pos = 0, success = 0; ! ! w = PyInt_FromLong(CELL); ! if (!w) ! return 0; ! while (PyDict_Next(scope, &pos, &name, &v)) { ! assert(PyInt_Check(v)); ! flags = PyInt_AS_LONG(v); ! if (flags != LOCAL) ! continue; ! if (!PyDict_GetItem(free, name)) ! continue; ! /* Replace LOCAL with CELL for this name, and remove ! from free. It is safe to replace the value of name ! in the dict, because it will not cause a resize. ! */ ! if (PyDict_SetItem(scope, name, w) < 0) ! goto error; ! if (!PyDict_DelItem(free, name) < 0) ! goto error; ! } ! success = 1; ! error: ! Py_DECREF(w); ! return success; ! } ! ! /* Enter the final scope information into the st_symbols dict. */ ! int ! update_symbols(PyObject *symbols, PyObject *scope) ! { ! PyObject *name, *v, *u, *w; ! int i, flags, pos = 0; ! ! while (PyDict_Next(symbols, &pos, &name, &v)) { ! assert(PyInt_Check(v)); ! flags = PyInt_AS_LONG(v); ! w = PyDict_GetItem(scope, name); ! assert(w && PyInt_Check(w)); ! i = PyInt_AS_LONG(w); ! flags |= (i << SCOPE_OFF); ! u = PyInt_FromLong(flags); ! if (!PyDict_SetItem(symbols, name, u)) { ! Py_DECREF(u); ! return 0; ! } ! Py_DECREF(u); ! } ! return 1; ! } ! ! int ! analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free) ! { ! PyObject *name, *v, *local = NULL, *scope = NULL, *newbound = NULL; ! int i, flags, pos = 0, success = 0; ! ! local = PyDict_New(); ! if (!local) ! goto error; ! scope = PyDict_New(); ! if (!scope) ! goto error; ! ! while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) { ! flags = PyInt_AS_LONG(v); ! if (!analyze_name(scope, name, flags, bound, local, free)) ! goto error; ! } ! ! /* create a new bound dictionary to pass to children */ ! newbound = PyDict_New(); ! if (!newbound) ! goto error; ! if (ste->ste_type != ClassBlock) { ! if (PyDict_Update(newbound, local) < 0) ! goto error; ! } ! if (bound) { ! if (PyDict_Update(newbound, bound) < 0) ! goto error; ! } ! ! /* call analyze_block() on each child */ ! for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) { ! PyObject *c; ! c = PyDict_GetItem(ste->ste_table->st_symbols, ! PyList_GET_ITEM(ste->ste_children, i)); ! assert(c && PySTEntry_Check(c)); ! if (!analyze_block((PySTEntryObject *)c, local, free)) ! goto error; ! } ! ! if (!analyze_cells(scope, free)) ! goto error; ! if (!update_symbols(ste->ste_symbols, scope)) ! goto error; ! success = 1; ! error: ! Py_XDECREF(local); ! Py_XDECREF(scope); ! Py_XDECREF(newbound); ! return success; ! } ! ! int ! PySymtable_Analyze(struct symtable *st) ! { ! PyObject *free; ! int r; ! ! free = PyDict_New(); ! if (!free) ! return 0; ! r = analyze_block((PySTEntryObject *)st->st_global, NULL, free); ! Py_DECREF(free); ! return r; ! } ! ! ! /* symtable_enter_block() gets a reference via PySTEntry_New(). ! This reference is released when the block is exited, via the DECREF ! in symtable_exit_block(). */ static int ! symtable_exit_block(struct symtable *st, void *ast) { int end; Py_DECREF(st->st_cur); end = PyList_GET_SIZE(st->st_stack) - 1; ! st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, end); if (PySequence_DelItem(st->st_stack, end) < 0) *************** *** 255,262 **** static int ! symtable_enter_scope(struct symtable *st, identifier name, scope_ty scope, void *ast, int lineno) { ! PySymtableEntryObject *prev = NULL; if (st->st_cur) { --- 483,490 ---- static int ! symtable_enter_block(struct symtable *st, identifier name, block_ty block, void *ast, int lineno) { ! PySTEntryObject *prev = NULL; if (st->st_cur) { *************** *** 268,272 **** } } ! st->st_cur = PySymtableEntry_New(st, name, scope, ast, lineno); if (name == GET_IDENTIFIER(top)) st->st_global = st->st_cur->ste_symbols; --- 496,500 ---- } } ! st->st_cur = PySTEntry_New(st, name, block, ast, lineno); if (name == GET_IDENTIFIER(top)) st->st_global = st->st_cur->ste_symbols; *************** *** 357,373 **** if (s->v.FunctionDef.args->defaults) VISIT_SEQ(st, expr, s->v.FunctionDef.args->defaults); ! symtable_enter_scope(st, s->v.FunctionDef.name, FunctionScope, (void *)s, s->lineno); VISIT(st, arguments, s->v.FunctionDef.args); VISIT_SEQ(st, stmt, s->v.FunctionDef.body); ! symtable_exit_scope(st, s); break; case ClassDef_kind: symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL); VISIT_SEQ(st, expr, s->v.ClassDef.bases); ! symtable_enter_scope(st, s->v.ClassDef.name, ClassScope, (void *)s, s->lineno); VISIT_SEQ(st, stmt, s->v.ClassDef.body); ! symtable_exit_scope(st, s); break; case Return_kind: --- 585,601 ---- if (s->v.FunctionDef.args->defaults) VISIT_SEQ(st, expr, s->v.FunctionDef.args->defaults); ! symtable_enter_block(st, s->v.FunctionDef.name, FunctionBlock, (void *)s, s->lineno); VISIT(st, arguments, s->v.FunctionDef.args); VISIT_SEQ(st, stmt, s->v.FunctionDef.body); ! symtable_exit_block(st, s); break; case ClassDef_kind: symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL); VISIT_SEQ(st, expr, s->v.ClassDef.bases); ! symtable_enter_block(st, s->v.ClassDef.name, ClassBlock, (void *)s, s->lineno); VISIT_SEQ(st, stmt, s->v.ClassDef.body); ! symtable_exit_block(st, s); break; case Return_kind: *************** *** 490,497 **** VISIT(st, arguments, e->v.Lambda.args); /* XXX how to get line numbers for expressions */ ! symtable_enter_scope(st, GET_IDENTIFIER(lambda), ! FunctionScope, (void *)e, 0); VISIT(st, expr, e->v.Lambda.body); ! symtable_exit_scope(st, (void *)e); break; case Dict_kind: --- 718,725 ---- VISIT(st, arguments, e->v.Lambda.args); /* XXX how to get line numbers for expressions */ ! symtable_enter_block(st, GET_IDENTIFIER(lambda), ! FunctionBlock, (void *)e, 0); VISIT(st, expr, e->v.Lambda.body); ! symtable_exit_block(st, (void *)e); break; case Dict_kind: *************** *** 591,595 **** symtable_visit_arguments(struct symtable *st, arguments_ty a) { ! /* skip default arguments inside function scope XXX should ast be different? */ --- 819,823 ---- symtable_visit_arguments(struct symtable *st, arguments_ty a) { ! /* skip default arguments inside function block XXX should ast be different? */ From jhylton@users.sourceforge.net Sun Aug 4 22:12:57 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:12:57 -0700 Subject: [Python-checkins] python/dist/src/Modules symtablemodule.c,1.5.8.2,1.5.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21771/Modules Modified Files: Tag: ast-branch symtablemodule.c Log Message: Track scope -> block change in symtable.h. Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.5.8.2 retrieving revision 1.5.8.3 diff -C2 -d -r1.5.8.2 -r1.5.8.3 *** symtablemodule.c 9 Jul 2002 13:22:00 -0000 1.5.8.2 --- symtablemodule.c 4 Aug 2002 21:12:54 -0000 1.5.8.3 *************** *** 65,71 **** PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); ! PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionScope); ! PyModule_AddIntConstant(m, "TYPE_CLASS", ClassScope); ! PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleScope); PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); --- 65,71 ---- PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); ! PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock); ! PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock); ! PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); From jackjansen@users.sourceforge.net Sun Aug 4 22:17:22 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:17:22 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv22770 Modified Files: Makefile.pre.in Log Message: Use the -n option of ln in stead of -h, as it also works with other ln's people may have (fink, gnu). Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** Makefile.pre.in 4 Aug 2002 17:29:52 -0000 1.93 --- Makefile.pre.in 4 Aug 2002 21:17:20 -0000 1.94 *************** *** 367,374 **** $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings ! $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current ! $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python ! $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers ! $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources # This rule builds the Cygwin Python DLL --- 367,374 ---- $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj/InfoPlist.strings ! $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current ! $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKDIR)/Python ! $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers ! $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources # This rule builds the Cygwin Python DLL *************** *** 786,798 **** fi; \ done ! $(LN) -sf $(INCLUDEPY) $(FRAMEWORKFINALDEST)/Headers $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKFINALDEST)/Resources/Info.plist $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKFINALDEST)/Resources/version.plist $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ $(FRAMEWORKFINALDEST)/Resources/English.lproj/InfoPlist.strings ! $(LN) -fsh $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current ! $(LN) -fsh Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python ! $(LN) -fsh Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers ! $(LN) -fsh Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) --- 786,798 ---- fi; \ done ! $(LN) -fsn include/python$(VERSION) $(FRAMEWORKFINALDEST)/Headers $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKFINALDEST)/Resources/Info.plist $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKFINALDEST)/Resources/version.plist $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ $(FRAMEWORKFINALDEST)/Resources/English.lproj/InfoPlist.strings ! $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current ! $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python ! $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers ! $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) From jackjansen@users.sourceforge.net Sun Aug 4 22:19:57 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:19:57 -0700 Subject: [Python-checkins] python/dist/src README,1.151,1.152 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv23118 Modified Files: README Log Message: Changes to the OSX section: - steer people away from installing with sudo - warn that fink-installed software may cause trouble - explain why you might want a framework build and point people to Mac/OSX/README. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** README 3 Aug 2002 21:38:27 -0000 1.151 --- README 4 Aug 2002 21:19:55 -0000 1.152 *************** *** 461,474 **** On a clean OSX /usr/local does not exist. Do a "sudo mkdir -m 775 /usr/local" ! before you do a make install. Alternatively, do "sudo make install" ! which installs everything as superuser. You may want to try the configure option "--enable-framework" which installs Python as a framework. The location can be set as argument to the --enable-framework option (default ! /Library/Frameworks). You may also want to check out ./Mac/OSX ! for building a Python.app. You may also want to manually ! install a symlink in /usr/local/bin/python to the executable ! deep down in the framework. Cygwin: With recent (relative to the time of writing, 2001-12-19) --- 461,481 ---- On a clean OSX /usr/local does not exist. Do a "sudo mkdir -m 775 /usr/local" ! before you do a make install. It is probably not a good idea to ! do "sudo make install" which installs everything as superuser, ! as this may later cause problems when installing distutils-based ! additions. ! ! Some people have reported problems building Python after using "fink" ! to install additional unix software. Disabling fink (remove all references ! to /sw from your .profile or .login) should solve this. You may want to try the configure option "--enable-framework" which installs Python as a framework. The location can be set as argument to the --enable-framework option (default ! /Library/Frameworks). A framework install is probably needed if you ! want to use any Aqua-based GUI toolkit (whether Tkinter, wxPython, ! Carbon, Cocoa or anything else). ! ! See Mac/OSX/README for more information on framework builds. Cygwin: With recent (relative to the time of writing, 2001-12-19) From jackjansen@users.sourceforge.net Sun Aug 4 22:31:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:31:54 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv25909/ibcarbon Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon added to the repository From jackjansen@users.sourceforge.net Sun Aug 4 22:34:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:34:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon IBCarbonscan.py,NONE,1.1 IBCarbonsupport.py,NONE,1.1 _IBCarbon.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv26022 Added Files: IBCarbonscan.py IBCarbonsupport.py _IBCarbon.c Log Message: Donovan Preston's interface to IBCarbon, allowing you to use Interface Builder carbon NIB files from Python. As-is, I may need to twiddle a few things as he donated this long ago. Donovan is now one of the four people in the world who know how to drive bgen! --- NEW FILE: IBCarbonscan.py --- # IBCarbonscan.py import sys import os import string import MacOS BGENDIR= '/Users/dp/python/dist/src/Tools/bgen/bgen' sys.path.append(BGENDIR) print sys.path, sys.prefix from bgenlocations import TOOLBOXDIR from scantools import Scanner_OSX def main(): print "---Scanning IBCarbonRuntime.h---" input = ["IBCarbonRuntime.h"] output = "IBCarbongen.py" defsoutput = TOOLBOXDIR + "IBCarbonRuntime.py" scanner = IBCarbon_Scanner(input, output, defsoutput) scanner.scan() scanner.close() print "--done scanning, importing--" import IBCarbonsupport print "done" class IBCarbon_Scanner(Scanner_OSX): def destination(self, type, name, arglist): classname = "IBCarbonFunction" listname = "functions" if arglist: t, n, m = arglist[0] if t == "IBNibRef" and m == "InMode": classname = "IBCarbonMethod" listname = "methods" return classname, listname def makeblacklistnames(self): return [ "DisposeNibReference", # taken care of by destructor "CreateNibReferenceWithCFBundle", ## need to wrap CFBundle.h properly first ] if __name__ == "__main__": main() --- NEW FILE: IBCarbonsupport.py --- # IBCarbonsupport.py from macsupport import * CFStringRef = OpaqueByValueType('CFStringRef', 'CFStringRefObj') IBNibRef = OpaqueByValueType('IBNibRef', 'IBNibRefObj') #CFBundleRef = OpaqueByValueType('CFBundleRef') IBCarbonFunction = OSErrFunctionGenerator IBCarbonMethod = OSErrMethodGenerator includestuff = """ #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif /* WITHOUT_FRAMEWORKS */ #include "macglue.h" #ifdef USE_TOOLBOX_OBJECT_GLUE extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); //#define CFStringRefObj_Convert _CFStringRefObj_Convert #endif //extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle """ initstuff = """ """ module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff) class CFReleaserObject(GlobalObjectDefinition): def outputFreeIt(self, name): Output("CFRelease(%s);" % name) class CFNibDesc(GlobalObjectDefinition): def outputFreeIt(self, name): Output("DisposeNibReference(%s);" % name) #cfstringobject = CFReleaserObject("CFStringRef") #module.addobject(cfstringobject) #cfbundleobject = CFReleaserObject("CFBundleRef") #module.addobject(cfbundleobject) ibnibobject = CFNibDesc("IBNibRef", "IBNibRefObj") module.addobject(ibnibobject) functions = [] methods = [] execfile('IBCarbongen.py') for f in functions: module.add(f) for m in methods: ibnibobject.add(m) SetOutputFileName('_IBCarbon.c') module.generate() --- NEW FILE: _IBCarbon.c --- /* ======================== Module _IBCarbon ======================== */ #include "Python.h" #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif /* WITHOUT_FRAMEWORKS */ #include "macglue.h" #ifdef USE_TOOLBOX_OBJECT_GLUE extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); //#define CFStringRefObj_Convert _CFStringRefObj_Convert #endif //extern int CFBundleRefObj_Convert(PyObject *, CFBundleRef *); // need to wrap CFBundle static PyObject *IBCarbon_Error; /* ---------------------- Object type IBNibRef ---------------------- */ PyTypeObject IBNibRef_Type; #define IBNibRefObj_Check(x) ((x)->ob_type == &IBNibRef_Type) typedef struct IBNibRefObject { PyObject_HEAD IBNibRef ob_itself; } IBNibRefObject; PyObject *IBNibRefObj_New(IBNibRef itself) { IBNibRefObject *it; it = PyObject_NEW(IBNibRefObject, &IBNibRef_Type); if (it == NULL) return NULL; it->ob_itself = itself; return (PyObject *)it; } int IBNibRefObj_Convert(PyObject *v, IBNibRef *p_itself) { if (!IBNibRefObj_Check(v)) { PyErr_SetString(PyExc_TypeError, "IBNibRef required"); return 0; } *p_itself = ((IBNibRefObject *)v)->ob_itself; return 1; } static void IBNibRefObj_dealloc(IBNibRefObject *self) { DisposeNibReference(self->ob_itself); PyMem_DEL(self); } static PyObject *IBNibRefObj_CreateWindowFromNib(IBNibRefObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef inName; WindowPtr outWindow; if (!PyArg_ParseTuple(_args, "O&", CFStringRefObj_Convert, &inName)) return NULL; Py_BEGIN_ALLOW_THREADS _err = CreateWindowFromNib(_self->ob_itself, inName, &outWindow); Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", WinObj_New, outWindow); return _res; } static PyObject *IBNibRefObj_CreateMenuFromNib(IBNibRefObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef inName; MenuHandle outMenuRef; if (!PyArg_ParseTuple(_args, "O&", CFStringRefObj_Convert, &inName)) return NULL; Py_BEGIN_ALLOW_THREADS _err = CreateMenuFromNib(_self->ob_itself, inName, &outMenuRef); Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", MenuObj_New, outMenuRef); return _res; } static PyObject *IBNibRefObj_CreateMenuBarFromNib(IBNibRefObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef inName; Handle outMenuBar; if (!PyArg_ParseTuple(_args, "O&", CFStringRefObj_Convert, &inName)) return NULL; Py_BEGIN_ALLOW_THREADS _err = CreateMenuBarFromNib(_self->ob_itself, inName, &outMenuBar); Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", ResObj_New, outMenuBar); return _res; } static PyObject *IBNibRefObj_SetMenuBarFromNib(IBNibRefObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef inName; if (!PyArg_ParseTuple(_args, "O&", CFStringRefObj_Convert, &inName)) return NULL; Py_BEGIN_ALLOW_THREADS _err = SetMenuBarFromNib(_self->ob_itself, inName); Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyMethodDef IBNibRefObj_methods[] = { {"CreateWindowFromNib", (PyCFunction)IBNibRefObj_CreateWindowFromNib, 1, "(CFStringRef inName) -> (WindowPtr outWindow)"}, {"CreateMenuFromNib", (PyCFunction)IBNibRefObj_CreateMenuFromNib, 1, "(CFStringRef inName) -> (MenuHandle outMenuRef)"}, {"CreateMenuBarFromNib", (PyCFunction)IBNibRefObj_CreateMenuBarFromNib, 1, "(CFStringRef inName) -> (Handle outMenuBar)"}, {"SetMenuBarFromNib", (PyCFunction)IBNibRefObj_SetMenuBarFromNib, 1, "(CFStringRef inName) -> None"}, {NULL, NULL, 0} }; PyMethodChain IBNibRefObj_chain = { IBNibRefObj_methods, NULL }; static PyObject *IBNibRefObj_getattr(IBNibRefObject *self, char *name) { return Py_FindMethodInChain(&IBNibRefObj_chain, (PyObject *)self, name); } #define IBNibRefObj_setattr NULL #define IBNibRefObj_compare NULL #define IBNibRefObj_repr NULL #define IBNibRefObj_hash NULL PyTypeObject IBNibRef_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "_IBCarbon.IBNibRef", /*tp_name*/ sizeof(IBNibRefObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor) IBNibRefObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc) IBNibRefObj_getattr, /*tp_getattr*/ (setattrfunc) IBNibRefObj_setattr, /*tp_setattr*/ (cmpfunc) IBNibRefObj_compare, /*tp_compare*/ (reprfunc) IBNibRefObj_repr, /*tp_repr*/ (PyNumberMethods *)0, /* tp_as_number */ (PySequenceMethods *)0, /* tp_as_sequence */ (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) IBNibRefObj_hash, /*tp_hash*/ }; /* -------------------- End object type IBNibRef -------------------- */ static PyObject *IBCarbon_CreateNibReference(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef inNibName; IBNibRef outNibRef; if (!PyArg_ParseTuple(_args, "O&", CFStringRefObj_Convert, &inNibName)) return NULL; Py_BEGIN_ALLOW_THREADS _err = CreateNibReference(inNibName, &outNibRef); Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", IBNibRefObj_New, outNibRef); return _res; } static PyMethodDef IBCarbon_methods[] = { {"CreateNibReference", (PyCFunction)IBCarbon_CreateNibReference, 1, "(CFStringRef inNibName) -> (IBNibRef outNibRef)"}, {NULL, NULL, 0} }; void init_IBCarbon(void) { PyObject *m; PyObject *d; m = Py_InitModule("_IBCarbon", IBCarbon_methods); d = PyModule_GetDict(m); IBCarbon_Error = PyMac_GetOSErrException(); if (IBCarbon_Error == NULL || PyDict_SetItemString(d, "Error", IBCarbon_Error) != 0) return; IBNibRef_Type.ob_type = &PyType_Type; Py_INCREF(&IBNibRef_Type); if (PyDict_SetItemString(d, "IBNibRefType", (PyObject *)&IBNibRef_Type) != 0) Py_FatalError("can't initialize IBNibRefType"); } /* ====================== End module _IBCarbon ====================== */ From jackjansen@users.sourceforge.net Sun Aug 4 22:55:27 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:55:27 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen scantools.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv30919 Modified Files: scantools.py Log Message: Use universal newline input when scanning header files. Index: scantools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** scantools.py 9 Jun 2002 09:08:53 -0000 1.28 --- scantools.py 4 Aug 2002 21:55:25 -0000 1.29 *************** *** 220,224 **** def openrepairfile(self, filename = "REPAIR"): try: ! return open(filename, "r") except IOError, msg: print `filename`, ":", msg --- 220,224 ---- def openrepairfile(self, filename = "REPAIR"): try: ! return open(filename, "rU") except IOError, msg: print `filename`, ":", msg *************** *** 360,369 **** #self.report("trying full name %s", `fullname`) try: ! return open(fullname, 'r') except IOError: pass # If not on the path, or absolute, try default open() try: ! return open(filename, 'r') except IOError, arg: raise IOError, (arg, filename) --- 360,369 ---- #self.report("trying full name %s", `fullname`) try: ! return open(fullname, 'rU') except IOError: pass # If not on the path, or absolute, try default open() try: ! return open(filename, 'rU') except IOError, arg: raise IOError, (arg, filename) From jackjansen@users.sourceforge.net Sun Aug 4 22:56:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:56:15 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenlocations.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv31011 Modified Files: bgenlocations.py Log Message: Specify pathnames in a way that works on both OS9 and OSX. You'll still have to manually edit it, though... Index: bgenlocations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenlocations.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bgenlocations.py 1 Jan 2002 22:39:07 -0000 1.5 --- bgenlocations.py 4 Aug 2002 21:56:12 -0000 1.6 *************** *** 4,12 **** import sys, os # Where to find the Universal Header include files: ! MWERKSDIR="Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:" ! INCLUDEDIR=MWERKSDIR + "MacOS Support:Universal:Interfaces:CIncludes:" # Where to put the python definitions file: ! TOOLBOXDIR=os.path.join(sys.prefix, ":Mac:Lib:Carbon:") # Creator for C files: --- 4,12 ---- import sys, os # Where to find the Universal Header include files: ! MWERKSDIR="/Applications/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" ! INCLUDEDIR=os.path.join(MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") # Where to put the python definitions file: ! TOOLBOXDIR=os.path.join(sys.prefix, "Mac", "Lib", "Carbon") # Creator for C files: From jackjansen@users.sourceforge.net Sun Aug 4 22:59:39 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 14:59:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon IBCarbonscan.py,1.1,1.2 _IBCarbon.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv31792 Modified Files: IBCarbonscan.py _IBCarbon.c Log Message: Updated to something that works on my system, and regenerated module. Index: IBCarbonscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/IBCarbonscan.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IBCarbonscan.py 4 Aug 2002 21:34:24 -0000 1.1 --- IBCarbonscan.py 4 Aug 2002 21:59:37 -0000 1.2 *************** *** 6,10 **** import MacOS ! BGENDIR= '/Users/dp/python/dist/src/Tools/bgen/bgen' sys.path.append(BGENDIR) print sys.path, sys.prefix --- 6,10 ---- import MacOS ! BGENDIR= '/Users/jack/src/python/Tools/bgen/bgen' sys.path.append(BGENDIR) print sys.path, sys.prefix *************** *** 26,29 **** --- 26,30 ---- class IBCarbon_Scanner(Scanner_OSX): + def destination(self, type, name, arglist): classname = "IBCarbonFunction" *************** *** 41,44 **** --- 42,49 ---- "CreateNibReferenceWithCFBundle", ## need to wrap CFBundle.h properly first ] + + def makerepairinstructions(self): + return [] + if __name__ == "__main__": Index: _IBCarbon.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/_IBCarbon.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _IBCarbon.c 4 Aug 2002 21:34:24 -0000 1.1 --- _IBCarbon.c 4 Aug 2002 21:59:37 -0000 1.2 *************** *** 56,60 **** { DisposeNibReference(self->ob_itself); ! PyMem_DEL(self); } --- 56,60 ---- { DisposeNibReference(self->ob_itself); ! PyObject_Del(self); } *************** *** 68,76 **** CFStringRefObj_Convert, &inName)) return NULL; - Py_BEGIN_ALLOW_THREADS _err = CreateWindowFromNib(_self->ob_itself, inName, &outWindow); - Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", --- 68,74 ---- *************** *** 88,96 **** CFStringRefObj_Convert, &inName)) return NULL; - Py_BEGIN_ALLOW_THREADS _err = CreateMenuFromNib(_self->ob_itself, inName, &outMenuRef); - Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", --- 86,92 ---- *************** *** 108,116 **** CFStringRefObj_Convert, &inName)) return NULL; - Py_BEGIN_ALLOW_THREADS _err = CreateMenuBarFromNib(_self->ob_itself, inName, &outMenuBar); - Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", --- 104,110 ---- *************** *** 127,134 **** CFStringRefObj_Convert, &inName)) return NULL; - Py_BEGIN_ALLOW_THREADS _err = SetMenuBarFromNib(_self->ob_itself, inName); - Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 121,126 ---- *************** *** 195,202 **** CFStringRefObj_Convert, &inNibName)) return NULL; - Py_BEGIN_ALLOW_THREADS _err = CreateNibReference(inNibName, &outNibRef); - Py_END_ALLOW_THREADS if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", --- 187,192 ---- From jackjansen@users.sourceforge.net Sun Aug 4 23:03:38 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 15:03:38 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon IBCarbonRuntime.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv32722 Added Files: IBCarbonRuntime.py Log Message: The definitions for IBCarbonRuntime.h --- NEW FILE: IBCarbonRuntime.py --- # Generated from 'IBCarbonRuntime.h' kIBCarbonRuntimeCantFindNibFile = -10960 kIBCarbonRuntimeObjectNotOfRequestedType = -10961 kIBCarbonRuntimeCantFindObject = -10962 From jackjansen@users.sourceforge.net Sun Aug 4 23:04:28 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 04 Aug 2002 15:04:28 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv429 Modified Files: setup.py Log Message: Build the _IBCarbon module. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** setup.py 3 Aug 2002 16:39:22 -0000 1.102 --- setup.py 4 Aug 2002 22:04:25 -0000 1.103 *************** *** 777,780 **** --- 777,782 ---- exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_List', ['list/_Listmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From tim_one@users.sourceforge.net Sun Aug 4 23:35:33 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 04 Aug 2002 15:35:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mhlib.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5856/python/Lib/test Modified Files: test_mhlib.py Log Message: Finally got around to figuring out and documenting why this test fails on Windows. The test_sequence() ERROR is easily repaired if we're willing to add an os.unlink() line to mhlib's updateline(). The test_listfolders FAIL I gave up on -- I don't remember enough about Unix link esoterica to recall why a link count of 2 is something a well- written program should be keenly interested in . Index: test_mhlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mhlib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_mhlib.py 23 Jul 2002 19:03:57 -0000 1.8 --- test_mhlib.py 4 Aug 2002 22:35:31 -0000 1.9 *************** *** 13,18 **** import mhlib ! if sys.platform.startswith("win") or sys.platform=="riscos" or sys.platform.startswith("atheos"): ! raise TestSkipped("test_mhlib skipped on %s -- "%sys.platform + "too many Unix assumptions") --- 13,26 ---- import mhlib ! if (sys.platform.startswith("win") or sys.platform=="riscos" or ! sys.platform.startswith("atheos"): ! # mhlib.updateline() renames a file to the name of a file that already ! # exists. That causes a reasonable OS to complain in test_sequence ! # here, like the "OSError: [Errno 17] File exists" raised on Windows. ! # mhlib's listsubfolders() and listallfolders() do something with ! # link counts, and that causes test_listfolders() here to get back ! # an empty list from its call of listallfolders(). ! # The other tests here pass on Windows. ! raise TestSkipped("test_mhlib skipped on %s -- " % sys.platform + "too many Unix assumptions") From tim_one@users.sourceforge.net Sun Aug 4 23:52:33 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 04 Aug 2002 15:52:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mhlib.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11110/python/Lib/test Modified Files: test_mhlib.py Log Message: Oops! Forgot the closing paren. Index: test_mhlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mhlib.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_mhlib.py 4 Aug 2002 22:35:31 -0000 1.9 --- test_mhlib.py 4 Aug 2002 22:52:30 -0000 1.10 *************** *** 14,18 **** if (sys.platform.startswith("win") or sys.platform=="riscos" or ! sys.platform.startswith("atheos"): # mhlib.updateline() renames a file to the name of a file that already # exists. That causes a reasonable OS to complain in test_sequence --- 14,18 ---- if (sys.platform.startswith("win") or sys.platform=="riscos" or ! sys.platform.startswith("atheos")): # mhlib.updateline() renames a file to the name of a file that already # exists. That causes a reasonable OS to complain in test_sequence From tim_one@users.sourceforge.net Sun Aug 4 23:55:38 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 04 Aug 2002 15:55:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mhlib.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11879/python/Lib/test Modified Files: test_mhlib.py Log Message: We don't really need the name of the test in the "test skipped" msg, and having it there causes the line to wrap. Index: test_mhlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mhlib.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_mhlib.py 4 Aug 2002 22:52:30 -0000 1.10 --- test_mhlib.py 4 Aug 2002 22:55:35 -0000 1.11 *************** *** 22,26 **** # an empty list from its call of listallfolders(). # The other tests here pass on Windows. ! raise TestSkipped("test_mhlib skipped on %s -- " % sys.platform + "too many Unix assumptions") --- 22,26 ---- # an empty list from its call of listallfolders(). # The other tests here pass on Windows. ! raise TestSkipped("skipped on %s -- " % sys.platform + "too many Unix assumptions") From loewis@users.sourceforge.net Mon Aug 5 02:32:11 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 18:32:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pep263.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9460 Added Files: test_pep263.py Log Message: Test whether a Cyrillic text correctly appears in a Unicode literal. --- NEW FILE: test_pep263.py --- (This appears to be a binary file; contents omitted.) From loewis@users.sourceforge.net Mon Aug 5 02:49:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 Aug 2002 18:49:18 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv13109 Modified Files: tokenizer.c Log Message: Add 1 to lineno in deprecation warning. Fixes #590888. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** tokenizer.c 4 Aug 2002 20:10:29 -0000 2.59 --- tokenizer.c 5 Aug 2002 01:49:16 -0000 2.60 *************** *** 433,438 **** sprintf(buf, "Non-ASCII character '\\x%.2x', " "but no declared encoding", badchar); PyErr_WarnExplicit(PyExc_DeprecationWarning, ! buf, tok->filename, tok->lineno, NULL, NULL); tok->issued_encoding_warning = 1; --- 433,440 ---- sprintf(buf, "Non-ASCII character '\\x%.2x', " "but no declared encoding", badchar); + /* Need to add 1 to the line number, since this line + has not been counted, yet. */ PyErr_WarnExplicit(PyExc_DeprecationWarning, ! buf, tok->filename, tok->lineno + 1, NULL, NULL); tok->issued_encoding_warning = 1; From rhettinger@users.sourceforge.net Mon Aug 5 04:55:38 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 04 Aug 2002 20:55:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6352 Modified Files: libpickle.tex Log Message: Note that True and False are pickable objects Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** libpickle.tex 21 May 2002 17:22:02 -0000 1.36 --- libpickle.tex 5 Aug 2002 03:55:36 -0000 1.37 *************** *** 311,315 **** \begin{itemize} ! \item \code{None} \item integers, long integers, floating point numbers, complex numbers --- 311,315 ---- \begin{itemize} ! \item \code{None}, \code{True}, and \code{False} \item integers, long integers, floating point numbers, complex numbers From rhettinger@users.sourceforge.net Mon Aug 5 07:28:25 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 04 Aug 2002 23:28:25 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.173,2.174 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2996 Modified Files: stringobject.c Log Message: SF 582071 clarified the .split() method's docstring to note that sep=None will trigger splitting on any whitespace. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.173 retrieving revision 2.174 diff -C2 -d -r2.173 -r2.174 *** stringobject.c 28 Jul 2002 16:44:23 -0000 2.173 --- stringobject.c 5 Aug 2002 06:28:21 -0000 2.174 *************** *** 1127,1132 **** Return a list of the words in the string S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ ! splits are done. If sep is not specified, any whitespace string\n\ ! is a separator."); static PyObject * --- 1127,1132 ---- Return a list of the words in the string S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ ! splits are done. If sep is not specified or is None, any\n\ ! whitespace string is a separator."); static PyObject * From rhettinger@users.sourceforge.net Mon Aug 5 07:28:57 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 04 Aug 2002 23:28:57 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.147.6.6,2.147.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3649 Modified Files: Tag: release22-maint stringobject.c Log Message: SF 582071 clarified the .split() method's docstring to note that sep=None will trigger splitting on any whitespace. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.6 retrieving revision 2.147.6.7 diff -C2 -d -r2.147.6.6 -r2.147.6.7 *** stringobject.c 28 Jul 2002 10:21:31 -0000 2.147.6.6 --- stringobject.c 5 Aug 2002 06:28:55 -0000 2.147.6.7 *************** *** 1099,1104 **** Return a list of the words in the string S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ ! splits are done. If sep is not specified, any whitespace string\n\ ! is a separator."; static PyObject * --- 1099,1104 ---- Return a list of the words in the string S, using sep as the\n\ delimiter string. If maxsplit is given, at most maxsplit\n\ ! splits are done. If sep is not specified or is None, any\n\ ! whitespace string is a separator."; static PyObject * From jackjansen@users.sourceforge.net Mon Aug 5 15:11:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:11:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/Build PythonStandSmall.mcp,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv1476 Modified Files: PythonStandSmall.mcp Log Message: Added _IBCarbon module. Index: PythonStandSmall.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandSmall.mcp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 Binary files /tmp/cvsLIP3hk and /tmp/cvsA29Hiv differ From jackjansen@users.sourceforge.net Mon Aug 5 15:12:08 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:12:08 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules macconfig.c,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1600 Modified Files: macconfig.c Log Message: Added _IBCarbon module. Index: macconfig.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macconfig.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** macconfig.c 7 Jul 2002 20:54:44 -0000 1.32 --- macconfig.c 5 Aug 2002 14:12:06 -0000 1.33 *************** *** 98,101 **** --- 98,102 ---- extern void init_Fm(); extern void init_Help(); + extern void init_IBCarbon(); extern void init_Icn(); extern void init_List(); *************** *** 231,234 **** --- 232,236 ---- {"_App", init_App}, {"_Fm", init_Fm}, + {"_IBCarbon", init_IBCarbon}, {"_Icn", init_Icn}, {"_List", init_List}, From jackjansen@users.sourceforge.net Mon Aug 5 15:12:26 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:12:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts genpluginprojects.py,1.33,1.34 fullbuild.py,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv1674 Modified Files: genpluginprojects.py fullbuild.py Log Message: Added _IBCarbon module. Index: genpluginprojects.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genpluginprojects.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** genpluginprojects.py 22 Jul 2002 12:32:31 -0000 1.33 --- genpluginprojects.py 5 Aug 2002 14:12:24 -0000 1.34 *************** *** 169,172 **** --- 169,174 ---- genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") + genpluginproject("carbon", "_IBCarbon", sources=[":ibcarbon:_IBCarbon.c"], + outputdir="::Lib:Carbon") genpluginproject("carbon", "_Icn", outputdir="::Lib:Carbon") genpluginproject("all", "_List", outputdir="::Lib:Carbon") Index: fullbuild.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/fullbuild.py,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** fullbuild.py 27 Jun 2002 22:09:19 -0000 1.82 --- fullbuild.py 5 Aug 2002 14:12:24 -0000 1.83 *************** *** 222,225 **** --- 222,226 ---- (":Mac:Build:_Evt.carbon.mcp", "_Evt.carbon"), (":Mac:Build:_Fm.carbon.mcp", "_Fm.carbon"), + (":Mac:Build:_IBCarbon.carbon.mcp", "_IBCarbon.carbon"), (":Mac:Build:_Icn.carbon.mcp", "_Icn.carbon"), (":Mac:Build:_List.carbon.mcp", "_List.carbon"), From jackjansen@users.sourceforge.net Mon Aug 5 15:13:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:13:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/Python macmain.c,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv2136 Modified Files: macmain.c Log Message: Renamed Py_Main to PyMac_Main as it has a different signature than the "normal" Py_Main, and that signature has appeared in a .h file. Index: macmain.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macmain.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** macmain.c 22 May 2002 15:02:08 -0000 1.78 --- macmain.c 5 Aug 2002 14:13:31 -0000 1.79 *************** *** 87,91 **** PyMac_PrefRecord PyMac_options; ! static void Py_Main(int, char **, char *); /* Forward */ void PyMac_Exit(int); /* Forward */ --- 87,91 ---- PyMac_PrefRecord PyMac_options; ! static void PyMac_Main(int, char **, char *); /* Forward */ void PyMac_Exit(int); /* Forward */ *************** *** 538,542 **** } ! Py_Main(argc, argv, script); return 0; } --- 538,542 ---- } ! PyMac_Main(argc, argv, script); return 0; } *************** *** 581,585 **** } } ! Py_Main(argc, argv, script); } #endif /* TARGET_API_MAC_OSX */ --- 581,585 ---- } } ! PyMac_Main(argc, argv, script); } #endif /* TARGET_API_MAC_OSX */ *************** *** 588,592 **** static void ! Py_Main(int argc, char **argv, char *filename) { int sts; --- 588,592 ---- static void ! PyMac_Main(int argc, char **argv, char *filename) { int sts; From jackjansen@users.sourceforge.net Mon Aug 5 15:14:07 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:14:07 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv2401 Modified Files: tokenizer.c Log Message: Added a cast to shut up a compiler warning. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** tokenizer.c 5 Aug 2002 01:49:16 -0000 2.60 --- tokenizer.c 5 Aug 2002 14:14:05 -0000 2.61 *************** *** 423,427 **** if (warn && line && !tok->issued_encoding_warning && !tok->encoding) { unsigned char *c; ! for (c = line; *c; c++) if (*c > 127) { badchar = *c; --- 423,427 ---- if (warn && line && !tok->issued_encoding_warning && !tok->encoding) { unsigned char *c; ! for (c = (unsigned char *)line; *c; c++) if (*c > 127) { badchar = *c; From gvanrossum@users.sourceforge.net Mon Aug 5 15:17:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:17:23 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.451,1.452 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv3971 Modified Files: NEWS Log Message: Add a small description of PEP 263. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.451 retrieving revision 1.452 diff -C2 -d -r1.451 -r1.452 *** NEWS 4 Aug 2002 17:29:52 -0000 1.451 --- NEWS 5 Aug 2002 14:17:20 -0000 1.452 *************** *** 7,11 **** Core and builtins ! - Encoding declarations (PEP 263, phase 1) have been implemented. - list.sort() has a new implementation. While cross-platform results --- 7,13 ---- Core and builtins ! - Encoding declarations (PEP 263, phase 1) have been implemented. A ! comment of the form "# -*- coding: -*-" in the first ! or second line of a Python source file indicates the encoding. - list.sort() has a new implementation. While cross-platform results From nascheme@users.sourceforge.net Mon Aug 5 15:45:46 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:45:46 -0700 Subject: [Python-checkins] python/dist/src/Objects iterobject.c,1.7,1.7.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15123/Objects Modified Files: Tag: release22-maint iterobject.c Log Message: Remove calls to 2.1 GC API (they are noops). Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.7 retrieving revision 1.7.16.1 diff -C2 -d -r1.7 -r1.7.16.1 *** iterobject.c 16 Aug 2001 13:15:00 -0000 1.7 --- iterobject.c 5 Aug 2002 14:45:43 -0000 1.7.16.1 *************** *** 19,23 **** Py_INCREF(seq); it->it_seq = seq; - PyObject_GC_Init(it); return (PyObject *)it; } --- 19,22 ---- *************** *** 25,31 **** iter_dealloc(seqiterobject *it) { - PyObject_GC_Fini(it); Py_DECREF(it->it_seq); - it = (seqiterobject *) PyObject_AS_GC(it); PyObject_DEL(it); } --- 24,28 ---- *************** *** 101,105 **** 0, /* ob_size */ "iterator", /* tp_name */ ! sizeof(seqiterobject) + PyGC_HEAD_SIZE, /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ --- 98,102 ---- 0, /* ob_size */ "iterator", /* tp_name */ ! sizeof(seqiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ *************** *** 119,123 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)iter_traverse, /* tp_traverse */ --- 116,120 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ (traverseproc)iter_traverse, /* tp_traverse */ *************** *** 155,159 **** Py_INCREF(sentinel); it->it_sentinel = sentinel; - PyObject_GC_Init(it); return (PyObject *)it; } --- 152,155 ---- *************** *** 161,168 **** calliter_dealloc(calliterobject *it) { - PyObject_GC_Fini(it); Py_DECREF(it->it_callable); Py_DECREF(it->it_sentinel); - it = (calliterobject *) PyObject_AS_GC(it); PyObject_DEL(it); } --- 157,162 ---- *************** *** 219,223 **** 0, /* ob_size */ "callable-iterator", /* tp_name */ ! sizeof(calliterobject) + PyGC_HEAD_SIZE,/* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ --- 213,217 ---- 0, /* ob_size */ "callable-iterator", /* tp_name */ ! sizeof(calliterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ *************** *** 237,241 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)calliter_traverse, /* tp_traverse */ --- 231,235 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ (traverseproc)calliter_traverse, /* tp_traverse */ From nascheme@users.sourceforge.net Mon Aug 5 15:46:13 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:46:13 -0700 Subject: [Python-checkins] python/dist/src/Objects methodobject.c,2.40,2.40.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15342/Objects Modified Files: Tag: release22-maint methodobject.c Log Message: Remove calls to 2.1 GC API (they are noops). Index: methodobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/methodobject.c,v retrieving revision 2.40 retrieving revision 2.40.12.1 diff -C2 -d -r2.40 -r2.40.12.1 *** methodobject.c 20 Sep 2001 21:45:26 -0000 2.40 --- methodobject.c 5 Aug 2002 14:46:11 -0000 2.40.12.1 *************** *** 23,27 **** Py_XINCREF(self); op->m_self = self; - PyObject_GC_Init(op); return (PyObject *)op; } --- 23,26 ---- *************** *** 112,116 **** meth_dealloc(PyCFunctionObject *m) { - PyObject_GC_Fini(m); Py_XDECREF(m->m_self); m->m_self = (PyObject *)free_list; --- 111,114 ---- *************** *** 217,221 **** 0, "builtin_function_or_method", ! sizeof(PyCFunctionObject) + PyGC_HEAD_SIZE, 0, (destructor)meth_dealloc, /* tp_dealloc */ --- 215,219 ---- 0, "builtin_function_or_method", ! sizeof(PyCFunctionObject), 0, (destructor)meth_dealloc, /* tp_dealloc */ *************** *** 234,238 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)meth_traverse, /* tp_traverse */ --- 232,236 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ (traverseproc)meth_traverse, /* tp_traverse */ *************** *** 328,332 **** PyCFunctionObject *v = free_list; free_list = (PyCFunctionObject *)(v->m_self); - v = (PyCFunctionObject *) PyObject_AS_GC(v); PyObject_DEL(v); } --- 326,329 ---- From nascheme@users.sourceforge.net Mon Aug 5 15:46:32 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:46:32 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.301.4.3,2.301.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15491/Python Modified Files: Tag: release22-maint ceval.c Log Message: Remove calls to 2.1 GC API (they are noops). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.301.4.3 retrieving revision 2.301.4.4 diff -C2 -d -r2.301.4.3 -r2.301.4.4 *** ceval.c 12 Jun 2002 03:48:46 -0000 2.301.4.3 --- ceval.c 5 Aug 2002 14:46:29 -0000 2.301.4.4 *************** *** 108,112 **** gen->gi_frame = f; gen->gi_running = 0; - PyObject_GC_Init(gen); return (PyObject *)gen; } --- 108,111 ---- *************** *** 121,125 **** gen_dealloc(genobject *gen) { - PyObject_GC_Fini(gen); Py_DECREF(gen->gi_frame); PyObject_Del(gen); --- 120,123 ---- *************** *** 205,209 **** 0, /* ob_size */ "generator", /* tp_name */ ! sizeof(genobject) + PyGC_HEAD_SIZE, /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ --- 203,207 ---- 0, /* ob_size */ "generator", /* tp_name */ ! sizeof(genobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ *************** *** 223,227 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)gen_traverse, /* tp_traverse */ --- 221,225 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ (traverseproc)gen_traverse, /* tp_traverse */ From loewis@users.sourceforge.net Mon Aug 5 15:53:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:53:54 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle CallTips.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv17315 Modified Files: CallTips.py Log Message: 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.10 diff -C2 -d -r1.9 -r1.10 *** CallTips.py 16 Sep 2001 02:19:49 -0000 1.9 --- CallTips.py 5 Aug 2002 14:53:52 -0000 1.10 *************** *** 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 loewis@users.sourceforge.net Mon Aug 5 15:55:23 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:55:23 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.7,1.8 PyShell.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv18841 Modified Files: IOBinding.py PyShell.py Log Message: Patch #590913: PEP 263 support. Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IOBinding.py 10 Jun 2002 18:52:02 -0000 1.7 --- IOBinding.py 5 Aug 2002 14:55:20 -0000 1.8 *************** *** 1,3 **** --- 1,7 ---- import os + import types + import sys + import codecs + import re import tempfile import tkFileDialog *************** *** 25,28 **** --- 29,97 ---- #$ unix + try: + from codecs import BOM_UTF8 + except ImportError: + # only available since Python 2.3 + BOM_UTF8 = '\xef\xbb\xbf' + + # Try setting the locale, so that we can find out + # what encoding to use + try: + import locale + locale.setlocale(locale.LC_CTYPE, "") + except ImportError: + pass + + encoding = "ascii" + if sys.platform == 'win32': + # On Windows, we could use "mbcs". However, to give the user + # a portable encoding name, we need to find the code page + try: + encoding = locale.getdefaultlocale()[1] + codecs.lookup(encoding) + except LookupError: + pass + else: + try: + # Different things can fail here: the locale module may not be + # loaded, it may not offer nl_langinfo, or CODESET, or the + # resulting codeset may be unknown to Python. We ignore all + # these problems, falling back to ASCII + encoding = locale.nl_langinfo(locale.CODESET) + codecs.lookup(encoding) + except (NameError, AttributeError, LookupError): + # Try getdefaultlocale well: it parses environment variables, + # which may give a clue. Unfortunately, getdefaultlocale has + # bugs that can cause ValueError. + try: + encoding = locale.getdefaultlocale()[1] + codecs.lookup(encoding) + except (ValueError, LookupError): + pass + + encoding = encoding.lower() + + coding_re = re.compile("coding[:=]\s*([-\w_.]+)") + def coding_spec(str): + + """Return the encoding declaration according to PEP 263. + Raise LookupError if the encoding is declared but unknown.""" + + # Only consider the first two lines + str = str.split("\n")[:2] + str = "\n".join(str) + + match = coding_re.search(str) + if not match: + return None + name = match.group(1) + # Check whether the encoding is known + import codecs + try: + codecs.lookup(name) + except LookupError: + # The standard encoding error does not indicate the encoding + raise LookupError, "Unknown encoding "+name + return name class IOBinding: *************** *** 38,41 **** --- 107,111 ---- self.save_a_copy) self.__id_print = self.text.bind("<>", self.print_window) + self.fileencoding = None def close(self): *************** *** 102,105 **** --- 172,178 ---- tkMessageBox.showerror("I/O Error", str(msg), master=self.text) return False + + chars = self.decode(chars) + self.text.delete("1.0", "end") self.set_filename(None) *************** *** 111,114 **** --- 184,235 ---- return True + def decode(self, chars): + # Try to create a Unicode string. If that fails, let Tcl try + # its best + + # Check presence of a UTF-8 signature first + if chars.startswith(BOM_UTF8): + try: + chars = chars[3:].decode("utf-8") + except UnicodeError: + # has UTF-8 signature, but fails to decode... + return chars + else: + # Indicates that this file originally had a BOM + self.fileencoding = BOM_UTF8 + return chars + + # Next look for coding specification + try: + enc = coding_spec(chars) + except LookupError, name: + tkMessageBox.showerror( + title="Error loading the file", + message="The encoding '%s' is not known to this Python "\ + "installation. The file may not display correctly" % name, + master = self.text) + enc = None + + if enc: + try: + return unicode(chars, enc) + except UnicodeError: + pass + + # If it is ASCII, we need not to record anything + try: + return unicode(chars, 'ascii') + except UnicodeError: + pass + + # Finally, try the locale's encoding. This is deprecated; + # the user should declare a non-ASCII encoding + try: + chars = unicode(chars, encoding) + self.fileencoding = encoding + except UnicodeError: + pass + return chars + def maybesave(self): if self.get_saved(): *************** *** 181,185 **** def writefile(self, filename): self.fixlastline() ! chars = str(self.text.get("1.0", "end-1c")) try: f = open(filename, "w") --- 302,306 ---- def writefile(self, filename): self.fixlastline() ! chars = self.encode(self.text.get("1.0", "end-1c")) try: f = open(filename, "w") *************** *** 192,195 **** --- 313,378 ---- master=self.text) return False + + def encode(self, chars): + if isinstance(chars, types.StringType): + # This is either plain ASCII, or Tk was returning mixed-encoding + # text to us. Don't try to guess further. + return chars + + # See whether there is anything non-ASCII in it. + # If not, no need to figure out the encoding. + try: + return chars.encode('ascii') + except UnicodeError: + pass + + # If there is an encoding declared, try this first. + try: + enc = coding_spec(chars) + failed = None + except LookupError, msg: + failed = msg + enc = None + if enc: + try: + return chars.encode(enc) + except UnicodeError: + failed = "Invalid encoding '%s'" % enc + + if failed: + tkMessageBox.showerror( + "I/O Error", + "%s. Saving as UTF-8" % failed, + master = self.text) + + # If there was a UTF-8 signature, use that. This should not fail + if self.fileencoding == BOM_UTF8 or failed: + return BOM_UTF8 + chars.encode("utf-8") + + # Try the original file encoding next, if any + if self.fileencoding: + try: + return chars.encode(self.fileencoding) + except UnicodeError: + tkMessageBox.showerror( + "I/O Error", + "Cannot save this as '%s' anymore. Saving as UTF-8" % self.fileencoding, + master = self.text) + return BOM_UTF8 + chars.encode("utf-8") + + # Nothing was declared, and we had not determined an encoding + # on loading. Recommend an encoding line. + try: + chars = chars.encode(encoding) + enc = encoding + except UnicodeError: + chars = BOM_UTF8 + chars.encode("utf-8") + enc = "utf-8" + tkMessageBox.showerror( + "I/O Error", + "Non-ASCII found, yet no encoding declared. Add a line like\n" + "# -*- coding: %s -*- \nto your file" % enc, + master = self.text) + return chars def fixlastline(self): Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** PyShell.py 21 May 2002 17:00:20 -0000 1.37 --- PyShell.py 5 Aug 2002 14:55:21 -0000 1.38 *************** *** 7,10 **** --- 7,11 ---- import re import warnings + import types import linecache *************** *** 189,192 **** --- 190,196 ---- self.save_warnings_filters = warnings.filters[:] warnings.filterwarnings(action="error", category=SyntaxWarning) + if isinstance(source, types.UnicodeType): + import IOBinding + source = source.encode(IOBinding.encoding) try: return InteractiveInterpreter.runsource(self, source, filename) From jackjansen@users.sourceforge.net Mon Aug 5 15:56:06 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:56:06 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenlocations.py,1.6,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv18718/Tools/bgen/bgen Removed Files: bgenlocations.py Log Message: Moved bgenlocations to the Mac/Lib directory. Not perfect, but better than where it was: it is really a configuration file, not a normal module. By moving it into Mac/Lib we can now also store the location of bgen itself in there, which is needed because bgen isn't installed. --- bgenlocations.py DELETED --- From jackjansen@users.sourceforge.net Mon Aug 5 15:56:06 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 07:56:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib bgenlocations.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18718/Mac/Lib Added Files: bgenlocations.py Log Message: Moved bgenlocations to the Mac/Lib directory. Not perfect, but better than where it was: it is really a configuration file, not a normal module. By moving it into Mac/Lib we can now also store the location of bgen itself in there, which is needed because bgen isn't installed. --- NEW FILE: bgenlocations.py --- # # Local customizations for generating the Carbon interface modules. # Edit this file to reflect where things should be on your system. # Note that pathnames are unix-style for OSX MachoPython/unix-Python, # but mac-style for MacPython, whether running on OS9 or OSX. # import sys, os Error = "bgenlocations.Error" # # Where bgen is. For unix-Python bgen isn't installed, so you have to refer to # the source tree here. if sys.platform == 'mac': # For MacPython we know where it is def _pardir(p): return os.path.split(p)[0] BGENDIR=os.path.join(sys.prefix, "Tools", "bgen", "bgen") else: # for unix-Python we don't know, please set it yourself. BGENDIR="/Users/jack/src/python/Tools/bgen/bgen" # # Where to find the Universal Header include files. If you have CodeWarrior # installed you can use the Universal Headers from there, otherwise you can # download them from the Apple website. Bgen can handle both unix- and mac-style # end of lines, so don't worry about that. # if sys.platform == 'mac': _MWERKSDIR="Macintosh HD:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") # # Where to put the python definitions files. Note that, on unix-Python, # if you want to commit your changes to the CVS repository this should refer to # your source directory, not your installed directory. # if sys.platform == 'mac': TOOLBOXDIR=os.path.join(sys.prefix, "Mac", "Lib", "Carbon") else: TOOLBOXDIR="/Users/jack/src/python/Mac/Lib/Carbon" # Creator for C files: CREATOR="CWIE" if not os.path.exists(BGENDIR): raise Error, "Please fix bgenlocations.py, BGENDIR does not exist: %s" % BGENDIR if not os.path.exists(INCLUDEDIR): raise Error, "Please fix bgenlocations.py, INCLUDEDIR does not exist: %s" % INCLUDEDIR if not os.path.exists(TOOLBOXDIR): raise Error, "Please fix bgenlocations.py, TOOLBOXDIR does not exist: %s" % TOOLBOXDIR # Sigh, due to the way these are used make sure they end with : or /. if BGENDIR[-1] != os.sep: BGENDIR = BGENDIR + os.sep if INCLUDEDIR[-1] != os.sep: INCLUDEDIR = INCLUDEDIR + os.sep if TOOLBOXDIR[-1] != os.sep: TOOLBOXDIR = TOOLBOXDIR + os.sep From loewis@users.sourceforge.net Mon Aug 5 16:11:29 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:11:29 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.452,1.453 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25063/Misc Modified Files: NEWS Log Message: IDLE support for PEP 263. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.452 retrieving revision 1.453 diff -C2 -d -r1.452 -r1.453 *** NEWS 5 Aug 2002 14:17:20 -0000 1.452 --- NEWS 5 Aug 2002 15:11:26 -0000 1.453 *************** *** 332,335 **** --- 332,340 ---- Tools/Demos + - IDLE supports now encoding declarations (PEP 263); it can also deal + with legacy 8-bit files if they use the locale's encoding. It allows + non-ASCII strings in the interactive shell and executes them in the + locale's encoding. + - freeze.py now produces binaries which can import shared modules, unlike before when this failed due to missing symbol exports in From loewis@users.sourceforge.net Mon Aug 5 16:14:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:14:34 -0700 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26784 Modified Files: pep-0263.txt Log Message: Implemented in CVS. Index: pep-0263.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0263.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0263.txt 15 Jul 2002 02:47:06 -0000 1.13 --- pep-0263.txt 5 Aug 2002 15:14:31 -0000 1.14 *************** *** 4,8 **** Author: mal@lemburg.com (Marc-André Lemburg), loewis@informatik.hu-berlin.de (Martin v. Löwis) ! Status: Draft Type: Standards Track Python-Version: 2.3 --- 4,8 ---- Author: mal@lemburg.com (Marc-André Lemburg), loewis@informatik.hu-berlin.de (Martin v. Löwis) ! Status: Final Type: Standards Track Python-Version: 2.3 From fdrake@users.sourceforge.net Mon Aug 5 16:24:22 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:24:22 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.453,1.454 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30135 Modified Files: NEWS Log Message: Typo: "now" --> "the new" Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.453 retrieving revision 1.454 diff -C2 -d -r1.453 -r1.454 *** NEWS 5 Aug 2002 15:11:26 -0000 1.453 --- NEWS 5 Aug 2002 15:24:19 -0000 1.454 *************** *** 332,339 **** Tools/Demos ! - IDLE supports now encoding declarations (PEP 263); it can also deal ! with legacy 8-bit files if they use the locale's encoding. It allows ! non-ASCII strings in the interactive shell and executes them in the ! locale's encoding. - freeze.py now produces binaries which can import shared modules, --- 332,339 ---- Tools/Demos ! - 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 ! allows non-ASCII strings in the interactive shell and executes them ! in the locale's encoding. - freeze.py now produces binaries which can import shared modules, From jackjansen@users.sourceforge.net Mon Aug 5 16:33:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:33:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts bgenall.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv1195/Mac/scripts Modified Files: bgenall.py Log Message: This can now run under unix-Python too. You have to pass the folder to search on the command line in that case. Index: bgenall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/bgenall.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bgenall.py 14 Dec 2001 23:01:34 -0000 1.2 --- bgenall.py 5 Aug 2002 15:33:44 -0000 1.3 *************** *** 20,25 **** success = [] failure = [] ! sys.path.insert(0, ':') ! srcdir = os.path.join(os.path.join(sys.prefix, 'Mac'), 'Modules') contents = os.listdir(srcdir) for name in contents: --- 20,29 ---- success = [] failure = [] ! sys.path.insert(0, os.curdir) ! if len(sys.argv) > 1: ! srcdir = sys.argv[1] ! else: ! srcdir = os.path.join(os.path.join(sys.prefix, 'Mac'), 'Modules') ! srcdir = os.path.abspath(srcdir) contents = os.listdir(srcdir) for name in contents: From jackjansen@users.sourceforge.net Mon Aug 5 16:32:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:32:33 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen scantools.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv814/Tools/bgen/bgen Modified Files: scantools.py Log Message: Fixed to run better in unix-Python, and to cater for bgenlocations possibly being missing. Index: scantools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** scantools.py 4 Aug 2002 21:55:25 -0000 1.29 --- scantools.py 5 Aug 2002 15:32:30 -0000 1.30 *************** *** 26,30 **** MacOS = None ! from bgenlocations import CREATOR, INCLUDEDIR Error = "scantools.Error" --- 26,34 ---- MacOS = None ! try: ! from bgenlocations import CREATOR, INCLUDEDIR ! except ImportError: ! CREATOR = None ! INCLUDEDIR = os.curdir Error = "scantools.Error" *************** *** 237,241 **** def initpaths(self): ! self.includepath = [':', INCLUDEDIR] def initpatterns(self): --- 241,245 ---- def initpaths(self): ! self.includepath = [os.curdir, INCLUDEDIR] def initpatterns(self): *************** *** 264,268 **** def initosspecifics(self): ! if MacOS: self.filetype = 'TEXT' self.filecreator = CREATOR --- 268,272 ---- def initosspecifics(self): ! if MacOS and CREATOR: self.filetype = 'TEXT' self.filecreator = CREATOR From jackjansen@users.sourceforge.net Mon Aug 5 16:36:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:36:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl ctlsupport.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv2251/ctl Modified Files: ctlsupport.py Log Message: Got rid of staticforward. Index: ctlsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlsupport.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** ctlsupport.py 4 Jan 2002 19:45:15 -0000 1.49 --- ctlsupport.py 5 Aug 2002 15:36:56 -0000 1.50 *************** *** 129,133 **** #endif ! staticforward PyObject *CtlObj_WhichControl(ControlHandle); #define as_Control(h) ((ControlHandle)h) --- 129,133 ---- #endif ! static PyObject *CtlObj_WhichControl(ControlHandle); #define as_Control(h) ((ControlHandle)h) *************** *** 233,239 **** static ControlUserPaneTrackingUPP mytrackingproc_upp; ! staticforward int settrackfunc(PyObject *); /* forward */ ! staticforward void clrtrackfunc(void); /* forward */ ! staticforward int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); """ --- 233,239 ---- static ControlUserPaneTrackingUPP mytrackingproc_upp; ! static int settrackfunc(PyObject *); /* forward */ ! static void clrtrackfunc(void); /* forward */ ! static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); """ From jackjansen@users.sourceforge.net Mon Aug 5 16:36:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:36:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte mltesupport.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv2251/mlte Modified Files: mltesupport.py Log Message: Got rid of staticforward. Index: mltesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltesupport.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mltesupport.py 1 Jan 2002 22:42:23 -0000 1.8 --- mltesupport.py 5 Aug 2002 15:36:56 -0000 1.9 *************** *** 28,35 **** /* For now we declare them forward here. They'll go to mactoolbox later */ ! staticforward PyObject *TXNObj_New(TXNObject); ! staticforward int TXNObj_Convert(PyObject *, TXNObject *); ! staticforward PyObject *TXNFontMenuObj_New(TXNFontMenuObject); ! staticforward int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); // ADD declarations --- 28,35 ---- /* For now we declare them forward here. They'll go to mactoolbox later */ ! static PyObject *TXNObj_New(TXNObject); ! static int TXNObj_Convert(PyObject *, TXNObject *); ! static PyObject *TXNFontMenuObj_New(TXNFontMenuObject); ! static int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *); // ADD declarations From jackjansen@users.sourceforge.net Mon Aug 5 16:36:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:36:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastesupport.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv2251/waste Modified Files: wastesupport.py Log Message: Got rid of staticforward. Index: wastesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastesupport.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** wastesupport.py 11 Jan 2002 12:37:15 -0000 1.15 --- wastesupport.py 5 Aug 2002 15:36:57 -0000 1.16 *************** *** 74,79 **** /* Forward declaration */ ! staticforward PyObject *WEOObj_New(WEObjectReference); ! staticforward PyObject *ExistingwasteObj_New(WEReference); /* --- 74,79 ---- /* Forward declaration */ ! static PyObject *WEOObj_New(WEObjectReference); ! static PyObject *ExistingwasteObj_New(WEReference); /* From jackjansen@users.sourceforge.net Mon Aug 5 16:36:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:36:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd qdsupport.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv2251/qd Modified Files: qdsupport.py Log Message: Got rid of staticforward. Index: qdsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdsupport.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** qdsupport.py 25 Mar 2002 00:31:45 -0000 1.38 --- qdsupport.py 5 Aug 2002 15:36:57 -0000 1.39 *************** *** 158,162 **** #endif /* !TARGET_API_MAC_CARBON */ ! staticforward PyObject *BMObj_NewCopied(BitMapPtr); /* --- 158,162 ---- #endif /* !TARGET_API_MAC_CARBON */ ! static PyObject *BMObj_NewCopied(BitMapPtr); /* From jackjansen@users.sourceforge.net Mon Aug 5 16:39:56 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ae aescan.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv2925/ae Modified Files: aescan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: aescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aescan.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aescan.py 17 Dec 2001 11:47:27 -0000 1.13 --- aescan.py 5 Aug 2002 15:39:23 -0000 1.14 *************** *** 8,14 **** import MacOS ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) - from bgenlocations import TOOLBOXDIR from scantools import Scanner --- 8,13 ---- import MacOS ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner From jackjansen@users.sourceforge.net Mon Aug 5 16:39:56 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/app appscan.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv2925/app Modified Files: appscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: appscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appscan.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** appscan.py 6 Jan 2002 23:03:39 -0000 1.8 --- appscan.py 5 Aug 2002 15:39:24 -0000 1.9 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Appearance" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Appearance" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:57 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt CarbonEvtscan.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory usw-pr-cvs1:/tmp/cvs-serv2925/carbonevt Modified Files: CarbonEvtscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: CarbonEvtscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/CarbonEvtscan.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CarbonEvtscan.py 9 Jan 2002 18:54:16 -0000 1.7 --- CarbonEvtscan.py 5 Aug 2002 15:39:24 -0000 1.8 *************** *** 7,14 **** import sys ! BGENDIR= os.path.join(sys.prefix, ':Tools:bgen:bgen:') sys.path.append(BGENDIR) - - from bgenlocations import TOOLBOXDIR from scantools import Scanner, Scanner_OSX --- 7,12 ---- import sys ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner, Scanner_OSX From jackjansen@users.sourceforge.net Mon Aug 5 16:39:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf cfscan.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv2925/cf Modified Files: cfscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: cfscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfscan.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cfscan.py 13 May 2002 21:21:44 -0000 1.10 --- cfscan.py 5 Aug 2002 15:39:25 -0000 1.11 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner_OSX - from bgenlocations import TOOLBOXDIR LONG = "CoreFoundation" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "CoreFoundation" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cm cmscan.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv2925/cm Modified Files: cmscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: cmscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmscan.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cmscan.py 10 Dec 2000 23:43:30 -0000 1.8 --- cmscan.py 5 Aug 2002 15:39:26 -0000 1.9 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Components" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Components" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg cgscan.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory usw-pr-cvs1:/tmp/cvs-serv2925/cg Modified Files: cgscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: cgscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/cgscan.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cgscan.py 13 Dec 2001 13:17:20 -0000 1.1 --- cgscan.py 5 Aug 2002 15:39:26 -0000 1.2 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner_OSX - from bgenlocations import TOOLBOXDIR LONG = "CoreGraphics" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "CoreGraphics" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/dlg dlgscan.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv2925/dlg Modified Files: dlgscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: dlgscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/dlgscan.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dlgscan.py 16 Dec 2001 20:15:27 -0000 1.15 --- dlgscan.py 5 Aug 2002 15:39:26 -0000 1.16 *************** *** 3,11 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Dialogs" --- 3,10 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Dialogs" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl ctlscan.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv2925/ctl Modified Files: ctlscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: ctlscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ctlscan.py 31 Dec 2001 09:50:32 -0000 1.27 --- ctlscan.py 5 Aug 2002 15:39:26 -0000 1.28 *************** *** 2,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR def main(): --- 2,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner def main(): From jackjansen@users.sourceforge.net Mon Aug 5 16:39:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag dragscan.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv2925/drag Modified Files: dragscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: dragscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragscan.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dragscan.py 5 Feb 2001 13:47:13 -0000 1.2 --- dragscan.py 5 Aug 2002 15:39:27 -0000 1.3 *************** *** 2,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR, INCLUDEDIR MISSING_DEFINES=""" --- 2,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner MISSING_DEFINES=""" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/evt evtscan.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory usw-pr-cvs1:/tmp/cvs-serv2925/evt Modified Files: evtscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: evtscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/evtscan.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** evtscan.py 10 Dec 2000 23:43:40 -0000 1.10 --- evtscan.py 5 Aug 2002 15:39:27 -0000 1.11 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Events" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Events" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/help helpscan.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory usw-pr-cvs1:/tmp/cvs-serv2925/help Modified Files: helpscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: helpscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/helpscan.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** helpscan.py 25 Aug 2000 22:04:24 -0000 1.4 --- helpscan.py 5 Aug 2002 15:39:27 -0000 1.5 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Balloons" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Balloons" From jackjansen@users.sourceforge.net Mon Aug 5 16:40:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:40:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/htmlrender htmlscan.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/htmlrender In directory usw-pr-cvs1:/tmp/cvs-serv2925/htmlrender Modified Files: htmlscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: htmlscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/htmlrender/htmlscan.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** htmlscan.py 15 May 2000 15:36:52 -0000 1.2 --- htmlscan.py 5 Aug 2002 15:39:27 -0000 1.3 *************** *** 3,11 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "HtmlRendering" --- 3,10 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "HtmlRendering" From jackjansen@users.sourceforge.net Mon Aug 5 16:40:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:40:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon IBCarbonscan.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv2925/ibcarbon Modified Files: IBCarbonscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: IBCarbonscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/IBCarbonscan.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IBCarbonscan.py 4 Aug 2002 21:59:37 -0000 1.2 --- IBCarbonscan.py 5 Aug 2002 15:39:28 -0000 1.3 *************** *** 4,13 **** import os import string - import MacOS ! BGENDIR= '/Users/jack/src/python/Tools/bgen/bgen' sys.path.append(BGENDIR) - print sys.path, sys.prefix - from bgenlocations import TOOLBOXDIR from scantools import Scanner_OSX --- 4,10 ---- import os import string ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX From jackjansen@users.sourceforge.net Mon Aug 5 16:39:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/fm fmscan.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/fm In directory usw-pr-cvs1:/tmp/cvs-serv2925/fm Modified Files: fmscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: fmscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/fmscan.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** fmscan.py 7 Jan 2002 14:15:02 -0000 1.10 --- fmscan.py 5 Aug 2002 15:39:27 -0000 1.11 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Fonts" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Fonts" From barry@python.org Mon Aug 5 16:40:48 2002 From: barry@python.org (Barry A. Warsaw) Date: Mon, 5 Aug 2002 11:40:48 -0400 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.13,1.14 References: Message-ID: <15694.40064.925281.105046@anthem.wooz.org> I've marked 263 as Final in PEP 0. I'll move it to the finished category when the code is checked in. In case I'm not paying close enough attention to python-checkins, email peps@python.org when you're done committing the code. -Barry From bwarsaw@users.sourceforge.net Mon Aug 5 16:39:51 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:51 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.206,1.207 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv3335 Modified Files: pep-0000.txt Log Message: PEP 263 is final. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.206 retrieving revision 1.207 diff -C2 -d -r1.206 -r1.207 *** pep-0000.txt 2 Aug 2002 18:05:59 -0000 1.206 --- pep-0000.txt 5 Aug 2002 15:39:49 -0000 1.207 *************** *** 77,81 **** S 258 Docutils Design Specification Goodger S 262 Database of Installed Python Packages Kuchling ! S 263 Defining Python Source Code Encodings Lemburg S 265 Sorting Dictionaries by Value Griffin S 266 Optimizing Global Variable/Attribute Access Montanaro --- 77,81 ---- S 258 Docutils Design Specification Goodger S 262 Database of Installed Python Packages Kuchling ! SF 263 Defining Python Source Code Encodings Lemburg S 265 Sorting Dictionaries by Value Griffin S 266 Optimizing Global Variable/Attribute Access Montanaro *************** *** 252,256 **** S 261 Support for "wide" Unicode characters Prescod S 262 Database of Installed Python Packages Kuchling ! S 263 Defining Python Source Code Encodings Lemburg SF 264 Future statements in simulated shells Hudson S 265 Sorting Dictionaries by Value Griffin --- 252,256 ---- S 261 Support for "wide" Unicode characters Prescod S 262 Database of Installed Python Packages Kuchling ! SF 263 Defining Python Source Code Encodings Lemburg SF 264 Future statements in simulated shells Hudson S 265 Sorting Dictionaries by Value Griffin From jackjansen@users.sourceforge.net Mon Aug 5 16:39:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/snd sndscan.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv2925/snd Modified Files: sndscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: sndscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/sndscan.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** sndscan.py 5 Feb 2002 22:35:31 -0000 1.16 --- sndscan.py 5 Aug 2002 15:39:30 -0000 1.17 *************** *** 5,11 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) - from bgenlocations import TOOLBOXDIR from scantools import Scanner --- 5,10 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner From jackjansen@users.sourceforge.net Mon Aug 5 16:39:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/res resscan.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv2925/res Modified Files: resscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: resscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/resscan.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** resscan.py 4 Jan 2002 16:00:27 -0000 1.16 --- resscan.py 5 Aug 2002 15:39:29 -0000 1.17 *************** *** 8,14 **** import MacOS ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) - from bgenlocations import TOOLBOXDIR from scantools import Scanner --- 8,13 ---- import MacOS ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner From jackjansen@users.sourceforge.net Mon Aug 5 16:39:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/scrap scrapscan.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory usw-pr-cvs1:/tmp/cvs-serv2925/scrap Modified Files: scrapscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: scrapscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/scrapscan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** scrapscan.py 31 Dec 2001 14:51:59 -0000 1.5 --- scrapscan.py 5 Aug 2002 15:39:30 -0000 1.6 *************** *** 6,16 **** import sys import os ! if os.sep == ':': ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') ! else: ! BGENDIR="../../../Tools/bgen/bgen" sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Scrap" --- 6,12 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Scrap" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/te tescan.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv2925/te Modified Files: tescan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: tescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/tescan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tescan.py 12 Dec 2000 22:10:20 -0000 1.5 --- tescan.py 5 Aug 2002 15:39:30 -0000 1.6 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "TextEdit" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "TextEdit" From jackjansen@users.sourceforge.net Mon Aug 5 16:39:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/win winscan.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv2925/win Modified Files: winscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: winscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winscan.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** winscan.py 5 Jun 2002 17:41:03 -0000 1.21 --- winscan.py 5 Aug 2002 15:39:30 -0000 1.22 *************** *** 2,8 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) - from bgenlocations import TOOLBOXDIR from scantools import Scanner --- 2,7 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner From jackjansen@users.sourceforge.net Mon Aug 5 16:39:31 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qdoffs qdoffsscan.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv2925/qdoffs Modified Files: qdoffsscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: qdoffsscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/qdoffsscan.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** qdoffsscan.py 12 Dec 1999 21:41:40 -0000 1.2 --- qdoffsscan.py 5 Aug 2002 15:39:29 -0000 1.3 *************** *** 2,8 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) - from bgenlocations import TOOLBOXDIR from scantools import Scanner --- 2,7 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner From jackjansen@users.sourceforge.net Mon Aug 5 16:39:31 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:39:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qt qtscan.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv2925/qt Modified Files: qtscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: qtscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/qtscan.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** qtscan.py 18 Dec 2001 15:39:04 -0000 1.18 --- qtscan.py 5 Aug 2002 15:39:29 -0000 1.19 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "QuickTime" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "QuickTime" From jackjansen@users.sourceforge.net Mon Aug 5 16:40:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:40:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/list listscan.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv2925/list Modified Files: listscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: listscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listscan.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** listscan.py 16 Dec 2001 20:18:05 -0000 1.9 --- listscan.py 5 Aug 2002 15:39:28 -0000 1.10 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Lists" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Lists" From jackjansen@users.sourceforge.net Mon Aug 5 16:40:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:40:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/icn icnscan.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory usw-pr-cvs1:/tmp/cvs-serv2925/icn Modified Files: icnscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: icnscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnscan.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** icnscan.py 3 Jan 2001 16:44:27 -0000 1.7 --- icnscan.py 5 Aug 2002 15:39:28 -0000 1.8 *************** *** 3,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR LONG = "Icons" --- 3,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "Icons" From jackjansen@users.sourceforge.net Mon Aug 5 16:40:01 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 08:40:01 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu menuscan.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv2925/menu Modified Files: menuscan.py Log Message: Enable building of Carbon toolbox modules with unix-Python. Index: menuscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menuscan.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** menuscan.py 3 Jan 2002 12:16:18 -0000 1.12 --- menuscan.py 5 Aug 2002 15:39:28 -0000 1.13 *************** *** 2,10 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import TOOLBOXDIR def main(): --- 2,9 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner def main(): From gvanrossum@users.sourceforge.net Mon Aug 5 17:13:26 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 05 Aug 2002 09:13:26 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17001 Modified Files: os.py Log Message: SF patch 590294: os._execvpe security fix (Zack Weinberg). 1) Do not attempt to exec a file which does not exist just to find out what error the operating system returns. This is an exploitable race on all platforms that support symbolic links. 2) Immediately re-raise the exception if we get an error other than errno.ENOENT or errno.ENOTDIR. This may need to be adapted for other platforms. (As a security issue, this should be considered for 2.1 and 2.2 as well as 2.3.) Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** os.py 2 Jul 2002 21:28:04 -0000 1.58 --- os.py 5 Aug 2002 16:13:24 -0000 1.59 *************** *** 320,325 **** __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) - _notfound = None def _execvpe(file, args, env=None): if env is not None: func = execve --- 320,326 ---- __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) def _execvpe(file, args, env=None): + from errno import ENOENT, ENOTDIR + if env is not None: func = execve *************** *** 329,333 **** argrest = (args,) env = environ ! global _notfound head, tail = path.split(file) if head: --- 330,334 ---- argrest = (args,) env = environ ! head, tail = path.split(file) if head: *************** *** 339,357 **** envpath = defpath PATH = envpath.split(pathsep) - if not _notfound: - if sys.platform[:4] == 'beos': - # Process handling (fork, wait) under BeOS (up to 5.0) - # doesn't interoperate reliably with the thread interlocking - # that happens during an import. The actual error we need - # is the same on BeOS for posix.open() et al., ENOENT. - try: unlink('/_#.# ## #.#') - except error, _notfound: pass - else: - import tempfile - t = tempfile.mktemp() - # Exec a file that is guaranteed not to exist - try: execv(t, ('blah',)) - except error, _notfound: pass - exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) --- 340,343 ---- *************** *** 359,366 **** apply(func, (fullname,) + argrest) except error, (errno, msg): ! if errno != arg[0]: ! exc, arg = error, (errno, msg) ! raise exc, arg ! # Change environ to automatically call putenv() if it exists --- 345,351 ---- 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 From gvanrossum@users.sourceforge.net Mon Aug 5 17:14:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 05 Aug 2002 09:14:48 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.191,1.192 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17402 Modified Files: ACKS Log Message: SF patch 590294: os._execvpe security fix (Zack Weinberg). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.191 retrieving revision 1.192 diff -C2 -d -r1.191 -r1.192 *** ACKS 2 Aug 2002 16:50:24 -0000 1.191 --- ACKS 5 Aug 2002 16:14:46 -0000 1.192 *************** *** 501,504 **** --- 501,505 ---- Bob Watson Henrik Weber + Zack Weinberg Edward Welbourne Rickard Westman From loewis@informatik.hu-berlin.de Mon Aug 5 16:50:57 2002 From: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-1?q?L=F6wis?=) Date: 05 Aug 2002 17:50:57 +0200 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.13,1.14 In-Reply-To: <15694.40064.925281.105046@anthem.wooz.org> References: <15694.40064.925281.105046@anthem.wooz.org> Message-ID: barry@python.org (Barry A. Warsaw) writes: > I've marked 263 as Final in PEP 0. I'll move it to the finished > category when the code is checked in. Actually, the code *is* checked in: python.org/sf/534304. There is one issue, though: the PEP has two phases, and only phase 1 is planned for Python 2.3; that is done. Phase 2 has no actual schedule; I guess it will depend on user feedback to phase 1 (might be Python 2.5 or Python 2.6). I'm not sure how to present this in the PEP status. Thanks for dealing with the PEP maintenance, Martin From barry@python.org Mon Aug 5 18:36:01 2002 From: barry@python.org (Barry A. Warsaw) Date: Mon, 5 Aug 2002 13:36:01 -0400 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.13,1.14 References: <15694.40064.925281.105046@anthem.wooz.org> Message-ID: <15694.46977.894117.512757@anthem.wooz.org> >>>>> "MvL" =3D=3D Martin v L=F6wis wr= ites: >> I've marked 263 as Final in PEP 0. I'll move it to the >> finished category when the code is checked in. MvL> Actually, the code *is* checked in: python.org/sf/534304. Oops, yes. I dislexically flipped the middle digit. PEP 0 is updated now. MvL> There is one issue, though: the PEP has two phases, and only MvL> phase 1 is planned for Python 2.3; that is done. Phase 2 has MvL> no actual schedule; I guess it will depend on user feedback MvL> to phase 1 (might be Python 2.5 or Python 2.6). I'm not sure MvL> how to present this in the PEP status. Good question. We really don't have a way to do that now. I suppose we could either split phase2 into a separate PEP, should it ever get a schedule, or we could un-finalize the existing PEP. It's more work, but I think I prefer the former approach. MvL> Thanks for dealing with the PEP maintenance, No problem. -Barry From guido@python.org Mon Aug 5 18:51:05 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 05 Aug 2002 13:51:05 -0400 Subject: [Python-checkins] python/nondist/peps pep-0263.txt,1.13,1.14 In-Reply-To: Your message of "Mon, 05 Aug 2002 13:36:01 EDT." <15694.46977.894117.512757@anthem.wooz.org> References: <15694.40064.925281.105046@anthem.wooz.org> <15694.46977.894117.512757@anthem.wooz.org> Message-ID: <200208051751.g75Hp5226180@pcp02138704pcs.reston01.va.comcast.net> > MvL> There is one issue, though: the PEP has two phases, and only > MvL> phase 1 is planned for Python 2.3; that is done. Phase 2 has > MvL> no actual schedule; I guess it will depend on user feedback > MvL> to phase 1 (might be Python 2.5 or Python 2.6). I'm not sure > MvL> how to present this in the PEP status. > > Good question. We really don't have a way to do that now. I suppose > we could either split phase2 into a separate PEP, should it ever get a > schedule, or we could un-finalize the existing PEP. It's more work, > but I think I prefer the former approach. Splitting PEPs sounds unattractive. How about a new PEP stage, something between finalized and accepted? Like in-progress. PEP 237 also in in this stage. --Guido van Rossum (home page: http://www.python.org/~guido/) From bwarsaw@users.sourceforge.net Mon Aug 5 18:34:08 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 05 Aug 2002 10:34:08 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.207,1.208 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19764 Modified Files: pep-0000.txt Log Message: PEP 263 is finished. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -d -r1.207 -r1.208 *** pep-0000.txt 5 Aug 2002 15:39:49 -0000 1.207 --- pep-0000.txt 5 Aug 2002 17:34:06 -0000 1.208 *************** *** 77,81 **** S 258 Docutils Design Specification Goodger S 262 Database of Installed Python Packages Kuchling - SF 263 Defining Python Source Code Encodings Lemburg S 265 Sorting Dictionaries by Value Griffin S 266 Optimizing Global Variable/Attribute Access Montanaro --- 77,80 ---- *************** *** 135,138 **** --- 134,138 ---- SF 260 Simplify xrange() van Rossum S 261 Support for "wide" Unicode characters Prescod + SF 263 Defining Python Source Code Encodings Lemburg SF 264 Future statements in simulated shells Hudson SF 279 The enumerate() built-in function Hettinger From fdrake@users.sourceforge.net Mon Aug 5 19:06:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:06:19 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv413 Modified Files: setup.py Log Message: Since the errno module is needed by os._execvpe(), and that is used by the setup.py (indirectly) script to build the standard dynamically loaded modules, the errno module is being made static so it will always be available. Closes SF bug #591205 (needed on trunk only). Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** setup.py 4 Aug 2002 22:04:25 -0000 1.103 --- setup.py 5 Aug 2002 18:06:16 -0000 1.104 *************** *** 316,321 **** # grp(3) exts.append( Extension('grp', ['grpmodule.c']) ) - # posix (UNIX) errno values - exts.append( Extension('errno', ['errnomodule.c']) ) # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) --- 316,319 ---- From fdrake@users.sourceforge.net Mon Aug 5 19:06:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:06:19 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv413/Modules Modified Files: Setup.dist Log Message: Since the errno module is needed by os._execvpe(), and that is used by the setup.py (indirectly) script to build the standard dynamically loaded modules, the errno module is being made static so it will always be available. Closes SF bug #591205 (needed on trunk only). Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Setup.dist 14 Jun 2002 20:41:14 -0000 1.28 --- Setup.dist 5 Aug 2002 18:06:17 -0000 1.29 *************** *** 110,113 **** --- 110,114 ---- posix posixmodule.c # posix (UNIX) system calls + errno errnomodule.c # posix (UNIX) errno values _sre _sre.c # Fredrik Lundh's new regular expressions *************** *** 178,182 **** #pwd pwdmodule.c # pwd(3) #grp grpmodule.c # grp(3) - #errno errnomodule.c # posix (UNIX) errno values #select selectmodule.c # select(2); not on ancient System V --- 179,182 ---- From jhylton@users.sourceforge.net Mon Aug 5 19:20:04 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:20:04 -0700 Subject: [Python-checkins] python/dist/src/Include cStringIO.h,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv6454 Modified Files: cStringIO.h Log Message: Remove function definition from cStringIO.h. xxxPyCObject_Import() seems to be a copy of PyCObject_Import(). Index: cStringIO.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/cStringIO.h,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** cStringIO.h 4 Apr 2002 17:52:50 -0000 2.17 --- cStringIO.h 5 Aug 2002 18:20:01 -0000 2.18 *************** *** 19,22 **** --- 19,25 ---- */ + #define PycString_IMPORT \ + PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", \ + "cStringIO_CAPI") /* Basic functions to manipulate cStringIO objects from C */ *************** *** 47,51 **** PyTypeObject *InputType, *OutputType; ! } * PycStringIO = NULL; /* These can be used to test if you have one */ --- 50,54 ---- PyTypeObject *InputType, *OutputType; ! } *PycStringIO; /* These can be used to test if you have one */ *************** *** 54,79 **** #define PycStringIO_OutputCheck(O) \ ((O)->ob_type==PycStringIO->OutputType) - - static void * - xxxPyCObject_Import(char *module_name, char *name) - { - PyObject *m, *c; - void *r=NULL; - - if((m=PyImport_ImportModule(module_name))) - { - if((c=PyObject_GetAttrString(m,name))) - { - r=PyCObject_AsVoidPtr(c); - Py_DECREF(c); - } - Py_DECREF(m); - } - - return r; - } - - #define PycString_IMPORT \ - PycStringIO=(struct PycStringIO_CAPI*)xxxPyCObject_Import("cStringIO", "cStringIO_CAPI") #ifdef __cplusplus --- 57,60 ---- From jhylton@users.sourceforge.net Mon Aug 5 19:28:37 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:28:37 -0700 Subject: [Python-checkins] python/dist/src/Tools/framer - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Tools/framer In directory usw-pr-cvs1:/tmp/cvs-serv10320/framer Log Message: Directory /cvsroot/python/python/dist/src/Tools/framer added to the repository From jhylton@users.sourceforge.net Mon Aug 5 19:28:47 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:28:47 -0700 Subject: [Python-checkins] python/dist/src/Tools/framer/framer - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Tools/framer/framer In directory usw-pr-cvs1:/tmp/cvs-serv10437/framer/framer Log Message: Directory /cvsroot/python/python/dist/src/Tools/framer/framer added to the repository From jhylton@users.sourceforge.net Mon Aug 5 19:29:47 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:29:47 -0700 Subject: [Python-checkins] python/dist/src/Tools/framer README.txt,NONE,1.1 TODO.txt,NONE,1.1 example.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/framer In directory usw-pr-cvs1:/tmp/cvs-serv10915/framer Added Files: README.txt TODO.txt example.py Log Message: Initial prototype of framer: a tool to build the frame for extension modules. --- NEW FILE: README.txt --- framer is a tool to generate boilerplate code for C extension types. The boilerplate is generated from a specification object written in Python. The specification uses the class statement to describe the extension module and any extension types it contains. From the specification, framer can generate all the boilerplate C code, including function definitions, argument handling code, and type objects. --- NEW FILE: TODO.txt --- Add spec for getsets. Generate a distutils setup script. Handle operator overloading. Generate traverse and clear methods for GC. Handle mapping, sequence, buffer protocols. Finish the todo list. --- NEW FILE: example.py --- """Generate the skeleton for cStringIO as an example of framer.""" from framer.bases import Module, Type from framer.member import member class cStringIO(Module): """A simple fast partial StringIO replacement. This module provides a simple useful replacement for the StringIO module that is written in C. It does not provide the full generality of StringIO, but it provides enough for most applications and is especially useful in conjunction with the pickle module. Usage: from cStringIO import StringIO an_output_stream = StringIO() an_output_stream.write(some_stuff) ... value = an_output_stream.getvalue() an_input_stream = StringIO(a_string) spam = an_input_stream.readline() spam = an_input_stream.read(5) an_input_stream.seek(0) # OK, start over spam = an_input_stream.read() # and read it all """ __file__ = "cStringIO.c" def StringIO(o): """Return a StringIO-like stream for reading or writing""" StringIO.pyarg = "|O" class InputType(Type): "Simple type for treating strings as input file streams" abbrev = "input" struct = """\ typedef struct { PyObject_HEAD char *buf; int pos; int size; PyObject *pbuf; } InputObject; """ def flush(self): """Does nothing""" def getvalue(self): """Get the string value. If use_pos is specified and is a true value, then the string returned will include only the text up to the current file position. """ def isatty(self): """Always returns False""" def read(self, s): """Return s characters or the rest of the string.""" read.pyarg = "|i" def readline(self): """Read one line.""" def readlines(self, hint): """Read all lines.""" readlines.pyarg = "|i" def reset(self): """Reset the file position to the beginning.""" def tell(self): """Get the current position.""" def truncate(self, pos): """Truncate the file at the current position.""" truncate.pyarg = "|i" def seek(self, position, mode=0): """Set the current position. The optional mode argument can be 0 for absolute, 1 for relative, and 2 for relative to EOF. The default is absolute. """ seek.pyarg = "i|i" def close(self): pass class OutputType(InputType): "Simple type for output strings." abbrev = "output" struct = """\ typedef struct { PyObject_HEAD char *buf; int pos; int size; int softspace; } OutputObject; """ softspace = member() def close(self): """Explicitly release resources.""" def write(self, s): """Write a string to the file.""" # XXX Hack: writing None resets the buffer def writelines(self, lines): """Write each string in lines.""" cStringIO.gen() From jhylton@users.sourceforge.net Mon Aug 5 19:29:48 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 Aug 2002 11:29:48 -0700 Subject: [Python-checkins] python/dist/src/Tools/framer/framer __init__.py,NONE,1.1 bases.py,NONE,1.1 function.py,NONE,1.1 member.py,NONE,1.1 slots.py,NONE,1.1 struct.py,NONE,1.1 structparse.py,NONE,1.1 template.py,NONE,1.1 util.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/framer/framer In directory usw-pr-cvs1:/tmp/cvs-serv10915/framer/framer Added Files: __init__.py bases.py function.py member.py slots.py struct.py structparse.py template.py util.py Log Message: Initial prototype of framer: a tool to build the frame for extension modules. --- NEW FILE: __init__.py --- """A tool to generate basic framework for C extension types. The basic ideas is the same as modulator, but the code generates code using many of the new features introduced in Python 2.2. It also takes a more declarative approach to generating code. """ --- NEW FILE: bases.py --- """Provides the Module and Type base classes that user code inherits from.""" __all__ = ["Module", "Type", "member"] from framer import struct, template from framer.function import Function, Method from framer.member import member from framer.slots import * from framer.util import cstring, unindent from types import FunctionType def sortitems(dict): L = dict.items() L.sort() return L # The Module and Type classes are implemented using metaclasses, # because most of the methods are class methods. It is easier to use # metaclasses than the cumbersome classmethod() builtin. They have # class methods because they are exposed to user code as base classes. class BaseMetaclass(type): """Shared infrastructure for generating modules and types.""" # just methoddef so far def dump_methoddef(self, f, functions, vars): def p(templ, vars=vars): # helper function to generate output print >> f, templ % vars if not functions: return p(template.methoddef_start) for name, func in sortitems(functions): if func.__doc__: p(template.methoddef_def_doc, func.vars) else: p(template.methoddef_def, func.vars) p(template.methoddef_end) class ModuleMetaclass(BaseMetaclass): """Provides methods for Module class.""" def gen(self): self.analyze() self.initvars() f = open(self.__filename, "w") self.dump(f) f.close() def analyze(self): self.name = getattr(self, "abbrev", self.__name__) self.__functions = {} self.__types = {} self.__members = False for name, obj in self.__dict__.iteritems(): if isinstance(obj, FunctionType): self.__functions[name] = Function(obj, self) elif isinstance(obj, TypeMetaclass): obj._TypeMetaclass__module = self.name obj.analyze() self.__types[name] = obj if obj.has_members(): self.__members = True def initvars(self): v = self.__vars = {} filename = getattr(self, "__file__", None) if filename is None: filename = self.__name__ + "module.c" self.__filename = v["FileName"] = filename name = v["ModuleName"] = self.__name__ v["MethodDefName"] = "%s_methods" % name v["ModuleDocstring"] = cstring(unindent(self.__doc__)) def dump(self, f): def p(templ, vars=self.__vars): # helper function to generate output print >> f, templ % vars p(template.module_start) if self.__members: p(template.member_include) print >> f if self.__doc__: p(template.module_doc) for name, type in sortitems(self.__types): type.dump(f) for name, func in sortitems(self.__functions): func.dump(f) self.dump_methoddef(f, self.__functions, self.__vars) p(template.module_init_start) for name, type in sortitems(self.__types): type.dump_init(f) p("}") class Module: __metaclass__ = ModuleMetaclass class TypeMetaclass(BaseMetaclass): def dump(self, f): self.initvars() # defined after initvars() so that __vars is defined def p(templ, vars=self.__vars): print >> f, templ % vars if self.struct is not None: print >> f, unindent(self.struct, False) if self.__doc__: p(template.docstring) for name, func in sortitems(self.__methods): func.dump(f) self.dump_methoddef(f, self.__methods, self.__vars) self.dump_memberdef(f) self.dump_slots(f) def has_members(self): if self.__members: return True else: return False def analyze(self): # called by ModuleMetaclass analyze() self.name = getattr(self, "abbrev", self.__name__) src = getattr(self, "struct", None) if src is not None: self.__struct = struct.parse(src) else: self.__struct = None self.__methods = {} self.__members = {} for cls in self.__mro__: for k, v in cls.__dict__.iteritems(): if isinstance(v, FunctionType): self.__methods[k] = Method(v, self) if isinstance(v, member): self.__members[k] = v assert self.__struct is not None v.register(k, self.__struct) self.analyze_slots() def analyze_slots(self): self.__slots = {} for s in Slots: if s.special is not None: meth = self.__methods.get(s.special) if meth is not None: self.__slots[s] = meth self.__slots[TP_NAME] = '"%s.%s"' % (self.__module, self.__name__) if self.__doc__: self.__slots[TP_DOC] = "%s_doc" % self.name if self.__struct is not None: self.__slots[TP_BASICSIZE] = "sizeof(%s)" % self.__struct.name self.__slots[TP_DEALLOC] = "%s_dealloc" % self.name if self.__methods: self.__slots[TP_METHODS] = "%s_methods" % self.name if self.__members: self.__slots[TP_MEMBERS] = "%s_members" % self.name def initvars(self): v = self.__vars = {} v["TypeName"] = self.__name__ v["CTypeName"] = "Py%s_Type" % self.__name__ v["MethodDefName"] = self.__slots[TP_METHODS] if self.__doc__: v["DocstringVar"] = self.__slots[TP_DOC] v["Docstring"] = cstring(unindent(self.__doc__)) if self.__struct is not None: v["StructName"] = self.__struct.name if self.__members: v["MemberDefName"] = self.__slots[TP_MEMBERS] def dump_memberdef(self, f): def p(templ, vars=self.__vars): print >> f, templ % vars if not self.__members: return p(template.memberdef_start) for name, slot in sortitems(self.__members): slot.dump(f) p(template.memberdef_end) def dump_slots(self, f): def p(templ, vars=self.__vars): print >> f, templ % vars if self.struct: p(template.dealloc_func, {"name" : self.__slots[TP_DEALLOC]}) p(template.type_struct_start) for s in Slots[:-5]: # XXX val = self.__slots.get(s, s.default) ntabs = 4 - (4 + len(val)) / 8 line = " %s,%s/* %s */" % (val, "\t" * ntabs, s.name) print >> f, line p(template.type_struct_end) def dump_init(self, f): def p(templ): print >> f, templ % self.__vars p(template.type_init_type) p(template.module_add_type) class Type: __metaclass__ = TypeMetaclass --- NEW FILE: function.py --- """Functions.""" from framer import template from framer.util import cstring, unindent METH_O = "METH_O" METH_NOARGS = "METH_NOARGS" METH_VARARGS = "METH_VARARGS" def parsefmt(fmt): for c in fmt: if c == '|': continue yield c class Argument: def __init__(self, name): self.name = name self.ctype = "PyObject *" self.default = None def __str__(self): return "%s%s" % (self.ctype, self.name) def setfmt(self, code): self.ctype = self._codes[code] if self.ctype[-1] != "*": self.ctype += " " _codes = {"O": "PyObject *", "i": "int", } def decl(self): if self.default is None: return str(self) + ";" else: return "%s = %s;" % (self, self.default) class _ArgumentList(object): # these instance variables should be initialized by subclasses ml_meth = None fmt = None def __init__(self, args): self.args = map(Argument, args) def __len__(self): return len(self.args) def __getitem__(self, i): return self.args[i] def dump_decls(self, f): pass class NoArgs(_ArgumentList): def __init__(self, args): assert len(args) == 0 super(NoArgs, self).__init__(args) self.ml_meth = METH_NOARGS def c_args(self): return "PyObject *self" class OneArg(_ArgumentList): def __init__(self, args): assert len(args) == 1 super(OneArg, self).__init__(args) self.ml_meth = METH_O def c_args(self): return "PyObject *self, %s" % self.args[0] class VarArgs(_ArgumentList): def __init__(self, args, fmt=None): super(VarArgs, self).__init__(args) self.ml_meth = METH_VARARGS if fmt is not None: self.fmt = fmt i = 0 for code in parsefmt(fmt): self.args[i].setfmt(code) i += 1 def c_args(self): return "PyObject *self, PyObject *args" def targets(self): return ", ".join(["&%s" % a.name for a in self.args]) def dump_decls(self, f): for a in self.args: print >> f, " %s" % a.decl() def ArgumentList(func, method): code = func.func_code args = code.co_varnames[:code.co_argcount] if method: args = args[1:] pyarg = getattr(func, "pyarg", None) if pyarg is not None: args = VarArgs(args, pyarg) if func.func_defaults: L = list(func.func_defaults) ndefault = len(L) i = len(args) - ndefault while L: args[i].default = L.pop(0) return args else: if len(args) == 0: return NoArgs(args) elif len(args) == 1: return OneArg(args) else: return VarArgs(args) class Function: method = False def __init__(self, func, parent): self._func = func self._parent = parent self.analyze() self.initvars() def dump(self, f): def p(templ, vars=None): # helper function to generate output if vars is None: vars = self.vars print >> f, templ % vars if self.__doc__: p(template.docstring) d = {"name" : self.vars["CName"], "args" : self.args.c_args(), } p(template.funcdef_start, d) self.args.dump_decls(f) if self.args.ml_meth == METH_VARARGS: p(template.varargs) p(template.funcdef_end) def analyze(self): self.__doc__ = self._func.__doc__ self.args = ArgumentList(self._func, self.method) def initvars(self): v = self.vars = {} v["PythonName"] = self._func.__name__ s = v["CName"] = "%s_%s" % (self._parent.name, self._func.__name__) v["DocstringVar"] = s + "_doc" v["MethType"] = self.args.ml_meth if self.__doc__: v["Docstring"] = cstring(unindent(self.__doc__)) if self.args.fmt is not None: v["ArgParse"] = self.args.fmt v["ArgTargets"] = self.args.targets() class Method(Function): method = True --- NEW FILE: member.py --- from framer import template from framer.util import cstring, unindent T_SHORT = "T_SHORT" T_INT = "T_INT" T_LONG = "T_LONG" T_FLOAT = "T_FLOAT" T_DOUBLE = "T_DOUBLE" T_STRING = "T_STRING" T_OBJECT = "T_OBJECT" T_CHAR = "T_CHAR" T_BYTE = "T_BYTE" T_UBYTE = "T_UBYTE" T_UINT = "T_UINT" T_ULONG = "T_ULONG" T_STRING_INPLACE = "T_STRING_INPLACE" T_OBJECT_EX = "T_OBJECT_EX" RO = READONLY = "READONLY" READ_RESTRICTED = "READ_RESTRICTED" WRITE_RESTRICTED = "WRITE_RESTRICTED" RESTRICT = "RESTRICTED" c2t = {"int" : T_INT, "unsigned int" : T_UINT, "long" : T_LONG, "unsigned long" : T_LONG, "float" : T_FLOAT, "double" : T_DOUBLE, "char *" : T_CHAR, "PyObject *" : T_OBJECT, } class member(object): def __init__(self, cname=None, type=None, flags=None, doc=None): self.type = type self.flags = flags self.cname = cname self.doc = doc self.name = None self.struct = None def register(self, name, struct): self.name = name self.struct = struct self.initvars() def initvars(self): v = self.vars = {} v["PythonName"] = self.name if self.cname is not None: v["CName"] = self.cname else: v["CName"] = self.name v["Flags"] = self.flags or "0" v["Type"] = self.get_type() if self.doc is not None: v["Docstring"] = cstring(unindent(self.doc)) v["StructName"] = self.struct.name def get_type(self): """Deduce type code from struct specification if not defined""" if self.type is not None: return self.type ctype = self.struct.get_type(self.name) return c2t[ctype] def dump(self, f): if self.doc is None: print >> f, template.memberdef_def % self.vars else: print >> f, template.memberdef_def_doc % self.vars --- NEW FILE: slots.py --- """Descriptions of all the slots in Python's type objects.""" class Slot(object): def __init__(self, name, cast=None, special=None, default="0"): self.name = name self.cast = cast self.special = special self.default = default Slots = (Slot("ob_size"), Slot("tp_name"), Slot("tp_basicsize"), Slot("tp_itemsize"), Slot("tp_dealloc", "destructor"), Slot("tp_print", "printfunc"), Slot("tp_getattr", "getattrfunc"), Slot("tp_setattr", "setattrfunc"), Slot("tp_compare", "cmpfunc", "__cmp__"), Slot("tp_repr", "reprfunc", "__repr__"), Slot("tp_as_number"), Slot("tp_as_sequence"), Slot("tp_as_mapping"), Slot("tp_hash", "hashfunc", "__hash__"), Slot("tp_call", "ternaryfunc", "__call__"), Slot("tp_str", "reprfunc", "__str__"), Slot("tp_getattro", "getattrofunc", "__getattr__", # XXX "PyObject_GenericGetAttr"), Slot("tp_setattro", "setattrofunc", "__setattr__"), Slot("tp_as_buffer"), Slot("tp_flags", default="Py_TPFLAGS_DEFAULT"), Slot("tp_doc"), Slot("tp_traverse", "traverseprox"), Slot("tp_clear", "inquiry"), Slot("tp_richcompare", "richcmpfunc"), Slot("tp_weaklistoffset"), Slot("tp_iter", "getiterfunc", "__iter__"), Slot("tp_iternext", "iternextfunc", "__next__"), # XXX Slot("tp_methods"), Slot("tp_members"), Slot("tp_getset"), Slot("tp_base"), Slot("tp_dict"), Slot("tp_descr_get", "descrgetfunc"), Slot("tp_descr_set", "descrsetfunc"), Slot("tp_dictoffset"), Slot("tp_init", "initproc", "__init__"), Slot("tp_alloc", "allocfunc"), Slot("tp_new", "newfunc"), Slot("tp_free", "freefunc"), Slot("tp_is_gc", "inquiry"), Slot("tp_bases"), Slot("tp_mro"), Slot("tp_cache"), Slot("tp_subclasses"), Slot("tp_weaklist"), ) # give some slots symbolic names TP_NAME = Slots[1] TP_BASICSIZE = Slots[2] TP_DEALLOC = Slots[4] TP_DOC = Slots[20] TP_METHODS = Slots[27] TP_MEMBERS = Slots[28] --- NEW FILE: struct.py --- """Rudimentary parser for C struct definitions.""" import re PyObject_HEAD = "PyObject_HEAD" PyObject_VAR_HEAD = "PyObject_VAR_HEAD" rx_name = re.compile("} (\w+);") class Struct: def __init__(self, name, head, members): self.name = name self.head = head self.members = members def get_type(self, name): for _name, type in self.members: if name == _name: return type raise ValueError, "no member named %s" % name def parse(s): """Parse a C struct definition. The parser is very restricted in what it will accept. """ lines = filter(None, s.split("\n")) # get non-empty lines assert lines[0].strip() == "typedef struct {" pyhead = lines[1].strip() assert (pyhead.startswith("PyObject") and pyhead.endswith("HEAD")) members = [] for line in lines[2:]: line = line.strip() if line.startswith("}"): break assert line.endswith(";") line = line[:-1] words = line.split() name = words[-1] type = " ".join(words[:-1]) if name[0] == "*": name = name[1:] type += " *" members.append((name, type)) name = None mo = rx_name.search(line) assert mo is not None name = mo.group(1) return Struct(name, pyhead, members) --- NEW FILE: structparse.py --- """Rudimentary parser for C struct definitions.""" import re PyObject_HEAD = "PyObject_HEAD" PyObject_VAR_HEAD = "PyObject_VAR_HEAD" rx_name = re.compile("} (\w+);") class Struct: def __init__(self, name, head, members): self.name = name self.head = head self.members = members def parse(s): """Parse a C struct definition. The parser is very restricted in what it will accept. """ lines = filter(None, s.split("\n")) # get non-empty lines assert lines[0].strip() == "typedef struct {" pyhead = lines[1].strip() assert (pyhead.startswith("PyObject") and pyhead.endswith("HEAD")) members = [] for line in lines[2:]: line = line.strip() if line.startswith("}"): break assert line.endswith(";") line = line[:-1] words = line.split() name = words[-1] type = " ".join(words[:-1]) if name[0] == "*": name = name[1:] type += " *" members.append((name, type)) name = None mo = rx_name.search(line) assert mo is not None name = mo.group(1) return Struct(name, pyhead, members) --- NEW FILE: template.py --- """framer's C code templates. Templates use the following variables: FileName: name of the file that contains the C source code ModuleName: name of the module, as in "import ModuleName" ModuleDocstring: C string containing the module doc string """ module_start = '#include "Python.h"' member_include = '#include "structmember.h"' module_doc = """\ PyDoc_STRVAR(%(ModuleName)s_doc, %(ModuleDocstring)s); """ methoddef_start = """\ static struct PyMethodDef %(MethodDefName)s[] = {""" methoddef_def = """\ {"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},""" methoddef_def_doc = """\ {"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s, %(DocstringVar)s},""" methoddef_end = """\ {NULL, NULL} }; """ memberdef_start = """\ #define OFF(X) offsetof(%(StructName)s, X) static struct PyMemberDef %(MemberDefName)s[] = {""" memberdef_def_doc = """\ {"%(PythonName)s", %(Type)s, OFF(%(CName)s), %(Flags)s, %(Docstring)s},""" memberdef_def = """\ {"%(PythonName)s", %(Type)s, OFF(%(CName)s), %(Flags)s},""" memberdef_end = """\ {NULL} }; #undef OFF """ dealloc_func = """static void %(name)s(PyObject *ob) { } """ docstring = """\ PyDoc_STRVAR(%(DocstringVar)s, %(Docstring)s); """ funcdef_start = """\ static PyObject * %(name)s(%(args)s) {""" funcdef_end = """\ } """ varargs = """\ if (!PyArg_ParseTuple(args, \"%(ArgParse)s:%(PythonName)s\", %(ArgTargets)s)) return NULL;""" module_init_start = """\ PyMODINIT_FUNC init%(ModuleName)s(void) { PyObject *mod; mod = Py_InitModule3("%(ModuleName)s", %(MethodDefName)s, %(ModuleName)s_doc); if (mod == NULL) return; """ type_init_type = " %(CTypeName)s.ob_type = &PyType_Type;" module_add_type = """\ if (!PyObject_SetAttrString(mod, "%(TypeName)s", (PyObject *)&%(CTypeName)s)) return; """ type_struct_start = """\ static PyTypeObject %(CTypeName)s = { PyObject_HEAD_INIT(0)""" type_struct_end = """\ }; """ --- NEW FILE: util.py --- def cstring(s, width=70): """Return C string representation of a Python string. width specifies the maximum width of any line of the C string. """ L = [] for l in s.split("\n"): if len(l) < width: L.append(r'"%s\n"' % l) return "\n".join(L) def unindent(s, skipfirst=True): """Return an unindented version of a docstring. Removes indentation on lines following the first one, using the leading whitespace of the first indented line that is not blank to determine the indentation. """ lines = s.split("\n") if skipfirst: first = lines.pop(0) L = [first] else: L = [] indent = None for l in lines: ls = l.strip() if ls: indent = len(l) - len(ls) break L += [l[indent:] for l in lines] return "\n".join(L) From Jack.Jansen@oratrix.com Mon Aug 5 22:11:23 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Mon, 5 Aug 2002 23:11:23 +0200 Subject: [Python-checkins] python/dist/src/Tools/framer README.txt,NONE,1.1 TODO.txt,NONE,1.1 example.py,NONE,1.1 In-Reply-To: Message-ID: On maandag, augustus 5, 2002, at 08:29 , jhylton@users.sourceforge.net wrote: > framer is a tool to generate boilerplate code for C extension types. Jeremy, how does framer relate to modulator? Is it a replacement? Should modulator be adapted to framer? (And, if so, who's going to do it? :-) -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From jackjansen@users.sourceforge.net Mon Aug 5 22:13:09 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 14:13:09 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag dragscan.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv21973/drag Modified Files: dragscan.py Log Message: Fixed the last two bgen-based modules to be buildable on OSX. Index: dragscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragscan.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dragscan.py 5 Aug 2002 15:39:27 -0000 1.3 --- dragscan.py 5 Aug 2002 21:13:07 -0000 1.4 *************** *** 2,6 **** import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) --- 2,6 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR, INCLUDEDIR sys.path.append(BGENDIR) From jackjansen@users.sourceforge.net Mon Aug 5 22:13:10 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 14:13:10 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastescan.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv21973/waste Modified Files: wastescan.py Log Message: Fixed the last two bgen-based modules to be buildable on OSX. Index: wastescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastescan.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** wastescan.py 24 Mar 2002 23:01:30 -0000 1.9 --- wastescan.py 5 Aug 2002 21:13:07 -0000 1.10 *************** *** 3,13 **** import sys import os ! BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen') sys.path.append(BGENDIR) from scantools import Scanner - from bgenlocations import MWERKSDIR, TOOLBOXDIR ! #WASTEDIR=":::::Waste 1.3 Distribution:WASTE C/C++ Headers:" ! WASTEDIR=MWERKSDIR + 'MacOS Support:(Third Party Support):Waste 2.0 Distribution:C_C++ Headers:' OBJECT = "TEHandle" --- 3,14 ---- import sys import os ! from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner ! WASTEDIR='/Applications/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/MacOS Support/(Third Party Support)/Waste 2.0 Distribution/C_C++ Headers/' ! ! if not os.path.exists(WASTEDIR): ! raise 'Error: not found: %s', WASTEDIR OBJECT = "TEHandle" From jackjansen@users.sourceforge.net Mon Aug 5 22:14:19 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 14:14:19 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts bgenall.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv22390 Modified Files: bgenall.py Log Message: Better output for errors, and some progress reports. Handle the two modules with non-standard scanner module names. Index: bgenall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/bgenall.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bgenall.py 5 Aug 2002 15:33:44 -0000 1.3 --- bgenall.py 5 Aug 2002 21:14:16 -0000 1.4 *************** *** 7,17 **** def bgenone(dirname, shortname): os.chdir(dirname) try: ! m = __import__(shortname+'scan') except: return 0 try: m.main() except: return 0 return 1 --- 7,28 ---- def bgenone(dirname, shortname): os.chdir(dirname) + print '%s:'%shortname + # Sigh, we don't want to lose CVS history, so two + # modules have funny names: + if shortname == 'carbonevt': + modulename = 'CarbonEvtscan' + elif shortname == 'ibcarbon': + modulename = 'IBCarbonscan' + else: + modulename = shortname + 'scan' try: ! m = __import__(modulename) except: + print "Error:", shortname, sys.exc_info()[1] return 0 try: m.main() except: + print "Error:", shortname, sys.exc_info()[1] return 0 return 1 From jackjansen@users.sourceforge.net Mon Aug 5 22:15:24 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 14:15:24 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenGenerator.py,1.11,1.12 scantools.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv22871 Modified Files: bgenGenerator.py scantools.py Log Message: Be a lot less verbose by default. Index: bgenGenerator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** bgenGenerator.py 27 Aug 2001 14:30:55 -0000 1.11 --- bgenGenerator.py 5 Aug 2002 21:15:22 -0000 1.12 *************** *** 6,9 **** --- 6,10 ---- Error = "bgenGenerator.Error" + DEBUG=0 # Strings to specify argument transfer modes in generator calls *************** *** 16,20 **** def __init__(self, name, condition=None): ! print "<--", name self.name = name self.prefix = name --- 17,21 ---- def __init__(self, name, condition=None): ! if DEBUG: print "<--", name self.name = name self.prefix = name *************** *** 26,30 **** def generate(self): ! print "-->", self.name if self.condition: Output() --- 27,31 ---- def generate(self): ! if DEBUG: print "-->", self.name if self.condition: Output() Index: scantools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** scantools.py 5 Aug 2002 15:32:30 -0000 1.30 --- scantools.py 5 Aug 2002 21:15:22 -0000 1.31 *************** *** 68,72 **** modes = self.usedtypes[type].keys() modes.sort() ! print type, string.join(modes) def gentypetest(self, file): --- 68,72 ---- modes = self.usedtypes[type].keys() modes.sort() ! self.report("%s %s", type, string.join(modes)) def gentypetest(self, file): *************** *** 90,94 **** def initsilent(self): ! self.silent = 0 def error(self, format, *args): --- 90,94 ---- def initsilent(self): ! self.silent = 1 def error(self, format, *args): *************** *** 487,491 **** self.report("==> %s %s <==", type, name) if self.blacklisted(type, name): ! self.error("*** %s %s blacklisted", type, name) return returnlist = [(type, name, 'ReturnMode')] --- 487,491 ---- self.report("==> %s %s <==", type, name) if self.blacklisted(type, name): ! self.report("*** %s %s blacklisted", type, name) return returnlist = [(type, name, 'ReturnMode')] *************** *** 497,501 **** ##for arg in arglist: ## self.report(" %s", `arg`) ! self.error("*** %s %s unmanageable", type, name) return self.alreadydone.append(name) --- 497,501 ---- ##for arg in arglist: ## self.report(" %s", `arg`) ! self.report("*** %s %s unmanageable", type, name) return self.alreadydone.append(name) From jackjansen@users.sourceforge.net Mon Aug 5 22:53:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 14:53:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib macostools.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4842 Modified Files: macostools.py Log Message: In copy() don't try to obtain an FSSpec until we know the destination exists. Partial fix for #585923. Index: macostools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macostools.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** macostools.py 3 Aug 2002 20:49:10 -0000 1.15 --- macostools.py 5 Aug 2002 21:53:57 -0000 1.16 *************** *** 28,31 **** --- 28,33 ---- """Create a finder alias""" srcfss = macfs.FSSpec(src) + # The next line will fail under unix-Python if the destination + # doesn't exist yet. We should change this code to be fsref-based. dstfss = macfs.FSSpec(dst) if relative: *************** *** 83,93 **** def copy(src, dst, createpath=0, copydates=1, forcetype=None): """Copy a file, including finder info, resource fork, etc""" if createpath: mkdirs(os.path.split(dst)[0]) - srcfss = macfs.FSSpec(src) - dstfss = macfs.FSSpec(dst) ! ifp = open(srcfss.as_pathname(), 'rb') ! ofp = open(dstfss.as_pathname(), 'wb') d = ifp.read(BUFSIZ) while d: --- 85,97 ---- def copy(src, dst, createpath=0, copydates=1, forcetype=None): """Copy a file, including finder info, resource fork, etc""" + if hasattr(src, 'as_pathname'): + src = src.as_pathname() + if hasattr(dst, 'as_pathname'): + dst = dst.as_pathname() if createpath: mkdirs(os.path.split(dst)[0]) ! ifp = open(src, 'rb') ! ofp = open(dst, 'wb') d = ifp.read(BUFSIZ) while d: *************** *** 97,102 **** ofp.close() ! ifp = openrf(srcfss.as_pathname(), '*rb') ! ofp = openrf(dstfss.as_pathname(), '*wb') d = ifp.read(BUFSIZ) while d: --- 101,106 ---- ofp.close() ! ifp = openrf(src, '*rb') ! ofp = openrf(dst, '*wb') d = ifp.read(BUFSIZ) while d: *************** *** 106,109 **** --- 110,115 ---- ofp.close() + srcfss = macfs.FSSpec(src) + dstfss = macfs.FSSpec(dst) sf = srcfss.GetFInfo() df = dstfss.GetFInfo() From jackjansen@users.sourceforge.net Mon Aug 5 23:06:31 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 05 Aug 2002 15:06:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib buildtools.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10601 Modified Files: buildtools.py Log Message: Patch by Ronald Oussoren: if there's a .lproj in the extras list also check whether it contains a .nib, and do the Cocoa song and dance if it does. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** buildtools.py 2 Aug 2002 14:57:43 -0000 1.15 --- buildtools.py 5 Aug 2002 22:06:29 -0000 1.16 *************** *** 323,327 **** NSPrincipalClass NSApplication""" % nibname ! plistname = os.path.join(template, 'Contents', 'Resources', 'Applet-Info.plist') --- 323,336 ---- NSPrincipalClass NSApplication""" % nibname ! elif o[-6:] == '.lproj': ! files = os.listdir(o) ! for f in files: ! if f[-4:] == '.nib': ! nibname = os.path.split(f)[1][:-4] ! cocoainfo = """ ! NSMainNibFile ! %s ! NSPrincipalClass ! NSApplication""" % nibname plistname = os.path.join(template, 'Contents', 'Resources', 'Applet-Info.plist') From skip@pobox.com Mon Aug 5 23:14:40 2002 From: skip@pobox.com (Skip Montanaro) Date: Mon, 5 Aug 2002 17:14:40 -0500 Subject: [Python-checkins] python/dist/src/Tools/framer README.txt,NONE,1.1 TODO.txt,NONE,1.1 example.py,NONE,1.1 In-Reply-To: References: Message-ID: <15694.63696.655874.808626@localhost.localdomain> >> framer is a tool to generate boilerplate code for C extension types. Jack> how does framer relate to modulator? Is it a replacement? Should Jack> modulator be adapted to framer? (And, if so, who's going to do Jack> it? :-) How does framer relate to Pyrex? Skip From fdrake@users.sourceforge.net Mon Aug 5 23:16:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 05 Aug 2002 15:16:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hotshot.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14341/Lib/test Modified Files: test_hotshot.py Log Message: We only need to check for StopIteration here. Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_hotshot.py 23 Jul 2002 19:03:54 -0000 1.10 --- test_hotshot.py 5 Aug 2002 22:16:40 -0000 1.11 *************** *** 31,35 **** try: return hotshot.log.LogReader.next(self) ! except (IndexError, StopIteration): self.close() os.unlink(self.__logfn) --- 31,35 ---- try: return hotshot.log.LogReader.next(self) ! except StopIteration: self.close() os.unlink(self.__logfn) From nnorwitz@users.sourceforge.net Tue Aug 6 00:33:56 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 05 Aug 2002 16:33:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6037 Modified Files: libdis.tex Log Message: SF patch #591305 Documentation err in bytecode defs Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** libdis.tex 26 Jun 2002 22:32:47 -0000 1.37 --- libdis.tex 5 Aug 2002 23:33:54 -0000 1.38 *************** *** 304,308 **** \begin{opcodedesc}{SLICE+2}{} ! Implements \code{TOS = TOS1[:TOS1]}. \end{opcodedesc} --- 304,308 ---- \begin{opcodedesc}{SLICE+2}{} ! Implements \code{TOS = TOS1[:TOS]}. \end{opcodedesc} From nnorwitz@users.sourceforge.net Tue Aug 6 00:35:04 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 05 Aug 2002 16:35:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.33.10.2,1.33.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6429 Modified Files: Tag: release22-maint libdis.tex Log Message: SF patch #591305 Documentation err in bytecode defs Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.33.10.2 retrieving revision 1.33.10.3 diff -C2 -d -r1.33.10.2 -r1.33.10.3 *** libdis.tex 26 Jun 2002 22:37:28 -0000 1.33.10.2 --- libdis.tex 5 Aug 2002 23:35:02 -0000 1.33.10.3 *************** *** 304,308 **** \begin{opcodedesc}{SLICE+2}{} ! Implements \code{TOS = TOS1[:TOS1]}. \end{opcodedesc} --- 304,308 ---- \begin{opcodedesc}{SLICE+2}{} ! Implements \code{TOS = TOS1[:TOS]}. \end{opcodedesc} From akuchling@users.sourceforge.net Tue Aug 6 02:40:50 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 05 Aug 2002 18:40:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv8449 Modified Files: whatsnew23.tex Log Message: Mention list.sort() Document heapq module Add PEP263 section (not sure I really understand the PEP's effect on 8-bit strings, though -- will have to experiment with it) Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** whatsnew23.tex 4 Aug 2002 01:20:05 -0000 1.42 --- whatsnew23.tex 6 Aug 2002 01:40:48 -0000 1.43 *************** *** 2,8 **** % $Id$ - % TODO: - % Go through and get the contributor's name for all the various changes - \title{What's New in Python 2.3} \release{0.03} --- 2,5 ---- *************** *** 16,25 **** % Optik (or whatever it gets called) % - % Bug #580462: changes to GC API - % - % heapq module - % % MacOS framework-related changes (section of its own, probably) % %\section{Introduction \label{intro}} --- 13,19 ---- % Optik (or whatever it gets called) % % MacOS framework-related changes (section of its own, probably) % + % New sorting code %\section{Introduction \label{intro}} *************** *** 192,195 **** --- 186,220 ---- %====================================================================== + \section{PEP 263: \label{section-encodings}} + + Python source files can now be declared as being in different + character set encodings. Encodings are declared by including a + specially formatted comment in the first or second line of the source + file. For example, a UTF-8 file can be declared with: + + \begin{verbatim} + #!/usr/bin/env python + # -*- coding: UTF-8 -*- + \end{verbatim} + + Without such an encoding declaration, the default encoding used is + ISO-8859-1, also known as Latin1. + + The encoding declaration only affects Unicode string literals; the + text in the source code will be converted to Unicode using the + specified encoding. Note that Python identifiers are still restricted + to ASCII characters, so you can't have variable names that use + characters outside of the usual alphanumerics. + + \begin{seealso} + + \seepep{263}{Defining Python Source Code Encodings}{Written by + Marc-Andr\'e Lemburg and Martin von L\"owis; implemented by Martin von + L\"owis.} + + \end{seealso} + + + %====================================================================== \section{PEP 278: Universal Newline Support} *************** *** 559,562 **** --- 584,591 ---- can't create \class{basestring} instances. + \item The \method{sort()} method of list objects has been extensively + rewritten by Tim Peters, and the implementation is significantly + faster. + \item Most type objects are now callable, so you can use them to create new objects such as functions, classes, and modules. (This *************** *** 676,679 **** --- 705,754 ---- \end{verbatim} + \item The new \module{heapq} module contains an implementation of a + heap queue algorithm. A heap is an array-like data structure that + keeps items in a sorted order such that, for every index k, heap[k] <= + heap[2*k+1] and heap[k] <= heap[2*k+2]. This makes it quick to remove + the smallest item, and inserting a new item while maintaining the heap + property is O(lg~n). (See + \url{http://www.nist.gov/dads/HTML/priorityque.html} for more + information about the priority queue data structure.) + + The Python \module{heapq} module provides \function{heappush()} and + \function{heappop()} functions for adding and removing items while + maintaining the heap property on top of some other mutable Python + sequence type. For example: + + \begin{verbatim} + >>> import heapq + >>> heap = [] + >>> for item in [3, 7, 5, 11, 1]: + ... heapq.heappush(heap, item) + ... + >>> heap + [1, 3, 5, 11, 7] + >>> heapq.heappop(heap) + 1 + >>> heapq.heappop(heap) + 3 + >>> heap + [5, 7, 11] + >>> + >>> heapq.heappush(heap, 5) + >>> heap = [] + >>> for item in [3, 7, 5, 11, 1]: + ... heapq.heappush(heap, item) + ... + >>> heap + [1, 3, 5, 11, 7] + >>> heapq.heappop(heap) + 1 + >>> heapq.heappop(heap) + 3 + >>> heap + [5, 7, 11] + >>> + \end{verbatim} + + (Contributed by Kevin O'Connor.) \item Two new functions in the \module{math} module, *************** *** 980,983 **** --- 1055,1064 ---- %====================================================================== + \section{Porting to Python 2.3} + + XXX write this + + + %====================================================================== \section{Acknowledgements \label{acks}} *************** *** 986,990 **** article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, ! Gustavo Niemeyer, Neal Norwitz. \end{document} --- 1067,1071 ---- article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, ! Gustavo Niemeyer, Neal Norwitz, Jason Tishler. \end{document} From jackjansen@users.sourceforge.net Tue Aug 6 10:33:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 Aug 2002 02:33:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon IBCarbon.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv27669 Added Files: IBCarbon.py Log Message: Wrapper around _IBCarbon. --- NEW FILE: IBCarbon.py --- from _IBCarbon import * From jackjansen@users.sourceforge.net Tue Aug 6 13:59:52 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 Aug 2002 05:59:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules macfsmodule.c,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2710 Modified Files: macfsmodule.c Log Message: Patch #567296 by Pim Buurman, slightly modified by me so it can be disabled at compile time: use PBGetCatInfoSync() to get FInfo data in stead of GetFInfo. The latter doesn't work for folders. The former does, at least on OSX, and insofar the info makes sense for a folder. Index: macfsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** macfsmodule.c 17 Jul 2002 16:30:34 -0000 1.56 --- macfsmodule.c 6 Aug 2002 12:59:44 -0000 1.57 *************** *** 40,43 **** --- 40,50 ---- #include "getapplbycreator.h" + /* + ** The next define uses PBGetCatInfoSync for GetFInfo, allowing you + ** to get FInfo for folders. This works on OSX, but it may result + ** in problems on OS9, hence the define (for the time being). + */ + #define USE_CATINFO_FOR_FINFO + #ifndef TARGET_API_MAC_OSX #include "pythonresources.h" *************** *** 593,602 **** OSErr err; mfsiobject *fip; ! ! if (!PyArg_ParseTuple(args, "")) return NULL; if ( (fip=newmfsiobject()) == NULL ) return NULL; err = FSpGetFInfo(&self->fsspec, &fip->finfo); if ( err ) { --- 600,623 ---- OSErr err; mfsiobject *fip; ! CInfoPBRec pb; ! FSSpec* fss = &self->fsspec; ! if (!PyArg_ParseTuple(args, "")) return NULL; if ( (fip=newmfsiobject()) == NULL ) return NULL; + #ifdef USE_CATINFO_FOR_FINFO + pb.dirInfo.ioNamePtr = fss->name; + pb.dirInfo.ioFDirIndex = 0; + pb.dirInfo.ioVRefNum = fss->vRefNum; + pb.dirInfo.ioDrDirID = fss->parID; + err = PBGetCatInfoSync(&pb); + if ( err ) { + PyErr_Mac(ErrorObject, err); + Py_DECREF(fip); + return NULL; + } + memcpy(&fip->finfo, &pb.hFileInfo.ioFlFndrInfo, sizeof(FileInfo)); + #else err = FSpGetFInfo(&self->fsspec, &fip->finfo); if ( err ) { *************** *** 605,608 **** --- 626,630 ---- return NULL; } + #endif return (PyObject *)fip; } From jackjansen@users.sourceforge.net Tue Aug 6 14:40:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 Aug 2002 06:40:33 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19719 Modified Files: Makefile.pre.in Log Message: In the altbininstall target, which is the first subtarget for "make install", if we are running in an OSX framework enabled build directory, test that the framework infrastructure exists. This catches the very common error of doing "make install" in stead of "make frameworkinstall". Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** Makefile.pre.in 4 Aug 2002 21:17:20 -0000 1.94 --- Makefile.pre.in 6 Aug 2002 13:40:31 -0000 1.95 *************** *** 570,573 **** --- 570,579 ---- # This goes into $(exec_prefix) altbininstall: $(BUILDPYTHON) + @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \ + if test ! -f $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \ + echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \ + exit 1; \ + fi; \ + fi @for i in $(BINDIR) $(LIBDIR); \ do \ *************** *** 771,775 **** # only have to cater for the structural bits of the framework. ! frameworkinstall: install frameworkinfrastructureinstall FRAMEWORKFINALDEST=$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION) frameworkinfrastructureinstall: $(LDLIBRARY) --- 777,781 ---- # only have to cater for the structural bits of the framework. ! frameworkinstall: frameworkinfrastructureinstall install FRAMEWORKFINALDEST=$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION) frameworkinfrastructureinstall: $(LDLIBRARY) From gvanrossum@users.sourceforge.net Tue Aug 6 16:55:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 08:55:30 -0700 Subject: [Python-checkins] python/dist/src/Include fileobject.h,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27731/Include Modified Files: fileobject.h Log Message: SF patch 580331 by Oren Tirosh: make file objects their own iterator. For a file f, iter(f) now returns f (unless f is closed), and f.next() is similar to f.readline() when EOF is not reached; however, f.next() uses a readahead buffer that messes up the file position, so mixing f.next() and f.readline() (or other methods) doesn't work right. Calling f.seek() drops the readahead buffer, but other operations don't. The real purpose of this change is to reduce the confusion between objects and their iterators. By making a file its own iterator, it's made clearer that using the iterator modifies the file object's state (in particular the current position). A nice side effect is that this speeds up "for line in f:" by not having to use the xreadlines module. The f.xreadlines() method is still supported for backwards compatibility, though it is the same as iter(f) now. (I made some cosmetic changes to Oren's code, and added a test for "file closed" to file_iternext() and file_iter().) Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** fileobject.h 24 May 2002 15:24:38 -0000 2.29 --- fileobject.h 6 Aug 2002 15:55:28 -0000 2.30 *************** *** 14,20 **** PyObject *f_mode; int (*f_close)(FILE *); ! int f_softspace; /* Flag used by 'print' command */ ! int f_binary; /* Flag which indicates whether the file is open ! open in binary (1) or test (0) mode */ #ifdef WITH_UNIVERSAL_NEWLINES int f_univ_newline; /* Handle any newline convention */ --- 14,23 ---- PyObject *f_mode; int (*f_close)(FILE *); ! int f_softspace; /* Flag used by 'print' command */ ! int f_binary; /* Flag which indicates whether the file is ! open in binary (1) or text (0) mode */ ! char* f_buf; /* Allocated readahead buffer */ ! char* f_bufend; /* Points after last occupied position */ ! char* f_bufptr; /* Current buffer position */ #ifdef WITH_UNIVERSAL_NEWLINES int f_univ_newline; /* Handle any newline convention */ From gvanrossum@users.sourceforge.net Tue Aug 6 16:55:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 08:55:31 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.165,2.166 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27731/Objects Modified Files: fileobject.c Log Message: SF patch 580331 by Oren Tirosh: make file objects their own iterator. For a file f, iter(f) now returns f (unless f is closed), and f.next() is similar to f.readline() when EOF is not reached; however, f.next() uses a readahead buffer that messes up the file position, so mixing f.next() and f.readline() (or other methods) doesn't work right. Calling f.seek() drops the readahead buffer, but other operations don't. The real purpose of this change is to reduce the confusion between objects and their iterators. By making a file its own iterator, it's made clearer that using the iterator modifies the file object's state (in particular the current position). A nice side effect is that this speeds up "for line in f:" by not having to use the xreadlines module. The f.xreadlines() method is still supported for backwards compatibility, though it is the same as iter(f) now. (I made some cosmetic changes to Oren's code, and added a test for "file closed" to file_iternext() and file_iter().) Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.165 retrieving revision 2.166 diff -C2 -d -r2.165 -r2.166 *** fileobject.c 14 Jul 2002 22:14:19 -0000 2.165 --- fileobject.c 6 Aug 2002 15:55:28 -0000 2.166 *************** *** 1,3 **** - /* File object implementation */ --- 1,2 ---- *************** *** 117,120 **** --- 116,120 ---- f->f_softspace = 0; f->f_binary = strchr(mode,'b') != NULL; + f->f_buf = NULL; #ifdef WITH_UNIVERSAL_NEWLINES f->f_univ_newline = (strchr(mode, 'U') != NULL); *************** *** 272,275 **** --- 272,277 ---- } + void drop_readahead(PyFileObject *); + /* Methods */ *************** *** 284,287 **** --- 286,290 ---- Py_XDECREF(f->f_name); Py_XDECREF(f->f_mode); + drop_readahead(f); f->ob_type->tp_free((PyObject *)f); } *************** *** 406,409 **** --- 409,413 ---- if (f->f_fp == NULL) return err_closed(); + drop_readahead(f); whence = 0; if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &whence)) *************** *** 1179,1204 **** static PyObject * - file_xreadlines(PyFileObject *f) - { - static PyObject* xreadlines_function = NULL; - - if (f->f_fp == NULL) - return err_closed(); - if (!xreadlines_function) { - PyObject *xreadlines_module = - PyImport_ImportModule("xreadlines"); - if(!xreadlines_module) - return NULL; - - xreadlines_function = PyObject_GetAttrString(xreadlines_module, - "xreadlines"); - Py_DECREF(xreadlines_module); - if(!xreadlines_function) - return NULL; - } - return PyObject_CallFunction(xreadlines_function, "(O)", f); - } - - static PyObject * file_readlines(PyFileObject *f, PyObject *args) { --- 1183,1186 ---- *************** *** 1463,1466 **** --- 1445,1457 ---- } + static PyObject * + file_getiter(PyFileObject *f) + { + if (f->f_fp == NULL) + return err_closed(); + Py_INCREF(f); + return (PyObject *)f; + } + PyDoc_STRVAR(readline_doc, "readline([size]) -> next line from the file, as a string.\n" *************** *** 1518,1525 **** PyDoc_STRVAR(xreadlines_doc, ! "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."); PyDoc_STRVAR(writelines_doc, --- 1509,1516 ---- PyDoc_STRVAR(xreadlines_doc, ! "xreadlines() -> returns self.\n" "\n" ! "For backward compatibility. File objects now include the performance\n" ! "optimizations previously implemented in the xreadlines module."); PyDoc_STRVAR(writelines_doc, *************** *** 1555,1559 **** {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, ! {"xreadlines", (PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc}, {"writelines", (PyCFunction)file_writelines, METH_O, writelines_doc}, {"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc}, --- 1546,1550 ---- {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, ! {"xreadlines", (PyCFunction)file_getiter, METH_NOARGS, xreadlines_doc}, {"writelines", (PyCFunction)file_writelines, METH_O, writelines_doc}, {"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc}, *************** *** 1618,1627 **** }; static PyObject * ! file_getiter(PyObject *f) { ! return PyObject_CallMethod(f, "xreadlines", ""); } static PyObject * file_new(PyTypeObject *type, PyObject *args, PyObject *kwds) --- 1609,1726 ---- }; + void + drop_readahead(PyFileObject *f) + { + if (f->f_buf != NULL) { + PyMem_Free(f->f_buf); + f->f_buf = NULL; + } + } + + /* Make sure that file has a readahead buffer with at least one byte + (unless at EOF) and no more than bufsize. Returns negative value on + error */ + int readahead(PyFileObject *f, int bufsize) { + int chunksize; + + if (f->f_buf != NULL) { + if( (f->f_bufend - f->f_bufptr) >= 1) + return 0; + else + drop_readahead(f); + } + if ((f->f_buf = PyMem_Malloc(bufsize)) == NULL) { + return -1; + } + Py_BEGIN_ALLOW_THREADS + errno = 0; + chunksize = Py_UniversalNewlineFread( + f->f_buf, bufsize, f->f_fp, (PyObject *)f); + Py_END_ALLOW_THREADS + if (chunksize == 0) { + if (ferror(f->f_fp)) { + PyErr_SetFromErrno(PyExc_IOError); + clearerr(f->f_fp); + drop_readahead(f); + return -1; + } + } + f->f_bufptr = f->f_buf; + f->f_bufend = f->f_buf + chunksize; + return 0; + } + + /* Used by file_iternext. The returned string will start with 'skip' + uninitialized bytes followed by the remainder of the line. Don't be + horrified by the recursive call: maximum recursion depth is limited by + logarithmic buffer growth to about 50 even when reading a 1gb line. */ + + PyStringObject * + readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) { + PyStringObject* s; + char *bufptr; + char *buf; + int len; + + if (f->f_buf == NULL) + if (readahead(f, bufsize) < 0) + return NULL; + + len = f->f_bufend - f->f_bufptr; + if (len == 0) + return (PyStringObject *) + PyString_FromStringAndSize(NULL, skip); + bufptr = memchr(f->f_bufptr, '\n', len); + if (bufptr != NULL) { + bufptr++; /* Count the '\n' */ + len = bufptr - f->f_bufptr; + s = (PyStringObject *) + PyString_FromStringAndSize(NULL, skip+len); + if (s == NULL) + return NULL; + memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); + f->f_bufptr = bufptr; + if (bufptr == f->f_bufend) + drop_readahead(f); + } else { + bufptr = f->f_bufptr; + buf = f->f_buf; + f->f_buf = NULL; /* Force new readahead buffer */ + s = readahead_get_line_skip( + f, skip+len, bufsize + (bufsize>>2) ); + if (s == NULL) { + PyMem_Free(buf); + return NULL; + } + memcpy(PyString_AS_STRING(s)+skip, bufptr, len); + PyMem_Free(buf); + } + return s; + } + + /* A larger buffer size may actually decrease performance. */ + #define READAHEAD_BUFSIZE 8192 + static PyObject * ! file_iternext(PyFileObject *f) { ! PyStringObject* l; ! ! int i; ! ! if (f->f_fp == NULL) ! return err_closed(); ! ! i = f->f_softspace; ! ! l = readahead_get_line_skip(f, 0, READAHEAD_BUFSIZE); ! if (l == NULL || PyString_GET_SIZE(l) == 0) { ! Py_XDECREF(l); ! return NULL; ! } ! return (PyObject *)l; } + static PyObject * file_new(PyTypeObject *type, PyObject *args, PyObject *kwds) *************** *** 1743,1748 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! file_getiter, /* tp_iter */ ! 0, /* tp_iternext */ file_methods, /* tp_methods */ file_memberlist, /* tp_members */ --- 1842,1847 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)file_getiter, /* tp_iter */ ! (iternextfunc)file_iternext, /* tp_iternext */ file_methods, /* tp_methods */ file_memberlist, /* tp_members */ From gvanrossum@users.sourceforge.net Tue Aug 6 16:58:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 08:58:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_file.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7925 Modified Files: test_file.py Log Message: Add next and __iter__ to the list of file methods that should raise ValueError when called for a closed file. Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_file.py 30 Jul 2002 23:26:01 -0000 1.10 --- test_file.py 6 Aug 2002 15:58:24 -0000 1.11 *************** *** 90,94 **** raise TestFailed, 'file.closed should be true' ! methods = ['fileno', 'flush', 'isatty', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines' ] if sys.platform.startswith('atheos'): methods.remove('truncate') --- 90,96 ---- raise TestFailed, 'file.closed should be true' ! methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readinto', ! 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', ! 'xreadlines', '__iter__'] if sys.platform.startswith('atheos'): methods.remove('truncate') From holdenweb@users.sourceforge.net Tue Aug 6 17:07:10 2002 From: holdenweb@users.sourceforge.net (holdenweb@users.sourceforge.net) Date: Tue, 06 Aug 2002 09:07:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16857 Modified Files: libposixpath.tex Log Message: Add comment about os.path.walk()'s behavior with symbolic links. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libposixpath.tex 5 Apr 2002 02:21:09 -0000 1.23 --- libposixpath.tex 6 Aug 2002 16:07:07 -0000 1.24 *************** *** 215,217 **** --- 215,222 ---- \var{names} must be modified in place, using \keyword{del} or slice assignment.) + + Note that symbolic links to directories are not treated as subdirectories, + and that \var{walk} therefore will not visit them. To visit linked + directories you must identify them with \var{os.path.islink(file)} and + \var{os.path.isdir(file)}, and invoke \function{walk()} as necessary. \end{funcdesc} From gvanrossum@users.sourceforge.net Tue Aug 6 17:20:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 09:20:29 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.454,1.455 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv789 Modified Files: NEWS Log Message: Files are now their own iterator. The xreadlines method and module are obsolete. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.454 retrieving revision 1.455 diff -C2 -d -r1.454 -r1.455 *** NEWS 5 Aug 2002 15:24:19 -0000 1.454 --- NEWS 6 Aug 2002 16:20:26 -0000 1.455 *************** *** 7,10 **** --- 7,20 ---- Core and builtins + - File objects are now their own iterators. For a file f, iter(f) now + returns f (unless f is closed), and f.next() is similar to + f.readline() when EOF is not reached; however, f.next() uses a + readahead buffer that messes up the file position, so mixing + f.next() and f.readline() (or other methods) doesn't work right. + Calling f.seek() drops the readahead buffer, but other operations + don't. It so happens that this gives a nice additional speed boost + to "for line in file:"; the xreadlines method and corresponding + module are now obsolete. + - Encoding declarations (PEP 263, phase 1) have been implemented. A comment of the form "# -*- coding: -*-" in the first *************** *** 167,170 **** --- 177,182 ---- Extension modules + + - The xreadlines module is slated for obsolescence. - The strptime function in the time module is now always available (a From bwarsaw@users.sourceforge.net Tue Aug 6 17:58:22 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 06 Aug 2002 09:58:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv20648/Doc/lib Modified Files: libstdtypes.tex Log Message: Committing patch #591250 which provides "str1 in str2" when str1 is a string of longer than 1 character. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** libstdtypes.tex 1 Aug 2002 03:10:45 -0000 1.101 --- libstdtypes.tex 6 Aug 2002 16:58:20 -0000 1.102 *************** *** 433,445 **** \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{\var{x} in \var{s}}{\code{1} if an item of \var{s} is equal to \var{x}, else \code{0}}{} \lineiii{\var{x} not in \var{s}}{\code{0} if an item of \var{s} is ! equal to \var{x}, else \code{1}}{} \hline \lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{} ! \lineiii{\var{s} * \var{n}\textrm{,} \var{n} * \var{s}}{\var{n} shallow copies of \var{s} concatenated}{(1)} \hline ! \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(2)} ! \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(2), (3)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} --- 433,445 ---- \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{\var{x} in \var{s}}{\code{1} if an item of \var{s} is equal to \var{x}, else \code{0}}{(1)} \lineiii{\var{x} not in \var{s}}{\code{0} if an item of \var{s} is ! equal to \var{x}, else \code{1}}{(1)} \hline \lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{} ! \lineiii{\var{s} * \var{n}\textrm{,} \var{n} * \var{s}}{\var{n} shallow copies of \var{s} concatenated}{(2)} \hline ! \lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(3)} ! \lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(3), (4)} \hline \lineiii{len(\var{s})}{length of \var{s}}{} *************** *** 462,466 **** \begin{description} ! \item[(1)] Values of \var{n} less than \code{0} are treated as \code{0} (which yields an empty sequence of the same type as \var{s}). Note also that the copies are shallow; nested structures --- 462,471 ---- \begin{description} ! \item[(1)] When \var{s} is a string or Unicode string object the ! \code{in} and \code{not in} operations act like a substring test. In ! Python versions before 2.3, \var{x} had to be a string of length 1. ! In Python 2.3 and beyond, \var{x} may be a string of any length. ! ! \item[(2)] Values of \var{n} less than \code{0} are treated as \code{0} (which yields an empty sequence of the same type as \var{s}). Note also that the copies are shallow; nested structures *************** *** 490,499 **** \end{verbatim} ! \item[(2)] If \var{i} or \var{j} is negative, the index is relative to the end of the string: \code{len(\var{s}) + \var{i}} or \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is still \code{0}. ! \item[(3)] The slice of \var{s} from \var{i} to \var{j} is defined as the sequence of items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}}. If \var{i} or \var{j} is greater than --- 495,504 ---- \end{verbatim} ! \item[(3)] If \var{i} or \var{j} is negative, the index is relative to the end of the string: \code{len(\var{s}) + \var{i}} or \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is still \code{0}. ! \item[(4)] The slice of \var{s} from \var{i} to \var{j} is defined as the sequence of items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}}. If \var{i} or \var{j} is greater than From bwarsaw@users.sourceforge.net Tue Aug 6 17:58:23 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 06 Aug 2002 09:58:23 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.174,2.175 unicodeobject.c,2.157,2.158 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20648/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Committing patch #591250 which provides "str1 in str2" when str1 is a string of longer than 1 character. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.174 retrieving revision 2.175 diff -C2 -d -r2.174 -r2.175 *** stringobject.c 5 Aug 2002 06:28:21 -0000 2.174 --- stringobject.c 6 Aug 2002 16:58:21 -0000 2.175 *************** *** 804,825 **** string_contains(PyObject *a, PyObject *el) { ! register char *s, *end; ! register char c; #ifdef Py_USING_UNICODE if (PyUnicode_Check(el)) return PyUnicode_Contains(a, el); #endif ! if (!PyString_Check(el) || PyString_Size(el) != 1) { PyErr_SetString(PyExc_TypeError, ! "'in ' requires character as left operand"); return -1; } ! c = PyString_AsString(el)[0]; ! s = PyString_AsString(a); ! end = s + PyString_Size(a); ! while (s < end) { ! if (c == *s++) return 1; } return 0; } --- 804,832 ---- string_contains(PyObject *a, PyObject *el) { ! const char *lhs, *rhs, *end; ! int size; #ifdef Py_USING_UNICODE if (PyUnicode_Check(el)) return PyUnicode_Contains(a, el); #endif ! if (!PyString_Check(el)) { PyErr_SetString(PyExc_TypeError, ! "'in ' requires string as left operand"); return -1; } ! size = PyString_Size(el); ! rhs = PyString_AS_STRING(el); ! lhs = PyString_AS_STRING(a); ! ! /* optimize for a single character */ ! if (size == 1) ! return memchr(lhs, *rhs, PyString_Size(a)) != NULL; ! ! end = lhs + (PyString_Size(a) - size); ! while (lhs <= end) { ! if (memcmp(lhs++, rhs, size) == 0) return 1; } + return 0; } Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.157 retrieving revision 2.158 diff -C2 -d -r2.157 -r2.158 *** unicodeobject.c 26 Jul 2002 16:22:46 -0000 2.157 --- unicodeobject.c 6 Aug 2002 16:58:21 -0000 2.158 *************** *** 3733,3739 **** { PyUnicodeObject *u = NULL, *v = NULL; ! int result; ! register const Py_UNICODE *p, *e; ! register Py_UNICODE ch; /* Coerce the two arguments */ --- 3733,3738 ---- { PyUnicodeObject *u = NULL, *v = NULL; ! int result, size; ! register const Py_UNICODE *lhs, *end, *rhs; /* Coerce the two arguments */ *************** *** 3741,3745 **** if (v == NULL) { PyErr_SetString(PyExc_TypeError, ! "'in ' requires character as left operand"); goto onError; } --- 3740,3744 ---- if (v == NULL) { PyErr_SetString(PyExc_TypeError, ! "'in ' requires string as left operand"); goto onError; } *************** *** 3750,3767 **** } ! /* Check v in u */ ! if (PyUnicode_GET_SIZE(v) != 1) { ! PyErr_SetString(PyExc_TypeError, ! "'in ' requires character as left operand"); ! goto onError; ! } ! ch = *PyUnicode_AS_UNICODE(v); ! p = PyUnicode_AS_UNICODE(u); ! e = p + PyUnicode_GET_SIZE(u); result = 0; ! while (p < e) { ! if (*p++ == ch) { ! result = 1; ! break; } } --- 3749,3773 ---- } ! size = PyUnicode_GET_SIZE(v); ! rhs = PyUnicode_AS_UNICODE(v); ! lhs = PyUnicode_AS_UNICODE(u); ! result = 0; ! if (size == 1) { ! end = lhs + PyUnicode_GET_SIZE(u); ! while (lhs < end) { ! if (*lhs++ == *rhs) { ! result = 1; ! break; ! } ! } ! } ! else { ! end = lhs + (PyUnicode_GET_SIZE(u) - size); ! while (lhs <= end) { ! if (memcmp(lhs++, rhs, size) == 0) { ! result = 1; ! break; ! } } } From bwarsaw@users.sourceforge.net Tue Aug 6 17:58:23 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 06 Aug 2002 09:58:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.19,1.20 test_contains.py,1.9,1.10 test_string.py,1.18,1.19 test_unicode.py,1.60,1.61 test_userstring.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20648/Lib/test Modified Files: string_tests.py test_contains.py test_string.py test_unicode.py test_userstring.py Log Message: Committing patch #591250 which provides "str1 in str2" when str1 is a string of longer than 1 character. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** string_tests.py 30 Jul 2002 23:26:00 -0000 1.19 --- string_tests.py 6 Aug 2002 16:58:20 -0000 1.20 *************** *** 2,6 **** import string ! from test.test_support import verify, verbose, TestFailed, have_unicode transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' --- 2,6 ---- import string ! from test.test_support import verify, vereq, verbose, TestFailed, have_unicode transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377' *************** *** 296,297 **** --- 296,317 ---- verify('hello world'.encode('zlib') == data) verify(data.decode('zlib') == 'hello world') + + def test_exception(lhs, rhs, msg): + try: + lhs in rhs + except TypeError: + pass + else: + raise TestFailed, msg + + def run_contains_tests(test): + vereq('' in '', True) + vereq('' in 'abc', True) + vereq('\0' in 'abc', False) + vereq('\0' in '\0abc', True) + vereq('\0' in 'abc\0', True) + vereq('a' in '\0abc', True) + vereq('asdf' in 'asdf', True) + vereq('asdf' in 'asd', False) + vereq('asdf' in '', False) + Index: test_contains.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_contains.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_contains.py 30 Jul 2002 23:26:01 -0000 1.9 --- test_contains.py 6 Aug 2002 16:58:20 -0000 1.10 *************** *** 46,60 **** check('d' not in 'abc', "'d' in 'abc'") ! try: ! '' in 'abc' ! check(0, "'' in 'abc' did not raise error") ! except TypeError: ! pass ! ! try: ! 'ab' in 'abc' ! check(0, "'ab' in 'abc' did not raise error") ! except TypeError: ! pass try: --- 46,51 ---- check('d' not in 'abc', "'d' in 'abc'") ! check('' in '', "'' not in ''") ! check('' in 'abc', "'' not in 'abc'") try: *************** *** 72,86 **** check('d' not in unicode('abc'), "'d' in u'abc'") ! try: ! '' in unicode('abc') ! check(0, "'' in u'abc' did not raise error") ! except TypeError: ! pass ! ! try: ! 'ab' in unicode('abc') ! check(0, "'ab' in u'abc' did not raise error") ! except TypeError: ! pass try: --- 63,72 ---- check('d' not in unicode('abc'), "'d' in u'abc'") ! check('' in unicode(''), "'' not in u''") ! check(unicode('') in '', "u'' not in ''") ! check(unicode('') in unicode(''), "u'' not in u''") ! check('' in unicode('abc'), "'' not in u'abc'") ! check(unicode('') in 'abc', "u'' not in 'abc'") ! check(unicode('') in unicode('abc'), "u'' not in u'abc'") try: *************** *** 95,126 **** check(unicode('d') not in unicode('abc'), "u'd' in u'abc'") - try: - unicode('') in unicode('abc') - check(0, "u'' in u'abc' did not raise error") - except TypeError: - pass - - try: - unicode('ab') in unicode('abc') - check(0, "u'ab' in u'abc' did not raise error") - except TypeError: - pass - # Test Unicode char in string check(unicode('c') in 'abc', "u'c' not in 'abc'") check(unicode('d') not in 'abc', "u'd' in 'abc'") - - try: - unicode('') in 'abc' - check(0, "u'' in 'abc' did not raise error") - except TypeError: - pass - - try: - unicode('ab') in 'abc' - check(0, "u'ab' in 'abc' did not raise error") - except TypeError: - pass # A collection of tests on builtin sequence types --- 81,88 ---- Index: test_string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_string.py 23 Jul 2002 19:04:04 -0000 1.18 --- test_string.py 6 Aug 2002 16:58:20 -0000 1.19 *************** *** 52,55 **** --- 52,56 ---- string_tests.run_module_tests(test) string_tests.run_method_tests(test) + string_tests.run_contains_tests(test) string.whitespace Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** test_unicode.py 4 Aug 2002 17:28:33 -0000 1.60 --- test_unicode.py 6 Aug 2002 16:58:20 -0000 1.61 *************** *** 7,11 **** """#" ! from test.test_support import verify, verbose, TestFailed import sys, string --- 7,11 ---- """#" ! from test.test_support import verify, vereq, verbose, TestFailed import sys, string *************** *** 397,417 **** # Contains: print 'Testing Unicode contains method...', ! verify(('a' in u'abdb') == 1) ! verify(('a' in u'bdab') == 1) ! verify(('a' in u'bdaba') == 1) ! verify(('a' in u'bdba') == 1) ! verify(('a' in u'bdba') == 1) ! verify((u'a' in u'bdba') == 1) ! verify((u'a' in u'bdb') == 0) ! verify((u'a' in 'bdb') == 0) ! verify((u'a' in 'bdba') == 1) ! verify((u'a' in ('a',1,None)) == 1) ! verify((u'a' in (1,None,'a')) == 1) ! verify((u'a' in (1,None,u'a')) == 1) ! verify(('a' in ('a',1,None)) == 1) ! verify(('a' in (1,None,'a')) == 1) ! verify(('a' in (1,None,u'a')) == 1) ! verify(('a' in ('x',1,u'y')) == 0) ! verify(('a' in ('x',1,None)) == 0) print 'done.' --- 397,417 ---- # Contains: print 'Testing Unicode contains method...', ! vereq(('a' in u'abdb'), True) ! vereq(('a' in u'bdab'), True) ! vereq(('a' in u'bdaba'), True) ! vereq(('a' in u'bdba'), True) ! vereq(('a' in u'bdba'), True) ! vereq((u'a' in u'bdba'), True) ! vereq((u'a' in u'bdb'), False) ! vereq((u'a' in 'bdb'), False) ! vereq((u'a' in 'bdba'), True) ! vereq((u'a' in ('a',1,None)), True) ! vereq((u'a' in (1,None,'a')), True) ! vereq((u'a' in (1,None,u'a')), True) ! vereq(('a' in ('a',1,None)), True) ! vereq(('a' in (1,None,'a')), True) ! vereq(('a' in (1,None,u'a')), True) ! vereq(('a' in ('x',1,u'y')), False) ! vereq(('a' in ('x',1,None)), False) print 'done.' *************** *** 759,760 **** --- 759,799 ---- print u'def\n' print 'done.' + + def test_exception(lhs, rhs, msg): + try: + lhs in rhs + except TypeError: + pass + else: + raise TestFailed, msg + + def run_contains_tests(): + vereq(u'' in '', True) + vereq('' in u'', True) + vereq(u'' in u'', True) + vereq(u'' in 'abc', True) + vereq('' in u'abc', True) + vereq(u'' in u'abc', True) + vereq(u'\0' in 'abc', False) + vereq('\0' in u'abc', False) + vereq(u'\0' in u'abc', False) + vereq(u'\0' in '\0abc', True) + vereq('\0' in u'\0abc', True) + vereq(u'\0' in u'\0abc', True) + vereq(u'\0' in 'abc\0', True) + vereq('\0' in u'abc\0', True) + vereq(u'\0' in u'abc\0', True) + vereq(u'a' in '\0abc', True) + vereq('a' in u'\0abc', True) + vereq(u'a' in u'\0abc', True) + vereq(u'asdf' in 'asdf', True) + vereq('asdf' in u'asdf', True) + vereq(u'asdf' in u'asdf', True) + vereq(u'asdf' in 'asd', False) + vereq('asdf' in u'asd', False) + vereq(u'asdf' in u'asd', False) + vereq(u'asdf' in '', False) + vereq('asdf' in u'', False) + vereq(u'asdf' in u'', False) + + run_contains_tests() Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_userstring.py 23 Jul 2002 19:04:09 -0000 1.7 --- test_userstring.py 6 Aug 2002 16:58:20 -0000 1.8 *************** *** 42,43 **** --- 42,44 ---- string_tests.run_method_tests(test) + string_tests.run_contains_tests(test) From gvanrossum@users.sourceforge.net Tue Aug 6 18:01:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:01:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.102,1.103 libxreadlines.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22817 Modified Files: libstdtypes.tex libxreadlines.tex Log Message: Document file.next(). Mark xreadlines obsolete (both method and module). (One thing remains to be done: the gzip class has an xreadline method; this ought to be replaced by an iterator as well.) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** libstdtypes.tex 6 Aug 2002 16:58:20 -0000 1.102 --- libstdtypes.tex 6 Aug 2002 17:01:28 -0000 1.103 *************** *** 1123,1132 **** \end{methoddesc} - \begin{methoddesc}[file]{isatty}{} - Return \code{True} if the file is connected to a tty(-like) device, else - \code{False}. \note{If a file-like object is not associated - with a real file, this method should \emph{not} be implemented.} - \end{methoddesc} - \begin{methoddesc}[file]{fileno}{} \index{file descriptor} --- 1123,1126 ---- *************** *** 1142,1145 **** --- 1136,1162 ---- \end{methoddesc} + \begin{methoddesc}[file]{isatty}{} + Return \code{True} if the file is connected to a tty(-like) device, else + \code{False}. \note{If a file-like object is not associated + with a real file, this method should \emph{not} be implemented.} + \end{methoddesc} + + \begin{methoddesc}[file]{next}{} + A file object is its own iterator, i.e. \code{iter(\var{f})} returns + \var{f} (unless \var{f} is closed). When a file is used as an + iterator, typically in a \keyword{for} loop (for example, + \code{for line in f: print line}), the \method{next()} method is + called repeatedly. This method returns the next input line, or raises + \exception{StopIteration} when \EOF{} is hit. In order to make a + \keyword{for} loop the most efficient way of looping over the lines of + a file (a very common operation), the \method{next()} method uses a + hidden read-ahead buffer. As a consequence of using a read-ahead + buffer, combining \method{next()} with other file methods (like + \method{readline()}) does not work right. However, using + \method{seek()} to reposition the file to an absolute position will + flush the read-ahead buffer. + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}[file]{read}{\optional{size}} Read at most \var{size} bytes from the file (less if the read hits *************** *** 1185,1192 **** \begin{methoddesc}[file]{xreadlines}{} ! Equivalent to ! \function{xreadlines.xreadlines(\var{file})}.\refstmodindex{xreadlines} ! (See the \refmodule{xreadlines} module for more information.) \versionadded{2.1} \end{methoddesc} --- 1202,1208 ---- \begin{methoddesc}[file]{xreadlines}{} ! This method returns the same thing as \code{iter(f)}. \versionadded{2.1} + \deprecated{2.3}{Use \code{for line in file} instead.} \end{methoddesc} Index: libxreadlines.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxreadlines.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libxreadlines.tex 6 May 2002 16:02:42 -0000 1.3 --- libxreadlines.tex 6 Aug 2002 17:01:28 -0000 1.4 *************** *** 7,10 **** --- 7,11 ---- \versionadded{2.1} + \deprecated{2.3}{Use \code{for line in file} instead.} This module defines a new object type which can efficiently iterate From bwarsaw@users.sourceforge.net Tue Aug 6 18:01:53 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:01:53 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.455,1.456 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23036 Modified Files: NEWS Log Message: Describe new "str1 in str2" behavior. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.455 retrieving revision 1.456 diff -C2 -d -r1.455 -r1.456 *** NEWS 6 Aug 2002 16:20:26 -0000 1.455 --- NEWS 6 Aug 2002 17:01:51 -0000 1.456 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - Previously, "str1 in str2" required str1 to be a string of length 1. + This restriction has been relaxed to allow str1 to be a string of + any length. Thus "'el' in 'hello world'" returns True now. + - File objects are now their own iterators. For a file f, iter(f) now returns f (unless f is closed), and f.next() is similar to From gvanrossum@users.sourceforge.net Tue Aug 6 18:03:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:03:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libgzip.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23780 Modified Files: libgzip.tex Log Message: Remove mention of deprecated xreadlines method. Index: libgzip.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgzip.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libgzip.tex 2 Aug 2002 17:20:46 -0000 1.15 --- libgzip.tex 6 Aug 2002 17:03:04 -0000 1.16 *************** *** 22,27 **** compresslevel\optional{, fileobj}}}}} Constructor for the \class{GzipFile} class, which simulates most of ! the methods of a file object, with the exception of the \method{readinto()}, ! \method{truncate()}, and \method{xreadlines()} methods. At least one of \var{fileobj} and \var{filename} must be given a non-trivial value. --- 22,27 ---- compresslevel\optional{, fileobj}}}}} Constructor for the \class{GzipFile} class, which simulates most of ! the methods of a file object, with the exception of the \method{readinto()} ! and \method{truncate()} methods. At least one of \var{fileobj} and \var{filename} must be given a non-trivial value. From gvanrossum@users.sourceforge.net Tue Aug 6 18:03:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:03:27 -0700 Subject: [Python-checkins] python/dist/src/Lib gzip.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23935 Modified Files: gzip.py Log Message: Remove mention of deprecated xreadlines method. Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** gzip.py 29 May 2002 16:18:42 -0000 1.34 --- gzip.py 6 Aug 2002 17:03:25 -0000 1.35 *************** *** 38,42 **** class GzipFile: """The GzipFile class simulates most of the methods of a file object with ! the exception of the readinto(), truncate(), and xreadlines() methods. """ --- 38,42 ---- class GzipFile: """The GzipFile class simulates most of the methods of a file object with ! the exception of the readinto() and truncate() methods. """ From gvanrossum@users.sourceforge.net Tue Aug 6 18:14:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:14:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_iter.py,1.26,1.27 test_xreadline.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29047/Lib/test Modified Files: test_iter.py test_xreadline.py Log Message: Mark xreadlines deprecated. Don't use f.xreadlines() in test_iter.py. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_iter.py 23 Jul 2002 19:03:55 -0000 1.26 --- test_iter.py 6 Aug 2002 17:14:03 -0000 1.27 *************** *** 270,274 **** self.assertEqual(list(f), ["0\n", "1\n", "2\n", "3\n", "4\n"]) f.seek(0, 0) ! self.assertEqual(list(f.xreadlines()), ["0\n", "1\n", "2\n", "3\n", "4\n"]) finally: --- 270,274 ---- self.assertEqual(list(f), ["0\n", "1\n", "2\n", "3\n", "4\n"]) f.seek(0, 0) ! self.assertEqual(list(f), ["0\n", "1\n", "2\n", "3\n", "4\n"]) finally: *************** *** 303,307 **** self.assertEqual(tuple(f), ("0\n", "1\n", "2\n", "3\n", "4\n")) f.seek(0, 0) ! self.assertEqual(tuple(f.xreadlines()), ("0\n", "1\n", "2\n", "3\n", "4\n")) finally: --- 303,307 ---- self.assertEqual(tuple(f), ("0\n", "1\n", "2\n", "3\n", "4\n")) f.seek(0, 0) ! self.assertEqual(tuple(f), ("0\n", "1\n", "2\n", "3\n", "4\n")) finally: Index: test_xreadline.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xreadline.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_xreadline.py 23 Jul 2002 19:04:09 -0000 1.4 --- test_xreadline.py 6 Aug 2002 17:14:03 -0000 1.5 *************** *** 1,4 **** --- 1,7 ---- from test.test_support import verbose + import warnings + warnings.filterwarnings('ignore', "xreadlines", DeprecationWarning) + class XReader: def __init__(self): From gvanrossum@users.sourceforge.net Tue Aug 6 18:14:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:14:06 -0700 Subject: [Python-checkins] python/dist/src/Modules xreadlinesmodule.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29047/Modules Modified Files: xreadlinesmodule.c Log Message: Mark xreadlines deprecated. Don't use f.xreadlines() in test_iter.py. Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** xreadlinesmodule.c 2 Aug 2002 02:27:13 -0000 1.12 --- xreadlinesmodule.c 6 Aug 2002 17:14:04 -0000 1.13 *************** *** 174,176 **** --- 174,178 ---- XReadlinesObject_Type.ob_type = &PyType_Type; Py_InitModule("xreadlines", xreadlines_functions); + PyErr_Warn(PyExc_DeprecationWarning, + "xreadlines is deprecated; use 'for line in file'."); } From gvanrossum@users.sourceforge.net Tue Aug 6 18:18:58 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:18:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv32020 Modified Files: newtypes.tex Log Message: Add some fine points: METH_KEYWORDS implies METH_VARARGS, and ob_size is no longer unused in type objects. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** newtypes.tex 31 May 2002 21:00:18 -0000 1.13 --- newtypes.tex 6 Aug 2002 17:18:56 -0000 1.14 *************** *** 222,226 **** convention or a binding convention. Of the calling convention flags, only \constant{METH_VARARGS} and \constant{METH_KEYWORDS} can be ! combined. Any of the calling convention flags can be combined with a binding flag. --- 222,228 ---- convention or a binding convention. Of the calling convention flags, only \constant{METH_VARARGS} and \constant{METH_KEYWORDS} can be ! combined (but note that \constant{METH_KEYWORDS} alone is equivalent ! to \code{\constant{METH_VARARGS} | \constant{METH_KEYWORDS}}). ! Any of the calling convention flags can be combined with a binding flag. *************** *** 336,344 **** \verbatiminput{typestruct.h} ! The type object structure extends the \ctype{PyVarObject} structure, ! though it does not actually need the the \member{ob_size} field. The ! inclusion of this field is a historical accident that must be ! maintained to ensure binary compatibility between new versions of ! Python and older compiled extensions. \begin{cmemberdesc}{PyObject}{PyObject*}{_ob_next} --- 338,347 ---- \verbatiminput{typestruct.h} ! The type object structure extends the \ctype{PyVarObject} structure. ! The \member{ob_size} field is used for dynamic types (created ! by \function{type_new()}, usually called from a class statement). ! Note that \cdata{PyType_Type} (the metatype) initializes ! \member{tp_itemsize}, which means that its instances (i.e. type ! objects) \emph{must} have the \member{ob_size} field. \begin{cmemberdesc}{PyObject}{PyObject*}{_ob_next} *************** *** 1489,1492 **** --- 1492,1496 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} + [Guido: the description is missing!] \end{ctypedesc} From gvanrossum@users.sourceforge.net Tue Aug 6 18:21:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:21:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test pystone.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv865 Modified Files: pystone.py Log Message: Bump the LOOPS count. 50,000 iterations takes about 5 seconds on my machine -- that feels just right. Index: pystone.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pystone.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pystone.py 23 Oct 2000 17:22:07 -0000 1.6 --- pystone.py 6 Aug 2002 17:21:20 -0000 1.7 *************** *** 33,37 **** """ ! LOOPS = 10000 from time import clock --- 33,37 ---- """ ! LOOPS = 50000 from time import clock From gvanrossum@users.sourceforge.net Tue Aug 6 18:28:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:28:33 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.104,1.105 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv4586 Modified Files: setup.py Log Message: Update the URL for getting zlib, and update the minimal required version to 1.1.4 (because of the 1.1.3 security problem). Also replace a funny use of line.find() with line.startswith(). Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** setup.py 5 Aug 2002 18:06:16 -0000 1.104 --- setup.py 6 Aug 2002 17:28:30 -0000 1.105 *************** *** 654,664 **** # Andrew Kuchling's zlib module. ! # This require zlib 1.1.3 (or later). ! # See http://www.cdrom.com/pub/infozip/zlib/ zlib_inc = find_file('zlib.h', [], inc_dirs) if zlib_inc is not None: zlib_h = zlib_inc[0] + '/zlib.h' version = '"0.0.0"' ! version_req = '"1.1.3"' fp = open(zlib_h) while 1: --- 654,664 ---- # Andrew Kuchling's zlib module. ! # This requires zlib 1.1.4 (1.1.3 has a security problem). ! # See http://www.gzip.org/zlib/ zlib_inc = find_file('zlib.h', [], inc_dirs) if zlib_inc is not None: zlib_h = zlib_inc[0] + '/zlib.h' version = '"0.0.0"' ! version_req = '"1.1.4"' fp = open(zlib_h) while 1: *************** *** 666,670 **** if not line: break ! if line.find('#define ZLIB_VERSION', 0) == 0: version = line.split()[2] break --- 666,670 ---- if not line: break ! if line.startswith('#define ZLIB_VERSION'): version = line.split()[2] break From gvanrossum@users.sourceforge.net Tue Aug 6 18:29:40 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:29:40 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5109 Modified Files: pydoc.py Log Message: Add a coding cookie, because of the mřřse quote. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** pydoc.py 1 Jun 2002 19:51:15 -0000 1.65 --- pydoc.py 6 Aug 2002 17:29:38 -0000 1.66 *************** *** 1,3 **** --- 1,4 ---- #!/usr/bin/env python + # -*- coding: Latin-1 -*- """Generate Python documentation in HTML or text for interactive use. From montanaro@users.sourceforge.net Tue Aug 6 18:47:43 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 Aug 2002 10:47:43 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.321,2.322 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14993 Modified Files: ceval.c Log Message: get rid of GETNAMEV macro - use GETITEM directly same idea as getting rid of GETCONST & GETNAME (see patch #506436) Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.321 retrieving revision 2.322 diff -C2 -d -r2.321 -r2.322 *** ceval.c 4 Aug 2002 21:03:35 -0000 2.321 --- ceval.c 6 Aug 2002 17:47:40 -0000 2.322 *************** *** 515,519 **** /* Code access macros */ - #define GETNAMEV(i) (GETITEM(names, (i))) #define INSTR_OFFSET() (next_instr - first_instr) #define NEXTOP() (*next_instr++) --- 515,518 ---- *************** *** 1564,1568 **** case STORE_NAME: ! w = GETNAMEV(oparg); v = POP(); if ((x = f->f_locals) == NULL) { --- 1563,1567 ---- case STORE_NAME: ! w = GETITEM(names, oparg); v = POP(); if ((x = f->f_locals) == NULL) { *************** *** 1577,1581 **** case DELETE_NAME: ! w = GETNAMEV(oparg); if ((x = f->f_locals) == NULL) { PyErr_Format(PyExc_SystemError, --- 1576,1580 ---- case DELETE_NAME: ! w = GETITEM(names, oparg); if ((x = f->f_locals) == NULL) { PyErr_Format(PyExc_SystemError, *************** *** 1632,1636 **** case STORE_ATTR: ! w = GETNAMEV(oparg); v = POP(); u = POP(); --- 1631,1635 ---- case STORE_ATTR: ! w = GETITEM(names, oparg); v = POP(); u = POP(); *************** *** 1641,1645 **** case DELETE_ATTR: ! w = GETNAMEV(oparg); v = POP(); err = PyObject_SetAttr(v, w, (PyObject *)NULL); --- 1640,1644 ---- case DELETE_ATTR: ! w = GETITEM(names, oparg); v = POP(); err = PyObject_SetAttr(v, w, (PyObject *)NULL); *************** *** 1649,1653 **** case STORE_GLOBAL: ! w = GETNAMEV(oparg); v = POP(); err = PyDict_SetItem(f->f_globals, w, v); --- 1648,1652 ---- case STORE_GLOBAL: ! w = GETITEM(names, oparg); v = POP(); err = PyDict_SetItem(f->f_globals, w, v); *************** *** 1656,1660 **** case DELETE_GLOBAL: ! w = GETNAMEV(oparg); if ((err = PyDict_DelItem(f->f_globals, w)) != 0) format_exc_check_arg( --- 1655,1659 ---- case DELETE_GLOBAL: ! w = GETITEM(names, oparg); if ((err = PyDict_DelItem(f->f_globals, w)) != 0) format_exc_check_arg( *************** *** 1663,1667 **** case LOAD_NAME: ! w = GETNAMEV(oparg); if ((x = f->f_locals) == NULL) { PyErr_Format(PyExc_SystemError, --- 1662,1666 ---- case LOAD_NAME: ! w = GETITEM(names, oparg); if ((x = f->f_locals) == NULL) { PyErr_Format(PyExc_SystemError, *************** *** 1688,1692 **** case LOAD_GLOBAL: ! w = GETNAMEV(oparg); x = PyDict_GetItem(f->f_globals, w); if (x == NULL) { --- 1687,1691 ---- case LOAD_GLOBAL: ! w = GETITEM(names, oparg); x = PyDict_GetItem(f->f_globals, w); if (x == NULL) { *************** *** 1789,1793 **** case LOAD_ATTR: ! w = GETNAMEV(oparg); v = POP(); x = PyObject_GetAttr(v, w); --- 1788,1792 ---- case LOAD_ATTR: ! w = GETITEM(names, oparg); v = POP(); x = PyObject_GetAttr(v, w); *************** *** 1831,1835 **** case IMPORT_NAME: ! w = GETNAMEV(oparg); x = PyDict_GetItemString(f->f_builtins, "__import__"); if (x == NULL) { --- 1830,1834 ---- case IMPORT_NAME: ! w = GETITEM(names, oparg); x = PyDict_GetItemString(f->f_builtins, "__import__"); if (x == NULL) { *************** *** 1871,1875 **** case IMPORT_FROM: ! w = GETNAMEV(oparg); v = TOP(); x = import_from(v, w); --- 1870,1874 ---- case IMPORT_FROM: ! w = GETITEM(names, oparg); v = TOP(); x = import_from(v, w); From mal@lemburg.com Tue Aug 6 19:51:14 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 06 Aug 2002 20:51:14 +0200 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.174,2.175 unicodeobject.c,2.157,2.158 References: Message-ID: <3D501AA2.7000509@lemburg.com> bwarsaw@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv20648/Objects > > Modified Files: > stringobject.c unicodeobject.c > Log Message: > Committing patch #591250 which provides "str1 in str2" when str1 is a > string of longer than 1 character. > ... > ! end = lhs + (PyUnicode_GET_SIZE(u) - size); > ! while (lhs <= end) { > ! if (memcmp(lhs++, rhs, size) == 0) { This doesn't take into account that sizeof(Py_UNICODE) == 2 or == 4. -- 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 bwarsaw@users.sourceforge.net Tue Aug 6 20:03:19 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 06 Aug 2002 12:03:19 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.158,2.159 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18905 Modified Files: unicodeobject.c Log Message: PyUnicode_Contains(): The memcmp() call didn't take into account the width of Py_UNICODE. Good catch, MAL. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.158 retrieving revision 2.159 diff -C2 -d -r2.158 -r2.159 *** unicodeobject.c 6 Aug 2002 16:58:21 -0000 2.158 --- unicodeobject.c 6 Aug 2002 19:03:17 -0000 2.159 *************** *** 3766,3770 **** end = lhs + (PyUnicode_GET_SIZE(u) - size); while (lhs <= end) { ! if (memcmp(lhs++, rhs, size) == 0) { result = 1; break; --- 3766,3770 ---- end = lhs + (PyUnicode_GET_SIZE(u) - size); while (lhs <= end) { ! if (memcmp(lhs++, rhs, size * sizeof(Py_UNICODE)) == 0) { result = 1; break; From bwarsaw@users.sourceforge.net Tue Aug 6 20:04:31 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 06 Aug 2002 12:04:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19199 Modified Files: test_unicode.py Log Message: Added a test for PyUnicode_Contains() taking into account the width of Py_UNICODE. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** test_unicode.py 6 Aug 2002 16:58:20 -0000 1.61 --- test_unicode.py 6 Aug 2002 19:03:56 -0000 1.62 *************** *** 414,417 **** --- 414,418 ---- vereq(('a' in ('x',1,u'y')), False) vereq(('a' in ('x',1,None)), False) + vereq(u'abcd' in u'abcxxxx', False) print 'done.' From fdrake@users.sourceforge.net Tue Aug 6 22:23:01 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 06 Aug 2002 14:23:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmimetools.tex,1.20,1.20.16.1 libmultifile.tex,1.11,1.11.22.1 librfc822.tex,1.38.14.1,1.38.14.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25741/lib Modified Files: Tag: release22-maint libmimetools.tex libmultifile.tex librfc822.tex Log Message: Added references to the email package. Closes SF bug #586937. Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.20 retrieving revision 1.20.16.1 diff -C2 -d -r1.20 -r1.20.16.1 *** libmimetools.tex 3 Aug 2001 18:39:36 -0000 1.20 --- libmimetools.tex 6 Aug 2002 21:22:59 -0000 1.20.16.1 *************** *** 51,54 **** --- 51,56 ---- \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{mimetools} module.} \seemodule{rfc822}{Provides the base class for \class{mimetools.Message}.} Index: libmultifile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmultifile.tex,v retrieving revision 1.11 retrieving revision 1.11.22.1 diff -C2 -d -r1.11 -r1.11.22.1 *** libmultifile.tex 8 Mar 2001 22:46:41 -0000 1.11 --- libmultifile.tex 6 Aug 2002 21:22:59 -0000 1.11.22.1 *************** *** 35,38 **** --- 35,43 ---- own pattern for section-divider and end-marker lines. + \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{multifile} module.} + \end{seealso} + \subsection{MultiFile Objects \label{MultiFile-objects}} Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.38.14.1 retrieving revision 1.38.14.2 diff -C2 -d -r1.38.14.1 -r1.38.14.2 *** librfc822.tex 5 Jan 2002 01:52:23 -0000 1.38.14.1 --- librfc822.tex 6 Aug 2002 21:22:59 -0000 1.38.14.2 *************** *** 125,128 **** --- 125,130 ---- \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{rfc822} module.} \seemodule{mailbox}{Classes to read various mailbox formats produced by end-user mail programs.} From fdrake@users.sourceforge.net Tue Aug 6 22:26:03 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 06 Aug 2002 14:26:03 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmimetools.tex,1.21,1.22 libmultifile.tex,1.11,1.12 librfc822.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27190/lib Modified Files: libmimetools.tex libmultifile.tex librfc822.tex Log Message: Added references to the email package. Closes SF bug #586937. Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libmimetools.tex 10 Apr 2002 04:37:09 -0000 1.21 --- libmimetools.tex 6 Aug 2002 21:26:01 -0000 1.22 *************** *** 54,57 **** --- 54,59 ---- \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{mimetools} module.} \seemodule{rfc822}{Provides the base class for \class{mimetools.Message}.} Index: libmultifile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmultifile.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libmultifile.tex 8 Mar 2001 22:46:41 -0000 1.11 --- libmultifile.tex 6 Aug 2002 21:26:01 -0000 1.12 *************** *** 35,38 **** --- 35,43 ---- own pattern for section-divider and end-marker lines. + \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{multifile} module.} + \end{seealso} + \subsection{MultiFile Objects \label{MultiFile-objects}} Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** librfc822.tex 9 Apr 2002 18:14:59 -0000 1.40 --- librfc822.tex 6 Aug 2002 21:26:01 -0000 1.41 *************** *** 125,132 **** \begin{seealso} \seemodule{mailbox}{Classes to read various mailbox formats produced by end-user mail programs.} ! \seemodule{mimetools}{Subclass of rfc.Message that handles MIME encoded ! messages.} \end{seealso} --- 125,134 ---- \begin{seealso} + \seemodule{email}{Comprehensive email handling package; supercedes + the \module{rfc822} module.} \seemodule{mailbox}{Classes to read various mailbox formats produced by end-user mail programs.} ! \seemodule{mimetools}{Subclass of \class{rfc822.Message} that ! handles MIME encoded messages.} \end{seealso} From gvanrossum@users.sourceforge.net Tue Aug 6 22:28:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 14:28:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.150,1.151 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28164 Modified Files: test_descr.py Log Message: Add testcase for SF bug 574207 (chained __slots__ dealloc segfault). Fix forthcoming. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** test_descr.py 1 Aug 2002 14:39:03 -0000 1.150 --- test_descr.py 6 Aug 2002 21:28:28 -0000 1.151 *************** *** 3220,3223 **** --- 3220,3236 ---- del C.__del__ + def slottrash(): + # Deallocating deeply nested slotted trash caused stack overflows + if verbose: + print "Testing slot trash..." + class trash(object): + __slots__ = ['x'] + def __init__(self, x): + self.x = x + o = None + for i in xrange(50000): + o = trash(o) + del o + def do_this_first(): if verbose: *************** *** 3311,3314 **** --- 3324,3328 ---- slices() subtype_resurrection() + slottrash() if verbose: print "All OK" From fdrake@users.sourceforge.net Tue Aug 6 22:36:08 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 06 Aug 2002 14:36:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv31510 Modified Files: ref2.tex Log Message: Fix the markup so it doesn't break formatting. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ref2.tex 4 Aug 2002 17:29:52 -0000 1.38 --- ref2.tex 6 Aug 2002 21:36:06 -0000 1.39 *************** *** 76,80 **** If a comment in the first or second line of the Python script matches ! the regular expression "coding[=:]\s*([\w-_.]+)", this comment is processed as an encoding declaration; the first group of this expression names the encoding of the source code file. The recommended --- 76,80 ---- If a comment in the first or second line of the Python script matches ! the regular expression \regexp{coding[=:]\e s*([\e w-_.]+)}, this comment is processed as an encoding declaration; the first group of this expression names the encoding of the source code file. The recommended *************** *** 92,98 **** which is recognized by Bram Moolenar's VIM. In addition, if the first ! bytes of the file are the UTF-8 signature ($'\xef\xbb\xbf'$), the ! declared file encoding is UTF-8 (this is supported, among others, by ! Microsoft's notepad.exe). If an encoding is declared, the encoding name must be recognized by --- 92,98 ---- which is recognized by Bram Moolenar's VIM. In addition, if the first ! bytes of the file are the UTF-8 byte-order mark ! (\code{'\e xef\e xbb\e xbf'}), the declared file encoding is UTF-8 ! (this is supported, among others, by Microsoft's \program{notepad}). If an encoding is declared, the encoding name must be recognized by From gvanrossum@users.sourceforge.net Tue Aug 6 22:41:47 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 06 Aug 2002 14:41:47 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.165,2.166 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1803 Modified Files: typeobject.c Log Message: Fix SF bug 574207 (chained __slots__ dealloc segfault). This is inspired by SF patch 581742 (by Jonathan Hogg, who also submitted the bug report, and two other suggested patches), but separates the non-GC case from the GC case to avoid testing for GC several times. Had to fix an assert() from call_finalizer() that asserted that the object wasn't untracked, because it's possible that the object isn't GC'ed! Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.165 retrieving revision 2.166 diff -C2 -d -r2.165 -r2.166 *** typeobject.c 1 Aug 2002 14:38:53 -0000 2.165 --- typeobject.c 6 Aug 2002 21:41:44 -0000 2.166 *************** *** 402,406 **** self->ob_refcnt = refcnt; } ! assert(_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); /* If Py_REF_DEBUG, the original decref dropped _Py_RefTotal, but * _Py_NewReference bumped it again, so that's a wash. --- 402,407 ---- self->ob_refcnt = refcnt; } ! assert(!PyType_IS_GC(self->ob_type) || ! _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); /* If Py_REF_DEBUG, the original decref dropped _Py_RefTotal, but * _Py_NewReference bumped it again, so that's a wash. *************** *** 424,429 **** destructor basedealloc; ! /* This exists so we can DECREF self->ob_type */ if (call_finalizer(self) < 0) return; --- 425,472 ---- destructor basedealloc; ! /* Extract the type; we expect it to be a heap type */ ! type = self->ob_type; ! assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); ! ! /* Test whether the type has GC exactly once */ ! ! if (!PyType_IS_GC(type)) { ! /* It's really rare to find a dynamic type that doesn't have ! GC; it can only happen when deriving from 'object' and not ! adding any slots or instance variables. This allows ! certain simplifications: there's no need to call ! clear_slots(), or DECREF the dict, or clear weakrefs. */ ! ! /* Maybe call finalizer; exit early if resurrected */ ! if (call_finalizer(self) < 0) ! return; ! ! /* Find the nearest base with a different tp_dealloc */ ! base = type; ! while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { ! assert(base->ob_size == 0); ! base = base->tp_base; ! assert(base); ! } ! ! /* Call the base tp_dealloc() */ ! assert(basedealloc); ! basedealloc(self); ! ! /* Can't reference self beyond this point */ ! Py_DECREF(type); ! ! /* Done */ ! return; ! } + /* We get here only if the type has GC */ + + /* UnTrack and re-Track around the trashcan macro, alas */ + _PyObject_GC_UNTRACK(self); + Py_TRASHCAN_SAFE_BEGIN(self); + _PyObject_GC_TRACK(self); /* We'll untrack for real later */ + + /* Maybe call finalizer; exit early if resurrected */ if (call_finalizer(self) < 0) return; *************** *** 431,435 **** /* Find the nearest base with a different tp_dealloc and clear slots while we're at it */ - type = self->ob_type; base = type; while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { --- 474,477 ---- *************** *** 457,461 **** /* Finalize GC if the base doesn't do GC and we do */ ! if (PyType_IS_GC(type) && !PyType_IS_GC(base)) _PyObject_GC_UNTRACK(self); --- 499,503 ---- /* Finalize GC if the base doesn't do GC and we do */ ! if (!PyType_IS_GC(base)) _PyObject_GC_UNTRACK(self); *************** *** 465,471 **** /* Can't reference self beyond this point */ ! if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! Py_DECREF(type); ! } } --- 507,513 ---- /* Can't reference self beyond this point */ ! Py_DECREF(type); ! ! Py_TRASHCAN_SAFE_END(self); } *************** *** 2808,2812 **** return Py_None; } ! static PyObject * wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) --- 2850,2854 ---- return Py_None; } ! static PyObject * wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) *************** *** 2993,2997 **** return -1; if (len < 0) { ! PyErr_SetString(PyExc_ValueError, "__len__() should return >= 0"); return -1; --- 3035,3039 ---- return -1; if (len < 0) { ! PyErr_SetString(PyExc_ValueError, "__len__() should return >= 0"); return -1; *************** *** 4040,4044 **** } ! static int recurse_down_subclasses(PyTypeObject *type, slotdef **pp, PyObject *name); --- 4082,4086 ---- } ! static int recurse_down_subclasses(PyTypeObject *type, slotdef **pp, PyObject *name); From nnorwitz@users.sourceforge.net Tue Aug 6 22:50:56 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 06 Aug 2002 14:50:56 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.166,2.167 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6220/Objects Modified Files: fileobject.c Log Message: Make readahead functions static Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.166 retrieving revision 2.167 diff -C2 -d -r2.166 -r2.167 *** fileobject.c 6 Aug 2002 15:55:28 -0000 2.166 --- fileobject.c 6 Aug 2002 21:50:54 -0000 2.167 *************** *** 272,276 **** } ! void drop_readahead(PyFileObject *); /* Methods */ --- 272,276 ---- } ! static void drop_readahead(PyFileObject *); /* Methods */ *************** *** 1609,1613 **** }; ! void drop_readahead(PyFileObject *f) { --- 1609,1613 ---- }; ! static void drop_readahead(PyFileObject *f) { *************** *** 1621,1625 **** (unless at EOF) and no more than bufsize. Returns negative value on error */ ! int readahead(PyFileObject *f, int bufsize) { int chunksize; --- 1621,1627 ---- (unless at EOF) and no more than bufsize. Returns negative value on error */ ! static int ! readahead(PyFileObject *f, int bufsize) ! { int chunksize; *************** *** 1656,1661 **** logarithmic buffer growth to about 50 even when reading a 1gb line. */ ! PyStringObject * ! readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) { PyStringObject* s; char *bufptr; --- 1658,1664 ---- logarithmic buffer growth to about 50 even when reading a 1gb line. */ ! static PyStringObject * ! readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) ! { PyStringObject* s; char *bufptr; From nnorwitz@users.sourceforge.net Tue Aug 6 23:12:54 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 06 Aug 2002 15:12:54 -0700 Subject: [Python-checkins] python/dist/src/Objects boolobject.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16384/Objects Modified Files: boolobject.c Log Message: Make more functions static Index: boolobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/boolobject.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** boolobject.c 13 Jun 2002 20:32:55 -0000 1.4 --- boolobject.c 6 Aug 2002 22:12:52 -0000 1.5 *************** *** 17,21 **** static PyObject *true_str = NULL; ! PyObject * bool_repr(PyBoolObject *self) { --- 17,21 ---- static PyObject *true_str = NULL; ! static PyObject * bool_repr(PyBoolObject *self) { *************** *** 48,52 **** /* We define bool_new to always return either Py_True or Py_False */ ! PyObject * bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { --- 48,52 ---- /* We define bool_new to always return either Py_True or Py_False */ ! static PyObject * bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { From jackjansen@users.sourceforge.net Tue Aug 6 23:14:25 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 Aug 2002 15:14:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libmacostools.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv16919 Modified Files: libmacostools.tex Log Message: Changed a sentence that confused some people. Index: libmacostools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacostools.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libmacostools.tex 10 Sep 2001 08:55:25 -0000 1.14 --- libmacostools.tex 6 Aug 2002 22:14:23 -0000 1.15 *************** *** 16,21 **** Copy file \var{src} to \var{dst}. The files can be specified as pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero ! \var{dst} must be a pathname and the folders leading to the ! destination are created if necessary. The method copies data and resource fork and some finder information (creator, type, flags) and optionally the creation, modification and backup times (default is to --- 16,21 ---- Copy file \var{src} to \var{dst}. The files can be specified as pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero ! the folders leading to \var{dst} are created if necessary. ! The method copies data and resource fork and some finder information (creator, type, flags) and optionally the creation, modification and backup times (default is to From jackjansen@users.sourceforge.net Tue Aug 6 23:15:25 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 Aug 2002 15:15:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libmacfs.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv17154 Modified Files: libmacfs.tex Log Message: Added a note about the inability to specify a pathname to a non-existing file in unix-Python. Index: libmacfs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacfs.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** libmacfs.tex 17 Jan 2002 04:44:34 -0000 1.27 --- libmacfs.tex 6 Aug 2002 22:15:23 -0000 1.28 *************** *** 18,22 **** pathname, (2) an \pytype{FSSpec} object or (3) a 3-tuple \code{(\var{wdRefNum}, \var{parID}, \var{name})} as described in ! \citetitle{Inside Macintosh:\ Files}. A description of aliases and the Standard File package can also be found there. --- 18,28 ---- pathname, (2) an \pytype{FSSpec} object or (3) a 3-tuple \code{(\var{wdRefNum}, \var{parID}, \var{name})} as described in ! \citetitle{Inside Macintosh:\ Files}. An \pytype{FSSpec} can point to ! a non-existing file, as long as the folder containing the file exists. ! Under MacPython the same is true for a pathname, but not under unix-Pyton ! because of the way pathnames and FSRefs works. See Apple's documentation ! for details. ! ! A description of aliases and the Standard File package can also be found there. From tim_one@users.sourceforge.net Tue Aug 6 23:25:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 06 Aug 2002 15:25:05 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.239,1.240 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20543/python/Modules Modified Files: socketmodule.c Log Message: internal_connect(): Windows. When sock_timeout > 0 and connect() yields WSAEWOULDBLOCK, the second connect() attempt appears to yield WSAEISCONN on Win98 but WSAEINVAL on Win2K. So accept either as meaning "yawn, fine". This allows test_socket to succeed on my Win2K box (which it already did on my Win98SE box). Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.239 retrieving revision 1.240 diff -C2 -d -r1.239 -r1.240 *** socketmodule.c 2 Aug 2002 02:27:13 -0000 1.239 --- socketmodule.c 6 Aug 2002 22:25:02 -0000 1.240 *************** *** 1306,1311 **** internal_select(s, 1); res = connect(s->sock_fd, addr, addrlen); ! if (res < 0 && WSAGetLastError() == WSAEISCONN) ! res = 0; } } --- 1306,1319 ---- internal_select(s, 1); res = connect(s->sock_fd, addr, addrlen); ! if (res < 0) { ! /* On Win98, WSAEISCONN was seen here. But ! * on Win2K, WSAEINVAL. So accept both as ! * meaning "fine". ! */ ! int code = WSAGetLastError(); ! if (code == WSAEISCONN || ! code == WSAEINVAL) ! res = 0; ! } } } *************** *** 2496,2504 **** "long int larger than 32 bits"); x = y; ! } #endif } else ! return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", arg->ob_type->tp_name); --- 2504,2512 ---- "long int larger than 32 bits"); x = y; ! } #endif } else ! return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", arg->ob_type->tp_name); *************** *** 2555,2563 **** "long int larger than 32 bits"); x = y; ! } #endif } else ! return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", arg->ob_type->tp_name); --- 2563,2571 ---- "long int larger than 32 bits"); x = y; ! } #endif } else ! return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", arg->ob_type->tp_name); From rhettinger@users.sourceforge.net Tue Aug 6 23:36:28 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 Aug 2002 15:36:28 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv25850 Modified Files: ref2.tex Log Message: Document handling of raw-unicode-escapes. Closes SF bug 587087. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** ref2.tex 6 Aug 2002 21:36:06 -0000 1.39 --- ref2.tex 6 Aug 2002 22:36:26 -0000 1.40 *************** *** 458,461 **** --- 458,469 ---- as part of the string, \emph{not} as a line continuation. + When an `r' or `R' prefix is used in conjunction with a `u' or `U' + prefix, then the \uXXXX escape sequence is processed while \emph{all other + backslashes are left in the string}. For example, the string literal + \code{ur"\u0062\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, \uXXXX escape sequences are + only recognized when there are an odd number of backslashes. \subsection{String literal concatenation\label{string-catenation}} From rhettinger@users.sourceforge.net Tue Aug 6 23:39:33 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 Aug 2002 15:39:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.34.6.2,1.34.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv27819 Modified Files: Tag: release22-maint ref2.tex Log Message: Document handling of raw-unicode-escapes. Closes SF bug 587087. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.34.6.2 retrieving revision 1.34.6.3 diff -C2 -d -r1.34.6.2 -r1.34.6.3 *** ref2.tex 18 Jun 2002 19:18:02 -0000 1.34.6.2 --- ref2.tex 6 Aug 2002 22:39:30 -0000 1.34.6.3 *************** *** 424,427 **** --- 424,435 ---- as part of the string, \emph{not} as a line continuation. + When an `r' or `R' prefix is used in conjunction with a `u' or `U' + prefix, then the \uXXXX escape sequence is processed while \emph{all other + backslashes are left in the string}. For example, the string literal + \code{ur"\u0062\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, \uXXXX escape sequences are + only recognized when there are an odd number of backslashes. \subsection{String literal concatenation\label{string-catenation}} From rhettinger@users.sourceforge.net Wed Aug 7 00:08:53 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 Aug 2002 16:08:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8763 Modified Files: test_unicode.py Log Message: Expanded the unittests for the new width sensitive PyUnicode_Contains(). Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** test_unicode.py 6 Aug 2002 19:03:56 -0000 1.62 --- test_unicode.py 6 Aug 2002 23:08:51 -0000 1.63 *************** *** 415,418 **** --- 415,424 ---- vereq(('a' in ('x',1,None)), False) vereq(u'abcd' in u'abcxxxx', False) + vereq((u'ab' in u'abcd'), True) + vereq(('ab' in u'abc'), True) + vereq((u'ab' in 'abc'), True) + vereq((u'ab' in (1,None,u'ab')), True) + vereq((u'' in u'abc'), True) + vereq(('' in u'abc'), True) print 'done.' From holdenweb@users.sourceforge.net Wed Aug 7 13:01:43 2002 From: holdenweb@users.sourceforge.net (holdenweb@users.sourceforge.net) Date: Wed, 07 Aug 2002 05:01:43 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17561 Modified Files: libposixpath.tex Log Message: Fix markup errors. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libposixpath.tex 6 Aug 2002 16:07:07 -0000 1.24 --- libposixpath.tex 7 Aug 2002 12:01:41 -0000 1.25 *************** *** 217,222 **** Note that symbolic links to directories are not treated as subdirectories, ! and that \var{walk} therefore will not visit them. To visit linked ! directories you must identify them with \var{os.path.islink(file)} and ! \var{os.path.isdir(file)}, and invoke \function{walk()} as necessary. \end{funcdesc} --- 217,222 ---- Note that symbolic links to directories are not treated as subdirectories, ! and that \function{walk} therefore will not visit them. To visit linked ! directories you must identify them with \code{os.path.islink(file)} and ! \code{os.path.isdir(file)}, and invoke \function{walk()} as necessary. \end{funcdesc} From loewis@users.sourceforge.net Wed Aug 7 13:33:20 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 07 Aug 2002 05:33:20 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv1896/Parser Modified Files: tokenizer.c Log Message: Fix PEP 263 code --without-unicode. Fixes #591943. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** tokenizer.c 5 Aug 2002 14:14:05 -0000 2.61 --- tokenizer.c 7 Aug 2002 12:33:18 -0000 2.62 *************** *** 257,260 **** --- 257,261 ---- tok->encoding = cs; } else { + #ifdef Py_USING_UNICODE r = set_readline(tok, cs); if (r) { *************** *** 262,265 **** --- 263,272 ---- tok->decoding_state = -1; } + #else + /* Without Unicode support, we cannot + process the coding spec. Since there + won't be any Unicode literals, that + won't matter. */ + #endif } } else { /* then, compare cs with BOM */ *************** *** 318,321 **** --- 325,332 ---- fp_readl(char *s, int size, struct tok_state *tok) { + #ifndef Py_USING_UNICODE + /* In a non-Unicode built, this should never be called. */ + abort(); + #else PyObject* utf8; PyObject* buf = tok->decoding_buffer; *************** *** 339,342 **** --- 350,354 ---- return s; } + #endif } *************** *** 488,491 **** --- 500,504 ---- C byte string STR, which is encoded with ENC. */ + #ifdef Py_USING_UNICODE static PyObject * translate_into_utf8(const char* str, const char* enc) { *************** *** 498,501 **** --- 511,515 ---- return utf8; } + #endif /* Decode a byte string STR for use as the buffer of TOK. *************** *** 515,518 **** --- 529,533 ---- str = tok->str; /* string after BOM if any */ assert(str); + #ifdef Py_USING_UNICODE if (tok->enc != NULL) { utf8 = translate_into_utf8(str, tok->enc); *************** *** 521,524 **** --- 536,540 ---- str = PyString_AsString(utf8); } + #endif for (s = str;; s++) { if (*s == '\0') break; *************** *** 531,534 **** --- 547,551 ---- if (!check_coding_spec(str, s - str, tok, buf_setreadl)) return NULL; + #ifdef Py_USING_UNICODE if (tok->enc != NULL) { assert(utf8 == NULL); *************** *** 538,541 **** --- 555,559 ---- str = PyString_AsString(utf8); } + #endif assert(tok->decoding_buffer == NULL); tok->decoding_buffer = utf8; /* CAUTION */ From loewis@users.sourceforge.net Wed Aug 7 13:33:20 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 07 Aug 2002 05:33:20 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.250,2.251 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv1896/Python Modified Files: compile.c Log Message: Fix PEP 263 code --without-unicode. Fixes #591943. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.250 retrieving revision 2.251 diff -C2 -d -r2.250 -r2.251 *** compile.c 4 Aug 2002 17:29:52 -0000 2.250 --- compile.c 7 Aug 2002 12:33:18 -0000 2.251 *************** *** 1186,1189 **** --- 1186,1192 ---- decode_utf8(char **sPtr, char *end, char* encoding) { + #ifndef Py_USING_UNICODE + abort(); + #else PyObject *u, *v; char *s, *t; *************** *** 1198,1201 **** --- 1201,1205 ---- Py_DECREF(u); return v; + #endif } *************** *** 1313,1316 **** --- 1317,1325 ---- if (rawmode || strchr(s, '\\') == NULL) { if (need_encoding) { + #ifndef Py_USING_UNICODE + /* This should not happen - we never see any other + encoding. */ + abort(); + #else PyObject* u = PyUnicode_DecodeUTF8(s, len, NULL); if (u == NULL) *************** *** 1319,1322 **** --- 1328,1332 ---- Py_DECREF(u); return v; + #endif } else { return PyString_FromStringAndSize(s, len); From fdrake@users.sourceforge.net Wed Aug 7 13:39:35 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 07 Aug 2002 05:39:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv4472/lib Modified Files: libposixpath.tex Log Message: Change the markup a bit more; the parameter was not marked as \var in the sample code, and the note was marked as a logical thing. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libposixpath.tex 7 Aug 2002 12:01:41 -0000 1.25 --- libposixpath.tex 7 Aug 2002 12:39:33 -0000 1.26 *************** *** 216,222 **** assignment.) ! Note that symbolic links to directories are not treated as subdirectories, ! and that \function{walk} therefore will not visit them. To visit linked ! directories you must identify them with \code{os.path.islink(file)} and ! \code{os.path.isdir(file)}, and invoke \function{walk()} as necessary. \end{funcdesc} --- 216,226 ---- assignment.) ! \begin{notice} ! Symbolic links to directories are not treated as subdirectories, and ! that \function{walk()} therefore will not visit them. To visit linked ! directories you must identify them with ! \code{os.path.islink(\var{file})} and ! \code{os.path.isdir(\var{file})}, and invoke \function{walk()} as ! necessary. ! \end{notice} \end{funcdesc} From fdrake@users.sourceforge.net Wed Aug 7 14:24:11 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 07 Aug 2002 06:24:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv25887 Modified Files: ref2.tex Log Message: Fix up some more markup problems. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ref2.tex 6 Aug 2002 22:36:26 -0000 1.40 --- ref2.tex 7 Aug 2002 13:24:09 -0000 1.41 *************** *** 458,469 **** as part of the string, \emph{not} as a line continuation. ! When an `r' or `R' prefix is used in conjunction with a `u' or `U' ! prefix, then the \uXXXX escape sequence is processed while \emph{all other ! backslashes are left in the string}. For example, the string literal ! \code{ur"\u0062\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, \uXXXX escape sequences are ! only recognized when there are an odd number of backslashes. \subsection{String literal concatenation\label{string-catenation}} --- 458,470 ---- as part of the string, \emph{not} as a line continuation. ! When an \character{r} or \character{R} prefix is used in conjunction ! 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 mal@lemburg.com Wed Aug 7 14:50:33 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 07 Aug 2002 15:50:33 +0200 Subject: [Python-checkins] python/dist/src/Python compile.c,2.250,2.251 References: Message-ID: <3D5125A9.6010301@lemburg.com> loewis@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Python > In directory usw-pr-cvs1:/tmp/cvs-serv1896/Python > > Modified Files: > compile.c > Log Message: > Fix PEP 263 code --without-unicode. Fixes #591943. > > > Index: compile.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v > retrieving revision 2.250 > retrieving revision 2.251 > diff -C2 -d -r2.250 -r2.251 > *** compile.c 4 Aug 2002 17:29:52 -0000 2.250 > --- compile.c 7 Aug 2002 12:33:18 -0000 2.251 > *************** > *** 1186,1189 **** > --- 1186,1192 ---- > decode_utf8(char **sPtr, char *end, char* encoding) > { > + #ifndef Py_USING_UNICODE > + abort(); > + #else Shouldn't this be a call to Py_FatalError() with a proper error message ? -- 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 jackjansen@users.sourceforge.net Wed Aug 7 15:06:01 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 07:06:01 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX pythonw.sh,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv16744 Modified Files: pythonw.sh Log Message: Quote the arguments, they may contain strings. Index: pythonw.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/pythonw.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pythonw.sh 2 Aug 2002 21:05:16 -0000 1.2 --- pythonw.sh 7 Aug 2002 14:05:58 -0000 1.3 *************** *** 1,2 **** #!/bin/sh ! exec /Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python $@ --- 1,2 ---- #!/bin/sh ! exec /Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python "$@" From jackjansen@users.sourceforge.net Wed Aug 7 15:49:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 07:49:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib aepack.py,1.4,1.5 aetools.py,1.3,1.4 aetypes.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13794/d Modified Files: aepack.py aetools.py aetypes.py Log Message: Donovan Preston's patch #538395, with some mods by me. This patch makes inheritance for OSA classes work. The implementation is a bit convoluted, but I don't immedeately see a simpler way of doing it. I added calls to ascii() everywhere we output strings that may contain non-ascii characters (Python has gotten very picky since the encoding patch:-). I also removed Donovan's different way of opening resource files: I don't seem to need it. Index: aepack.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aepack.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** aepack.py 30 Mar 2002 23:44:58 -0000 1.4 --- aepack.py 7 Aug 2002 14:48:59 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- import aetypes from aetypes import mkenum, mktype + import os # These ones seem to be missing from AppleEvents *************** *** 62,65 **** --- 63,75 ---- AliasType = macfs.AliasType + def packkey(ae, key, value): + if hasattr(key, 'which'): + keystr = key.which + elif hasattr(key, 'want'): + keystr = key.want + else: + keystr = key + ae.AEPutParamDesc(keystr, pack(value)) + def pack(x, forcetype = None): """Pack a python object into an AE descriptor""" *************** *** 100,110 **** record = AE.AECreateList('', 1) for key, value in x.items(): ! record.AEPutParamDesc(key, pack(value)) return record if t == InstanceType and hasattr(x, '__aepack__'): return x.__aepack__() return AE.AECreateDesc('TEXT', repr(x)) # Copout ! def unpack(desc): """Unpack an AE descriptor to a python object""" t = desc.type --- 110,125 ---- record = AE.AECreateList('', 1) for key, value in x.items(): ! packkey(record, key, value) ! #record.AEPutParamDesc(key, pack(value)) return record if t == InstanceType and hasattr(x, '__aepack__'): return x.__aepack__() + if hasattr(x, 'which'): + return AE.AECreateDesc('TEXT', x.which) + if hasattr(x, 'want'): + return AE.AECreateDesc('TEXT', x.want) return AE.AECreateDesc('TEXT', repr(x)) # Copout ! def unpack(desc, formodulename=""): """Unpack an AE descriptor to a python object""" t = desc.type *************** *** 118,122 **** for i in range(desc.AECountItems()): keyword, item = desc.AEGetNthDesc(i+1, '****') ! l.append(unpack(item)) return l if t == typeAERecord: --- 133,137 ---- for i in range(desc.AECountItems()): keyword, item = desc.AEGetNthDesc(i+1, '****') ! l.append(unpack(item, formodulename)) return l if t == typeAERecord: *************** *** 124,132 **** for i in range(desc.AECountItems()): keyword, item = desc.AEGetNthDesc(i+1, '****') ! d[keyword] = unpack(item) return d if t == typeAEText: record = desc.AECoerceDesc('reco') ! return mkaetext(unpack(record)) if t == typeAlias: return macfs.RawAlias(desc.data) --- 139,147 ---- for i in range(desc.AECountItems()): keyword, item = desc.AEGetNthDesc(i+1, '****') ! d[keyword] = unpack(item, formodulename) return d if t == typeAEText: record = desc.AECoerceDesc('reco') ! return mkaetext(unpack(record, formodulename)) if t == typeAlias: return macfs.RawAlias(desc.data) *************** *** 154,158 **** if t == typeInsertionLoc: record = desc.AECoerceDesc('reco') ! return mkinsertionloc(unpack(record)) # typeInteger equal to typeLongInteger if t == typeIntlText: --- 169,173 ---- if t == typeInsertionLoc: record = desc.AECoerceDesc('reco') ! return mkinsertionloc(unpack(record, formodulename)) # typeInteger equal to typeLongInteger if t == typeIntlText: *************** *** 178,182 **** if t == typeObjectSpecifier: record = desc.AECoerceDesc('reco') ! return mkobject(unpack(record)) # typePict returned as unknown # typePixelMap coerced to typeAERecord --- 193,201 ---- if t == typeObjectSpecifier: record = desc.AECoerceDesc('reco') ! # If we have been told the name of the module we are unpacking aedescs for, ! # we can attempt to create the right type of python object from that module. ! if formodulename: ! return mkobjectfrommodule(unpack(record, formodulename), formodulename) ! return mkobject(unpack(record, formodulename)) # typePict returned as unknown # typePixelMap coerced to typeAERecord *************** *** 215,225 **** if t == 'rang': record = desc.AECoerceDesc('reco') ! return mkrange(unpack(record)) if t == 'cmpd': record = desc.AECoerceDesc('reco') ! return mkcomparison(unpack(record)) if t == 'logi': record = desc.AECoerceDesc('reco') ! return mklogical(unpack(record)) return mkunknown(desc.type, desc.data) --- 234,244 ---- if t == 'rang': record = desc.AECoerceDesc('reco') ! return mkrange(unpack(record, formodulename)) if t == 'cmpd': record = desc.AECoerceDesc('reco') ! return mkcomparison(unpack(record, formodulename)) if t == 'logi': record = desc.AECoerceDesc('reco') ! return mklogical(unpack(record, formodulename)) return mkunknown(desc.type, desc.data) *************** *** 311,314 **** --- 330,347 ---- return aetypes.Property(seld.type, fr) return aetypes.ObjectSpecifier(want, form, seld, fr) + + # Note by Jack: I'm not 100% sure of the following code. This was + # provided by Donovan Preston, but I wonder whether the assignment + # to __class__ is safe. Moreover, shouldn't there be a better + # initializer for the classes in the suites? + def mkobjectfrommodule(dict, modulename): + want = dict['want'].type + module = __import__(modulename) + codenamemapper = module._classdeclarations + classtype = codenamemapper.get(want, None) + newobj = mkobject(dict) + if classtype: + newobj.__class__ = classtype + return newobj def _test(): Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aetools.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** aetools.py 23 Jan 2002 22:46:30 -0000 1.3 --- aetools.py 7 Aug 2002 14:48:59 -0000 1.4 *************** *** 29,33 **** from aetypes import * ! from aepack import pack, unpack, coerce, AEDescType Error = 'aetools.Error' --- 29,33 ---- from aetypes import * ! from aepack import packkey, pack, unpack, coerce, AEDescType Error = 'aetools.Error' *************** *** 57,61 **** return desc.data ! def unpackevent(ae): parameters = {} try: --- 57,61 ---- return desc.data ! def unpackevent(ae, formodulename=""): parameters = {} try: *************** *** 64,73 **** pass else: ! parameters['----'] = unpack(dirobj) del dirobj while 1: key = missed(ae) if not key: break ! parameters[key] = unpack(ae.AEGetParamDesc(key, '****')) attributes = {} for key in aekeywords: --- 64,73 ---- pass else: ! parameters['----'] = unpack(dirobj, formodulename) del dirobj while 1: key = missed(ae) if not key: break ! parameters[key] = unpack(ae.AEGetParamDesc(key, '****'), formodulename) attributes = {} for key in aekeywords: *************** *** 78,89 **** raise sys.exc_type, sys.exc_value continue ! attributes[key] = unpack(desc) return parameters, attributes def packevent(ae, parameters = {}, attributes = {}): for key, value in parameters.items(): ! ae.AEPutParamDesc(key, pack(value)) for key, value in attributes.items(): ! ae.AEPutAttributeDesc(key, pack(value)) # --- 78,89 ---- raise sys.exc_type, sys.exc_value continue ! attributes[key] = unpack(desc, formodulename) return parameters, attributes def packevent(ae, parameters = {}, attributes = {}): for key, value in parameters.items(): ! packkey(ae, key, value) for key, value in attributes.items(): ! packkey(ae, key, value) # *************** *** 131,134 **** --- 131,135 ---- """An AE connection to an application""" _signature = None # Can be overridden by subclasses + _moduleName = None # Can be overridden by subclasses def __init__(self, signature=None, start=0, timeout=0): *************** *** 184,188 **** reply = event.AESend(self.send_flags, self.send_priority, self.send_timeout) ! parameters, attributes = unpackevent(reply) return reply, parameters, attributes --- 185,189 ---- reply = event.AESend(self.send_flags, self.send_priority, self.send_timeout) ! parameters, attributes = unpackevent(reply, self._moduleName) return reply, parameters, attributes *************** *** 211,214 **** --- 212,238 ---- if as: _arguments['rtyp'] = mktype(as) + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.has_key('errn'): + raise Error, decodeerror(_arguments) + + if _arguments.has_key('----'): + return _arguments['----'] + if as: + item.__class__ = as + return item + + def _set(self, _object, _arguments = {}, _attributes = {}): + """ _set: set data for an object + Required argument: the object + Keyword argument _parameters: Parameter dictionary for the set operation + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the data + """ + _code = 'core' + _subcode = 'setd' + + _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, Index: aetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aetypes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** aetypes.py 25 Aug 2001 12:01:13 -0000 1.2 --- aetypes.py 7 Aug 2002 14:48:59 -0000 1.3 *************** *** 10,16 **** # aetools_convert. # ! def pack(*args): from aepack import pack ! return apply(pack, args) def IsSubclass(cls, base): --- 10,16 ---- # aetools_convert. # ! def pack(*args, **kwargs): from aepack import pack ! return apply(pack, args, kwargs) def IsSubclass(cls, base): *************** *** 69,72 **** --- 69,92 ---- if IsEnum(enum): return enum return Enum(enum) + + # Jack changed the way this is done + class InsertionLoc: + def __init__(self, of, pos): + self.of = of + self.pos = pos + + def __repr__(self): + return "InsertionLoc(%s, %s)" % (`self.of`, `self.pos`) + + def __aepack__(self): + rec = {'kobj': self.of, 'kpos': self.pos} + return pack(rec, forcetype='insl') + + # Convenience functions for dsp: + def beginning(of): + return InsertionLoc(of, Enum('bgng')) + + def end(of): + return InsertionLoc(of, Enum('end ')) class Boolean: From jackjansen@users.sourceforge.net Wed Aug 7 15:49:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 07:49:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv13794/scripts Modified Files: gensuitemodule.py Log Message: Donovan Preston's patch #538395, with some mods by me. This patch makes inheritance for OSA classes work. The implementation is a bit convoluted, but I don't immedeately see a simpler way of doing it. I added calls to ascii() everywhere we output strings that may contain non-ascii characters (Python has gotten very picky since the encoding patch:-). I also removed Donovan's different way of opening resource files: I don't seem to need it. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** gensuitemodule.py 23 Apr 2002 21:03:21 -0000 1.23 --- gensuitemodule.py 7 Aug 2002 14:49:00 -0000 1.24 *************** *** 16,19 **** --- 16,20 ---- import keyword import macresource + from aetools import unpack from Carbon.Res import * *************** *** 275,279 **** fp.write('"""\n') fp.write("Package generated from %s\n"%fname) ! fp.write("Resource %s resid %d %s\n"%(resinfo[1], resinfo[0], resinfo[2])) fp.write('"""\n') fp.write('import aetools\n') --- 276,281 ---- fp.write('"""\n') fp.write("Package generated from %s\n"%fname) ! if resinfo: ! fp.write("Resource %s resid %d %s\n"%(ascii(resinfo[1]), resinfo[0], ascii(resinfo[2]))) fp.write('"""\n') fp.write('import aetools\n') *************** *** 283,294 **** fp.write("\n\n_code_to_module = {\n") for code, modname in suitelist: ! fp.write("\t'%s' : %s,\n"%(code, modname)) fp.write("}\n\n") fp.write("\n\n_code_to_fullname = {\n") for code, modname in suitelist: ! fp.write("\t'%s' : ('%s.%s', '%s'),\n"%(code, packagename, modname, modname)) fp.write("}\n\n") for code, modname in suitelist: fp.write("from %s import *\n"%modname) if suitelist: fp.write("\n\nclass %s(%s_Events"%(packagename, suitelist[0][1])) --- 285,324 ---- fp.write("\n\n_code_to_module = {\n") for code, modname in suitelist: ! fp.write("\t'%s' : %s,\n"%(ascii(code), modname)) fp.write("}\n\n") fp.write("\n\n_code_to_fullname = {\n") for code, modname in suitelist: ! fp.write("\t'%s' : ('%s.%s', '%s'),\n"%(ascii(code), packagename, modname, modname)) fp.write("}\n\n") for code, modname in suitelist: fp.write("from %s import *\n"%modname) + + # Generate property dicts and element dicts for all types declared in this module + fp.write("def getbaseclasses(v):\n") + fp.write("\tif hasattr(v, '_superclassnames'):\n") + fp.write("\t\tv._propdict = {}\n") + fp.write("\t\tv._elemdict = {}\n") + fp.write("\t\tfor superclass in v._superclassnames:\n") + fp.write("\t\t\tgetbaseclasses(superclass)\n") + fp.write("\t\t\tv._propdict.update(getattr(eval(superclass), '_privpropdict'))\n") + fp.write("\t\t\tv._elemdict.update(getattr(eval(superclass), '_privelemdict'))\n") + fp.write("\t\tv._propdict.update(v._privpropdict)\n") + fp.write("\t\tv._elemdict.update(v._privelemdict)\n") + fp.write("import StdSuites\n") + if allprecompinfo: + fp.write("\n#\n# Set property and element dictionaries now that all classes have been defined\n#\n") + for codenamemapper in allprecompinfo: + for k, v in codenamemapper.getall('class'): + fp.write("getbaseclasses(%s)\n" % v) + + # Generate a code-to-name mapper for all of the types (classes) declared in this module + if allprecompinfo: + fp.write("\n#\n# Indices of types declared in this module\n#\n") + fp.write("_classdeclarations = {\n") + for codenamemapper in allprecompinfo: + for k, v in codenamemapper.getall('class'): + fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) + fp.write("}\n") + if suitelist: fp.write("\n\nclass %s(%s_Events"%(packagename, suitelist[0][1])) *************** *** 296,300 **** fp.write(",\n\t\t%s_Events"%modname) fp.write(",\n\t\taetools.TalkTo):\n") ! fp.write("\t_signature = %s\n\n"%`creatorsignature`) fp.close() --- 326,331 ---- fp.write(",\n\t\t%s_Events"%modname) fp.write(",\n\t\taetools.TalkTo):\n") ! fp.write("\t_signature = %s\n\n"%`ascii(creatorsignature)`) ! fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() *************** *** 354,360 **** fss.SetCreatorType('Pyth', 'TEXT') ! fp.write('"""Suite %s: %s\n' % (name, desc)) fp.write("Level %d, version %d\n\n" % (level, version)) ! fp.write("Generated from %s\n"%fname) fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ (major, minor, language, script)) --- 385,391 ---- fss.SetCreatorType('Pyth', 'TEXT') ! fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc))) fp.write("Level %d, version %d\n\n" % (level, version)) ! fp.write("Generated from %s\n"%ascii(fname)) fp.write("AETE/AEUT resource version %d/%d, language %d, script %d\n" % \ (major, minor, language, script)) *************** *** 363,367 **** fp.write('import aetools\n') fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `code`) if basepackage and basepackage._code_to_module.has_key(code): # We are an extension of a baseclass (usually an application extending --- 394,398 ---- fp.write('import aetools\n') fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `ascii(code)`) if basepackage and basepackage._code_to_module.has_key(code): # We are an extension of a baseclass (usually an application extending *************** *** 422,426 **** fp.write("\t_argmap_%s = {\n"%funcname) for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `a[1]`)) fp.write("\t}\n\n") --- 453,457 ---- fp.write("\t_argmap_%s = {\n"%funcname) for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `ascii(a[1])`)) fp.write("\t}\n\n") *************** *** 444,448 **** # available documentation, due to our name-remaping) # ! fp.write('\t\t"""%s: %s\n'%(name, desc)) if has_arg: fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) --- 475,479 ---- # available documentation, due to our name-remaping) # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) if has_arg: fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) *************** *** 459,464 **** # Fiddle the args so everything ends up in 'arguments' dictionary # ! fp.write("\t\t_code = %s\n"% `code`) ! fp.write("\t\t_subcode = %s\n\n"% `subcode`) # # Do keyword name substitution --- 490,495 ---- # Fiddle the args so everything ends up in 'arguments' dictionary # ! fp.write("\t\t_code = %s\n"% `ascii(code)`) ! fp.write("\t\t_subcode = %s\n\n"% `ascii(subcode)`) # # Do keyword name substitution *************** *** 488,492 **** if ename <> '****': fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`kname`, identify(ename))) enumsneeded[ename] = 1 fp.write("\n") --- 519,523 ---- if ename <> '****': fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`ascii(kname)`, identify(ename))) enumsneeded[ename] = 1 fp.write("\n") *************** *** 666,670 **** if self.fp: self.fp.write('\nclass %s(aetools.ComponentItem):\n' % pname) ! self.fp.write('\t"""%s - %s """\n' % (name, desc)) self.fp.write('\twant = %s\n' % `code`) self.namemappers[0].addnamecode('class', pname, code) --- 697,701 ---- if self.fp: self.fp.write('\nclass %s(aetools.ComponentItem):\n' % pname) ! self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(desc))) self.fp.write('\twant = %s\n' % `code`) self.namemappers[0].addnamecode('class', pname, code) *************** *** 690,696 **** if self.fp: self.fp.write("class %s(aetools.NProperty):\n" % pname) ! self.fp.write('\t"""%s - %s """\n' % (name, what[1])) ! self.fp.write("\twhich = %s\n" % `code`) ! self.fp.write("\twant = %s\n" % `what[0]`) self.namemappers[0].addnamecode('property', pname, code) --- 721,727 ---- if self.fp: self.fp.write("class %s(aetools.NProperty):\n" % pname) ! self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) ! self.fp.write("\twhich = %s\n" % `ascii(code)`) ! self.fp.write("\twant = %s\n" % `ascii(what[0])`) self.namemappers[0].addnamecode('property', pname, code) *************** *** 698,702 **** [code, keyform] = elem if self.fp: ! self.fp.write("# element %s as %s\n" % (`code`, keyform)) def fillclasspropsandelems(self, cls): --- 729,733 ---- [code, keyform] = elem if self.fp: ! self.fp.write("# element %s as %s\n" % (`ascii(code)`, ascii(keyform))) def fillclasspropsandelems(self, cls): *************** *** 709,718 **** --- 740,762 ---- plist = [] elist = [] + superclasses = [] for prop in properties: [pname, pcode, what] = prop + if pcode == "c@#^": + superclasses.append(what) if pcode == 'c@#!': continue pname = identify(pname) plist.append(pname) + + superclassnames = [] + for superclass in superclasses: + superId, superDesc, dummy = superclass + superclassname, fullyqualifiedname, module = self.findcodename("class", superId) + superclassnames.append(superclassname) + + if self.fp: + self.fp.write("%s._superclassnames = %s\n"%(cname, `superclassnames`)) + for elem in elements: [ecode, keyform] = elem *************** *** 722,735 **** if not name: if self.fp: ! self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ecode`)) else: elist.append((name, ename)) if self.fp: ! self.fp.write("%s._propdict = {\n"%cname) for n in plist: self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") ! self.fp.write("%s._elemdict = {\n"%cname) for n, fulln in elist: self.fp.write("\t'%s' : %s,\n"%(n, fulln)) --- 766,779 ---- if not name: if self.fp: ! self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ascii(ecode)`)) else: elist.append((name, ename)) if self.fp: ! self.fp.write("%s._privpropdict = {\n"%cname) for n in plist: self.fp.write("\t'%s' : %s,\n"%(n, n)) self.fp.write("}\n") ! self.fp.write("%s._privelemdict = {\n"%cname) for n, fulln in elist: self.fp.write("\t'%s' : %s,\n"%(n, fulln)) *************** *** 742,746 **** if self.fp: self.fp.write("class %s(aetools.NComparison):\n" % iname) ! self.fp.write('\t"""%s - %s """\n' % (name, comment)) def compileenumeration(self, enum): --- 786,790 ---- if self.fp: self.fp.write("class %s(aetools.NComparison):\n" % iname) ! self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(comment))) def compileenumeration(self, enum): *************** *** 757,761 **** def compileenumerator(self, item): [name, code, desc] = item ! self.fp.write("\t%s : %s,\t# %s\n" % (`identify(name)`, `code`, desc)) def checkforenum(self, enum): --- 801,805 ---- def compileenumerator(self, item): [name, code, desc] = item ! self.fp.write("\t%s : %s,\t# %s\n" % (`identify(name)`, `ascii(code)`, desc)) def checkforenum(self, enum): *************** *** 764,768 **** if not name: if self.fp: ! self.fp.write("_Enum_%s = None # XXXX enum %s not found!!\n"%(identify(enum), enum)) return if module: --- 808,812 ---- if not name: if self.fp: ! self.fp.write("_Enum_%s = None # XXXX enum %s not found!!\n"%(identify(enum), ascii(enum))) return if module: *************** *** 776,792 **** self.fp.write("_classdeclarations = {\n") for k, v in self.namemappers[0].getall('class'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k, v in self.namemappers[0].getall('property'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k, v in self.namemappers[0].getall('comparison'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k, v in self.namemappers[0].getall('enum'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") --- 820,836 ---- self.fp.write("_classdeclarations = {\n") for k, v in self.namemappers[0].getall('class'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k, v in self.namemappers[0].getall('property'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k, v in self.namemappers[0].getall('comparison'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k, v in self.namemappers[0].getall('enum'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") *************** *** 807,816 **** [type, descr, flags] = data if descr: ! return descr if type == '****': return 'anything' if type == 'obj ': return 'an AE object reference' ! return "undocumented, typecode %s"%`type` dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"} --- 851,860 ---- [type, descr, flags] = data if descr: ! return ascii(descr) if type == '****': return 'anything' if type == 'obj ': return 'an AE object reference' ! return "undocumented, typecode %s"%`ascii(type)` dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"} *************** *** 825,828 **** --- 869,884 ---- return '[%s]' % string.join(bits) + def ascii(str): + """Return a string with all non-ascii characters hex-encoded""" + if type(str) != type(''): + return map(ascii, str) + rv = '' + for c in str: + if c in ('\t', '\n', '\r') or ' ' <= c < chr(0x7f): + rv = rv + c + else: + rv = rv + '\\x%02.2x' % ord(c) + return rv + def identify(str): """Turn any string into an identifier: *************** *** 853,855 **** main() sys.exit(1) ! print identify('for') \ No newline at end of file --- 909,911 ---- main() sys.exit(1) ! print identify('for') From loewis@informatik.hu-berlin.de Wed Aug 7 15:47:23 2002 From: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 07 Aug 2002 16:47:23 +0200 Subject: [Python-checkins] python/dist/src/Python compile.c,2.250,2.251 In-Reply-To: <3D5125A9.6010301@lemburg.com> References: <3D5125A9.6010301@lemburg.com> Message-ID: "M.-A. Lemburg" writes: > > + #ifndef Py_USING_UNICODE > > + abort(); > > + #else > > Shouldn't this be a call to Py_FatalError() with a proper > error message ? What is the guideline for when to use abort, and when to use Py_FatalError? Regards, Martin From jackjansen@users.sourceforge.net Wed Aug 7 16:05:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:05:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv30207/scripts Modified Files: gensuitemodule.py Log Message: Don't be over-enthusiastic with the ascii() calls: we don't need it if the result passes through backticks. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** gensuitemodule.py 7 Aug 2002 14:49:00 -0000 1.24 --- gensuitemodule.py 7 Aug 2002 15:05:42 -0000 1.25 *************** *** 318,322 **** for codenamemapper in allprecompinfo: for k, v in codenamemapper.getall('class'): ! fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) fp.write("}\n") --- 318,322 ---- for codenamemapper in allprecompinfo: for k, v in codenamemapper.getall('class'): ! fp.write("\t%s : %s,\n" % (`k`, v)) fp.write("}\n") *************** *** 326,330 **** fp.write(",\n\t\t%s_Events"%modname) fp.write(",\n\t\taetools.TalkTo):\n") ! fp.write("\t_signature = %s\n\n"%`ascii(creatorsignature)`) fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() --- 326,330 ---- fp.write(",\n\t\t%s_Events"%modname) fp.write(",\n\t\taetools.TalkTo):\n") ! fp.write("\t_signature = %s\n\n"%`creatorsignature`) fp.write("\t_moduleName = '%s'\n\n"%packagename) fp.close() *************** *** 394,398 **** fp.write('import aetools\n') fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `ascii(code)`) if basepackage and basepackage._code_to_module.has_key(code): # We are an extension of a baseclass (usually an application extending --- 394,398 ---- fp.write('import aetools\n') fp.write('import MacOS\n\n') ! fp.write("_code = %s\n\n"% `code`) if basepackage and basepackage._code_to_module.has_key(code): # We are an extension of a baseclass (usually an application extending *************** *** 453,457 **** fp.write("\t_argmap_%s = {\n"%funcname) for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `ascii(a[1])`)) fp.write("\t}\n\n") --- 453,457 ---- fp.write("\t_argmap_%s = {\n"%funcname) for a in arguments: ! fp.write("\t\t%s : %s,\n"%(`identify(a[0])`, `a[1]`)) fp.write("\t}\n\n") *************** *** 475,479 **** # available documentation, due to our name-remaping) # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) if has_arg: fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) --- 475,479 ---- # available documentation, due to our name-remaping) # ! fp.write('\t\t"""%s: %s\n'%(name, desc)) if has_arg: fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) *************** *** 490,495 **** # Fiddle the args so everything ends up in 'arguments' dictionary # ! fp.write("\t\t_code = %s\n"% `ascii(code)`) ! fp.write("\t\t_subcode = %s\n\n"% `ascii(subcode)`) # # Do keyword name substitution --- 490,495 ---- # Fiddle the args so everything ends up in 'arguments' dictionary # ! fp.write("\t\t_code = %s\n"% `code`) ! fp.write("\t\t_subcode = %s\n\n"% `subcode`) # # Do keyword name substitution *************** *** 519,523 **** if ename <> '****': fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`ascii(kname)`, identify(ename))) enumsneeded[ename] = 1 fp.write("\n") --- 519,523 ---- if ename <> '****': fp.write("\t\taetools.enumsubst(_arguments, %s, _Enum_%s)\n" % ! (`kname`, identify(ename))) enumsneeded[ename] = 1 fp.write("\n") *************** *** 722,727 **** self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) ! self.fp.write("\twhich = %s\n" % `ascii(code)`) ! self.fp.write("\twant = %s\n" % `ascii(what[0])`) self.namemappers[0].addnamecode('property', pname, code) --- 722,727 ---- self.fp.write("class %s(aetools.NProperty):\n" % pname) self.fp.write('\t"""%s - %s """\n' % (ascii(name), ascii(what[1]))) ! self.fp.write("\twhich = %s\n" % `code`) ! self.fp.write("\twant = %s\n" % `what[0]`) self.namemappers[0].addnamecode('property', pname, code) *************** *** 729,733 **** [code, keyform] = elem if self.fp: ! self.fp.write("# element %s as %s\n" % (`ascii(code)`, ascii(keyform))) def fillclasspropsandelems(self, cls): --- 729,733 ---- [code, keyform] = elem if self.fp: ! self.fp.write("# element %s as %s\n" % (`code`, keyform)) def fillclasspropsandelems(self, cls): *************** *** 766,770 **** if not name: if self.fp: ! self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ascii(ecode)`)) else: elist.append((name, ename)) --- 766,770 ---- if not name: if self.fp: ! self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ecode`)) else: elist.append((name, ename)) *************** *** 801,805 **** def compileenumerator(self, item): [name, code, desc] = item ! self.fp.write("\t%s : %s,\t# %s\n" % (`identify(name)`, `ascii(code)`, desc)) def checkforenum(self, enum): --- 801,805 ---- def compileenumerator(self, item): [name, code, desc] = item ! self.fp.write("\t%s : %s,\t# %s\n" % (`identify(name)`, `code`, desc)) def checkforenum(self, enum): *************** *** 820,836 **** self.fp.write("_classdeclarations = {\n") for k, v in self.namemappers[0].getall('class'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k, v in self.namemappers[0].getall('property'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k, v in self.namemappers[0].getall('comparison'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k, v in self.namemappers[0].getall('enum'): ! self.fp.write("\t%s : %s,\n" % (`ascii(k)`, v)) self.fp.write("}\n") --- 820,836 ---- self.fp.write("_classdeclarations = {\n") for k, v in self.namemappers[0].getall('class'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") for k, v in self.namemappers[0].getall('property'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") for k, v in self.namemappers[0].getall('comparison'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") for k, v in self.namemappers[0].getall('enum'): ! self.fp.write("\t%s : %s,\n" % (`k`, v)) self.fp.write("}\n") *************** *** 856,860 **** if type == 'obj ': return 'an AE object reference' ! return "undocumented, typecode %s"%`ascii(type)` dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"} --- 856,860 ---- if type == 'obj ': return 'an AE object reference' ! return "undocumented, typecode %s"%`type` dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"} *************** *** 878,882 **** rv = rv + c else: ! rv = rv + '\\x%02.2x' % ord(c) return rv --- 878,882 ---- rv = rv + c else: ! rv = rv + '\\' + 'x%02.2x' % ord(c) return rv From loewis@users.sourceforge.net Wed Aug 7 16:18:59 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:18:59 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv7907/Parser Modified Files: tokenizer.c Log Message: Use Py_FatalError instead of abort. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** tokenizer.c 7 Aug 2002 12:33:18 -0000 2.62 --- tokenizer.c 7 Aug 2002 15:18:56 -0000 2.63 *************** *** 327,331 **** #ifndef Py_USING_UNICODE /* In a non-Unicode built, this should never be called. */ ! abort(); #else PyObject* utf8; --- 327,332 ---- #ifndef Py_USING_UNICODE /* In a non-Unicode built, this should never be called. */ ! Py_FatalError("fp_readl should not be called in this build."); ! return NULL; #else PyObject* utf8; *************** *** 404,408 **** decoding_fgets(char *s, int size, struct tok_state *tok) { ! char *line; int warn = 0, badchar = 0; for (;;) { --- 405,409 ---- decoding_fgets(char *s, int size, struct tok_state *tok) { ! char *line = NULL; int warn = 0, badchar = 0; for (;;) { From loewis@users.sourceforge.net Wed Aug 7 16:19:00 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:19:00 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.251,2.252 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7907/Python Modified Files: compile.c Log Message: Use Py_FatalError instead of abort. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.251 retrieving revision 2.252 diff -C2 -d -r2.251 -r2.252 *** compile.c 7 Aug 2002 12:33:18 -0000 2.251 --- compile.c 7 Aug 2002 15:18:57 -0000 2.252 *************** *** 1187,1191 **** { #ifndef Py_USING_UNICODE ! abort(); #else PyObject *u, *v; --- 1187,1192 ---- { #ifndef Py_USING_UNICODE ! Py_FatalError("decode_utf8 should not be called in this build."); ! return NULL; #else PyObject *u, *v; *************** *** 1320,1324 **** /* This should not happen - we never see any other encoding. */ ! abort(); #else PyObject* u = PyUnicode_DecodeUTF8(s, len, NULL); --- 1321,1325 ---- /* This should not happen - we never see any other encoding. */ ! Py_FatalError("cannot deal with encodings in this build."); #else PyObject* u = PyUnicode_DecodeUTF8(s, len, NULL); From fdrake@users.sourceforge.net Wed Aug 7 16:40:17 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:40:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv26551/Doc/lib Modified Files: libstdtypes.tex Log Message: Clarify that the bool instances are acceptable return values from __nonzero__(), in response to SF bug #579991. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** libstdtypes.tex 6 Aug 2002 17:01:28 -0000 1.103 --- libstdtypes.tex 7 Aug 2002 15:40:15 -0000 1.104 *************** *** 34,41 **** \item \code{None} ! \withsubitem{(Built-in object)}{\ttindex{None}} \item \code{False} ! \withsubitem{(Built-in object)}{\ttindex{False}} \item zero of any numeric type, for example, \code{0}, \code{0L}, --- 34,41 ---- \item \code{None} ! \withsubitem{(Built-in object)}{\ttindex{None}} \item \code{False} ! \withsubitem{(Built-in object)}{\ttindex{False}} \item zero of any numeric type, for example, \code{0}, \code{0L}, *************** *** 47,52 **** \item instances of user-defined classes, if the class defines a ! \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero.\footnote{Additional information on these special methods may be found in the \citetitle[../ref/ref.html]{Python Reference Manual}.} --- 47,53 ---- \item instances of user-defined classes, if the class defines a ! \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero or \class{bool} value ! \code{False}.\footnote{Additional information on these special methods may be found in the \citetitle[../ref/ref.html]{Python Reference Manual}.} From fdrake@users.sourceforge.net Wed Aug 7 16:41:34 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:41:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.10,1.80.6.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27501/lib Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Clarify that the bool instances are acceptable return values from __nonzero__(), in response to SF bug #579991. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.10 retrieving revision 1.80.6.11 diff -C2 -d -r1.80.6.10 -r1.80.6.11 *** libstdtypes.tex 12 Jul 2002 17:15:45 -0000 1.80.6.10 --- libstdtypes.tex 7 Aug 2002 15:41:31 -0000 1.80.6.11 *************** *** 29,33 **** \item \code{None} ! \withsubitem{(Built-in object)}{\ttindex{None}} \item zero of any numeric type, for example, \code{0}, \code{0L}, --- 29,36 ---- \item \code{None} ! \withsubitem{(Built-in object)}{\ttindex{None}} ! ! \item \code{False} ! \withsubitem{(Built-in object)}{\ttindex{False}} \item zero of any numeric type, for example, \code{0}, \code{0L}, *************** *** 39,44 **** \item instances of user-defined classes, if the class defines a ! \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero.\footnote{Additional information on these special methods may be found in the \citetitle[../ref/ref.html]{Python Reference Manual}.} --- 42,48 ---- \item instances of user-defined classes, if the class defines a ! \method{__nonzero__()} or \method{__len__()} method, when that ! method returns the integer zero or \class{bool} value ! \code{False}.\footnote{Additional information on these special methods may be found in the \citetitle[../ref/ref.html]{Python Reference Manual}.} From jackjansen@users.sourceforge.net Wed Aug 7 16:44:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:44:55 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv28731/scripts Modified Files: gensuitemodule.py Log Message: - If an OSA identifier is a Python reserved word we now append an _ in stead of prepending it, which messes up "import * from". - A few ascii()s added again. - Changed the getbaseclasses a little, but it still isn't perfect. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** gensuitemodule.py 7 Aug 2002 15:05:42 -0000 1.25 --- gensuitemodule.py 7 Aug 2002 15:44:53 -0000 1.26 *************** *** 296,308 **** # Generate property dicts and element dicts for all types declared in this module fp.write("def getbaseclasses(v):\n") ! fp.write("\tif hasattr(v, '_superclassnames'):\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") fp.write("\t\tfor superclass in v._superclassnames:\n") ! fp.write("\t\t\tgetbaseclasses(superclass)\n") ! fp.write("\t\t\tv._propdict.update(getattr(eval(superclass), '_privpropdict'))\n") ! fp.write("\t\t\tv._elemdict.update(getattr(eval(superclass), '_privelemdict'))\n") fp.write("\t\tv._propdict.update(v._privpropdict)\n") fp.write("\t\tv._elemdict.update(v._privelemdict)\n") fp.write("import StdSuites\n") if allprecompinfo: --- 296,310 ---- # Generate property dicts and element dicts for all types declared in this module fp.write("def getbaseclasses(v):\n") ! fp.write("\tif hasattr(v, '_superclassnames') and v._superclassnames:\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") fp.write("\t\tfor superclass in v._superclassnames:\n") ! ## fp.write("\t\t\tgetbaseclasses(superclass)\n") ! fp.write("\t\t\tv._propdict.update(getattr(eval(superclass), '_privpropdict', {}))\n") ! fp.write("\t\t\tv._elemdict.update(getattr(eval(superclass), '_privelemdict', {}))\n") fp.write("\t\tv._propdict.update(v._privpropdict)\n") fp.write("\t\tv._elemdict.update(v._privelemdict)\n") + fp.write("\t\tv._superclassnames = None\n") + fp.write("\n") fp.write("import StdSuites\n") if allprecompinfo: *************** *** 475,479 **** # available documentation, due to our name-remaping) # ! fp.write('\t\t"""%s: %s\n'%(name, desc)) if has_arg: fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) --- 477,481 ---- # available documentation, due to our name-remaping) # ! fp.write('\t\t"""%s: %s\n'%(ascii(name), ascii(desc))) if has_arg: fp.write("\t\tRequired argument: %s\n"%getdatadoc(accepts)) *************** *** 801,805 **** def compileenumerator(self, item): [name, code, desc] = item ! self.fp.write("\t%s : %s,\t# %s\n" % (`identify(name)`, `code`, desc)) def checkforenum(self, enum): --- 803,807 ---- def compileenumerator(self, item): [name, code, desc] = item ! self.fp.write("\t%s : %s,\t# %s\n" % (`identify(name)`, `code`, ascii(desc))) def checkforenum(self, enum): *************** *** 888,892 **** """ if not str: ! return "_empty_ae_name" rv = '' ok = string.ascii_letters + '_' --- 890,894 ---- """ if not str: ! return "empty_ae_name_" rv = '' ok = string.ascii_letters + '_' *************** *** 901,905 **** ok = ok2 if keyword.iskeyword(rv): ! rv = '_' + rv return rv --- 903,907 ---- ok = ok2 if keyword.iskeyword(rv): ! rv = rv + '_' return rv From gvanrossum@users.sourceforge.net Wed Aug 7 16:46:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:46:21 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29169 Modified Files: socket.py Log Message: "Unbuffered" mode of class _fileobject wasn't actually unbuffered, and this broke a Zope "pipelining" test which read multiple responses from the same connection (this attaches a new file object to the socket for each response). Added a test for this too. (I want to do some code cleanup too, but I thought I'd first fix the problem with as little code as possible, and add a unit test for this case. So that's what this checkin is about.) Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** socket.py 31 Jul 2002 17:48:02 -0000 1.24 --- socket.py 7 Aug 2002 15:46:19 -0000 1.25 *************** *** 175,183 **** """Implements a file object on top of a regular socket object.""" ! def __init__(self, sock, mode='rb', bufsize=8192): self._sock = sock self._mode = mode if bufsize <= 0: ! bufsize = 512 self._rbufsize = bufsize self._wbufsize = bufsize --- 175,186 ---- """Implements a file object on top of a regular socket object.""" ! def __init__(self, sock, mode='rb', bufsize=-1): self._sock = sock self._mode = mode if bufsize <= 0: ! if bufsize == 0: ! bufsize = 1 # Unbuffered mode ! else: ! bufsize = 8192 self._rbufsize = bufsize self._wbufsize = bufsize From gvanrossum@users.sourceforge.net Wed Aug 7 16:46:22 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:46:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29169/test Modified Files: test_socket.py Log Message: "Unbuffered" mode of class _fileobject wasn't actually unbuffered, and this broke a Zope "pipelining" test which read multiple responses from the same connection (this attaches a new file object to the socket for each response). Added a test for this too. (I want to do some code cleanup too, but I thought I'd first fix the problem with as little code as possible, and add a unit test for this case. So that's what this checkin is about.) Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** test_socket.py 2 Aug 2002 15:52:30 -0000 1.49 --- test_socket.py 7 Aug 2002 15:46:19 -0000 1.50 *************** *** 503,506 **** --- 503,508 ---- class FileObjectClassTestCase(SocketConnectedTest): + bufsize = -1 # Use default buffer size + def __init__(self, methodName='runTest'): SocketConnectedTest.__init__(self, methodName=methodName) *************** *** 508,512 **** def setUp(self): SocketConnectedTest.setUp(self) ! self.serv_file = socket._fileobject(self.cli_conn, 'rb', 8192) def tearDown(self): --- 510,514 ---- def setUp(self): SocketConnectedTest.setUp(self) ! self.serv_file = self.cli_conn.makefile('rb', self.bufsize) def tearDown(self): *************** *** 517,521 **** def clientSetUp(self): SocketConnectedTest.clientSetUp(self) ! self.cli_file = socket._fileobject(self.serv_conn, 'rb', 8192) def clientTearDown(self): --- 519,523 ---- def clientSetUp(self): SocketConnectedTest.clientSetUp(self) ! self.cli_file = self.serv_conn.makefile('wb') def clientTearDown(self): *************** *** 558,568 **** self.cli_file.flush() def test_main(): suite = unittest.TestSuite() ! 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)) test_support.run_suite(suite) --- 560,597 ---- self.cli_file.flush() + class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase): + + """Repeat the tests from FileObjectClassTestCase with bufsize==0. + + In this case (and in this case only), it should be possible to + create a file object, read a line from it, create another file + object, read another line from it, without loss of data in the + first file object's buffer. Note that httplib relies on this + when reading multiple requests from the same socket.""" + + bufsize = 0 # Use unbuffered mode + + def testUnbufferedReadline(self): + """Read a line, create a new file object, read another line with it.""" + line = self.serv_file.readline() # first line + self.assertEqual(line, MSG) # first line + self.serv_file = self.cli_conn.makefile('rb', 0) + line = self.serv_file.readline() # second line + self.assertEqual(line, MSG) # second line + + def _testUnbufferedReadline(self): + self.cli_file.write(MSG) + self.cli_file.write(MSG) + self.cli_file.flush() + + def test_main(): suite = unittest.TestSuite() ! ##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)) + suite.addTest(unittest.makeSuite(UnbufferedFileObjectClassTestCase)) test_support.run_suite(suite) From guido@python.org Wed Aug 7 16:47:34 2002 From: guido@python.org (Guido van Rossum) Date: Wed, 07 Aug 2002 11:47:34 -0400 Subject: [Python-checkins] python/dist/src/Python compile.c,2.250,2.251 In-Reply-To: Your message of "Wed, 07 Aug 2002 16:47:23 +0200." References: <3D5125A9.6010301@lemburg.com> Message-ID: <200208071547.g77FlYD03755@pcp02138704pcs.reston01.va.comcast.net> > > Shouldn't this be a call to Py_FatalError() with a proper > > error message ? > > What is the guideline for when to use abort, and when to use > Py_FatalError? You should always use Py_FatalError(), never abort(). --Guido van Rossum (home page: http://www.python.org/~guido/) From rhettinger@users.sourceforge.net Wed Aug 7 16:49:47 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:49:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.74.2.1.2.5,1.74.2.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1078 Modified Files: Tag: release22-maint libos.tex Log Message: Documented os.fsync and os.fdatasync. Closes SF bug 584695. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.5 retrieving revision 1.74.2.1.2.6 diff -C2 -d -r1.74.2.1.2.5 -r1.74.2.1.2.6 *** libos.tex 18 Jun 2002 20:31:23 -0000 1.74.2.1.2.5 --- libos.tex 7 Aug 2002 15:49:45 -0000 1.74.2.1.2.6 *************** *** 391,394 **** --- 391,400 ---- \end{funcdesc} + \begin{funcdesc}{fdatasync}{fd} + Force write of file with filedescriptor \var{fd} to disk. + Does not force update of metadata. + Availability: \UNIX. + \end{funcdesc} + \begin{funcdesc}{fpathconf}{fd, name} Return system configuration information relevant to an open file. *************** *** 418,421 **** --- 424,432 ---- Return information about the filesystem containing the file associated with file descriptor \var{fd}, like \function{statvfs()}. + Availability: \UNIX. + \end{funcdesc} + + \begin{funcdesc}{fsync}{fd} + Force write of file with filedescriptor \var{fd} to disk. Availability: \UNIX. \end{funcdesc} From rhettinger@users.sourceforge.net Wed Aug 7 16:48:19 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:48:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31964 Modified Files: libos.tex Log Message: Documented os.fsync and os.fdatasync. Closes SF bug 584695. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** libos.tex 28 Jul 2002 16:33:45 -0000 1.93 --- libos.tex 7 Aug 2002 15:48:17 -0000 1.94 *************** *** 400,403 **** --- 400,409 ---- \end{funcdesc} + \begin{funcdesc}{fdatasync}{fd} + Force write of file with filedescriptor \var{fd} to disk. + Does not force update of metadata. + Availability: \UNIX. + \end{funcdesc} + \begin{funcdesc}{fpathconf}{fd, name} Return system configuration information relevant to an open file. *************** *** 427,430 **** --- 433,441 ---- Return information about the filesystem containing the file associated with file descriptor \var{fd}, like \function{statvfs()}. + Availability: \UNIX. + \end{funcdesc} + + \begin{funcdesc}{fsync}{fd} + Force write of file with filedescriptor \var{fd} to disk. Availability: \UNIX. \end{funcdesc} From jackjansen@users.sourceforge.net Wed Aug 7 16:52:47 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:52:47 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts gensuitemodule.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv3278/scripts Modified Files: gensuitemodule.py Log Message: Fixed incorrect logic in determining whether we should initialize the classes' attribute list. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** gensuitemodule.py 7 Aug 2002 15:44:53 -0000 1.26 --- gensuitemodule.py 7 Aug 2002 15:52:44 -0000 1.27 *************** *** 296,300 **** # Generate property dicts and element dicts for all types declared in this module fp.write("def getbaseclasses(v):\n") ! fp.write("\tif hasattr(v, '_superclassnames') and v._superclassnames:\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") --- 296,300 ---- # Generate property dicts and element dicts for all types declared in this module fp.write("def getbaseclasses(v):\n") ! fp.write("\tif hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'):\n") fp.write("\t\tv._propdict = {}\n") fp.write("\t\tv._elemdict = {}\n") *************** *** 305,309 **** fp.write("\t\tv._propdict.update(v._privpropdict)\n") fp.write("\t\tv._elemdict.update(v._privelemdict)\n") - fp.write("\t\tv._superclassnames = None\n") fp.write("\n") fp.write("import StdSuites\n") --- 305,308 ---- From jackjansen@users.sourceforge.net Wed Aug 7 16:53:43 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:53:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Explorer Standard_Suite.py,NONE,1.1 Microsoft_Internet_Explorer.py,1.2,1.3 Netscape_Suite.py,1.2,1.3 Required_Suite.py,1.2,1.3 URL_Suite.py,1.2,1.3 Web_Browser_Suite.py,1.2,1.3 __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer In directory usw-pr-cvs1:/tmp/cvs-serv3925/Explorer Modified Files: Microsoft_Internet_Explorer.py Netscape_Suite.py Required_Suite.py URL_Suite.py Web_Browser_Suite.py __init__.py Added Files: Standard_Suite.py Log Message: Regenerated with OSA class inheritance and fix for non-ascii chars. --- NEW FILE: Standard_Suite.py --- """Suite Standard Suite: Common terms for most applications Level 1, version 1 Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ import aetools import MacOS _code = '****' class Standard_Suite_Events: _argmap_get = { 'as' : 'rtyp', } def get(self, _object, _attributes={}, **_arguments): """get: Required argument: an AE object reference Keyword argument as: undocumented, typecode 'type' Keyword argument _attributes: AppleEvent attribute dictionary Returns: anything """ _code = 'core' _subcode = 'getd' aetools.keysubst(_arguments, self._argmap_get) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] class application(aetools.ComponentItem): """application - An application program """ want = 'capp' class selected_text(aetools.NProperty): """selected text - the selected text """ which = 'stxt' want = 'TEXT' application._superclassnames = [] application._privpropdict = { 'selected_text' : selected_text, } application._privelemdict = { } # # Indices of types declared in this module # _classdeclarations = { 'capp' : application, } _propdeclarations = { 'stxt' : selected_text, } _compdeclarations = { } _enumdeclarations = { } Index: Microsoft_Internet_Explorer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Microsoft_Internet_Explorer.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Microsoft_Internet_Explorer.py 23 Apr 2002 21:05:38 -0000 1.2 --- Microsoft_Internet_Explorer.py 7 Aug 2002 15:53:40 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Netscape_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Netscape_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Netscape_Suite.py 23 Apr 2002 21:05:44 -0000 1.2 --- Netscape_Suite.py 7 Aug 2002 15:53:41 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Required_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_Suite.py 23 Apr 2002 21:05:54 -0000 1.2 --- Required_Suite.py 7 Aug 2002 15:53:41 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 53,57 **** return _arguments['----'] ! def _print(self, _object, _attributes={}, **_arguments): """print: Print documents Required argument: undocumented, typecode 'alis' --- 53,57 ---- return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): """print: Print documents Required argument: undocumented, typecode 'alis' Index: URL_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/URL_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** URL_Suite.py 23 Apr 2002 21:05:49 -0000 1.2 --- URL_Suite.py 7 Aug 2002 15:53:41 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Web_Browser_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/Web_Browser_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Web_Browser_Suite.py 23 Apr 2002 21:06:00 -0000 1.2 --- Web_Browser_Suite.py 7 Aug 2002 15:53:41 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 23 Apr 2002 21:05:34 -0000 1.2 --- __init__.py 7 Aug 2002 15:53:41 -0000 1.3 *************** *** 1,4 **** """ ! Package generated from Moes:Applications (Mac OS 9):Internet Explorer 5:Internet Explorer Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Internet Explorer 5/Internet Explorer Resource aete resid 0 """ *************** *** 39,42 **** --- 39,65 ---- from Microsoft_Internet_Explorer import * from Netscape_Suite import * + def getbaseclasses(v): + if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): + v._propdict = {} + v._elemdict = {} + for superclass in v._superclassnames: + v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) + v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) + v._propdict.update(v._privpropdict) + v._elemdict.update(v._privelemdict) + + import StdSuites + + # + # Set property and element dictionaries now that all classes have been defined + # + getbaseclasses(application) + + # + # Indices of types declared in this module + # + _classdeclarations = { + 'capp' : application, + } *************** *** 49,51 **** --- 72,76 ---- aetools.TalkTo): _signature = 'MSIE' + + _moduleName = 'Explorer' From jackjansen@users.sourceforge.net Wed Aug 7 16:53:44 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:53:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.3,1.4 PowerPlant.py,1.3,1.4 Required_suite.py,1.4,1.5 Standard_Suite.py,1.3,1.4 Standard_URL_suite.py,1.3,1.4 Text.py,1.4,1.5 WorldWideWeb_suite.py,1.3,1.4 __init__.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv3925/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Regenerated with OSA class inheritance and fix for non-ascii chars. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mozilla_suite.py 23 Apr 2002 21:07:33 -0000 1.3 --- Mozilla_suite.py 7 Aug 2002 15:53:41 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 21,25 **** """Read help file: Reads in the help file (file should be in the help file format) Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to •DEFAULTŐ) Keyword argument search_text: Optional text to search for Keyword argument _attributes: AppleEvent attribute dictionary --- 21,25 ---- """Read help file: Reads in the help file (file should be in the help file format) Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to \xd4DEFAULT\xd5) Keyword argument search_text: Optional text to search for Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 89,93 **** """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Will return text of the from –FILE://foo/applicationname” """ _code = 'MOSS' --- 89,93 ---- """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Will return text of the from \xd2FILE://foo/applicationname\xd3 """ _code = 'MOSS' *************** *** 128,132 **** """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, •BrwzŐ browser, •AddrŐ addressbook, •MesgŐ messenger, etc., 4 bytes) """ _code = 'MOSS' --- 128,132 ---- """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, \xd4Brwz\xd5 browser, \xd4Addr\xd5 addressbook, \xd4Mesg\xd5 messenger, etc., 4 bytes) """ _code = 'MOSS' *************** *** 148,152 **** """Get Profile Name: Get the current User Profile Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Name of the current profile, like –Joe Bloggs”. This is the name of the profile folder in the Netscape Users folder. """ _code = 'MOSS' --- 148,152 ---- """Get Profile Name: Get the current User Profile Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Name of the current profile, like \xd2Joe Bloggs\xd3. This is the name of the profile folder in the Netscape Users folder. """ _code = 'MOSS' Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PowerPlant.py 23 Apr 2002 21:07:37 -0000 1.3 --- PowerPlant.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 2,6 **** Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 43,47 **** def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the –focus” of AppleEvents Keyword argument to: reference to new focus of AppleEvents Keyword argument _attributes: AppleEvent attribute dictionary --- 43,47 ---- def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the \xd2focus\xd3 of AppleEvents Keyword argument to: reference to new focus of AppleEvents Keyword argument _attributes: AppleEvent attribute dictionary Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required_suite.py 23 Apr 2002 21:08:02 -0000 1.4 --- Required_suite.py 7 Aug 2002 15:53:42 -0000 1.5 *************** *** 2,6 **** Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 34,38 **** return _arguments['----'] ! def _print(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print --- 34,38 ---- return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 23 Apr 2002 21:08:06 -0000 1.3 --- Standard_Suite.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 81,85 **** def set(self, _object, _attributes={}, **_arguments): ! """set: Set an objectŐs data Required argument: the object to change Keyword argument to: the new value --- 81,85 ---- def set(self, _object, _attributes={}, **_arguments): ! """set: Set an object\xd5s data Required argument: the object to change Keyword argument to: the new value *************** *** 106,110 **** want = 'capp' class alert_application(aetools.NProperty): ! """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. IŐd like to conform to the standard. """ which = 'ALAP' want = 'type' --- 106,110 ---- want = 'capp' class alert_application(aetools.NProperty): ! """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I\xd5d like to conform to the standard. """ which = 'ALAP' want = 'type' *************** *** 171,175 **** want = 'TEXT' class unique_ID(aetools.NProperty): ! """unique ID - WindowŐs unique ID (a bridge between WWW! suite window idŐs and standard AE windows) """ which = 'wiid' want = 'long' --- 171,175 ---- want = 'TEXT' class unique_ID(aetools.NProperty): ! """unique ID - Window\xd5s unique ID (a bridge between WWW! suite window id\xd5s and standard AE windows) """ which = 'wiid' want = 'long' *************** *** 178,189 **** which = 'busy' want = 'long' ! application._propdict = { 'alert_application' : alert_application, 'kiosk_mode' : kiosk_mode, } ! application._elemdict = { 'window' : window, } ! window._propdict = { 'bounds' : bounds, 'closeable' : closeable, --- 178,191 ---- which = 'busy' want = 'long' ! application._superclassnames = [] ! application._privpropdict = { 'alert_application' : alert_application, 'kiosk_mode' : kiosk_mode, } ! application._privelemdict = { 'window' : window, } ! window._superclassnames = [] ! window._privpropdict = { 'bounds' : bounds, 'closeable' : closeable, *************** *** 202,206 **** 'busy' : busy, } ! window._elemdict = { } --- 204,208 ---- 'busy' : busy, } ! window._privelemdict = { } Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_URL_suite.py 23 Apr 2002 21:07:41 -0000 1.3 --- Standard_URL_suite.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 1,9 **** ! """Suite Standard URL suite: Mac URL standard, supported by many apps ! ! ! Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 1,6 ---- ! """Suite Standard URL suite: Mac URL standard, supported by many apps Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 19,32 **** 'to' : 'dest', 'inside' : 'HWIN', ! '_from' : 'refe', } def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Loads the URL (optionally to disk) ! Required argument: The url Keyword argument to: file the URL should be loaded into Keyword argument inside: Window the URL should be loaded to ! Keyword argument _from: Referrer, to be sent with the HTTP request Keyword argument _attributes: AppleEvent attribute dictionary """ --- 16,28 ---- 'to' : 'dest', 'inside' : 'HWIN', ! 'from_' : 'refe', } def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Loads the URL (optionally to disk) Required argument: The url Keyword argument to: file the URL should be loaded into Keyword argument inside: Window the URL should be loaded to ! Keyword argument from_: Referrer, to be sent with the HTTP request Keyword argument _attributes: AppleEvent attribute dictionary """ Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Text.py 23 Apr 2002 21:07:51 -0000 1.4 --- Text.py 7 Aug 2002 15:53:42 -0000 1.5 *************** *** 2,6 **** Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 43,47 **** class styleset(aetools.ComponentItem): ! """styleset - A style –set” that may be used repeatedly in text objects. """ want = 'stys' class name(aetools.NProperty): --- 43,47 ---- class styleset(aetools.ComponentItem): ! """styleset - A style \xd2set\xd3 that may be used repeatedly in text objects. """ want = 'stys' class name(aetools.NProperty): *************** *** 71,75 **** stylesets = styleset ! text._propdict = { 'updateLevel' : updateLevel, 'beginning' : beginning, --- 71,76 ---- stylesets = styleset ! text._superclassnames = [] ! text._privpropdict = { 'updateLevel' : updateLevel, 'beginning' : beginning, *************** *** 78,85 **** 'justbehind' : justbehind, } ! text._elemdict = { 'styleset' : styleset, } ! styleset._propdict = { 'name' : name, 'color' : color, --- 79,87 ---- 'justbehind' : justbehind, } ! text._privelemdict = { 'styleset' : styleset, } ! styleset._superclassnames = [] ! styleset._privpropdict = { 'name' : name, 'color' : color, *************** *** 89,93 **** 'style' : style, } ! styleset._elemdict = { } --- 91,95 ---- 'style' : style, } ! styleset._privelemdict = { } Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WorldWideWeb_suite.py 23 Apr 2002 21:07:56 -0000 1.3 --- WorldWideWeb_suite.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 213,217 **** def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the –echo” application. Each download from now on will be echoed to this application. Required argument: Application signature Keyword argument _attributes: AppleEvent attribute dictionary --- 213,217 ---- def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the \xd2echo\xd3 application. Each download from now on will be echoed to this application. Required argument: Application signature Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 258,262 **** def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a •specialŐ viewer for this MIME type. The application will be launched with ViewDoc events Required argument: Application sig Keyword argument MIME_type: MIME type viewer is registering for --- 258,262 ---- def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a \xd4special\xd5 viewer for this MIME type. The application will be launched with ViewDoc events Required argument: Application sig Keyword argument MIME_type: MIME type viewer is registering for *************** *** 311,317 **** def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a –handler” for this protocol with a given prefix. The handler will receive –OpenURL”, or if that fails, –GetURL” event. Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: –finger:”, –file”, Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if registration has been successful --- 311,317 ---- def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event. Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3, Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if registration has been successful *************** *** 337,341 **** def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of –register protocol” Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols --- 337,341 ---- def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of \xd2register protocol\xd3 Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 23 Apr 2002 21:07:27 -0000 1.4 --- __init__.py 7 Aug 2002 15:53:42 -0000 1.5 *************** *** 1,4 **** """ ! Package generated from Moes:Applications (Mac OS 9):Netscape CommunicatorŽ Folder:Netscape CommunicatorŽ Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator™ Folder/Netscape Communicator™ Resource aete resid 0 """ *************** *** 43,46 **** --- 43,89 ---- from PowerPlant import * from Text import * + def getbaseclasses(v): + if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): + v._propdict = {} + v._elemdict = {} + for superclass in v._superclassnames: + v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) + v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) + v._propdict.update(v._privpropdict) + v._elemdict.update(v._privelemdict) + + import StdSuites + + # + # Set property and element dictionaries now that all classes have been defined + # + getbaseclasses(window) + getbaseclasses(application) + getbaseclasses(text) + getbaseclasses(styleset) + getbaseclasses(StdSuites.Text_Suite.paragraph) + getbaseclasses(StdSuites.Text_Suite.character) + getbaseclasses(StdSuites.Text_Suite.text_style_info) + getbaseclasses(StdSuites.Text_Suite.word) + getbaseclasses(StdSuites.Text_Suite.text_flow) + getbaseclasses(StdSuites.Text_Suite.line) + getbaseclasses(StdSuites.Text_Suite.text) + + # + # Indices of types declared in this module + # + _classdeclarations = { + 'cwin' : window, + 'capp' : application, + 'ctxt' : text, + 'stys' : styleset, + 'cpar' : StdSuites.Text_Suite.paragraph, + 'cha ' : StdSuites.Text_Suite.character, + 'tsty' : StdSuites.Text_Suite.text_style_info, + 'cwor' : StdSuites.Text_Suite.word, + 'cflo' : StdSuites.Text_Suite.text_flow, + 'clin' : StdSuites.Text_Suite.line, + 'ctxt' : StdSuites.Text_Suite.text, + } *************** *** 54,56 **** --- 97,101 ---- aetools.TalkTo): _signature = 'MOSS' + + _moduleName = 'Netscape' From jackjansen@users.sourceforge.net Wed Aug 7 16:53:44 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:53:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.4,1.5 Macintosh_Connectivity_Clas.py,1.2,1.3 QuickDraw_Graphics_Suite.py,1.2,1.3 QuickDraw_Graphics_Suppleme.py,1.2,1.3 Required_Suite.py,1.2,1.3 Standard_Suite.py,1.4,1.5 Table_Suite.py,1.3,1.4 Text_Suite.py,1.3,1.4 Type_Names_Suite.py,1.2,1.3 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv3925/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Required_Suite.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Regenerated with OSA class inheritance and fix for non-ascii chars. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AppleScript_Suite.py 23 Apr 2002 21:08:37 -0000 1.4 --- AppleScript_Suite.py 7 Aug 2002 15:53:42 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 [...1300 lines suppressed...] 'enum' : constant, --- 2114,2118 ---- 'cha ' : character, 'apr ' : April, ! 'undf' : empty_ae_name_, 'capp' : app, 'enum' : constant, *************** *** 2046,2050 **** 'tstr' : time_string, 'pi ' : pi, ! 'ret ' : _return, 'plcd' : language_code, 'kMsg' : key, --- 2156,2160 ---- 'tstr' : time_string, 'pi ' : pi, ! 'ret ' : return_, 'plcd' : language_code, 'kMsg' : key, Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Macintosh_Connectivity_Clas.py 22 Jan 2002 23:21:33 -0000 1.2 --- Macintosh_Connectivity_Clas.py 7 Aug 2002 15:53:42 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 159,183 **** USB_Addresses = USB_address ! device_specification._propdict = { 'properties' : properties, 'device_type' : device_type, 'device_address' : device_address, } ! device_specification._elemdict = { } ! address_specification._propdict = { 'properties' : properties, 'conduit' : conduit, 'protocol' : protocol, } ! address_specification._elemdict = { } ! ADB_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! ADB_address._elemdict = { } ! AppleTalk_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'AppleTalk_machine' : AppleTalk_machine, --- 159,187 ---- USB_Addresses = USB_address ! device_specification._superclassnames = [] ! device_specification._privpropdict = { 'properties' : properties, 'device_type' : device_type, 'device_address' : device_address, } ! device_specification._privelemdict = { } ! address_specification._superclassnames = [] ! address_specification._privpropdict = { 'properties' : properties, 'conduit' : conduit, 'protocol' : protocol, } ! address_specification._privelemdict = { } ! ADB_address._superclassnames = ['address_specification'] ! ADB_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! ADB_address._privelemdict = { } ! AppleTalk_address._superclassnames = ['address_specification'] ! AppleTalk_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'AppleTalk_machine' : AppleTalk_machine, *************** *** 185,209 **** 'AppleTalk_type' : AppleTalk_type, } ! AppleTalk_address._elemdict = { } ! bus_slot._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! bus_slot._elemdict = { } ! Ethernet_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! Ethernet_address._elemdict = { } ! FireWire_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! FireWire_address._elemdict = { } ! IP_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, --- 189,217 ---- 'AppleTalk_type' : AppleTalk_type, } ! AppleTalk_address._privelemdict = { } ! bus_slot._superclassnames = ['address_specification'] ! bus_slot._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! bus_slot._privelemdict = { } ! Ethernet_address._superclassnames = ['address_specification'] ! Ethernet_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! Ethernet_address._privelemdict = { } ! FireWire_address._superclassnames = ['address_specification'] ! FireWire_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! FireWire_address._privelemdict = { } ! IP_address._superclassnames = ['address_specification'] ! IP_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, *************** *** 211,217 **** 'port' : port, } ! IP_address._elemdict = { } ! LocalTalk_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'network' : network, --- 219,226 ---- 'port' : port, } ! IP_address._privelemdict = { } ! LocalTalk_address._superclassnames = ['address_specification'] ! LocalTalk_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'network' : network, *************** *** 219,225 **** 'socket' : socket, } ! LocalTalk_address._elemdict = { } ! SCSI_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'SCSI_bus' : SCSI_bus, --- 228,235 ---- 'socket' : socket, } ! LocalTalk_address._privelemdict = { } ! SCSI_address._superclassnames = ['address_specification'] ! SCSI_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'SCSI_bus' : SCSI_bus, *************** *** 227,243 **** 'LUN' : LUN, } ! SCSI_address._elemdict = { } ! Token_Ring_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! Token_Ring_address._elemdict = { } ! USB_address._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'name' : name, } ! USB_address._elemdict = { } _Enum_edvt = { --- 237,255 ---- 'LUN' : LUN, } ! SCSI_address._privelemdict = { } ! Token_Ring_address._superclassnames = ['address_specification'] ! Token_Ring_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'ID' : ID, } ! Token_Ring_address._privelemdict = { } ! USB_address._superclassnames = ['address_specification'] ! USB_address._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'name' : name, } ! USB_address._privelemdict = { } _Enum_edvt = { Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuickDraw_Graphics_Suite.py 22 Jan 2002 23:22:04 -0000 1.2 --- QuickDraw_Graphics_Suite.py 7 Aug 2002 15:53:42 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 227,231 **** rounded_rectangles = rounded_rectangle ! arc._propdict = { 'arc_angle' : arc_angle, 'bounds' : bounds, --- 227,232 ---- rounded_rectangles = rounded_rectangle ! arc._superclassnames = [] ! arc._privpropdict = { 'arc_angle' : arc_angle, 'bounds' : bounds, *************** *** 239,245 **** 'transfer_mode' : transfer_mode, } ! arc._elemdict = { } ! drawing_area._propdict = { 'background_color' : background_color, 'background_pattern' : background_pattern, --- 240,247 ---- 'transfer_mode' : transfer_mode, } ! arc._privelemdict = { } ! drawing_area._superclassnames = [] ! drawing_area._privpropdict = { 'background_color' : background_color, 'background_pattern' : background_pattern, *************** *** 256,262 **** 'update_on_change' : update_on_change, } ! drawing_area._elemdict = { } ! graphic_line._propdict = { 'start_point' : start_point, 'end_point' : end_point, --- 258,265 ---- 'update_on_change' : update_on_change, } ! drawing_area._privelemdict = { } ! graphic_line._superclassnames = [] ! graphic_line._privpropdict = { 'start_point' : start_point, 'end_point' : end_point, *************** *** 264,278 **** 'arrow_style' : arrow_style, } ! graphic_line._elemdict = { } ! graphic_object._propdict = { } ! graphic_object._elemdict = { } ! graphic_shape._propdict = { } ! graphic_shape._elemdict = { } ! graphic_text._propdict = { 'color' : color, 'font' : font, --- 267,284 ---- 'arrow_style' : arrow_style, } ! graphic_line._privelemdict = { } ! graphic_object._superclassnames = [] ! graphic_object._privpropdict = { } ! graphic_object._privelemdict = { } ! graphic_shape._superclassnames = [] ! graphic_shape._privpropdict = { } ! graphic_shape._privelemdict = { } ! graphic_text._superclassnames = [] ! graphic_text._privpropdict = { 'color' : color, 'font' : font, *************** *** 280,316 **** 'uniform_styles' : uniform_styles, } ! graphic_text._elemdict = { } ! graphic_group._propdict = { } ! graphic_group._elemdict = { } ! oval._propdict = { } ! oval._elemdict = { } ! pixel._propdict = { 'color' : color, } ! pixel._elemdict = { } ! pixel_map._propdict = { } ! pixel_map._elemdict = { } ! polygon._propdict = { 'point_list' : point_list, } ! polygon._elemdict = { } ! rectangle._propdict = { } ! rectangle._elemdict = { } ! rounded_rectangle._propdict = { 'corner_curve_height' : corner_curve_height, 'corner_curve_width' : corner_curve_width, } ! rounded_rectangle._elemdict = { } _Enum_tran = { --- 286,329 ---- 'uniform_styles' : uniform_styles, } ! graphic_text._privelemdict = { } ! graphic_group._superclassnames = [] ! graphic_group._privpropdict = { } ! graphic_group._privelemdict = { } ! oval._superclassnames = [] ! oval._privpropdict = { } ! oval._privelemdict = { } ! pixel._superclassnames = [] ! pixel._privpropdict = { 'color' : color, } ! pixel._privelemdict = { } ! pixel_map._superclassnames = [] ! pixel_map._privpropdict = { } ! pixel_map._privelemdict = { } ! polygon._superclassnames = [] ! polygon._privpropdict = { 'point_list' : point_list, } ! polygon._privelemdict = { } ! rectangle._superclassnames = [] ! rectangle._privpropdict = { } ! rectangle._privelemdict = { } ! rounded_rectangle._superclassnames = [] ! rounded_rectangle._privpropdict = { 'corner_curve_height' : corner_curve_height, 'corner_curve_width' : corner_curve_width, } ! rounded_rectangle._privelemdict = { } _Enum_tran = { Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuickDraw_Graphics_Suppleme.py 22 Jan 2002 23:22:08 -0000 1.2 --- QuickDraw_Graphics_Suppleme.py 7 Aug 2002 15:53:42 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 39,52 **** graphic_groups = graphic_group ! drawing_area._propdict = { 'rotation' : rotation, 'scale' : scale, 'translation' : translation, } ! drawing_area._elemdict = { } ! graphic_group._propdict = { } ! graphic_group._elemdict = { } --- 39,54 ---- graphic_groups = graphic_group ! drawing_area._superclassnames = [] ! drawing_area._privpropdict = { 'rotation' : rotation, 'scale' : scale, 'translation' : translation, } ! drawing_area._privelemdict = { } ! graphic_group._superclassnames = [] ! graphic_group._privpropdict = { } ! graphic_group._privelemdict = { } Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Required_Suite.py 22 Jan 2002 23:22:13 -0000 1.2 --- Required_Suite.py 7 Aug 2002 15:53:42 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 23 Apr 2002 21:08:46 -0000 1.4 --- Standard_Suite.py 7 Aug 2002 15:53:42 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 72,76 **** return _arguments['----'] ! def _print(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print --- 72,76 ---- return _arguments['----'] ! def print_(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print *************** *** 298,302 **** _argmap_save = { ! '_in' : 'kfil', 'as' : 'fltp', } --- 298,302 ---- _argmap_save = { ! 'in_' : 'kfil', 'as' : 'fltp', } *************** *** 305,309 **** """save: Save an object Required argument: the object to save, usually a document or window ! Keyword argument _in: the file in which to save the object Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary --- 305,309 ---- """save: Save an object Required argument: the object to save, usually a document or window ! Keyword argument in_: the file in which to save the object Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 371,375 **** _argmap_suite_info = { ! '_in' : 'wrcd', } --- 371,375 ---- _argmap_suite_info = { ! 'in_' : 'wrcd', } *************** *** 377,381 **** """suite info: (optional) Get information about event suite(s) Required argument: the suite for which to return information ! Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary Returns: a record containing the suites and their versions --- 377,381 ---- """suite info: (optional) Get information about event suite(s) Required argument: the suite for which to return information ! Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary Returns: a record containing the suites and their versions *************** *** 397,401 **** _argmap_event_info = { ! '_in' : 'wrcd', } --- 397,401 ---- _argmap_event_info = { ! 'in_' : 'wrcd', } *************** *** 403,407 **** """event info: (optional) Get information about the Apple events in a suite Required argument: the event class of the Apple events for which to return information ! Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary Returns: a record containing the events and their parameters --- 403,407 ---- """event info: (optional) Get information about the Apple events in a suite Required argument: the event class of the Apple events for which to return information ! Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary Returns: a record containing the events and their parameters *************** *** 423,427 **** _argmap_class_info = { ! '_in' : 'wrcd', } --- 423,427 ---- _argmap_class_info = { ! 'in_' : 'wrcd', } *************** *** 429,435 **** """class info: (optional) Get information about an object class Required argument: the object class about which information is requested ! Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the objectŐs properties and elements """ _code = 'core' --- 429,435 ---- """class info: (optional) Get information about an object class Required argument: the object class about which information is requested ! Keyword argument in_: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the object\xd5s properties and elements """ _code = 'core' *************** *** 461,465 **** want = 'bool' class selection(aetools.NProperty): ! """selection - the selection visible to the user. Use the •selectŐ command to set a new selection; use •contents of selectionŐ to get or change information in the document. """ which = 'sele' want = 'csel' --- 461,465 ---- want = 'bool' class selection(aetools.NProperty): ! """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' *************** *** 502,509 **** class selection_2d_object(aetools.ComponentItem): ! """selection-object - A way to refer to the state of the current of the selection. Use the •selectŐ command to make a new selection. """ want = 'csel' class contents(aetools.NProperty): ! """contents - the information currently selected. Use •contents of selectionŐ to get or change information in a document. """ which = 'pcnt' want = '****' --- 502,509 ---- class selection_2d_object(aetools.ComponentItem): ! """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """ want = 'csel' class contents(aetools.NProperty): ! """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """ which = 'pcnt' want = '****' *************** *** 560,564 **** insertion_points = insertion_point ! application._propdict = { 'name' : name, 'frontmost' : frontmost, --- 560,565 ---- insertion_points = insertion_point ! application._superclassnames = [] ! application._privpropdict = { 'name' : name, 'frontmost' : frontmost, *************** *** 567,592 **** 'version' : version, } ! application._elemdict = { } ! document._propdict = { 'modified' : modified, } ! document._elemdict = { } ! file._propdict = { 'stationery' : stationery, } ! file._elemdict = { } ! alias._propdict = { } ! alias._elemdict = { } ! selection_2d_object._propdict = { 'contents' : contents, } ! selection_2d_object._elemdict = { } ! window._propdict = { 'bounds' : bounds, 'closeable' : closeable, --- 568,598 ---- 'version' : version, } ! application._privelemdict = { } ! document._superclassnames = [] ! document._privpropdict = { 'modified' : modified, } ! document._privelemdict = { } ! file._superclassnames = [] ! file._privpropdict = { 'stationery' : stationery, } ! file._privelemdict = { } ! alias._superclassnames = [] ! alias._privpropdict = { } ! alias._privelemdict = { } ! selection_2d_object._superclassnames = [] ! selection_2d_object._privpropdict = { 'contents' : contents, } ! selection_2d_object._privelemdict = { } ! window._superclassnames = [] ! window._privpropdict = { 'bounds' : bounds, 'closeable' : closeable, *************** *** 600,608 **** 'visible' : visible, } ! window._elemdict = { } ! insertion_point._propdict = { } ! insertion_point._elemdict = { } class starts_with(aetools.NComparison): --- 606,615 ---- 'visible' : visible, } ! window._privelemdict = { } ! insertion_point._superclassnames = [] ! insertion_point._privpropdict = { } ! insertion_point._privelemdict = { } class starts_with(aetools.NComparison): *************** *** 617,625 **** """> - Greater than """ class _b3_(aetools.NComparison): ! """ł - Greater than or equal to """ class _3c_(aetools.NComparison): """< - Less than """ class _b2_(aetools.NComparison): ! """˛ - Less than or equal to """ _Enum_savo = { 'yes' : 'yes ', # Save objects now --- 624,632 ---- """> - Greater than """ class _b3_(aetools.NComparison): ! """\xb3 - Greater than or equal to """ class _3c_(aetools.NComparison): """< - Less than """ class _b2_(aetools.NComparison): ! """\xb2 - Less than or equal to """ _Enum_savo = { 'yes' : 'yes ', # Save objects now Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Table_Suite.py 22 Jan 2002 23:22:27 -0000 1.3 --- Table_Suite.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 51,75 **** tables = table ! cell._propdict = { 'formula' : formula, 'protection' : protection, } ! cell._elemdict = { } ! column._propdict = { 'name' : name, } ! column._elemdict = { } ! row._propdict = { } ! row._elemdict = { } ! table._propdict = { } ! table._elemdict = { } _Enum_prtn = { ! 'read_only' : 'nmod', # CanŐt change values or formulas 'formulas_protected' : 'fpro', # Can changes values but not formulas 'read_2f_write' : 'modf', # Can change values and formulas --- 51,79 ---- tables = table ! cell._superclassnames = [] ! cell._privpropdict = { 'formula' : formula, 'protection' : protection, } ! cell._privelemdict = { } ! column._superclassnames = [] ! column._privpropdict = { 'name' : name, } ! column._privelemdict = { } ! row._superclassnames = [] ! row._privpropdict = { } ! row._privelemdict = { } ! table._superclassnames = [] ! table._privpropdict = { } ! table._privelemdict = { } _Enum_prtn = { ! 'read_only' : 'nmod', # Can\xd5t change values or formulas 'formulas_protected' : 'fpro', # Can changes values but not formulas 'read_2f_write' : 'modf', # Can change values and formulas Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Text_Suite.py 22 Jan 2002 23:22:32 -0000 1.3 --- Text_Suite.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 74,78 **** class text_flow(aetools.ComponentItem): ! """text flow - A contiguous block of text. Page layout applications call this a •story.Ő """ want = 'cflo' class name(aetools.NProperty): --- 74,78 ---- class text_flow(aetools.ComponentItem): ! """text flow - A contiguous block of text. Page layout applications call this a \xd4story.\xd5 """ want = 'cflo' class name(aetools.NProperty): *************** *** 102,122 **** words = word ! character._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ! character._elemdict = { } ! line._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'justification' : justification, } ! line._elemdict = { } ! paragraph._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ! paragraph._elemdict = { } ! text._propdict = { 'color' : color, 'font' : font, --- 102,126 ---- words = word ! character._superclassnames = ['text'] ! character._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ! character._privelemdict = { } ! line._superclassnames = ['text'] ! line._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'justification' : justification, } ! line._privelemdict = { } ! paragraph._superclassnames = ['text'] ! paragraph._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ! paragraph._privelemdict = { } ! text._superclassnames = [] ! text._privpropdict = { 'color' : color, 'font' : font, *************** *** 126,130 **** 'uniform_styles' : uniform_styles, } ! text._elemdict = { 'character' : character, 'line' : line, --- 130,134 ---- 'uniform_styles' : uniform_styles, } ! text._privelemdict = { 'character' : character, 'line' : line, *************** *** 133,152 **** 'word' : word, } ! text_flow._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'name' : name, } ! text_flow._elemdict = { } ! text_style_info._propdict = { 'on_styles' : on_styles, 'off_styles' : off_styles, } ! text_style_info._elemdict = { } ! word._propdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ! word._elemdict = { } _Enum_just = { --- 137,159 ---- 'word' : word, } ! text_flow._superclassnames = ['text'] ! text_flow._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, 'name' : name, } ! text_flow._privelemdict = { } ! text_style_info._superclassnames = [] ! text_style_info._privpropdict = { 'on_styles' : on_styles, 'off_styles' : off_styles, } ! text_style_info._privelemdict = { } ! word._superclassnames = ['text'] ! word._privpropdict = { '_3c_inheritance_3e_' : _3c_inheritance_3e_, } ! word._privelemdict = { } _Enum_just = { Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Type_Names_Suite.py 22 Jan 2002 23:21:44 -0000 1.2 --- Type_Names_Suite.py 7 Aug 2002 15:53:42 -0000 1.3 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Extensies:AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 179,345 **** """target id - """ want = 'targ' ! type_class_info._propdict = { } ! type_class_info._elemdict = { } ! type_event_info._propdict = { } ! type_event_info._elemdict = { } ! plain_text._propdict = { } ! plain_text._elemdict = { } ! plain_text._propdict = { } ! plain_text._elemdict = { } ! bounding_rectangle._propdict = { } ! bounding_rectangle._elemdict = { } ! point._propdict = { } ! point._elemdict = { } ! fixed._propdict = { } ! fixed._elemdict = { } ! location_reference._propdict = { } ! location_reference._elemdict = { } ! application_dictionary._propdict = { } ! application_dictionary._elemdict = { } ! color_table._propdict = { } ! color_table._elemdict = { } ! dash_style._propdict = { } ! dash_style._elemdict = { } ! double_integer._propdict = { } ! double_integer._elemdict = { } ! extended_real._propdict = { } ! extended_real._elemdict = { } ! fixed_point._propdict = { } ! fixed_point._elemdict = { } ! fixed_rectangle._propdict = { } ! fixed_rectangle._elemdict = { } ! long_fixed._propdict = { } ! long_fixed._elemdict = { } ! long_fixed_point._propdict = { } ! long_fixed_point._elemdict = { } ! long_fixed_rectangle._propdict = { } ! long_fixed_rectangle._elemdict = { } ! long_point._propdict = { } ! long_point._elemdict = { } ! long_rectangle._propdict = { } ! long_rectangle._elemdict = { } ! machine_location._propdict = { } ! machine_location._elemdict = { } ! menu._propdict = { } ! menu._elemdict = { } ! menu_item._propdict = { } ! menu_item._elemdict = { } ! null._propdict = { } ! null._elemdict = { } ! pixel_map_record._propdict = { } ! pixel_map_record._elemdict = { } ! PostScript_picture._propdict = { } ! PostScript_picture._elemdict = { } ! RGB16_color._propdict = { } ! RGB16_color._elemdict = { } ! RGB96_color._propdict = { } ! RGB96_color._elemdict = { } ! small_integer._propdict = { } ! small_integer._elemdict = { } ! small_real._propdict = { } ! small_real._elemdict = { } ! system_dictionary._propdict = { } ! system_dictionary._elemdict = { } ! rotation._propdict = { } ! rotation._elemdict = { } ! scrap_styles._propdict = { } ! scrap_styles._elemdict = { } ! TIFF_picture._propdict = { } ! TIFF_picture._elemdict = { } ! version._propdict = { } ! version._elemdict = { } ! unsigned_integer._propdict = { } ! unsigned_integer._elemdict = { } ! type_property_info._propdict = { } ! type_property_info._elemdict = { } ! type_element_info._propdict = { } ! type_element_info._elemdict = { } ! type_parameter_info._propdict = { } ! type_parameter_info._elemdict = { } ! type_suite_info._propdict = { } ! type_suite_info._elemdict = { } ! target_id._propdict = { } ! target_id._elemdict = { } --- 179,386 ---- """target id - """ want = 'targ' ! type_class_info._superclassnames = [] ! type_class_info._privpropdict = { } ! type_class_info._privelemdict = { } ! type_event_info._superclassnames = [] ! type_event_info._privpropdict = { } ! type_event_info._privelemdict = { } ! plain_text._superclassnames = [] ! plain_text._privpropdict = { } ! plain_text._privelemdict = { } ! plain_text._superclassnames = [] ! plain_text._privpropdict = { } ! plain_text._privelemdict = { } ! bounding_rectangle._superclassnames = [] ! bounding_rectangle._privpropdict = { } ! bounding_rectangle._privelemdict = { } ! point._superclassnames = [] ! point._privpropdict = { } ! point._privelemdict = { } ! fixed._superclassnames = [] ! fixed._privpropdict = { } ! fixed._privelemdict = { } ! location_reference._superclassnames = [] ! location_reference._privpropdict = { } ! location_reference._privelemdict = { } ! application_dictionary._superclassnames = [] ! application_dictionary._privpropdict = { } ! application_dictionary._privelemdict = { } ! color_table._superclassnames = [] ! color_table._privpropdict = { } ! color_table._privelemdict = { } ! dash_style._superclassnames = [] ! dash_style._privpropdict = { } ! dash_style._privelemdict = { } ! double_integer._superclassnames = [] ! double_integer._privpropdict = { } ! double_integer._privelemdict = { } ! extended_real._superclassnames = [] ! extended_real._privpropdict = { } ! extended_real._privelemdict = { } ! fixed_point._superclassnames = [] ! fixed_point._privpropdict = { } ! fixed_point._privelemdict = { } ! fixed_rectangle._superclassnames = [] ! fixed_rectangle._privpropdict = { } ! fixed_rectangle._privelemdict = { } ! long_fixed._superclassnames = [] ! long_fixed._privpropdict = { } ! long_fixed._privelemdict = { } ! long_fixed_point._superclassnames = [] ! long_fixed_point._privpropdict = { } ! long_fixed_point._privelemdict = { } ! long_fixed_rectangle._superclassnames = [] ! long_fixed_rectangle._privpropdict = { } ! long_fixed_rectangle._privelemdict = { } ! long_point._superclassnames = [] ! long_point._privpropdict = { } ! long_point._privelemdict = { } ! long_rectangle._superclassnames = [] ! long_rectangle._privpropdict = { } ! long_rectangle._privelemdict = { } ! machine_location._superclassnames = [] ! machine_location._privpropdict = { } ! machine_location._privelemdict = { } ! menu._superclassnames = [] ! menu._privpropdict = { } ! menu._privelemdict = { } ! menu_item._superclassnames = [] ! menu_item._privpropdict = { } ! menu_item._privelemdict = { } ! null._superclassnames = [] ! null._privpropdict = { } ! null._privelemdict = { } ! pixel_map_record._superclassnames = [] ! pixel_map_record._privpropdict = { } ! pixel_map_record._privelemdict = { } ! PostScript_picture._superclassnames = [] ! PostScript_picture._privpropdict = { } ! PostScript_picture._privelemdict = { } ! RGB16_color._superclassnames = [] ! RGB16_color._privpropdict = { } ! RGB16_color._privelemdict = { } ! RGB96_color._superclassnames = [] ! RGB96_color._privpropdict = { } ! RGB96_color._privelemdict = { } ! small_integer._superclassnames = [] ! small_integer._privpropdict = { } ! small_integer._privelemdict = { } ! small_real._superclassnames = [] ! small_real._privpropdict = { } ! small_real._privelemdict = { } ! system_dictionary._superclassnames = [] ! system_dictionary._privpropdict = { } ! system_dictionary._privelemdict = { } ! rotation._superclassnames = [] ! rotation._privpropdict = { } ! rotation._privelemdict = { } ! scrap_styles._superclassnames = [] ! scrap_styles._privpropdict = { } ! scrap_styles._privelemdict = { } ! TIFF_picture._superclassnames = [] ! TIFF_picture._privpropdict = { } ! TIFF_picture._privelemdict = { } ! version._superclassnames = [] ! version._privpropdict = { } ! version._privelemdict = { } ! unsigned_integer._superclassnames = [] ! unsigned_integer._privpropdict = { } ! unsigned_integer._privelemdict = { } ! type_property_info._superclassnames = [] ! type_property_info._privpropdict = { } ! type_property_info._privelemdict = { } ! type_element_info._superclassnames = [] ! type_element_info._privpropdict = { } ! type_element_info._privelemdict = { } ! type_parameter_info._superclassnames = [] ! type_parameter_info._privpropdict = { } ! type_parameter_info._privelemdict = { } ! type_suite_info._superclassnames = [] ! type_suite_info._privpropdict = { } ! type_suite_info._privelemdict = { } ! target_id._superclassnames = [] ! target_id._privpropdict = { } ! target_id._privelemdict = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 22 Jan 2002 23:21:28 -0000 1.3 --- __init__.py 7 Aug 2002 15:53:42 -0000 1.4 *************** *** 1,4 **** """ ! Package generated from Moes:Systeemmap:Extensies:AppleScript Resource aeut resid 0 Standard Event Suites for English """ --- 1,4 ---- """ ! Package generated from /Volumes/Sap/System Folder/Extensions/AppleScript Resource aeut resid 0 Standard Event Suites for English """ *************** *** 51,54 **** --- 51,455 ---- from Macintosh_Connectivity_Clas import * from Type_Names_Suite import * + def getbaseclasses(v): + if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): + v._propdict = {} + v._elemdict = {} + for superclass in v._superclassnames: + v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) + v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) + v._propdict.update(v._privpropdict) + v._elemdict.update(v._privelemdict) + + import StdSuites + + # + # Set property and element dictionaries now that all classes have been defined + # + getbaseclasses(July) + getbaseclasses(May) + getbaseclasses(string) + getbaseclasses(cubic_metres) + getbaseclasses(styled_text) + getbaseclasses(number_2c__date_or_text) + getbaseclasses(feet) + getbaseclasses(February) + getbaseclasses(number) + getbaseclasses(miles) + getbaseclasses(keystroke) + getbaseclasses(writing_code) + getbaseclasses(degrees_Fahrenheit) + getbaseclasses(list_2c__record_or_text) + getbaseclasses(date) + getbaseclasses(litres) + getbaseclasses(number_or_date) + getbaseclasses(centimetres) + getbaseclasses(event) + getbaseclasses(Pascal_string) + getbaseclasses(zone) + getbaseclasses(picture) + getbaseclasses(list_or_string) + getbaseclasses(integer) + getbaseclasses(alias_or_string) + getbaseclasses(writing_code_info) + getbaseclasses(text_item) + getbaseclasses(machine) + getbaseclasses(type_class) + getbaseclasses(preposition) + getbaseclasses(Tuesday) + getbaseclasses(upper_case) + getbaseclasses(version) + getbaseclasses(Wednesday) + getbaseclasses(December) + getbaseclasses(square_kilometres) + getbaseclasses(reference) + getbaseclasses(vector) + getbaseclasses(weekday) + getbaseclasses(RGB_color) + getbaseclasses(Sunday) + getbaseclasses(international_text) + getbaseclasses(seconds) + getbaseclasses(March) + getbaseclasses(kilometres) + getbaseclasses(square_feet) + getbaseclasses(list) + getbaseclasses(real) + getbaseclasses(November) + getbaseclasses(quarts) + getbaseclasses(degrees_Celsius) + getbaseclasses(missing_value) + getbaseclasses(alias) + getbaseclasses(January) + getbaseclasses(metres) + getbaseclasses(month) + getbaseclasses(number_or_string) + getbaseclasses(June) + getbaseclasses(August) + getbaseclasses(linked_list) + getbaseclasses(styled_Clipboard_text) + getbaseclasses(encoded_string) + getbaseclasses(gallons) + getbaseclasses(cubic_inches) + getbaseclasses(Friday) + getbaseclasses(styled_Unicode_text) + getbaseclasses(list_or_record) + getbaseclasses(degrees_Kelvin) + getbaseclasses(Monday) + getbaseclasses(sound) + getbaseclasses(class_) + getbaseclasses(kilograms) + getbaseclasses(script) + getbaseclasses(anything) + getbaseclasses(property) + getbaseclasses(record) + getbaseclasses(boolean) + getbaseclasses(October) + getbaseclasses(square_metres) + getbaseclasses(inches) + getbaseclasses(reference_form) + getbaseclasses(item) + getbaseclasses(grams) + getbaseclasses(character) + getbaseclasses(April) + getbaseclasses(empty_ae_name_) + getbaseclasses(app) + getbaseclasses(constant) + getbaseclasses(handler) + getbaseclasses(square_miles) + getbaseclasses(data) + getbaseclasses(C_string) + getbaseclasses(Unicode_text) + getbaseclasses(Thursday) + getbaseclasses(square_yards) + getbaseclasses(yards) + getbaseclasses(cubic_yards) + getbaseclasses(ounces) + getbaseclasses(pounds) + getbaseclasses(cubic_feet) + getbaseclasses(cubic_centimetres) + getbaseclasses(Saturday) + getbaseclasses(September) + getbaseclasses(file_specification) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(selection_2d_object) + getbaseclasses(alias) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(paragraph) + getbaseclasses(character) + getbaseclasses(text_flow) + getbaseclasses(text_style_info) + getbaseclasses(line) + getbaseclasses(word) + getbaseclasses(text) + getbaseclasses(graphic_group) + getbaseclasses(oval) + getbaseclasses(graphic_text) + getbaseclasses(graphic_shape) + getbaseclasses(graphic_line) + getbaseclasses(graphic_object) + getbaseclasses(drawing_area) + getbaseclasses(polygon) + getbaseclasses(pixel) + getbaseclasses(rounded_rectangle) + getbaseclasses(arc) + getbaseclasses(pixel_map) + getbaseclasses(rectangle) + getbaseclasses(graphic_group) + getbaseclasses(drawing_area) + getbaseclasses(cell) + getbaseclasses(column) + getbaseclasses(table) + getbaseclasses(row) + getbaseclasses(AppleTalk_address) + getbaseclasses(address_specification) + getbaseclasses(Token_Ring_address) + getbaseclasses(FireWire_address) + getbaseclasses(bus_slot) + getbaseclasses(SCSI_address) + getbaseclasses(ADB_address) + getbaseclasses(USB_address) + getbaseclasses(device_specification) + getbaseclasses(LocalTalk_address) + getbaseclasses(IP_address) + getbaseclasses(Ethernet_address) + getbaseclasses(small_integer) + getbaseclasses(RGB16_color) + getbaseclasses(version) + getbaseclasses(system_dictionary) + getbaseclasses(color_table) + getbaseclasses(fixed_point) + getbaseclasses(plain_text) + getbaseclasses(type_element_info) + getbaseclasses(location_reference) + getbaseclasses(machine_location) + getbaseclasses(PostScript_picture) + getbaseclasses(point) + getbaseclasses(menu_item) + getbaseclasses(pixel_map_record) + getbaseclasses(application_dictionary) + getbaseclasses(unsigned_integer) + getbaseclasses(menu) + getbaseclasses(fixed_rectangle) + getbaseclasses(long_fixed_rectangle) + getbaseclasses(type_event_info) + getbaseclasses(small_real) + getbaseclasses(type_suite_info) + getbaseclasses(rotation) + getbaseclasses(type_parameter_info) + getbaseclasses(fixed) + getbaseclasses(scrap_styles) + getbaseclasses(long_point) + getbaseclasses(type_class_info) + getbaseclasses(TIFF_picture) + getbaseclasses(RGB96_color) + getbaseclasses(dash_style) + getbaseclasses(extended_real) + getbaseclasses(type_property_info) + getbaseclasses(long_fixed_point) + getbaseclasses(long_rectangle) + getbaseclasses(bounding_rectangle) + getbaseclasses(double_integer) + getbaseclasses(long_fixed) + getbaseclasses(null) + getbaseclasses(target_id) + + # + # Indices of types declared in this module + # + _classdeclarations = { + 'jul ' : July, + 'may ' : May, + 'TEXT' : string, + 'cmet' : cubic_metres, + 'STXT' : styled_text, + 'nds ' : number_2c__date_or_text, + 'feet' : feet, + 'feb ' : February, + 'nmbr' : number, + 'mile' : miles, + 'kprs' : keystroke, + 'psct' : writing_code, + 'degf' : degrees_Fahrenheit, + 'lrs ' : list_2c__record_or_text, + 'ldt ' : date, + 'litr' : litres, + 'nd ' : number_or_date, + 'cmtr' : centimetres, + 'evnt' : event, + 'pstr' : Pascal_string, + 'zone' : zone, + 'PICT' : picture, + 'ls ' : list_or_string, + 'long' : integer, + 'sf ' : alias_or_string, + 'citl' : writing_code_info, + 'citm' : text_item, + 'mach' : machine, + 'type' : type_class, + 'prep' : preposition, + 'tue ' : Tuesday, + 'case' : upper_case, + 'vers' : version, + 'wed ' : Wednesday, + 'dec ' : December, + 'sqkm' : square_kilometres, + 'obj ' : reference, + 'vect' : vector, + 'wkdy' : weekday, + 'cRGB' : RGB_color, + 'sun ' : Sunday, + 'itxt' : international_text, + 'scnd' : seconds, + 'mar ' : March, + 'kmtr' : kilometres, + 'sqft' : square_feet, + 'list' : list, + 'doub' : real, + 'nov ' : November, + 'qrts' : quarts, + 'degc' : degrees_Celsius, + 'msng' : missing_value, + 'alis' : alias, + 'jan ' : January, + 'metr' : metres, + 'mnth' : month, + 'ns ' : number_or_string, + 'jun ' : June, + 'aug ' : August, + 'llst' : linked_list, + 'styl' : styled_Clipboard_text, + 'encs' : encoded_string, + 'galn' : gallons, + 'cuin' : cubic_inches, + 'fri ' : Friday, + 'sutx' : styled_Unicode_text, + 'lr ' : list_or_record, + 'degk' : degrees_Kelvin, + 'mon ' : Monday, + 'snd ' : sound, + 'pcls' : class_, + 'kgrm' : kilograms, + 'scpt' : script, + '****' : anything, + 'prop' : property, + 'reco' : record, + 'bool' : boolean, + 'oct ' : October, + 'sqrm' : square_metres, + 'inch' : inches, + 'kfrm' : reference_form, + 'cobj' : item, + 'gram' : grams, + 'cha ' : character, + 'apr ' : April, + 'undf' : empty_ae_name_, + 'capp' : app, + 'enum' : constant, + 'hand' : handler, + 'sqmi' : square_miles, + 'rdat' : data, + 'cstr' : C_string, + 'utxt' : Unicode_text, + 'thu ' : Thursday, + 'sqyd' : square_yards, + 'yard' : yards, + 'cyrd' : cubic_yards, + 'ozs ' : ounces, + 'lbs ' : pounds, + 'cfet' : cubic_feet, + 'ccmt' : cubic_centimetres, + 'sat ' : Saturday, + 'sep ' : September, + 'fss ' : file_specification, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'csel' : selection_2d_object, + 'alis' : alias, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + 'cpar' : paragraph, + 'cha ' : character, + 'cflo' : text_flow, + 'tsty' : text_style_info, + 'clin' : line, + 'cwor' : word, + 'ctxt' : text, + 'cpic' : graphic_group, + 'covl' : oval, + 'cgtx' : graphic_text, + 'cgsh' : graphic_shape, + 'glin' : graphic_line, + 'cgob' : graphic_object, + 'cdrw' : drawing_area, + 'cpgn' : polygon, + 'cpxl' : pixel, + 'crrc' : rounded_rectangle, + 'carc' : arc, + 'cpix' : pixel_map, + 'crec' : rectangle, + 'cpic' : graphic_group, + 'cdrw' : drawing_area, + 'ccel' : cell, + 'ccol' : column, + 'ctbl' : table, + 'crow' : row, + 'cat ' : AppleTalk_address, + 'cadr' : address_specification, + 'ctok' : Token_Ring_address, + 'cfw ' : FireWire_address, + 'cbus' : bus_slot, + 'cscs' : SCSI_address, + 'cadb' : ADB_address, + 'cusb' : USB_address, + 'cdev' : device_specification, + 'clt ' : LocalTalk_address, + 'cip ' : IP_address, + 'cen ' : Ethernet_address, + 'shor' : small_integer, + 'tr16' : RGB16_color, + 'vers' : version, + 'aeut' : system_dictionary, + 'clrt' : color_table, + 'fpnt' : fixed_point, + 'TEXT' : plain_text, + 'elin' : type_element_info, + 'insl' : location_reference, + 'mLoc' : machine_location, + 'EPS ' : PostScript_picture, + 'QDpt' : point, + 'cmen' : menu_item, + 'tpmm' : pixel_map_record, + 'aete' : application_dictionary, + 'magn' : unsigned_integer, + 'cmnu' : menu, + 'frct' : fixed_rectangle, + 'lfrc' : long_fixed_rectangle, + 'evin' : type_event_info, + 'sing' : small_real, + 'suin' : type_suite_info, + 'trot' : rotation, + 'pmin' : type_parameter_info, + 'fixd' : fixed, + 'styl' : scrap_styles, + 'lpnt' : long_point, + 'gcli' : type_class_info, + 'TIFF' : TIFF_picture, + 'tr96' : RGB96_color, + 'tdas' : dash_style, + 'exte' : extended_real, + 'pinf' : type_property_info, + 'lfpt' : long_fixed_point, + 'lrct' : long_rectangle, + 'qdrt' : bounding_rectangle, + 'comp' : double_integer, + 'lfxd' : long_fixed, + 'null' : null, + 'targ' : target_id, + } *************** *** 64,66 **** --- 465,469 ---- aetools.TalkTo): _signature = 'ascr' + + _moduleName = 'StdSuites' From jackjansen@users.sourceforge.net Wed Aug 7 16:53:44 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:53:44 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/Finder Containers_and_folders.py,1.4,1.5 Earlier_terms.py,1.4,1.5 Enumerations.py,1.3,1.4 Files_and_suitcases.py,1.4,1.5 Finder_Basics.py,1.3,1.4 Finder_items.py,1.3,1.4 Obsolete_terms.py,1.4,1.5 Process_classes.py,1.3,1.4 Standard_Suite.py,1.4,1.5 Type_Definitions.py,1.4,1.5 Window_classes.py,1.4,1.5 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv3925/Finder Modified Files: Containers_and_folders.py Earlier_terms.py Enumerations.py Files_and_suitcases.py Finder_Basics.py Finder_items.py Obsolete_terms.py Process_classes.py Standard_Suite.py Type_Definitions.py Window_classes.py __init__.py Log Message: Regenerated with OSA class inheritance and fix for non-ascii chars. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Containers_and_folders.py 23 Apr 2002 21:06:14 -0000 1.4 --- Containers_and_folders.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 217,221 **** class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the –desktop” object """ want = 'cdsk' class startup_disk(aetools.NProperty): --- 217,221 ---- class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the \xd2desktop\xd3 object """ want = 'cdsk' class startup_disk(aetools.NProperty): *************** *** 247,251 **** class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the –trash” object """ want = 'ctrs' class warns_before_emptying(aetools.NProperty): --- 247,251 ---- class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ want = 'ctrs' class warns_before_emptying(aetools.NProperty): *************** *** 271,276 **** # element 'dsut' as ['indx', 'name'] import Earlier_terms import Files_and_suitcases ! container._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'selection' : selection, --- 271,277 ---- # element 'dsut' as ['indx', 'name'] import Earlier_terms + container._superclassnames = ['item'] import Files_and_suitcases ! container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'selection' : selection, *************** *** 283,287 **** 'view_options_window' : view_options_window, } ! container._elemdict = { 'item' : Earlier_terms.item, 'container' : container, --- 284,288 ---- 'view_options_window' : view_options_window, } ! container._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, *************** *** 302,306 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! sharable_container._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'owner' : owner, --- 303,308 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! sharable_container._superclassnames = ['container'] ! sharable_container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'owner' : owner, *************** *** 315,319 **** 'protected' : protected, } ! sharable_container._elemdict = { 'item' : Earlier_terms.item, 'container' : container, --- 317,321 ---- 'protected' : protected, } ! sharable_container._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, *************** *** 334,345 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! sharing_privileges._propdict = { 'see_folders' : see_folders, 'see_files' : see_files, 'make_changes' : make_changes, } ! sharing_privileges._elemdict = { } ! disk._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'capacity' : capacity, --- 336,349 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! sharing_privileges._superclassnames = [] ! sharing_privileges._privpropdict = { 'see_folders' : see_folders, 'see_files' : see_files, 'make_changes' : make_changes, } ! sharing_privileges._privelemdict = { } ! disk._superclassnames = ['sharable_container'] ! disk._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'capacity' : capacity, *************** *** 349,353 **** 'startup' : startup, } ! disk._elemdict = { 'item' : Earlier_terms.item, 'container' : container, --- 353,357 ---- 'startup' : startup, } ! disk._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, *************** *** 368,375 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! folder._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! folder._elemdict = { 'item' : Earlier_terms.item, 'container' : container, --- 372,380 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! folder._superclassnames = ['sharable_container'] ! folder._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! folder._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, *************** *** 390,399 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! desktop_2d_object._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'startup_disk' : startup_disk, 'trash' : trash, } ! desktop_2d_object._elemdict = { 'item' : Earlier_terms.item, 'container' : container, --- 395,405 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! desktop_2d_object._superclassnames = ['container'] ! desktop_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'startup_disk' : startup_disk, 'trash' : trash, } ! desktop_2d_object._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, *************** *** 415,423 **** 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! trash_2d_object._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'warns_before_emptying' : warns_before_emptying, } ! trash_2d_object._elemdict = { 'item' : Earlier_terms.item, 'container' : container, --- 421,430 ---- 'accessory_suitcase' : Earlier_terms.accessory_suitcase, } ! trash_2d_object._superclassnames = ['container'] ! trash_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'warns_before_emptying' : warns_before_emptying, } ! trash_2d_object._privelemdict = { 'item' : Earlier_terms.item, 'container' : container, Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Earlier_terms.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Earlier_terms.py 23 Apr 2002 21:07:12 -0000 1.4 --- Earlier_terms.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 25,29 **** want = 'reco' class clipboard(aetools.NProperty): ! """clipboard - the FinderŐs clipboard window """ which = 'pcli' want = 'obj ' --- 25,29 ---- want = 'reco' class clipboard(aetools.NProperty): ! """clipboard - the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' *************** *** 33,41 **** want = 'long' class name(aetools.NProperty): ! """name - the FinderŐs name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the FinderŐs layer visible? """ which = 'pvis' want = 'bool' --- 33,41 ---- want = 'long' class name(aetools.NProperty): ! """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' want = 'bool' *************** *** 49,53 **** want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if –New Folder” was selected """ which = 'pins' want = 'obj ' --- 49,53 ---- want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' *************** *** 69,73 **** want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the –About this Computer” dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' --- 69,73 ---- want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' *************** *** 196,200 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Info”) """ want = 'iwnd' class comment(aetools.NProperty): --- 196,200 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by \xd2Get Info\xd3) """ want = 'iwnd' class comment(aetools.NProperty): *************** *** 360,364 **** class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the –trash” object """ want = 'ctrs' --- 360,364 ---- class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the \xd2trash\xd3 object """ want = 'ctrs' *************** *** 430,434 **** which = 'wshd' want = 'bool' ! application._propdict = { 'properties' : properties, 'clipboard' : clipboard, --- 430,435 ---- which = 'wshd' want = 'bool' ! application._superclassnames = [] ! application._privpropdict = { 'properties' : properties, 'clipboard' : clipboard, *************** *** 447,453 **** 'Finder_preferences' : Finder_preferences, } ! application._elemdict = { } ! application_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'minimum_partition_size' : minimum_partition_size, --- 448,456 ---- 'Finder_preferences' : Finder_preferences, } ! application._privelemdict = { } ! import Files_and_suitcases ! application_file._superclassnames = ['file'] ! application_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'minimum_partition_size' : minimum_partition_size, *************** *** 456,462 **** 'scriptable' : scriptable, } ! application_file._elemdict = { } ! container_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'container' : container, --- 459,466 ---- 'scriptable' : scriptable, } ! application_file._privelemdict = { } ! container_window._superclassnames = ['window'] ! container_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'container' : container, *************** *** 478,496 **** 'use_relative_dates' : use_relative_dates, } ! container_window._elemdict = { } ! accessory_process._propdict = { } ! accessory_process._elemdict = { } ! accessory_suitcase._propdict = { } ! accessory_suitcase._elemdict = { } ! internet_location._propdict = { } ! internet_location._elemdict = { } ! information_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'item' : item, --- 482,504 ---- 'use_relative_dates' : use_relative_dates, } ! container_window._privelemdict = { } ! accessory_process._superclassnames = [] ! accessory_process._privpropdict = { } ! accessory_process._privelemdict = { } ! accessory_suitcase._superclassnames = [] ! accessory_suitcase._privpropdict = { } ! accessory_suitcase._privelemdict = { } ! internet_location._superclassnames = [] ! internet_location._privpropdict = { } ! internet_location._privelemdict = { } ! information_window._superclassnames = ['window'] ! information_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'item' : item, *************** *** 510,516 **** 'version' : version, } ! information_window._elemdict = { } ! item._propdict = { 'properties' : properties, 'name' : name, --- 518,525 ---- 'version' : version, } ! information_window._privelemdict = { } ! item._superclassnames = [] ! item._privpropdict = { 'properties' : properties, 'name' : name, *************** *** 536,542 **** 'information_window' : information_window, } ! item._elemdict = { } ! process._propdict = { 'properties' : properties, 'name' : name, --- 545,552 ---- 'information_window' : information_window, } ! item._privelemdict = { } ! process._superclassnames = [] ! process._privpropdict = { 'properties' : properties, 'name' : name, *************** *** 551,557 **** 'partition_space_used' : partition_space_used, } ! process._elemdict = { } ! sharable_container._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'owner' : owner, --- 561,569 ---- 'partition_space_used' : partition_space_used, } ! process._privelemdict = { } ! import Containers_and_folders ! sharable_container._superclassnames = ['container'] ! sharable_container._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'owner' : owner, *************** *** 566,578 **** 'protected' : protected, } ! sharable_container._elemdict = { } ! trash_2d_object._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'warn_before_emptying' : warn_before_emptying, } ! trash_2d_object._elemdict = { } ! preferences._propdict = { 'window' : window, 'calculate_folder_sizes' : calculate_folder_sizes, --- 578,592 ---- 'protected' : protected, } ! sharable_container._privelemdict = { } ! trash_2d_object._superclassnames = ['container'] ! trash_2d_object._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'warn_before_emptying' : warn_before_emptying, } ! trash_2d_object._privelemdict = { } ! preferences._superclassnames = [] ! preferences._privpropdict = { 'window' : window, 'calculate_folder_sizes' : calculate_folder_sizes, *************** *** 590,596 **** 'use_wide_grid' : use_wide_grid, } ! preferences._elemdict = { } ! window._propdict = { 'properties' : properties, 'position' : position, --- 604,611 ---- 'use_wide_grid' : use_wide_grid, } ! preferences._privelemdict = { } ! window._superclassnames = [] ! window._privpropdict = { 'properties' : properties, 'position' : position, *************** *** 611,615 **** 'collapsed' : collapsed, } ! window._elemdict = { } --- 626,630 ---- 'collapsed' : collapsed, } ! window._privelemdict = { } Index: Enumerations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Enumerations.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Enumerations.py 23 Apr 2002 21:06:19 -0000 1.3 --- Enumerations.py 7 Aug 2002 15:53:41 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Files_and_suitcases.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Files_and_suitcases.py 23 Apr 2002 21:06:25 -0000 1.4 --- Files_and_suitcases.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 40,48 **** want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the –Get Info” window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the –Get Info” window) """ which = 'vers' want = 'itxt' --- 40,48 ---- want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' want = 'itxt' *************** *** 51,55 **** class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with –Make Alias”) """ want = 'alia' class original_item(aetools.NProperty): --- 51,55 ---- class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with \xd2Make Alias\xd3) """ want = 'alia' class original_item(aetools.NProperty): *************** *** 156,160 **** desk_accessory_suitcases = desk_accessory_suitcase ! file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'file_type' : file_type, --- 156,162 ---- desk_accessory_suitcases = desk_accessory_suitcase ! import Earlier_terms ! file._superclassnames = ['item'] ! file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'file_type' : file_type, *************** *** 165,177 **** 'version' : version, } ! file._elemdict = { } ! alias_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'original_item' : original_item, } ! alias_file._elemdict = { } ! application_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'suggested_size' : suggested_size, --- 167,181 ---- 'version' : version, } ! file._privelemdict = { } ! alias_file._superclassnames = ['file'] ! alias_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'original_item' : original_item, } ! alias_file._privelemdict = { } ! application_file._superclassnames = ['file'] ! application_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'suggested_size' : suggested_size, *************** *** 181,240 **** 'has_scripting_terminology' : has_scripting_terminology, } ! application_file._elemdict = { } ! document_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! document_file._elemdict = { } ! font_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! font_file._elemdict = { } ! desk_accessory_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! desk_accessory_file._elemdict = { } ! internet_location_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'location' : location, } ! internet_location_file._elemdict = { } ! sound_file._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'sound' : sound, } ! sound_file._elemdict = { } ! clipping._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping._elemdict = { } ! package._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! package._elemdict = { } ! import Earlier_terms ! suitcase._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! suitcase._elemdict = { 'item' : Earlier_terms.item, } ! font_suitcase._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! font_suitcase._elemdict = { 'item' : Earlier_terms.item, } ! desk_accessory_suitcase._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! desk_accessory_suitcase._elemdict = { 'item' : Earlier_terms.item, } --- 185,253 ---- 'has_scripting_terminology' : has_scripting_terminology, } ! application_file._privelemdict = { } ! document_file._superclassnames = ['file'] ! document_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! document_file._privelemdict = { } ! font_file._superclassnames = ['file'] ! font_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! font_file._privelemdict = { } ! desk_accessory_file._superclassnames = ['file'] ! desk_accessory_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! desk_accessory_file._privelemdict = { } ! internet_location_file._superclassnames = ['file'] ! internet_location_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'location' : location, } ! internet_location_file._privelemdict = { } ! sound_file._superclassnames = ['file'] ! sound_file._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'sound' : sound, } ! sound_file._privelemdict = { } ! clipping._superclassnames = ['file'] ! clipping._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping._privelemdict = { } ! package._superclassnames = ['item'] ! package._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! package._privelemdict = { } ! suitcase._superclassnames = ['file'] ! suitcase._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! suitcase._privelemdict = { 'item' : Earlier_terms.item, } ! font_suitcase._superclassnames = ['suitcase'] ! font_suitcase._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! font_suitcase._privelemdict = { 'item' : Earlier_terms.item, } ! desk_accessory_suitcase._superclassnames = ['suitcase'] ! desk_accessory_suitcase._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! desk_accessory_suitcase._privelemdict = { 'item' : Earlier_terms.item, } Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Finder_Basics.py 23 Apr 2002 21:07:18 -0000 1.3 --- Finder_Basics.py 7 Aug 2002 15:53:41 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 146,150 **** want = 'capp' class clipboard(aetools.NProperty): ! """clipboard - the FinderŐs clipboard window """ which = 'pcli' want = 'obj ' --- 146,150 ---- want = 'capp' class clipboard(aetools.NProperty): ! """clipboard - the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' *************** *** 154,162 **** want = 'long' class name(aetools.NProperty): ! """name - the FinderŐs name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the FinderŐs layer visible? """ which = 'pvis' want = 'bool' --- 154,162 ---- want = 'long' class name(aetools.NProperty): ! """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' want = 'bool' *************** *** 170,174 **** want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if –New Folder” was selected """ which = 'pins' want = 'obj ' --- 170,174 ---- want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' *************** *** 190,194 **** want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the –About this Computer” dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' --- 190,194 ---- want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' *************** *** 241,275 **** want = 'obj ' class apple_menu_items_folder(aetools.NProperty): ! """apple menu items folder - the special folder named –Apple Menu Items,” the contents of which appear in the Apple menu """ which = 'amnu' want = 'obj ' class control_panels_folder(aetools.NProperty): ! """control panels folder - the special folder named –Control Panels” """ which = 'ctrl' want = 'obj ' class extensions_folder(aetools.NProperty): ! """extensions folder - the special folder named –Extensions” """ which = 'extn' want = 'obj ' class fonts_folder(aetools.NProperty): ! """fonts folder - the special folder named –Fonts” """ which = 'font' want = 'obj ' class preferences_folder(aetools.NProperty): ! """preferences folder - the special folder named –Preferences” """ which = 'pref' want = 'obj ' class shutdown_items_folder(aetools.NProperty): ! """shutdown items folder - the special folder named –Shutdown Items” """ which = 'shdf' want = 'obj ' class startup_items_folder(aetools.NProperty): ! """startup items folder - the special folder named –Startup Items” """ which = 'strt' want = 'obj ' class temporary_items_folder(aetools.NProperty): ! """temporary items folder - the special folder named –Temporary Items” (invisible) """ which = 'temp' want = 'obj ' import Earlier_terms import Containers_and_folders --- 241,276 ---- want = 'obj ' class apple_menu_items_folder(aetools.NProperty): ! """apple menu items folder - the special folder named \xd2Apple Menu Items,\xd3 the contents of which appear in the Apple menu """ which = 'amnu' want = 'obj ' class control_panels_folder(aetools.NProperty): ! """control panels folder - the special folder named \xd2Control Panels\xd3 """ which = 'ctrl' want = 'obj ' class extensions_folder(aetools.NProperty): ! """extensions folder - the special folder named \xd2Extensions\xd3 """ which = 'extn' want = 'obj ' class fonts_folder(aetools.NProperty): ! """fonts folder - the special folder named \xd2Fonts\xd3 """ which = 'font' want = 'obj ' class preferences_folder(aetools.NProperty): ! """preferences folder - the special folder named \xd2Preferences\xd3 """ which = 'pref' want = 'obj ' class shutdown_items_folder(aetools.NProperty): ! """shutdown items folder - the special folder named \xd2Shutdown Items\xd3 """ which = 'shdf' want = 'obj ' class startup_items_folder(aetools.NProperty): ! """startup items folder - the special folder named \xd2Startup Items\xd3 """ which = 'strt' want = 'obj ' class temporary_items_folder(aetools.NProperty): ! """temporary items folder - the special folder named \xd2Temporary Items\xd3 (invisible) """ which = 'temp' want = 'obj ' + application._superclassnames = [] import Earlier_terms import Containers_and_folders *************** *** 277,281 **** import Process_classes import Window_classes ! application._propdict = { 'clipboard' : clipboard, 'largest_free_block' : largest_free_block, --- 278,282 ---- import Process_classes import Window_classes ! application._privpropdict = { 'clipboard' : clipboard, 'largest_free_block' : largest_free_block, *************** *** 294,298 **** 'Finder_preferences' : Finder_preferences, } ! application._elemdict = { 'item' : Earlier_terms.item, 'container' : Containers_and_folders.container, --- 295,299 ---- 'Finder_preferences' : Finder_preferences, } ! application._privelemdict = { 'item' : Earlier_terms.item, 'container' : Containers_and_folders.container, *************** *** 323,327 **** 'content_space' : Window_classes.content_space, } ! special_folders._propdict = { 'system_folder' : system_folder, 'apple_menu_items_folder' : apple_menu_items_folder, --- 324,329 ---- 'content_space' : Window_classes.content_space, } ! special_folders._superclassnames = [] ! special_folders._privpropdict = { 'system_folder' : system_folder, 'apple_menu_items_folder' : apple_menu_items_folder, *************** *** 334,338 **** 'temporary_items_folder' : temporary_items_folder, } ! special_folders._elemdict = { } --- 336,340 ---- 'temporary_items_folder' : temporary_items_folder, } ! special_folders._privelemdict = { } Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Finder_items.py 23 Apr 2002 21:06:31 -0000 1.3 --- Finder_items.py 7 Aug 2002 15:53:41 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 80,84 **** def empty(self, _object=None, _attributes={}, **_arguments): """empty: Empty the trash ! Required argument: –empty” and –empty trash” both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ --- 80,84 ---- def empty(self, _object=None, _attributes={}, **_arguments): """empty: Empty the trash ! Required argument: \xd2empty\xd3 and \xd2empty trash\xd3 both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 234,238 **** want = 'itxt' class comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the –Get Info” window """ which = 'comt' want = 'itxt' --- 234,238 ---- want = 'itxt' class comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the \xd2Get Info\xd3 window """ which = 'comt' want = 'itxt' *************** *** 275,279 **** items = item ! item._propdict = { 'name' : name, 'index' : index, --- 275,280 ---- items = item ! item._superclassnames = [] ! item._privpropdict = { 'name' : name, 'index' : index, *************** *** 298,302 **** 'information_window' : information_window, } ! item._elemdict = { } _Enum_bool = None # XXXX enum bool not found!! --- 299,303 ---- 'information_window' : information_window, } ! item._privelemdict = { } _Enum_bool = None # XXXX enum bool not found!! Index: Obsolete_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Obsolete_terms.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Obsolete_terms.py 23 Apr 2002 21:06:40 -0000 1.4 --- Obsolete_terms.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 60,64 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Info”) """ want = 'iwnd' class creation_date_obsolete(aetools.NProperty): --- 60,64 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by \xd2Get Info\xd3) """ want = 'iwnd' class creation_date_obsolete(aetools.NProperty): *************** *** 88,92 **** class sharing_window(aetools.ComponentItem): ! """sharing window - A sharing window (opened by –Sharingƒ”) """ want = 'swnd' class sharable_container(aetools.NProperty): --- 88,92 ---- class sharing_window(aetools.ComponentItem): ! """sharing window - A sharing window (opened by \xd2Sharing\xc9\xd3) """ want = 'swnd' class sharable_container(aetools.NProperty): *************** *** 110,163 **** status_windows = status_window ! application._propdict = { 'view_preferences' : view_preferences, } ! application._elemdict = { } ! container._propdict = { 'container_window' : container_window, } ! container._elemdict = { } ! container_window._propdict = { 'folder_obsolete' : folder_obsolete, } ! container_window._elemdict = { } ! control_panel._propdict = { } ! control_panel._elemdict = { } ! file._propdict = { 'file_type_obsolete' : file_type_obsolete, 'locked_obsolete' : locked_obsolete, } ! file._elemdict = { } ! information_window._propdict = { 'creation_date_obsolete' : creation_date_obsolete, 'locked_obsolete' : locked_obsolete, 'modification_date_obsolete' : modification_date_obsolete, } ! information_window._elemdict = { } ! item._propdict = { 'creation_date_obsolete' : creation_date_obsolete, 'folder_obsolete' : folder_obsolete, 'modification_date_obsolete' : modification_date_obsolete, } ! item._elemdict = { } ! process._propdict = { 'file_type_obsolete' : file_type_obsolete, } ! process._elemdict = { } ! sharable_container._propdict = { 'sharing_window' : sharing_window, } ! sharable_container._elemdict = { } ! sharing_window._propdict = { 'sharable_container' : sharable_container, 'item' : item, --- 110,173 ---- status_windows = status_window ! application._superclassnames = [] ! application._privpropdict = { 'view_preferences' : view_preferences, } ! application._privelemdict = { } ! container._superclassnames = [] ! container._privpropdict = { 'container_window' : container_window, } ! container._privelemdict = { } ! container_window._superclassnames = [] ! container_window._privpropdict = { 'folder_obsolete' : folder_obsolete, } ! container_window._privelemdict = { } ! control_panel._superclassnames = [] ! control_panel._privpropdict = { } ! control_panel._privelemdict = { } ! file._superclassnames = [] ! file._privpropdict = { 'file_type_obsolete' : file_type_obsolete, 'locked_obsolete' : locked_obsolete, } ! file._privelemdict = { } ! information_window._superclassnames = [] ! information_window._privpropdict = { 'creation_date_obsolete' : creation_date_obsolete, 'locked_obsolete' : locked_obsolete, 'modification_date_obsolete' : modification_date_obsolete, } ! information_window._privelemdict = { } ! item._superclassnames = [] ! item._privpropdict = { 'creation_date_obsolete' : creation_date_obsolete, 'folder_obsolete' : folder_obsolete, 'modification_date_obsolete' : modification_date_obsolete, } ! item._privelemdict = { } ! process._superclassnames = [] ! process._privpropdict = { 'file_type_obsolete' : file_type_obsolete, } ! process._privelemdict = { } ! sharable_container._superclassnames = [] ! sharable_container._privpropdict = { 'sharing_window' : sharing_window, } ! sharable_container._privelemdict = { } ! sharing_window._superclassnames = [] ! sharing_window._privpropdict = { 'sharable_container' : sharable_container, 'item' : item, *************** *** 165,173 **** 'folder_obsolete' : folder_obsolete, } ! sharing_window._elemdict = { } ! status_window._propdict = { } ! status_window._elemdict = { } --- 175,184 ---- 'folder_obsolete' : folder_obsolete, } ! sharing_window._privelemdict = { } ! status_window._superclassnames = [] ! status_window._privpropdict = { } ! status_window._privelemdict = { } Index: Process_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Process_classes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Process_classes.py 23 Apr 2002 21:06:49 -0000 1.3 --- Process_classes.py 7 Aug 2002 15:53:41 -0000 1.4 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 89,93 **** desk_accessory_processes = desk_accessory_process ! process._propdict = { 'name' : name, 'visible' : visible, --- 89,94 ---- desk_accessory_processes = desk_accessory_process ! process._superclassnames = [] ! process._privpropdict = { 'name' : name, 'visible' : visible, *************** *** 102,118 **** 'partition_space_used' : partition_space_used, } ! process._elemdict = { } ! application_process._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'application_file' : application_file, } ! application_process._elemdict = { } ! desk_accessory_process._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'desk_accessory_file' : desk_accessory_file, } ! desk_accessory_process._elemdict = { } --- 103,121 ---- 'partition_space_used' : partition_space_used, } ! process._privelemdict = { } ! application_process._superclassnames = ['process'] ! application_process._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'application_file' : application_file, } ! application_process._privelemdict = { } ! desk_accessory_process._superclassnames = ['process'] ! desk_accessory_process._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'desk_accessory_file' : desk_accessory_file, } ! desk_accessory_process._privelemdict = { } Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 7 May 2002 20:16:20 -0000 1.4 --- Standard_Suite.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 41,49 **** return _arguments['----'] ! _argmap__print = { 'with_properties' : 'prdt', } ! def _print(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print --- 41,49 ---- return _arguments['----'] ! _argmap_print_ = { 'with_properties' : 'prdt', } ! def print_(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: list of objects to print *************** *** 54,58 **** _subcode = 'pdoc' ! aetools.keysubst(_arguments, self._argmap__print) _arguments['----'] = _object --- 54,58 ---- _subcode = 'pdoc' ! aetools.keysubst(_arguments, self._argmap_print_) _arguments['----'] = _object Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Type_Definitions.py 23 Apr 2002 21:06:57 -0000 1.4 --- Type_Definitions.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 164,170 **** class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use •as alias listŐ when a list of aliases is needed (instead of a list of file system item references). """ want = 'alst' ! preferences._propdict = { 'window' : window, 'button_view_arrangement' : button_view_arrangement, --- 164,171 ---- class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use \xd4as alias list\xd5 when a list of aliases is needed (instead of a list of file system item references). """ want = 'alst' ! preferences._superclassnames = [] ! preferences._privpropdict = { 'window' : window, 'button_view_arrangement' : button_view_arrangement, *************** *** 189,203 **** 'view_font_size' : view_font_size, } ! preferences._elemdict = { 'label' : label, } ! label._propdict = { 'name' : name, 'index' : index, 'color' : color, } ! label._elemdict = { } ! icon_family._propdict = { 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, 'large_8_bit_mask' : large_8_bit_mask, --- 190,206 ---- 'view_font_size' : view_font_size, } ! preferences._privelemdict = { 'label' : label, } ! label._superclassnames = [] ! label._privpropdict = { 'name' : name, 'index' : index, 'color' : color, } ! label._privelemdict = { } ! icon_family._superclassnames = [] ! icon_family._privpropdict = { 'large_monochrome_icon_and_mask' : large_monochrome_icon_and_mask, 'large_8_bit_mask' : large_8_bit_mask, *************** *** 211,219 **** 'small_4_bit_icon' : small_4_bit_icon, } ! icon_family._elemdict = { } ! alias_list._propdict = { } ! alias_list._elemdict = { } --- 214,223 ---- 'small_4_bit_icon' : small_4_bit_icon, } ! icon_family._privelemdict = { } ! alias_list._superclassnames = [] ! alias_list._privpropdict = { } ! alias_list._privelemdict = { } Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Window_classes.py 23 Apr 2002 21:07:04 -0000 1.4 --- Window_classes.py 7 Aug 2002 15:53:41 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Systeemmap:Finder AETE/AEUT resource version 0/144, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Finder AETE/AEUT resource version 0/144, language 0, script 0 """ *************** *** 165,169 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Info”) """ want = 'iwnd' class current_panel(aetools.NProperty): --- 165,169 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by \xd2Get Info\xd3) """ want = 'iwnd' class current_panel(aetools.NProperty): *************** *** 220,228 **** want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the –Get Info” window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the –Get Info” window) """ which = 'vers' want = 'itxt' --- 220,228 ---- want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the \xd2Get Info\xd3 window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the \xd2Get Info\xd3 window) """ which = 'vers' want = 'itxt' *************** *** 247,255 **** class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (–Window” does not include the desktop window) """ want = 'dwnd' content_spaces = content_space ! window._propdict = { 'position' : position, 'bounds' : bounds, --- 247,256 ---- class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (\xd2Window\xd3 does not include the desktop window) """ want = 'dwnd' content_spaces = content_space ! window._superclassnames = [] ! window._privpropdict = { 'position' : position, 'bounds' : bounds, *************** *** 269,275 **** 'collapsed' : collapsed, } ! window._elemdict = { } ! container_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'container' : container, --- 270,277 ---- 'collapsed' : collapsed, } ! window._privelemdict = { } ! container_window._superclassnames = ['window'] ! container_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'container' : container, *************** *** 291,297 **** 'uses_relative_dates' : uses_relative_dates, } ! container_window._elemdict = { } ! information_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'item' : item, --- 293,300 ---- 'uses_relative_dates' : uses_relative_dates, } ! container_window._privelemdict = { } ! information_window._superclassnames = ['window'] ! information_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'item' : item, *************** *** 312,337 **** 'version' : version, } ! information_window._elemdict = { } ! view_options_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'item' : item, } ! view_options_window._elemdict = { } ! preferences_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'current_panel' : current_panel, } ! preferences_window._elemdict = { } ! clipping_window._propdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping_window._elemdict = { } ! content_space._propdict = { } ! content_space._elemdict = { } --- 315,344 ---- 'version' : version, } ! information_window._privelemdict = { } ! view_options_window._superclassnames = ['window'] ! view_options_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'item' : item, } ! view_options_window._privelemdict = { } ! preferences_window._superclassnames = ['window'] ! preferences_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, 'current_panel' : current_panel, } ! preferences_window._privelemdict = { } ! clipping_window._superclassnames = ['window'] ! clipping_window._privpropdict = { '_3c_Inheritance_3e_' : _3c_Inheritance_3e_, } ! clipping_window._privelemdict = { } ! content_space._superclassnames = [] ! content_space._privpropdict = { } ! content_space._privelemdict = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 23 Apr 2002 21:06:08 -0000 1.3 --- __init__.py 7 Aug 2002 15:53:41 -0000 1.4 *************** *** 1,4 **** """ ! Package generated from Moes:Systeemmap:Finder Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from /Volumes/Sap/System Folder/Finder Resource aete resid 0 """ *************** *** 59,62 **** --- 59,445 ---- from Enumerations import * from Obsolete_terms import * + def getbaseclasses(v): + if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): + v._propdict = {} + v._elemdict = {} + for superclass in v._superclassnames: + v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) + v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) + v._propdict.update(v._privpropdict) + v._elemdict.update(v._privelemdict) + + import StdSuites + + # + # Set property and element dictionaries now that all classes have been defined + # + getbaseclasses(accessory_suitcase) + getbaseclasses(preferences) + getbaseclasses(sharable_container) + getbaseclasses(application) + getbaseclasses(trash_2d_object) + getbaseclasses(accessory_process) + getbaseclasses(window) + getbaseclasses(information_window) + getbaseclasses(process) + getbaseclasses(application_file) + getbaseclasses(internet_location) + getbaseclasses(container_window) + getbaseclasses(item) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.plain_text) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + getbaseclasses(application) + getbaseclasses(special_folders) + getbaseclasses(item) + getbaseclasses(trash_2d_object) + getbaseclasses(desktop_2d_object) + getbaseclasses(sharable_container) + getbaseclasses(sharing_privileges) + getbaseclasses(disk) + getbaseclasses(folder) + getbaseclasses(container) + getbaseclasses(sound_file) + getbaseclasses(font_file) + getbaseclasses(internet_location_file) + getbaseclasses(clipping) + getbaseclasses(alias_file) + getbaseclasses(desk_accessory_file) + getbaseclasses(desk_accessory_suitcase) + getbaseclasses(font_suitcase) + getbaseclasses(file) + getbaseclasses(application_file) + getbaseclasses(suitcase) + getbaseclasses(document_file) + getbaseclasses(package) + getbaseclasses(preferences_window) + getbaseclasses(view_options_window) + getbaseclasses(window) + getbaseclasses(container_window) + getbaseclasses(content_space) + getbaseclasses(information_window) + getbaseclasses(clipping_window) + getbaseclasses(process) + getbaseclasses(desk_accessory_process) + getbaseclasses(application_process) + getbaseclasses(preferences) + getbaseclasses(alias_list) + getbaseclasses(icon_family) + getbaseclasses(label) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.plain_text) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + getbaseclasses(status_window) + getbaseclasses(application) + getbaseclasses(sharing_window) + getbaseclasses(control_panel) + getbaseclasses(process) + getbaseclasses(item) + getbaseclasses(file) + getbaseclasses(sharable_container) + getbaseclasses(container_window) + getbaseclasses(container) + getbaseclasses(information_window) + getbaseclasses(StdSuites.Type_Names_Suite.small_integer) + getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) + getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.color_table) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.plain_text) + getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) + getbaseclasses(StdSuites.Type_Names_Suite.location_reference) + getbaseclasses(StdSuites.Type_Names_Suite.version) + getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) + getbaseclasses(StdSuites.Type_Names_Suite.machine_location) + getbaseclasses(StdSuites.Type_Names_Suite.menu_item) + getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) + getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) + getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) + getbaseclasses(StdSuites.Type_Names_Suite.menu) + getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) + getbaseclasses(StdSuites.Type_Names_Suite.small_real) + getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) + getbaseclasses(StdSuites.Type_Names_Suite.rotation) + getbaseclasses(StdSuites.Type_Names_Suite.fixed) + getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) + getbaseclasses(StdSuites.Type_Names_Suite.long_point) + getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) + getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) + getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) + getbaseclasses(StdSuites.Type_Names_Suite.dash_style) + getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) + getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) + getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) + getbaseclasses(StdSuites.Type_Names_Suite.extended_real) + getbaseclasses(StdSuites.Type_Names_Suite.double_integer) + getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) + getbaseclasses(StdSuites.Type_Names_Suite.null) + getbaseclasses(StdSuites.Type_Names_Suite.target_id) + getbaseclasses(StdSuites.Type_Names_Suite.point) + getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) + + # + # Indices of types declared in this module + # + _classdeclarations = { + 'dsut' : accessory_suitcase, + 'cprf' : preferences, + 'sctr' : sharable_container, + 'capp' : application, + 'ctrs' : trash_2d_object, + 'pcda' : accessory_process, + 'cwin' : window, + 'iwnd' : information_window, + 'prcs' : process, + 'appf' : application_file, + 'inlf' : internet_location, + 'cwnd' : container_window, + 'cobj' : item, + 'shor' : StdSuites.Type_Names_Suite.small_integer, + 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, + 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, + 'clrt' : StdSuites.Type_Names_Suite.color_table, + 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, + 'TEXT' : StdSuites.Type_Names_Suite.plain_text, + 'elin' : StdSuites.Type_Names_Suite.type_element_info, + 'insl' : StdSuites.Type_Names_Suite.location_reference, + 'vers' : StdSuites.Type_Names_Suite.version, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'cmen' : StdSuites.Type_Names_Suite.menu_item, + 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, + 'aete' : StdSuites.Type_Names_Suite.application_dictionary, + 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, + 'cmnu' : StdSuites.Type_Names_Suite.menu, + 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, + 'evin' : StdSuites.Type_Names_Suite.type_event_info, + 'sing' : StdSuites.Type_Names_Suite.small_real, + 'suin' : StdSuites.Type_Names_Suite.type_suite_info, + 'trot' : StdSuites.Type_Names_Suite.rotation, + 'fixd' : StdSuites.Type_Names_Suite.fixed, + 'styl' : StdSuites.Type_Names_Suite.scrap_styles, + 'lpnt' : StdSuites.Type_Names_Suite.long_point, + 'gcli' : StdSuites.Type_Names_Suite.type_class_info, + 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, + 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, + 'tdas' : StdSuites.Type_Names_Suite.dash_style, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, + 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, + 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, + 'exte' : StdSuites.Type_Names_Suite.extended_real, + 'comp' : StdSuites.Type_Names_Suite.double_integer, + 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, + 'null' : StdSuites.Type_Names_Suite.null, + 'targ' : StdSuites.Type_Names_Suite.target_id, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + 'capp' : application, + 'spfl' : special_folders, + 'cobj' : item, + 'ctrs' : trash_2d_object, + 'cdsk' : desktop_2d_object, + 'sctr' : sharable_container, + 'priv' : sharing_privileges, + 'cdis' : disk, + 'cfol' : folder, + 'ctnr' : container, + 'sndf' : sound_file, + 'fntf' : font_file, + 'inlf' : internet_location_file, + 'clpf' : clipping, + 'alia' : alias_file, + 'dafi' : desk_accessory_file, + 'dsut' : desk_accessory_suitcase, + 'fsut' : font_suitcase, + 'file' : file, + 'appf' : application_file, + 'stcs' : suitcase, + 'docf' : document_file, + 'pack' : package, + 'pwnd' : preferences_window, + 'vwnd' : view_options_window, + 'cwin' : window, + 'cwnd' : container_window, + 'dwnd' : content_space, + 'iwnd' : information_window, + 'lwnd' : clipping_window, + 'prcs' : process, + 'pcda' : desk_accessory_process, + 'pcap' : application_process, + 'cprf' : preferences, + 'alst' : alias_list, + 'ifam' : icon_family, + 'clbl' : label, + 'shor' : StdSuites.Type_Names_Suite.small_integer, + 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, + 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, + 'clrt' : StdSuites.Type_Names_Suite.color_table, + 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, + 'TEXT' : StdSuites.Type_Names_Suite.plain_text, + 'elin' : StdSuites.Type_Names_Suite.type_element_info, + 'insl' : StdSuites.Type_Names_Suite.location_reference, + 'vers' : StdSuites.Type_Names_Suite.version, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'cmen' : StdSuites.Type_Names_Suite.menu_item, + 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, + 'aete' : StdSuites.Type_Names_Suite.application_dictionary, + 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, + 'cmnu' : StdSuites.Type_Names_Suite.menu, + 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, + 'evin' : StdSuites.Type_Names_Suite.type_event_info, + 'sing' : StdSuites.Type_Names_Suite.small_real, + 'suin' : StdSuites.Type_Names_Suite.type_suite_info, + 'trot' : StdSuites.Type_Names_Suite.rotation, + 'fixd' : StdSuites.Type_Names_Suite.fixed, + 'styl' : StdSuites.Type_Names_Suite.scrap_styles, + 'lpnt' : StdSuites.Type_Names_Suite.long_point, + 'gcli' : StdSuites.Type_Names_Suite.type_class_info, + 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, + 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, + 'tdas' : StdSuites.Type_Names_Suite.dash_style, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, + 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, + 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, + 'exte' : StdSuites.Type_Names_Suite.extended_real, + 'comp' : StdSuites.Type_Names_Suite.double_integer, + 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, + 'null' : StdSuites.Type_Names_Suite.null, + 'targ' : StdSuites.Type_Names_Suite.target_id, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + 'qwnd' : status_window, + 'capp' : application, + 'swnd' : sharing_window, + 'ccdv' : control_panel, + 'prcs' : process, + 'cobj' : item, + 'file' : file, + 'sctr' : sharable_container, + 'cwnd' : container_window, + 'ctnr' : container, + 'iwnd' : information_window, + 'shor' : StdSuites.Type_Names_Suite.small_integer, + 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, + 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, + 'clrt' : StdSuites.Type_Names_Suite.color_table, + 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, + 'TEXT' : StdSuites.Type_Names_Suite.plain_text, + 'elin' : StdSuites.Type_Names_Suite.type_element_info, + 'insl' : StdSuites.Type_Names_Suite.location_reference, + 'vers' : StdSuites.Type_Names_Suite.version, + 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, + 'mLoc' : StdSuites.Type_Names_Suite.machine_location, + 'cmen' : StdSuites.Type_Names_Suite.menu_item, + 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, + 'aete' : StdSuites.Type_Names_Suite.application_dictionary, + 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, + 'cmnu' : StdSuites.Type_Names_Suite.menu, + 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, + 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, + 'evin' : StdSuites.Type_Names_Suite.type_event_info, + 'sing' : StdSuites.Type_Names_Suite.small_real, + 'suin' : StdSuites.Type_Names_Suite.type_suite_info, + 'trot' : StdSuites.Type_Names_Suite.rotation, + 'fixd' : StdSuites.Type_Names_Suite.fixed, + 'styl' : StdSuites.Type_Names_Suite.scrap_styles, + 'lpnt' : StdSuites.Type_Names_Suite.long_point, + 'gcli' : StdSuites.Type_Names_Suite.type_class_info, + 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, + 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, + 'tdas' : StdSuites.Type_Names_Suite.dash_style, + 'pinf' : StdSuites.Type_Names_Suite.type_property_info, + 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, + 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, + 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, + 'exte' : StdSuites.Type_Names_Suite.extended_real, + 'comp' : StdSuites.Type_Names_Suite.double_integer, + 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, + 'null' : StdSuites.Type_Names_Suite.null, + 'targ' : StdSuites.Type_Names_Suite.target_id, + 'QDpt' : StdSuites.Type_Names_Suite.point, + 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, + } *************** *** 74,76 **** --- 457,461 ---- aetools.TalkTo): _signature = 'MACS' + + _moduleName = 'Finder' From jackjansen@users.sourceforge.net Wed Aug 7 16:54:12 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 Aug 2002 08:54:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.4,1.5 Metrowerks_Shell_Suite.py,1.4,1.5 Required.py,1.4,1.5 Standard_Suite.py,1.5,1.6 __init__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior In directory usw-pr-cvs1:/tmp/cvs-serv3925/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Regenerated with OSA class inheritance and fix for non-ascii chars. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CodeWarrior_suite.py 23 Apr 2002 21:04:44 -0000 1.4 --- CodeWarrior_suite.py 7 Aug 2002 15:53:39 -0000 1.5 *************** *** 2,6 **** Level 0, version 0 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 45,54 **** _argmap_export = { ! '_in' : 'kfil', } def export(self, _no_object=None, _attributes={}, **_arguments): """export: Export the project file as an XML file ! Keyword argument _in: the XML file in which to export the project Keyword argument _attributes: AppleEvent attribute dictionary """ --- 45,54 ---- _argmap_export = { ! 'in_' : 'kfil', } def export(self, _no_object=None, _attributes={}, **_arguments): """export: Export the project file as an XML file ! Keyword argument in_: the XML file in which to export the project Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 380,384 **** want = 'bool' class link_index(aetools.NProperty): ! """link index - the index of the source file in its targetŐs link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' --- 380,384 ---- want = 'bool' class link_index(aetools.NProperty): ! """link index - the index of the source file in its target\xd5s link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' *************** *** 408,412 **** want = 'bool' class init_before(aetools.NProperty): ! """init before - is the •initialize beforeŐ flag set for this shared library? """ which = 'INIT' want = 'bool' --- 408,412 ---- want = 'bool' class init_before(aetools.NProperty): ! """init before - is the \xd4initialize before\xd5 flag set for this shared library? """ which = 'INIT' want = 'bool' *************** *** 449,530 **** ToolServer_worksheets = ToolServer_worksheet ! build_progress_document._propdict = { 'inherits' : inherits, } ! build_progress_document._elemdict = { } ! catalog_document._propdict = { 'inherits' : inherits, } ! catalog_document._elemdict = { } ! class_browser._propdict = { 'inherits' : inherits, } ! class_browser._elemdict = { } ! class_hierarchy._propdict = { 'inherits' : inherits, } ! class_hierarchy._elemdict = { } ! editor_document._propdict = { 'inherits' : inherits, } ! editor_document._elemdict = { } ! file_compare_document._propdict = { 'inherits' : inherits, } ! file_compare_document._elemdict = { } ! message_document._propdict = { 'inherits' : inherits, } ! message_document._elemdict = { } ! project_document._propdict = { 'inherits' : inherits, 'current_target' : current_target, } ! project_document._elemdict = { 'target' : target, } ! project_inspector._propdict = { 'inherits' : inherits, } ! project_inspector._elemdict = { } ! single_class_browser._propdict = { 'inherits' : inherits, } ! single_class_browser._elemdict = { } ! single_class_hierarchy._propdict = { 'inherits' : inherits, } ! single_class_hierarchy._elemdict = { } ! subtarget._propdict = { 'inherits' : inherits, 'target' : target, 'link_against_output' : link_against_output, } ! subtarget._elemdict = { } ! symbol_browser._propdict = { 'inherits' : inherits, } ! symbol_browser._elemdict = { } ! target._propdict = { 'name' : name, 'project_document' : project_document, } ! target._elemdict = { 'target_file' : target_file, 'subtarget' : subtarget, } ! target_file._propdict = { 'id' : id, 'type' : type, --- 449,546 ---- ToolServer_worksheets = ToolServer_worksheet ! import Standard_Suite ! build_progress_document._superclassnames = ['document'] ! build_progress_document._privpropdict = { 'inherits' : inherits, } ! build_progress_document._privelemdict = { } ! catalog_document._superclassnames = ['text_document'] ! catalog_document._privpropdict = { 'inherits' : inherits, } ! catalog_document._privelemdict = { } ! class_browser._superclassnames = ['text_document'] ! class_browser._privpropdict = { 'inherits' : inherits, } ! class_browser._privelemdict = { } ! class_hierarchy._superclassnames = ['document'] ! class_hierarchy._privpropdict = { 'inherits' : inherits, } ! class_hierarchy._privelemdict = { } ! editor_document._superclassnames = ['text_document'] ! editor_document._privpropdict = { 'inherits' : inherits, } ! editor_document._privelemdict = { } ! file_compare_document._superclassnames = ['text_document'] ! file_compare_document._privpropdict = { 'inherits' : inherits, } ! file_compare_document._privelemdict = { } ! message_document._superclassnames = ['text_document'] ! message_document._privpropdict = { 'inherits' : inherits, } ! message_document._privelemdict = { } ! project_document._superclassnames = ['document'] ! project_document._privpropdict = { 'inherits' : inherits, 'current_target' : current_target, } ! project_document._privelemdict = { 'target' : target, } ! project_inspector._superclassnames = ['document'] ! project_inspector._privpropdict = { 'inherits' : inherits, } ! project_inspector._privelemdict = { } ! single_class_browser._superclassnames = ['text_document'] ! single_class_browser._privpropdict = { 'inherits' : inherits, } ! single_class_browser._privelemdict = { } ! single_class_hierarchy._superclassnames = ['document'] ! single_class_hierarchy._privpropdict = { 'inherits' : inherits, } ! single_class_hierarchy._privelemdict = { } ! subtarget._superclassnames = ['target'] ! subtarget._privpropdict = { 'inherits' : inherits, 'target' : target, 'link_against_output' : link_against_output, } ! subtarget._privelemdict = { } ! symbol_browser._superclassnames = ['text_document'] ! symbol_browser._privpropdict = { 'inherits' : inherits, } ! symbol_browser._privelemdict = { } ! target._superclassnames = [] ! target._privpropdict = { 'name' : name, 'project_document' : project_document, } ! target._privelemdict = { 'target_file' : target_file, 'subtarget' : subtarget, } ! target_file._superclassnames = [] ! target_file._privpropdict = { 'id' : id, 'type' : type, *************** *** 544,556 **** 'dependents' : dependents, } ! target_file._elemdict = { } ! import Standard_Suite ! text_document._propdict = { 'inherits' : inherits, 'modified' : modified, 'selection' : selection, } ! text_document._elemdict = { 'character' : Standard_Suite.character, 'insertion_point' : Standard_Suite.insertion_point, --- 560,572 ---- 'dependents' : dependents, } ! target_file._privelemdict = { } ! text_document._superclassnames = ['document'] ! text_document._privpropdict = { 'inherits' : inherits, 'modified' : modified, 'selection' : selection, } ! text_document._privelemdict = { 'character' : Standard_Suite.character, 'insertion_point' : Standard_Suite.insertion_point, *************** *** 558,565 **** 'text' : Standard_Suite.text, } ! ToolServer_worksheet._propdict = { 'inherits' : inherits, } ! ToolServer_worksheet._elemdict = { } _Enum_Inte = { --- 574,582 ---- 'text' : Standard_Suite.text, } ! ToolServer_worksheet._superclassnames = ['text_document'] ! ToolServer_worksheet._privpropdict = { 'inherits' : inherits, } ! ToolServer_worksheet._privelemdict = { } _Enum_Inte = { Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Metrowerks_Shell_Suite.py 23 Apr 2002 21:04:56 -0000 1.4 --- Metrowerks_Shell_Suite.py 7 Aug 2002 15:53:39 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 792,796 **** class Access_Paths(aetools.ComponentItem): ! """Access Paths - Contains the definitions of a projectŐs access (search) paths. """ want = 'PATH' class User_Paths(aetools.NProperty): --- 792,796 ---- class Access_Paths(aetools.ComponentItem): ! """Access Paths - Contains the definitions of a project\xd5s access (search) paths. """ want = 'PATH' class User_Paths(aetools.NProperty): *************** *** 999,1003 **** want = 'bool' class Confirm_Kill(aetools.NProperty): ! """Confirm Kill - Confirm the •killingŐ of the process. """ which = 'Dg04' want = 'bool' --- 999,1003 ---- want = 'bool' class Confirm_Kill(aetools.NProperty): ! """Confirm Kill - Confirm the \xd4killing\xd5 of the process. """ which = 'Dg04' want = 'bool' *************** *** 1011,1015 **** want = 'bool' class Dont_Step_in_Runtime(aetools.NProperty): ! """Dont Step in Runtime - DonŐt step into runtime code when debugging. """ which = 'Dg07' want = 'bool' --- 1011,1015 ---- want = 'bool' class Dont_Step_in_Runtime(aetools.NProperty): ! """Dont Step in Runtime - Don\xd5t step into runtime code when debugging. """ which = 'Dg07' want = 'bool' *************** *** 1047,1051 **** want = 'ctxt' class Cache_symbolics(aetools.NProperty): ! """Cache symbolics - Cache symbolics between runs when executable doesnŐt change, else release symbolics files after killing process. """ which = 'Dt15' want = 'bool' --- 1047,1051 ---- want = 'ctxt' class Cache_symbolics(aetools.NProperty): ! """Cache symbolics - Cache symbolics between runs when executable doesn\xd5t change, else release symbolics files after killing process. """ which = 'Dt15' want = 'bool' *************** *** 1075,1079 **** want = 'long' class Dynamic_Scroll(aetools.NProperty): ! """Dynamic Scroll - Display a windowŐs contents as you move the scroll box. """ which = 'ED02' want = 'bool' --- 1075,1079 ---- want = 'long' class Dynamic_Scroll(aetools.NProperty): ! """Dynamic Scroll - Display a window\xd5s contents as you move the scroll box. """ which = 'ED02' want = 'bool' *************** *** 1179,1187 **** want = 'bool' class Recent_Editor_Count(aetools.NProperty): ! """Recent Editor Count - Maximum number of editor documents to show in the –Open Recent” menu """ which = 'EX16' want = 'shor' class Recent_Project_Count(aetools.NProperty): ! """Recent Project Count - Maximum number of project documents to show in the –Open Recent” menu """ which = 'EX17' want = 'shor' --- 1179,1187 ---- want = 'bool' class Recent_Editor_Count(aetools.NProperty): ! """Recent Editor Count - Maximum number of editor documents to show in the \xd2Open Recent\xd3 menu """ which = 'EX16' want = 'shor' class Recent_Project_Count(aetools.NProperty): ! """Recent Project Count - Maximum number of project documents to show in the \xd2Open Recent\xd3 menu """ which = 'EX17' want = 'shor' *************** *** 1295,1299 **** want = 'PPrm' class root(aetools.NProperty): ! """root - Name of the root of the relative path. Pre-defined values are –Absolute”, –Project”, –CodeWarrior”, and –System”. Anything else is a user-defined root. """ which = 'Root' want = 'TEXT' --- 1295,1299 ---- want = 'PPrm' class root(aetools.NProperty): ! """root - Name of the root of the relative path. Pre-defined values are \xd2Absolute\xd3, \xd2Project\xd3, \xd2CodeWarrior\xd3, and \xd2System\xd3. Anything else is a user-defined root. """ which = 'Root' want = 'TEXT' *************** *** 1331,1339 **** want = 'SrcT' class codesize(aetools.NProperty): ! """codesize - The size of this fileŐs code. """ which = 'CSiz' want = 'long' class datasize(aetools.NProperty): ! """datasize - The size of this fileŐs data. """ which = 'DSiz' want = 'long' --- 1331,1339 ---- want = 'SrcT' class codesize(aetools.NProperty): ! """codesize - The size of this file\xd5s code. """ which = 'CSiz' want = 'long' class datasize(aetools.NProperty): ! """datasize - The size of this file\xd5s data. """ which = 'DSiz' want = 'long' *************** *** 1468,1472 **** class Target_Settings(aetools.ComponentItem): ! """Target Settings - Contains the definitions of a projectŐs target. """ want = 'TARG' class Linker(aetools.NProperty): --- 1468,1472 ---- class Target_Settings(aetools.ComponentItem): ! """Target Settings - Contains the definitions of a project\xd5s target. """ want = 'TARG' class Linker(aetools.NProperty): *************** *** 1487,1495 **** want = 'TEXT' class Output_Directory_Path(aetools.NProperty): ! """Output Directory Path - Path to output directory. Usage of this property is deprecated. Use the –Output Directory Location” property instead. """ which = 'TA11' want = 'TEXT' class Output_Directory_Origin(aetools.NProperty): ! """Output Directory Origin - Origin of path to output directory. Usage of this property is deprecated. Use the –Output Directory Location” property instead. """ which = 'TA12' want = 'PPrm' --- 1487,1495 ---- want = 'TEXT' class Output_Directory_Path(aetools.NProperty): ! """Output Directory Path - Path to output directory. Usage of this property is deprecated. Use the \xd2Output Directory Location\xd3 property instead. """ which = 'TA11' want = 'TEXT' class Output_Directory_Origin(aetools.NProperty): ! """Output Directory Origin - Origin of path to output directory. Usage of this property is deprecated. Use the \xd2Output Directory Location\xd3 property instead. """ which = 'TA12' want = 'PPrm' *************** *** 1555,1559 **** want = 'RlPt' ! class _class(aetools.ComponentItem): """class - A class, struct, or record type in the current project. """ want = 'Clas' --- 1555,1559 ---- want = 'RlPt' ! class class_(aetools.ComponentItem): """class - A class, struct, or record type in the current project. """ want = 'Clas' *************** *** 1586,1590 **** # element 'DtMb' as ['indx', 'name'] ! classes = _class class member_function(aetools.ComponentItem): --- 1586,1590 ---- # element 'DtMb' as ['indx', 'name'] ! classes = class_ class member_function(aetools.ComponentItem): *************** *** 1627,1631 **** """base class - A base class or super class of a class """ want = 'BsCl' ! class _class(aetools.NProperty): """class - The class object corresponding to this base class """ which = 'Clas' --- 1627,1631 ---- """base class - A base class or super class of a class """ want = 'BsCl' ! class class_(aetools.NProperty): """class - The class object corresponding to this base class """ which = 'Clas' *************** *** 1638,1642 **** want = 'Cata' # element 'Clas' as ['indx', 'name'] ! Access_Paths._propdict = { 'User_Paths' : User_Paths, 'System_Paths' : System_Paths, --- 1638,1643 ---- want = 'Cata' # element 'Clas' as ['indx', 'name'] ! Access_Paths._superclassnames = [] ! Access_Paths._privpropdict = { 'User_Paths' : User_Paths, 'System_Paths' : System_Paths, *************** *** 1645,1651 **** 'Require_Framework_Includes' : Require_Framework_Includes, } ! Access_Paths._elemdict = { } ! Browser_Coloring._propdict = { 'Browser_Keywords' : Browser_Keywords, 'Classes_Color' : Classes_Color, --- 1646,1653 ---- 'Require_Framework_Includes' : Require_Framework_Includes, } ! Access_Paths._privelemdict = { } ! Browser_Coloring._superclassnames = [] ! Browser_Coloring._privpropdict = { 'Browser_Keywords' : Browser_Keywords, 'Classes_Color' : Classes_Color, *************** *** 1659,1665 **** 'Template_Commands_in_Menu' : Template_Commands_in_Menu, } ! Browser_Coloring._elemdict = { } ! Build_Extras._propdict = { 'Browser_Active' : Browser_Active, 'Modification_Date_Caching' : Modification_Date_Caching, --- 1661,1668 ---- 'Template_Commands_in_Menu' : Template_Commands_in_Menu, } ! Browser_Coloring._privelemdict = { } ! Build_Extras._superclassnames = [] ! Build_Extras._privpropdict = { 'Browser_Active' : Browser_Active, 'Modification_Date_Caching' : Modification_Date_Caching, *************** *** 1667,1673 **** 'Cache_Subproject_Data' : Cache_Subproject_Data, } ! Build_Extras._elemdict = { } ! Build_Settings._propdict = { 'Completion_Sound' : Completion_Sound, 'Success_Sound' : Success_Sound, --- 1670,1677 ---- 'Cache_Subproject_Data' : Cache_Subproject_Data, } ! Build_Extras._privelemdict = { } ! Build_Settings._superclassnames = [] ! Build_Settings._privpropdict = { 'Completion_Sound' : Completion_Sound, 'Success_Sound' : Success_Sound, *************** *** 1678,1684 **** 'Compiler_Thread_Stack_Size' : Compiler_Thread_Stack_Size, } ! Build_Settings._elemdict = { } ! Custom_Keywords._propdict = { 'Custom_Color_1' : Custom_Color_1, 'Custom_Color_2' : Custom_Color_2, --- 1682,1689 ---- 'Compiler_Thread_Stack_Size' : Compiler_Thread_Stack_Size, } ! Build_Settings._privelemdict = { } ! Custom_Keywords._superclassnames = [] ! Custom_Keywords._privpropdict = { 'Custom_Color_1' : Custom_Color_1, 'Custom_Color_2' : Custom_Color_2, *************** *** 1686,1692 **** 'Custom_Color_4' : Custom_Color_4, } ! Custom_Keywords._elemdict = { } ! Debugger_Display._propdict = { 'Show_Variable_Types' : Show_Variable_Types, 'Show_Locals' : Show_Locals, --- 1691,1698 ---- 'Custom_Color_4' : Custom_Color_4, } ! Custom_Keywords._privelemdict = { } ! Debugger_Display._superclassnames = [] ! Debugger_Display._privpropdict = { 'Show_Variable_Types' : Show_Variable_Types, 'Show_Locals' : Show_Locals, *************** *** 1700,1706 **** 'Show_As_Decimal' : Show_As_Decimal, } ! Debugger_Display._elemdict = { } ! Debugger_Global._propdict = { 'Cache_Edited_Files' : Cache_Edited_Files, 'File_Cache_Duration' : File_Cache_Duration, --- 1706,1713 ---- 'Show_As_Decimal' : Show_As_Decimal, } ! Debugger_Display._privelemdict = { } ! Debugger_Global._superclassnames = [] ! Debugger_Global._privpropdict = { 'Cache_Edited_Files' : Cache_Edited_Files, 'File_Cache_Duration' : File_Cache_Duration, *************** *** 1714,1720 **** 'Auto_Target_Libraries' : Auto_Target_Libraries, } ! Debugger_Global._elemdict = { } ! Debugger_Target._propdict = { 'Log_System_Messages' : Log_System_Messages, 'Relocated_Executable_Path' : Relocated_Executable_Path, --- 1721,1728 ---- 'Auto_Target_Libraries' : Auto_Target_Libraries, } ! Debugger_Global._privelemdict = { } ! Debugger_Target._superclassnames = [] ! Debugger_Target._privpropdict = { 'Log_System_Messages' : Log_System_Messages, 'Relocated_Executable_Path' : Relocated_Executable_Path, *************** *** 1727,1739 **** 'Temp_Breakpoint_Type' : Temp_Breakpoint_Type, } ! Debugger_Target._elemdict = { } ! Debugger_Windowing._propdict = { 'Debugging_Start_Action' : Debugging_Start_Action, 'Do_Nothing_To_Projects' : Do_Nothing_To_Projects, } ! Debugger_Windowing._elemdict = { } ! Editor._propdict = { 'Flash_Delay' : Flash_Delay, 'Dynamic_Scroll' : Dynamic_Scroll, --- 1735,1749 ---- 'Temp_Breakpoint_Type' : Temp_Breakpoint_Type, } ! Debugger_Target._privelemdict = { } ! Debugger_Windowing._superclassnames = [] ! Debugger_Windowing._privpropdict = { 'Debugging_Start_Action' : Debugging_Start_Action, 'Do_Nothing_To_Projects' : Do_Nothing_To_Projects, } ! Debugger_Windowing._privelemdict = { } ! Editor._superclassnames = [] ! Editor._privpropdict = { 'Flash_Delay' : Flash_Delay, 'Dynamic_Scroll' : Dynamic_Scroll, *************** *** 1752,1764 **** 'Context_Popup_Delay' : Context_Popup_Delay, } ! Editor._elemdict = { } ! Environment_Variable._propdict = { 'name' : name, 'value' : value, } ! Environment_Variable._elemdict = { } ! Error_Information._propdict = { 'messageKind' : messageKind, 'message' : message, --- 1762,1776 ---- 'Context_Popup_Delay' : Context_Popup_Delay, } ! Editor._privelemdict = { } ! Environment_Variable._superclassnames = [] ! Environment_Variable._privpropdict = { 'name' : name, 'value' : value, } ! Environment_Variable._privelemdict = { } ! Error_Information._superclassnames = [] ! Error_Information._privpropdict = { 'messageKind' : messageKind, 'message' : message, *************** *** 1766,1772 **** 'lineNumber' : lineNumber, } ! Error_Information._elemdict = { } ! Extras._propdict = { 'Automatic_Toolbar_Help' : Automatic_Toolbar_Help, 'External_Reference' : External_Reference, --- 1778,1785 ---- 'lineNumber' : lineNumber, } ! Error_Information._privelemdict = { } ! Extras._superclassnames = [] ! Extras._privpropdict = { 'Automatic_Toolbar_Help' : Automatic_Toolbar_Help, 'External_Reference' : External_Reference, *************** *** 1779,1785 **** 'Use_ToolServer_Menu' : Use_ToolServer_Menu, } ! Extras._elemdict = { } ! File_Mapping._propdict = { 'File_Type' : File_Type, 'Extension' : Extension, --- 1792,1799 ---- 'Use_ToolServer_Menu' : Use_ToolServer_Menu, } ! Extras._privelemdict = { } ! File_Mapping._superclassnames = [] ! File_Mapping._privpropdict = { 'File_Type' : File_Type, 'Extension' : Extension, *************** *** 1790,1801 **** 'Compiler' : Compiler, } ! File_Mapping._elemdict = { } ! File_Mappings._propdict = { 'Mappings' : Mappings, } ! File_Mappings._elemdict = { } ! Font._propdict = { 'Auto_Indent' : Auto_Indent, 'Tab_Size' : Tab_Size, --- 1804,1817 ---- 'Compiler' : Compiler, } ! File_Mapping._privelemdict = { } ! File_Mappings._superclassnames = [] ! File_Mappings._privpropdict = { 'Mappings' : Mappings, } ! File_Mappings._privelemdict = { } ! Font._superclassnames = [] ! Font._privpropdict = { 'Auto_Indent' : Auto_Indent, 'Tab_Size' : Tab_Size, *************** *** 1805,1822 **** 'Text_Size' : Text_Size, } ! Font._elemdict = { } ! Function_Information._propdict = { 'disk_file' : disk_file, 'lineNumber' : lineNumber, } ! Function_Information._elemdict = { } ! Global_Source_Trees._propdict = { 'Source_Trees' : Source_Trees, } ! Global_Source_Trees._elemdict = { } ! Path_Information._propdict = { 'name' : name, 'format' : format, --- 1821,1841 ---- 'Text_Size' : Text_Size, } ! Font._privelemdict = { } ! Function_Information._superclassnames = [] ! Function_Information._privpropdict = { 'disk_file' : disk_file, 'lineNumber' : lineNumber, } ! Function_Information._privelemdict = { } ! Global_Source_Trees._superclassnames = [] ! Global_Source_Trees._privpropdict = { 'Source_Trees' : Source_Trees, } ! Global_Source_Trees._privelemdict = { } ! Path_Information._superclassnames = [] ! Path_Information._privpropdict = { 'name' : name, 'format' : format, *************** *** 1827,1839 **** 'host_flags' : host_flags, } ! Path_Information._elemdict = { } ! Plugin_Settings._propdict = { 'Plugin_Diagnostics_Level' : Plugin_Diagnostics_Level, 'Disable_Third_Party_COM_Plugins' : Disable_Third_Party_COM_Plugins, } ! Plugin_Settings._elemdict = { } ! ProjectFile._propdict = { 'filetype' : filetype, 'name' : name, --- 1846,1860 ---- 'host_flags' : host_flags, } ! Path_Information._privelemdict = { } ! Plugin_Settings._superclassnames = [] ! Plugin_Settings._privpropdict = { 'Plugin_Diagnostics_Level' : Plugin_Diagnostics_Level, 'Disable_Third_Party_COM_Plugins' : Disable_Third_Party_COM_Plugins, } ! Plugin_Settings._privelemdict = { } ! ProjectFile._superclassnames = [] ! ProjectFile._privpropdict = { 'filetype' : filetype, 'name' : name, *************** *** 1847,1853 **** 'includes' : includes, } ! ProjectFile._elemdict = { } ! Relative_Path._propdict = { 'name' : name, 'format' : format, --- 1868,1875 ---- 'includes' : includes, } ! ProjectFile._privelemdict = { } ! Relative_Path._superclassnames = [] ! Relative_Path._privpropdict = { 'name' : name, 'format' : format, *************** *** 1855,1861 **** 'root' : root, } ! Relative_Path._elemdict = { } ! Runtime_Settings._propdict = { 'Host_Application' : Host_Application, 'Command_Line_Arguments' : Command_Line_Arguments, --- 1877,1884 ---- 'root' : root, } ! Relative_Path._privelemdict = { } ! Runtime_Settings._superclassnames = [] ! Runtime_Settings._privpropdict = { 'Host_Application' : Host_Application, 'Command_Line_Arguments' : Command_Line_Arguments, *************** *** 1863,1869 **** 'Environment_Variables' : Environment_Variables, } ! Runtime_Settings._elemdict = { } ! Segment._propdict = { 'name' : name, 'filecount' : filecount, --- 1886,1893 ---- 'Environment_Variables' : Environment_Variables, } ! Runtime_Settings._privelemdict = { } ! Segment._superclassnames = [] ! Segment._privpropdict = { 'name' : name, 'filecount' : filecount, *************** *** 1874,1892 **** 'seg_2d_system_heap' : seg_2d_system_heap, } ! Segment._elemdict = { } ! Shielded_Folder._propdict = { 'Expression_To_Match' : Expression_To_Match, 'Skip_Project_Operations' : Skip_Project_Operations, 'Skip_Find_And_Compare_Operations' : Skip_Find_And_Compare_Operations, } ! Shielded_Folder._elemdict = { } ! Shielded_Folders._propdict = { 'Shielded_Items' : Shielded_Items, } ! Shielded_Folders._elemdict = { } ! Source_Tree._propdict = { 'name' : name, 'path' : path, --- 1898,1919 ---- 'seg_2d_system_heap' : seg_2d_system_heap, } ! Segment._privelemdict = { } ! Shielded_Folder._superclassnames = [] ! Shielded_Folder._privpropdict = { 'Expression_To_Match' : Expression_To_Match, 'Skip_Project_Operations' : Skip_Project_Operations, 'Skip_Find_And_Compare_Operations' : Skip_Find_And_Compare_Operations, } ! Shielded_Folder._privelemdict = { } ! Shielded_Folders._superclassnames = [] ! Shielded_Folders._privpropdict = { 'Shielded_Items' : Shielded_Items, } ! Shielded_Folders._privelemdict = { } ! Source_Tree._superclassnames = [] ! Source_Tree._privpropdict = { 'name' : name, 'path' : path, *************** *** 1894,1900 **** 'format' : format, } ! Source_Tree._elemdict = { } ! Syntax_Coloring._propdict = { 'Syntax_Coloring' : Syntax_Coloring, 'Comment_Color' : Comment_Color, --- 1921,1928 ---- 'format' : format, } ! Source_Tree._privelemdict = { } ! Syntax_Coloring._superclassnames = [] ! Syntax_Coloring._privpropdict = { 'Syntax_Coloring' : Syntax_Coloring, 'Comment_Color' : Comment_Color, *************** *** 1906,1912 **** 'Custom_Color_4' : Custom_Color_4, } ! Syntax_Coloring._elemdict = { } ! Target_Settings._propdict = { 'Linker' : Linker, 'Pre_Linker' : Pre_Linker, --- 1934,1941 ---- 'Custom_Color_4' : Custom_Color_4, } ! Syntax_Coloring._privelemdict = { } ! Target_Settings._superclassnames = [] ! Target_Settings._privpropdict = { 'Linker' : Linker, 'Pre_Linker' : Pre_Linker, *************** *** 1918,1929 **** 'Use_Relative_Paths' : Use_Relative_Paths, } ! Target_Settings._elemdict = { } ! Target_Source_Trees._propdict = { 'Source_Trees' : Source_Trees, } ! Target_Source_Trees._elemdict = { } ! VCS_Setup._propdict = { 'VCS_Active' : VCS_Active, 'Use_Global_Settings' : Use_Global_Settings, --- 1947,1960 ---- 'Use_Relative_Paths' : Use_Relative_Paths, } ! Target_Settings._privelemdict = { } ! Target_Source_Trees._superclassnames = [] ! Target_Source_Trees._privpropdict = { 'Source_Trees' : Source_Trees, } ! Target_Source_Trees._privelemdict = { } ! VCS_Setup._superclassnames = [] ! VCS_Setup._privpropdict = { 'VCS_Active' : VCS_Active, 'Use_Global_Settings' : Use_Global_Settings, *************** *** 1938,1944 **** 'Local_Path' : Local_Path, } ! VCS_Setup._elemdict = { } ! _class._propdict = { 'name' : name, 'language' : language, --- 1969,1976 ---- 'Local_Path' : Local_Path, } ! VCS_Setup._privelemdict = { } ! class_._superclassnames = [] ! class_._privpropdict = { 'name' : name, 'language' : language, *************** *** 1949,1958 **** 'all_subclasses' : all_subclasses, } ! _class._elemdict = { 'base_class' : base_class, 'member_function' : member_function, 'data_member' : data_member, } ! member_function._propdict = { 'name' : name, 'access' : access, --- 1981,1991 ---- 'all_subclasses' : all_subclasses, } ! class_._privelemdict = { 'base_class' : base_class, 'member_function' : member_function, 'data_member' : data_member, } ! member_function._superclassnames = [] ! member_function._privpropdict = { 'name' : name, 'access' : access, *************** *** 1966,1972 **** 'implementation_end_offset' : implementation_end_offset, } ! member_function._elemdict = { } ! data_member._propdict = { 'name' : name, 'access' : access, --- 1999,2006 ---- 'implementation_end_offset' : implementation_end_offset, } ! member_function._privelemdict = { } ! data_member._superclassnames = [] ! data_member._privpropdict = { 'name' : name, 'access' : access, *************** *** 1975,1991 **** 'declaration_end_offset' : declaration_end_offset, } ! data_member._elemdict = { } ! base_class._propdict = { ! '_class' : _class, 'access' : access, 'virtual' : virtual, } ! base_class._elemdict = { } ! browser_catalog._propdict = { } ! browser_catalog._elemdict = { ! '_class' : _class, } _Enum_TmpB = { --- 2009,2027 ---- 'declaration_end_offset' : declaration_end_offset, } ! data_member._privelemdict = { } ! base_class._superclassnames = [] ! base_class._privpropdict = { ! 'class_' : class_, 'access' : access, 'virtual' : virtual, } ! base_class._privelemdict = { } ! browser_catalog._superclassnames = [] ! browser_catalog._privpropdict = { } ! browser_catalog._privelemdict = { ! 'class_' : class_, } _Enum_TmpB = { *************** *** 2024,2029 **** _Enum_PPrm = { 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current projectŐs folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarriorŽ folder. 'system_relative' : 'YRel', # A path relative to the system folder 'root_relative' : 'RRel', # --- 2060,2065 ---- _Enum_PPrm = { 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current project\xd5s folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarrior\xaa folder. 'system_relative' : 'YRel', # A path relative to the system folder 'root_relative' : 'RRel', # *************** *** 2031,2035 **** _Enum_DbSA = { ! 'No_Action' : 'DSA1', # DonŐt do anything to non-debug windows 'Hide_Windows' : 'DSA2', # Hide non-debugging windows 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows --- 2067,2071 ---- _Enum_DbSA = { ! 'No_Action' : 'DSA1', # Don\xd5t do anything to non-debug windows 'Hide_Windows' : 'DSA2', # Hide non-debugging windows 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows *************** *** 2084,2090 **** _Enum_STKd = { ! 'Absolute_Path' : 'STK0', # The –path” property is an absolute path to the location of the source tree. ! 'Registry_Key' : 'STK1', # The –path” property is the name of a registry key that contains the path to the root. ! 'Environment_Variable' : 'STK2', # The –path” property is the name of an environment variable that contains the path to the root. } --- 2120,2126 ---- _Enum_STKd = { ! 'Absolute_Path' : 'STK0', # The \xd2path\xd3 property is an absolute path to the location of the source tree. ! 'Registry_Key' : 'STK1', # The \xd2path\xd3 property is the name of a registry key that contains the path to the root. ! 'Environment_Variable' : 'STK2', # The \xd2path\xd3 property is the name of an environment variable that contains the path to the root. } *************** *** 2136,2140 **** 'TSTs' : Target_Source_Trees, 'DbDS' : Debugger_Display, ! 'Clas' : _class, } --- 2172,2176 ---- 'TSTs' : Target_Source_Trees, 'DbDS' : Debugger_Display, ! 'Clas' : class_, } *************** *** 2227,2231 **** 'EX30' : Dump_Browser_Info, 'EX31' : Cache_Subproject_Data, ! 'Clas' : _class, 'DSiz' : datasize, 'ED14' : Context_Popup_Delay, --- 2263,2267 ---- 'EX30' : Dump_Browser_Info, 'EX31' : Cache_Subproject_Data, ! 'Clas' : class_, 'DSiz' : datasize, 'ED14' : Context_Popup_Delay, Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required.py 23 Apr 2002 21:05:03 -0000 1.4 --- Required.py 7 Aug 2002 15:53:40 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 23 Apr 2002 21:05:29 -0000 1.5 --- Standard_Suite.py 7 Aug 2002 15:53:40 -0000 1.6 *************** *** 2,6 **** Level 1, version 1 ! Generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 104,108 **** def make(self, _no_object=None, _attributes={}, **_arguments): """make: make a new element ! Keyword argument new: the class of the new element„keyword 'new' is optional in AppleScript Keyword argument as: the desired types for the data, in order of preference Keyword argument at: the location at which to insert the element --- 104,108 ---- def make(self, _no_object=None, _attributes={}, **_arguments): """make: make a new element ! Keyword argument new: the class of the new element\xd1keyword 'new' is optional in AppleScript Keyword argument as: the desired types for the data, in order of preference Keyword argument at: the location at which to insert the element *************** *** 286,303 **** windows = window ! application._propdict = { 'user_interaction' : user_interaction, } ! application._elemdict = { 'document' : document, 'window' : window, } ! character._propdict = { 'offset' : offset, 'length' : length, } ! character._elemdict = { } ! document._propdict = { 'name' : name, 'kind' : kind, --- 286,306 ---- windows = window ! application._superclassnames = [] ! application._privpropdict = { 'user_interaction' : user_interaction, } ! application._privelemdict = { 'document' : document, 'window' : window, } ! character._superclassnames = [] ! character._privpropdict = { 'offset' : offset, 'length' : length, } ! character._privelemdict = { } ! document._superclassnames = [] ! document._privpropdict = { 'name' : name, 'kind' : kind, *************** *** 307,345 **** 'window' : window, } ! document._elemdict = { } ! file._propdict = { } ! file._elemdict = { } ! insertion_point._propdict = { 'length' : length, 'offset' : offset, } ! insertion_point._elemdict = { } ! line._propdict = { 'index' : index, 'offset' : offset, 'length' : length, } ! line._elemdict = { 'character' : character, } ! selection_2d_object._propdict = { 'contents' : contents, 'length' : length, 'offset' : offset, } ! selection_2d_object._elemdict = { 'character' : character, 'line' : line, 'text' : text, } ! text._propdict = { 'length' : length, 'offset' : offset, } ! text._elemdict = { 'character' : character, 'insertion_point' : insertion_point, --- 310,353 ---- 'window' : window, } ! document._privelemdict = { } ! file._superclassnames = [] ! file._privpropdict = { } ! file._privelemdict = { } ! insertion_point._superclassnames = [] ! insertion_point._privpropdict = { 'length' : length, 'offset' : offset, } ! insertion_point._privelemdict = { } ! line._superclassnames = [] ! line._privpropdict = { 'index' : index, 'offset' : offset, 'length' : length, } ! line._privelemdict = { 'character' : character, } ! selection_2d_object._superclassnames = [] ! selection_2d_object._privpropdict = { 'contents' : contents, 'length' : length, 'offset' : offset, } ! selection_2d_object._privelemdict = { 'character' : character, 'line' : line, 'text' : text, } ! text._superclassnames = [] ! text._privpropdict = { 'length' : length, 'offset' : offset, } ! text._privelemdict = { 'character' : character, 'insertion_point' : insertion_point, *************** *** 347,351 **** 'text' : text, } ! window._propdict = { 'name' : name, 'index' : index, --- 355,360 ---- 'text' : text, } ! window._superclassnames = [] ! window._privpropdict = { 'name' : name, 'index' : index, *************** *** 356,360 **** 'zoomed' : zoomed, } ! window._elemdict = { } --- 365,369 ---- 'zoomed' : zoomed, } ! window._privelemdict = { } Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 22 Jan 2002 23:20:59 -0000 1.3 --- __init__.py 7 Aug 2002 15:53:40 -0000 1.4 *************** *** 1,4 **** """ ! Package generated from Moes:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior:CodeWarrior IDE 4.2.6 Resource aete resid 0 AppleEvent Suites """ --- 1,4 ---- """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 Resource aete resid 0 AppleEvent Suites """ *************** *** 31,34 **** --- 31,179 ---- from CodeWarrior_suite import * from Metrowerks_Shell_Suite import * + def getbaseclasses(v): + if hasattr(v, '_superclassnames') and not hasattr(v, '_propdict'): + v._propdict = {} + v._elemdict = {} + for superclass in v._superclassnames: + v._propdict.update(getattr(eval(superclass), '_privpropdict', {})) + v._elemdict.update(getattr(eval(superclass), '_privelemdict', {})) + v._propdict.update(v._privpropdict) + v._elemdict.update(v._privelemdict) + + import StdSuites + + # + # Set property and element dictionaries now that all classes have been defined + # + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) + getbaseclasses(single_class_browser) + getbaseclasses(project_document) + getbaseclasses(symbol_browser) + getbaseclasses(editor_document) + getbaseclasses(file_compare_document) + getbaseclasses(class_browser) + getbaseclasses(subtarget) + getbaseclasses(message_document) + getbaseclasses(project_inspector) + getbaseclasses(text_document) + getbaseclasses(catalog_document) + getbaseclasses(class_hierarchy) + getbaseclasses(target) + getbaseclasses(build_progress_document) + getbaseclasses(target_file) + getbaseclasses(ToolServer_worksheet) + getbaseclasses(single_class_hierarchy) + getbaseclasses(File_Mapping) + getbaseclasses(browser_catalog) + getbaseclasses(Build_Settings) + getbaseclasses(ProjectFile) + getbaseclasses(Browser_Coloring) + getbaseclasses(Error_Information) + getbaseclasses(VCS_Setup) + getbaseclasses(Editor) + getbaseclasses(Shielded_Folders) + getbaseclasses(Shielded_Folder) + getbaseclasses(Custom_Keywords) + getbaseclasses(Path_Information) + getbaseclasses(File_Mappings) + getbaseclasses(Segment) + getbaseclasses(Debugger_Target) + getbaseclasses(Function_Information) + getbaseclasses(Access_Paths) + getbaseclasses(Extras) + getbaseclasses(Debugger_Windowing) + getbaseclasses(Global_Source_Trees) + getbaseclasses(Syntax_Coloring) + getbaseclasses(base_class) + getbaseclasses(Relative_Path) + getbaseclasses(Target_Settings) + getbaseclasses(Environment_Variable) + getbaseclasses(Source_Tree) + getbaseclasses(Debugger_Global) + getbaseclasses(member_function) + getbaseclasses(Runtime_Settings) + getbaseclasses(Plugin_Settings) + getbaseclasses(data_member) + getbaseclasses(Build_Extras) + getbaseclasses(Font) + getbaseclasses(Target_Source_Trees) + getbaseclasses(Debugger_Display) + getbaseclasses(class_) + + # + # Indices of types declared in this module + # + _classdeclarations = { + 'cha ' : character, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'clin' : line, + 'csel' : selection_2d_object, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, + '1BRW' : single_class_browser, + 'PRJD' : project_document, + 'SYMB' : symbol_browser, + 'EDIT' : editor_document, + 'COMP' : file_compare_document, + 'BROW' : class_browser, + 'SBTG' : subtarget, + 'MSSG' : message_document, + 'INSP' : project_inspector, + 'TXTD' : text_document, + 'CTLG' : catalog_document, + 'HIER' : class_hierarchy, + 'TRGT' : target, + 'PRGS' : build_progress_document, + 'SRCF' : target_file, + 'TOOL' : ToolServer_worksheet, + '1HIR' : single_class_hierarchy, + 'FMap' : File_Mapping, + 'Cata' : browser_catalog, + 'BSTG' : Build_Settings, + 'SrcF' : ProjectFile, + 'BRKW' : Browser_Coloring, + 'ErrM' : Error_Information, + 'VCSs' : VCS_Setup, + 'EDTR' : Editor, + 'SHFL' : Shielded_Folders, + 'SFit' : Shielded_Folder, + 'CUKW' : Custom_Keywords, + 'PInf' : Path_Information, + 'FLMP' : File_Mappings, + 'Seg ' : Segment, + 'DbTG' : Debugger_Target, + 'FDef' : Function_Information, + 'PATH' : Access_Paths, + 'GXTR' : Extras, + 'DbWN' : Debugger_Windowing, + 'GSTs' : Global_Source_Trees, + 'SNTX' : Syntax_Coloring, + 'BsCl' : base_class, + 'RlPt' : Relative_Path, + 'TARG' : Target_Settings, + 'EnvV' : Environment_Variable, + 'SrcT' : Source_Tree, + 'DbGL' : Debugger_Global, + 'MbFn' : member_function, + 'RSTG' : Runtime_Settings, + 'PSTG' : Plugin_Settings, + 'DtMb' : data_member, + 'LXTR' : Build_Extras, + 'mFNT' : Font, + 'TSTs' : Target_Source_Trees, + 'DbDS' : Debugger_Display, + 'Clas' : class_, + } *************** *** 39,41 **** --- 184,188 ---- aetools.TalkTo): _signature = 'CWIE' + + _moduleName = 'CodeWarrior' From gvanrossum@users.sourceforge.net Wed Aug 7 17:03:08 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:03:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11899 Modified Files: test_socket.py Log Message: Oops. I accidentally commented out some tests. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** test_socket.py 7 Aug 2002 15:46:19 -0000 1.50 --- test_socket.py 7 Aug 2002 16:03:06 -0000 1.51 *************** *** 588,595 **** def test_main(): suite = unittest.TestSuite() ! ##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)) suite.addTest(unittest.makeSuite(UnbufferedFileObjectClassTestCase)) --- 588,595 ---- def test_main(): suite = unittest.TestSuite() ! 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)) suite.addTest(unittest.makeSuite(UnbufferedFileObjectClassTestCase)) From rhettinger@users.sourceforge.net Wed Aug 7 17:06:39 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:06:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.6,1.156.4.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv13633 Modified Files: Tag: release22-maint tut.tex Log Message: Describe nested scopes in the tutorial. Closes SF bug 500704. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.6 retrieving revision 1.156.4.1.2.7 diff -C2 -d -r1.156.4.1.2.6 -r1.156.4.1.2.7 *** tut.tex 26 Jun 2002 21:43:42 -0000 1.156.4.1.2.6 --- tut.tex 7 Aug 2002 16:06:35 -0000 1.156.4.1.2.7 *************** *** 3509,3518 **** Although scopes are determined statically, they are used dynamically. ! At any time during execution, exactly three nested scopes are in use ! (exactly three namespaces are directly accessible): the ! innermost scope, which is searched first, contains the local names, ! the middle scope, searched next, contains the current module's global ! names, and the outermost scope (searched last) is the namespace ! containing built-in names. Usually, the local scope references the local names of the (textually) --- 3509,3523 ---- Although scopes are determined statically, they are used dynamically. ! At any time during execution, there are at least three nested scopes whose ! namespaces are directly accessible: the innermost scope, which is searched ! first, contains the local names; the namespaces of any enclosing code ! blocks (a module, function, or class definition) which are searched starting ! with the nearest enclosing scope; the middle scope, searched next, contains ! the current module's global names; and the outermost scope (searched last) ! is the namespace containing built-in names. ! ! If a name is declared global, then all references and assignments go ! directly to the middle scope containing the module's global names. ! Otherwise, all variables found outside of the innermost scope are read-only. Usually, the local scope references the local names of the (textually) From rhettinger@users.sourceforge.net Wed Aug 7 17:09:50 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:09:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.166,1.167 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv14910 Modified Files: tut.tex Log Message: Describe nested scopes in the tutorial. Closes SF bug 500704. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** tut.tex 26 Jun 2002 21:25:15 -0000 1.166 --- tut.tex 7 Aug 2002 16:09:48 -0000 1.167 *************** *** 3552,3561 **** Although scopes are determined statically, they are used dynamically. ! At any time during execution, exactly three nested scopes are in use ! (exactly three namespaces are directly accessible): the ! innermost scope, which is searched first, contains the local names, ! the middle scope, searched next, contains the current module's global ! names, and the outermost scope (searched last) is the namespace ! containing built-in names. Usually, the local scope references the local names of the (textually) --- 3552,3566 ---- Although scopes are determined statically, they are used dynamically. ! At any time during execution, there are at least three nested scopes whose ! namespaces are directly accessible: the innermost scope, which is searched ! first, contains the local names; the namespaces of any enclosing code ! blocks (a module, function, or class definition) which are searched starting ! with the nearest enclosing scope; the middle scope, searched next, contains ! the current module's global names; and the outermost scope (searched last) ! is the namespace containing built-in names. ! ! If a name is declared global, then all references and assignments go ! directly to the middle scope containing the module's global names. ! Otherwise, all variables found outside of the innermost scope are read-only. Usually, the local scope references the local names of the (textually) From rhettinger@users.sourceforge.net Wed Aug 7 17:18:56 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:18:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libweakref.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19689 Modified Files: libweakref.tex Log Message: Described responsibilty of weakly referenced extension types to initialize the weakreflist to NULL in the constructor and to fill the tp_flags slot with Py_TPFLAGS_HAVE_WEAKREFS. Closes SF bug 586583. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libweakref.tex 8 Dec 2001 18:02:49 -0000 1.17 --- libweakref.tex 7 Aug 2002 16:18:54 -0000 1.18 *************** *** 218,222 **** object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. ! For example, the instance type is defined with the following structure: \begin{verbatim} --- 218,224 ---- object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. ! Also, it needs to add \constant{Py_TPFLAGS_HAVE_WEAKREFS} to the ! tp_flags slot. For example, the instance type is defined with the ! following structure: \begin{verbatim} *************** *** 239,244 **** /* Lots of stuff omitted for brevity... */ ! offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */ }; \end{verbatim} --- 241,265 ---- /* Lots of stuff omitted for brevity... */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ }; + \end{verbatim} + + The type constructor is responsible for initializing the weak reference + list to \NULL: + + \begin{verbatim} + static PyObject * + instance_new() { + /* Other initialization stuff omitted for brevity */ + + self->in_weakreflist = NULL; + + return (PyObject *) self; + } \end{verbatim} From rhettinger@users.sourceforge.net Wed Aug 7 17:21:25 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:21:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libweakref.tex,1.17,1.17.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23271 Modified Files: Tag: release22-maint libweakref.tex Log Message: Described responsibilty of weakly referenced extension types to initialize the weakreflist to NULL in the constructor and to fill the tp_flags slot with Py_TPFLAGS_HAVE_WEAKREFS. Closes SF bug 586583. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -C2 -d -r1.17 -r1.17.6.1 *** libweakref.tex 8 Dec 2001 18:02:49 -0000 1.17 --- libweakref.tex 7 Aug 2002 16:21:23 -0000 1.17.6.1 *************** *** 218,222 **** object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. ! For example, the instance type is defined with the following structure: \begin{verbatim} --- 218,224 ---- object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. ! Also, it needs to add \constant{Py_TPFLAGS_HAVE_WEAKREFS} to the ! tp_flags slot. For example, the instance type is defined with the ! following structure: \begin{verbatim} *************** *** 239,244 **** /* Lots of stuff omitted for brevity... */ ! offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */ }; \end{verbatim} --- 241,265 ---- /* Lots of stuff omitted for brevity... */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ }; + \end{verbatim} + + The type constructor is responsible for initializing the weak reference + list to \NULL: + + \begin{verbatim} + static PyObject * + instance_new() { + /* Other initialization stuff omitted for brevity */ + + self->in_weakreflist = NULL; + + return (PyObject *) self; + } \end{verbatim} From loewis@users.sourceforge.net Wed Aug 7 17:21:53 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:21:53 -0700 Subject: [Python-checkins] python/dist/src/Modules regexpr.c,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23966/Modules Modified Files: regexpr.c Log Message: Replace abort with Py_FatalError. Index: regexpr.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/regexpr.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** regexpr.c 15 Jul 2001 18:38:46 -0000 1.35 --- regexpr.c 7 Aug 2002 16:21:51 -0000 1.36 *************** *** 1244,1248 **** case Rquote: { ! abort(); /*NOTREACHED*/ } --- 1244,1248 ---- case Rquote: { ! Py_FatalError("Rquote"); /*NOTREACHED*/ } From loewis@users.sourceforge.net Wed Aug 7 17:21:53 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:21:53 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23966/Objects Modified Files: object.c Log Message: Replace abort with Py_FatalError. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** object.c 29 Jul 2002 13:42:08 -0000 2.187 --- object.c 7 Aug 2002 16:21:51 -0000 2.188 *************** *** 1783,1787 **** * we accidently decref None out of existance. */ ! abort(); } --- 1783,1787 ---- * we accidently decref None out of existance. */ ! Py_FatalError("deallocating None"); } From loewis@informatik.hu-berlin.de Wed Aug 7 17:22:18 2002 From: loewis@informatik.hu-berlin.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 07 Aug 2002 18:22:18 +0200 Subject: [Python-checkins] python/dist/src/Python compile.c,2.250,2.251 In-Reply-To: <200208071547.g77FlYD03755@pcp02138704pcs.reston01.va.comcast.net> References: <3D5125A9.6010301@lemburg.com> <200208071547.g77FlYD03755@pcp02138704pcs.reston01.va.comcast.net> Message-ID: Guido van Rossum writes: > > What is the guideline for when to use abort, and when to use > > Py_FatalError? > > You should always use Py_FatalError(), never abort(). Ok. I have now replaced the two remaining usages (in none_dealloc, and regexpr) also. Regards, Martin From rhettinger@users.sourceforge.net Wed Aug 7 17:53:19 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 09:53:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv10578 Modified Files: ref2.tex Log Message: Apply character{} markup. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ref2.tex 7 Aug 2002 13:24:09 -0000 1.41 --- ref2.tex 7 Aug 2002 16:53:17 -0000 1.42 *************** *** 388,399 **** otherwise have a special meaning, such as newline, backslash itself, or the quote character. String literals may optionally be prefixed ! with a letter `r' or `R'; such strings are called \dfn{raw ! strings}\index{raw string} and use different rules for interpreting ! backslash escape sequences. A prefix of 'u' or 'U' makes the string ! a Unicode string. Unicode strings use the Unicode character set as ! defined by the Unicode Consortium and ISO~10646. Some additional escape sequences, described below, are available in Unicode strings. ! The two prefix characters may be combined; in this case, `u' must ! appear before `r'. In triple-quoted strings, --- 388,399 ---- otherwise have a special meaning, such as newline, backslash itself, or the quote character. String literals may optionally be prefixed ! with a letter \character{r} or \character{R}; such strings are called ! \dfn{raw strings}\index{raw string} and use different rules for interpreting ! backslash escape sequences. A prefix of \character{u} or \character{U} ! makes the string a Unicode string. Unicode strings use the Unicode character ! set as defined by the Unicode Consortium and ISO~10646. Some additional escape sequences, described below, are available in Unicode strings. ! The two prefix characters may be combined; in this case, \character{u} must ! appear before \character{r}. In triple-quoted strings, *************** *** 403,408 **** \code{'} or \code{"}.) ! Unless an `r' or `R' prefix is present, escape sequences in strings ! are interpreted according to rules similar to those used by Standard C. The recognized escape sequences are: \index{physical line} --- 403,408 ---- \code{'} or \code{"}.) ! Unless an \character{r} or \character{R} prefix is present, escape ! sequences in strings are interpreted according to rules similar to those used by Standard C. The recognized escape sequences are: \index{physical line} *************** *** 444,453 **** escapes for non-Unicode string literals. ! When an `r' or `R' prefix is present, a character following a ! backslash is included in the string without change, and \emph{all backslashes are left in the string}. For example, the string literal \code{r"\e n"} consists of two characters: a backslash and a lowercase ! `n'. String quotes can be escaped with a backslash, but the backslash ! remains in the string; for example, \code{r"\e""} is a valid string literal consisting of two characters: a backslash and a double quote; \code{r"\e"} is not a valid string literal (even a raw string cannot --- 444,453 ---- escapes for non-Unicode string literals. ! When an \character{r} or \character{R} prefix is present, a character ! following a backslash is included in the string without change, and \emph{all backslashes are left in the string}. For example, the string literal \code{r"\e n"} consists of two characters: a backslash and a lowercase ! \character{n}. String quotes can be escaped with a backslash, but the ! backslash remains in the string; for example, \code{r"\e""} is a valid string literal consisting of two characters: a backslash and a double quote; \code{r"\e"} is not a valid string literal (even a raw string cannot *************** *** 538,544 **** \end{productionlist} ! Although both lower case `l' and upper case `L' are allowed as suffix ! for long integers, it is strongly recommended to always use `L', since ! the letter `l' looks too much like the digit `1'. Plain integer decimal literals must be at most 2147483647 (i.e., the --- 538,545 ---- \end{productionlist} ! Although both lower case \character{l} and upper case \character{L} are ! allowed as suffix for long integers, it is strongly recommended to always ! use \character{L}, since the letter \character{l} looks too much like the ! digit \character{1}. Plain integer decimal literals must be at most 2147483647 (i.e., the From guido@python.org Wed Aug 7 19:29:49 2002 From: guido@python.org (Guido van Rossum) Date: Wed, 07 Aug 2002 14:29:49 -0400 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.166,1.167 In-Reply-To: Your message of "Wed, 07 Aug 2002 09:09:50 PDT." References: Message-ID: <200208071829.g77ITn504077@pcp02138704pcs.reston01.va.comcast.net> > Although scopes are determined statically, they are used dynamically. > ! At any time during execution, there are at least three nested scopes whose > ! namespaces are directly accessible: the innermost scope, which is searched > ! first, contains the local names; the namespaces of any enclosing code > ! blocks (a module, function, or class definition) which are searched starting > ! with the nearest enclosing scope; the middle scope, searched next, contains > ! the current module's global names; and the outermost scope (searched last) > ! is the namespace containing built-in names. > ! > ! If a name is declared global, then all references and assignments go > ! directly to the middle scope containing the module's global names. > ! Otherwise, all variables found outside of the innermost scope are read-only. Umm, enclosing classes are *not* searched! *Only* enclosing function bodies are part of "nested scopes". --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum@users.sourceforge.net Wed Aug 7 19:56:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 11:56:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6810 Modified Files: libheapq.tex Log Message: Document that heappop() and heapreplace() raise IndexError if the heap is empty. Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libheapq.tex 3 Aug 2002 18:53:28 -0000 1.4 --- libheapq.tex 7 Aug 2002 18:56:08 -0000 1.5 *************** *** 46,50 **** \begin{funcdesc}{heappop}{heap} Pop and return the smallest item from the \var{heap}, maintaining the ! heap invariant. \end{funcdesc} --- 46,50 ---- \begin{funcdesc}{heappop}{heap} Pop and return the smallest item from the \var{heap}, maintaining the ! heap invariant. If the heap is empty, \exception{IndexError} is raised. \end{funcdesc} *************** *** 56,59 **** --- 56,60 ---- Pop and return the smallest item from the \var{heap}, and also push the new \var{item}. The heap size doesn't change. + If the heap is empty, \exception{IndexError} is raised. This is more efficient than \function{heappop()} followed by \function{heappush()}, and can be more appropriate when using From gvanrossum@users.sourceforge.net Wed Aug 7 19:58:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 11:58:13 -0700 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7748 Modified Files: heapq.py Log Message: Simplify heapreplace() -- there's no need for an explicit test for empty heap, since heap[0] raises the appropriate IndexError already. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** heapq.py 3 Aug 2002 19:20:16 -0000 1.12 --- heapq.py 7 Aug 2002 18:58:11 -0000 1.13 *************** *** 151,161 **** this routine. """ ! ! if heap: ! returnitem = heap[0] ! heap[0] = item ! _siftup(heap, 0) ! return returnitem ! heap.pop() # raise IndexError def heapify(x): --- 151,158 ---- this routine. """ ! returnitem = heap[0] # raises appropriate IndexError if heap is empty ! heap[0] = item ! _siftup(heap, 0) ! return returnitem def heapify(x): From gvanrossum@users.sourceforge.net Wed Aug 7 20:02:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 12:02:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10176 Modified Files: test_socket.py Log Message: Tighten the unbuffered readline test to distinguish between the two lines. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** test_socket.py 7 Aug 2002 16:03:06 -0000 1.51 --- test_socket.py 7 Aug 2002 19:02:49 -0000 1.52 *************** *** 575,586 **** """Read a line, create a new file object, read another line with it.""" line = self.serv_file.readline() # first line ! self.assertEqual(line, MSG) # first line self.serv_file = self.cli_conn.makefile('rb', 0) line = self.serv_file.readline() # second line ! self.assertEqual(line, MSG) # second line def _testUnbufferedReadline(self): ! self.cli_file.write(MSG) ! self.cli_file.write(MSG) self.cli_file.flush() --- 575,586 ---- """Read a line, create a new file object, read another line with it.""" line = self.serv_file.readline() # first line ! self.assertEqual(line, "A. " + MSG) # first line self.serv_file = self.cli_conn.makefile('rb', 0) line = self.serv_file.readline() # second line ! self.assertEqual(line, "B. " + MSG) # second line def _testUnbufferedReadline(self): ! self.cli_file.write("A. " + MSG) ! self.cli_file.write("B. " + MSG) self.cli_file.flush() From gvanrossum@users.sourceforge.net Wed Aug 7 20:03:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 12:03:37 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10677 Modified Files: socket.py Log Message: Replace tabs with spaces. (Sorry!) Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** socket.py 7 Aug 2002 15:46:19 -0000 1.25 --- socket.py 7 Aug 2002 19:03:35 -0000 1.26 *************** *** 179,185 **** self._mode = mode if bufsize <= 0: ! if bufsize == 0: ! bufsize = 1 # Unbuffered mode ! else: bufsize = 8192 self._rbufsize = bufsize --- 179,185 ---- self._mode = mode if bufsize <= 0: ! if bufsize == 0: ! bufsize = 1 # Unbuffered mode ! else: bufsize = 8192 self._rbufsize = bufsize From gvanrossum@users.sourceforge.net Wed Aug 7 20:06:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 12:06:29 -0700 Subject: [Python-checkins] python/dist/src/PCbuild rt.bat,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv11778 Modified Files: rt.bat Log Message: Add -E and -tt options to the python invocations, as for the Unix tests. The -tt means modules that mix tabs and spaces will be rejected. The -E refuses to believe Python options in the environment. Index: rt.bat =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/rt.bat,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** rt.bat 19 Feb 2001 21:44:53 -0000 1.7 --- rt.bat 7 Aug 2002 19:06:27 -0000 1.8 *************** *** 32,40 **** @echo Deleting .pyc/.pyo files ... @%_exe% rmpyc.py ! %_exe% %_dashO% ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo About to run again without deleting .pyc/.pyo first: @pause :Qmode ! %_exe% %_dashO% ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 @set _exe= @set _qmode= --- 32,40 ---- @echo Deleting .pyc/.pyo files ... @%_exe% rmpyc.py ! %_exe% %_dashO% -E -tt ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo About to run again without deleting .pyc/.pyo first: @pause :Qmode ! %_exe% %_dashO% -E -tt ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 @set _exe= @set _qmode= From rhettinger@users.sourceforge.net Wed Aug 7 21:20:54 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 13:20:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.167,1.168 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv21077 Modified Files: tut.tex Log Message: GvR pointed out that only enclosing function bodies are part of nested scopes. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** tut.tex 7 Aug 2002 16:09:48 -0000 1.167 --- tut.tex 7 Aug 2002 20:20:52 -0000 1.168 *************** *** 3554,3562 **** At any time during execution, there are at least three nested scopes whose namespaces are directly accessible: the innermost scope, which is searched ! first, contains the local names; the namespaces of any enclosing code ! blocks (a module, function, or class definition) which are searched starting ! with the nearest enclosing scope; the middle scope, searched next, contains ! the current module's global names; and the outermost scope (searched last) ! is the namespace containing built-in names. If a name is declared global, then all references and assignments go --- 3554,3562 ---- At any time during execution, there are at least three nested scopes whose namespaces are directly accessible: the innermost scope, which is searched ! first, contains the local names; the namespaces of any enclosing ! functions, which are searched starting with the nearest enclosing scope; ! the middle scope, searched next, contains the current module's global names; ! and the outermost scope (searched last) is the namespace containing built-in ! names. If a name is declared global, then all references and assignments go From rhettinger@users.sourceforge.net Wed Aug 7 21:23:02 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 Aug 2002 13:23:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.7,1.156.4.1.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv23265 Modified Files: Tag: release22-maint tut.tex Log Message: GvR pointed out that only enclosing function bodies are part of nested scopes. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.7 retrieving revision 1.156.4.1.2.8 diff -C2 -d -r1.156.4.1.2.7 -r1.156.4.1.2.8 *** tut.tex 7 Aug 2002 16:06:35 -0000 1.156.4.1.2.7 --- tut.tex 7 Aug 2002 20:23:00 -0000 1.156.4.1.2.8 *************** *** 3511,3519 **** At any time during execution, there are at least three nested scopes whose namespaces are directly accessible: the innermost scope, which is searched ! first, contains the local names; the namespaces of any enclosing code ! blocks (a module, function, or class definition) which are searched starting ! with the nearest enclosing scope; the middle scope, searched next, contains ! the current module's global names; and the outermost scope (searched last) ! is the namespace containing built-in names. If a name is declared global, then all references and assignments go --- 3511,3519 ---- At any time during execution, there are at least three nested scopes whose namespaces are directly accessible: the innermost scope, which is searched ! first, contains the local names; the namespaces of any enclosing ! functions, which are searched starting with the nearest enclosing scope; ! the middle scope, searched next, contains the current module's global names; ! and the outermost scope (searched last) is the namespace containing built-in ! names. If a name is declared global, then all references and assignments go From gvanrossum@users.sourceforge.net Wed Aug 7 21:42:11 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 13:42:11 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.166,2.167 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3424 Modified Files: typeobject.c Log Message: Fix a subtle bug in the trashcan code I added yesterday to subtype_dealloc(). When call_finalizer() failed, it would return without going through the trashcan end macro, thereby unbalancing the trashcan nesting level counter, and thereby defeating the test case (slottrash() in test_descr.py). This in turn meant that the assert in the GC_UNTRACK macro wasn't triggered by the slottrash() test despite a bug in the code: _PyTrash_destroy_chain() calls the dealloc routine with an object that's untracked, and the assert in the GC_UNTRACK macro would fail on this; but because of an earlier test that resurrects an object, causing call_finalizer() to fail and the trashcan nesting level to be unbalanced, so _PyTrash_destroy_chain() was never called. Calling the slottrash() test in isolation *did* trigger the assert, however. So the fix is twofold: (1) call the GC_UnTrack() function instead of the GC_UNTRACK macro, because the function is safe when the object is already untracked; (2) when call_finalizer() fails, jump to a label that exits through the trashcan end macro, keeping the trashcan nesting balanced. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.166 retrieving revision 2.167 diff -C2 -d -r2.166 -r2.167 *** typeobject.c 6 Aug 2002 21:41:44 -0000 2.166 --- typeobject.c 7 Aug 2002 20:42:09 -0000 2.167 *************** *** 464,468 **** /* UnTrack and re-Track around the trashcan macro, alas */ ! _PyObject_GC_UNTRACK(self); Py_TRASHCAN_SAFE_BEGIN(self); _PyObject_GC_TRACK(self); /* We'll untrack for real later */ --- 464,468 ---- /* UnTrack and re-Track around the trashcan macro, alas */ ! PyObject_GC_UnTrack(self); Py_TRASHCAN_SAFE_BEGIN(self); _PyObject_GC_TRACK(self); /* We'll untrack for real later */ *************** *** 470,474 **** /* Maybe call finalizer; exit early if resurrected */ if (call_finalizer(self) < 0) ! return; /* Find the nearest base with a different tp_dealloc --- 470,474 ---- /* Maybe call finalizer; exit early if resurrected */ if (call_finalizer(self) < 0) ! goto endlabel; /* Find the nearest base with a different tp_dealloc *************** *** 509,512 **** --- 509,513 ---- Py_DECREF(type); + endlabel: Py_TRASHCAN_SAFE_END(self); } From tim_one@users.sourceforge.net Wed Aug 7 21:53:07 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 07 Aug 2002 13:53:07 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.109,2.110 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv9506/python/Include Modified Files: object.h Log Message: Added info about the right way to leave the body of a trashcan-protected destructor early. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.109 retrieving revision 2.110 diff -C2 -d -r2.109 -r2.110 *** object.h 29 Jul 2002 13:42:00 -0000 2.109 --- object.h 7 Aug 2002 20:53:05 -0000 2.110 *************** *** 707,710 **** --- 707,715 ---- } + CAUTION: Never return from the middle of the body! If the body needs to + "get out early", put a label immediately before the Py_TRASHCAN_SAFE_END + call, and goto it. Else the call-depth counter (see below) will stay + above 0 forever, and the trashcan will never get emptied. + How it works: The BEGIN macro increments a call-depth counter. So long as this counter is small, the body of the deallocator is run directly without From gvanrossum@users.sourceforge.net Thu Aug 8 02:00:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 18:00:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5948/test Modified Files: test_socket.py Log Message: Replace docstrings on test functions witrh comments -- then unittest prints function and module names, which is more informative now that we repeat some tests in slightly modified subclasses. Add a test for read() until EOF. Add test suites for line-buffered (bufsize==1) and a small custom buffer size (bufsize==2). Restructure testUnbufferedRead() somewhat to avoid a potentially infinite loop. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** test_socket.py 7 Aug 2002 19:02:49 -0000 1.52 --- test_socket.py 8 Aug 2002 01:00:28 -0000 1.53 *************** *** 192,196 **** def testSocketError(self): ! """Testing that socket module exceptions.""" def raise_error(*args, **kwargs): raise socket.error --- 192,196 ---- def testSocketError(self): ! # Testing socket module exceptions def raise_error(*args, **kwargs): raise socket.error *************** *** 207,211 **** def testCrucialConstants(self): ! """Testing for mission critical constants.""" socket.AF_INET socket.SOCK_STREAM --- 207,211 ---- def testCrucialConstants(self): ! # Testing for mission critical constants socket.AF_INET socket.SOCK_STREAM *************** *** 218,222 **** def testHostnameRes(self): ! """Testing hostname resolution mechanisms.""" hostname = socket.gethostname() ip = socket.gethostbyname(hostname) --- 218,222 ---- def testHostnameRes(self): ! # Testing hostname resolution mechanisms hostname = socket.gethostname() ip = socket.gethostbyname(hostname) *************** *** 229,233 **** def testRefCountGetNameInfo(self): ! """Testing reference count for getnameinfo.""" import sys if hasattr(sys, "getrefcount"): --- 229,233 ---- def testRefCountGetNameInfo(self): ! # Testing reference count for getnameinfo import sys if hasattr(sys, "getrefcount"): *************** *** 241,245 **** def testInterpreterCrash(self): ! """Making sure getnameinfo doesn't crash the interpreter.""" try: # On some versions, this crashes the interpreter. --- 241,245 ---- def testInterpreterCrash(self): ! # Making sure getnameinfo doesn't crash the interpreter try: # On some versions, this crashes the interpreter. *************** *** 259,263 **** def testGetServByName(self): ! """Testing getservbyname().""" # try a few protocols - not everyone has telnet enabled found = 0 --- 259,263 ---- def testGetServByName(self): ! # Testing getservbyname() # try a few protocols - not everyone has telnet enabled found = 0 *************** *** 279,283 **** def testDefaultTimeout(self): ! """Testing default timeout.""" # The default timeout should initially be None self.assertEqual(socket.getdefaulttimeout(), None) --- 279,283 ---- def testDefaultTimeout(self): ! # Testing default timeout # The default timeout should initially be None self.assertEqual(socket.getdefaulttimeout(), None) *************** *** 309,313 **** def testSockName(self): ! """Testing getsockname().""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(("0.0.0.0", PORT+1)) --- 309,313 ---- def testSockName(self): ! # Testing getsockname() sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(("0.0.0.0", PORT+1)) *************** *** 316,320 **** def testGetSockOpt(self): ! """Testing getsockopt().""" # We know a socket should start without reuse==0 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) --- 316,320 ---- def testGetSockOpt(self): ! # Testing getsockopt() # We know a socket should start without reuse==0 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) *************** *** 323,327 **** def testSetSockOpt(self): ! """Testing setsockopt().""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) --- 323,327 ---- def testSetSockOpt(self): ! # Testing setsockopt() sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) *************** *** 330,334 **** def testSendAfterClose(self): ! """testing send() after close() with timeout.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(1) --- 330,334 ---- def testSendAfterClose(self): ! # testing send() after close() with timeout sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(1) *************** *** 342,346 **** def testRecv(self): ! """Testing large receive over TCP.""" msg = self.cli_conn.recv(1024) self.assertEqual(msg, MSG) --- 342,346 ---- def testRecv(self): ! # Testing large receive over TCP msg = self.cli_conn.recv(1024) self.assertEqual(msg, MSG) *************** *** 350,354 **** def testOverFlowRecv(self): ! """Testing receive in chunks over TCP.""" seg1 = self.cli_conn.recv(len(MSG) - 3) seg2 = self.cli_conn.recv(1024) --- 350,354 ---- def testOverFlowRecv(self): ! # Testing receive in chunks over TCP seg1 = self.cli_conn.recv(len(MSG) - 3) seg2 = self.cli_conn.recv(1024) *************** *** 360,364 **** def testRecvFrom(self): ! """Testing large recvfrom() over TCP.""" msg, addr = self.cli_conn.recvfrom(1024) self.assertEqual(msg, MSG) --- 360,364 ---- def testRecvFrom(self): ! # Testing large recvfrom() over TCP msg, addr = self.cli_conn.recvfrom(1024) self.assertEqual(msg, MSG) *************** *** 368,372 **** def testOverFlowRecvFrom(self): ! """Testing recvfrom() in chunks over TCP.""" seg1, addr = self.cli_conn.recvfrom(len(MSG)-3) seg2, addr = self.cli_conn.recvfrom(1024) --- 368,372 ---- def testOverFlowRecvFrom(self): ! # Testing recvfrom() in chunks over TCP seg1, addr = self.cli_conn.recvfrom(len(MSG)-3) seg2, addr = self.cli_conn.recvfrom(1024) *************** *** 378,382 **** def testSendAll(self): ! """Testing sendall() with a 2048 byte string over TCP.""" while 1: read = self.cli_conn.recv(1024) --- 378,382 ---- def testSendAll(self): ! # Testing sendall() with a 2048 byte string over TCP while 1: read = self.cli_conn.recv(1024) *************** *** 392,396 **** def testFromFd(self): ! """Testing fromfd().""" if not hasattr(socket, "fromfd"): return # On Windows, this doesn't exist --- 392,396 ---- def testFromFd(self): ! # Testing fromfd() if not hasattr(socket, "fromfd"): return # On Windows, this doesn't exist *************** *** 404,408 **** def testShutdown(self): ! """Testing shutdown().""" msg = self.cli_conn.recv(1024) self.assertEqual(msg, MSG) --- 404,408 ---- def testShutdown(self): ! # Testing shutdown() msg = self.cli_conn.recv(1024) self.assertEqual(msg, MSG) *************** *** 418,422 **** def testSendtoAndRecv(self): ! """Testing sendto() and Recv() over UDP.""" msg = self.serv.recv(len(MSG)) self.assertEqual(msg, MSG) --- 418,422 ---- def testSendtoAndRecv(self): ! # Testing sendto() and Recv() over UDP msg = self.serv.recv(len(MSG)) self.assertEqual(msg, MSG) *************** *** 426,430 **** def testRecvFrom(self): ! """Testing recvfrom() over UDP.""" msg, addr = self.serv.recvfrom(len(MSG)) self.assertEqual(msg, MSG) --- 426,430 ---- def testRecvFrom(self): ! # Testing recvfrom() over UDP msg, addr = self.serv.recvfrom(len(MSG)) self.assertEqual(msg, MSG) *************** *** 439,443 **** def testSetBlocking(self): ! """Testing whether set blocking works.""" self.serv.setblocking(0) start = time.time() --- 439,443 ---- def testSetBlocking(self): ! # Testing whether set blocking works self.serv.setblocking(0) start = time.time() *************** *** 453,457 **** def testAccept(self): ! """Testing non-blocking accept.""" self.serv.setblocking(0) try: --- 453,457 ---- def testAccept(self): ! # Testing non-blocking accept self.serv.setblocking(0) try: *************** *** 472,476 **** def testConnect(self): ! """Testing non-blocking connect.""" conn, addr = self.serv.accept() --- 472,476 ---- def testConnect(self): ! # Testing non-blocking connect conn, addr = self.serv.accept() *************** *** 480,484 **** def testRecv(self): ! """Testing non-blocking recv.""" conn, addr = self.serv.accept() conn.setblocking(0) --- 480,484 ---- def testRecv(self): ! # Testing non-blocking recv conn, addr = self.serv.accept() conn.setblocking(0) *************** *** 527,531 **** def testSmallRead(self): ! """Performing small file read test.""" first_seg = self.serv_file.read(len(MSG)-3) second_seg = self.serv_file.read(3) --- 527,531 ---- def testSmallRead(self): ! # Performing small file read test first_seg = self.serv_file.read(len(MSG)-3) second_seg = self.serv_file.read(3) *************** *** 537,549 **** self.cli_file.flush() def testUnbufferedRead(self): ! """Performing unbuffered file read test.""" buf = '' while 1: char = self.serv_file.read(1) ! self.failIf(not char) ! buf += char ! if buf == MSG: break def _testUnbufferedRead(self): --- 537,558 ---- self.cli_file.flush() + def testFullRead(self): + # read until EOF + msg = self.serv_file.read() + self.assertEqual(msg, MSG) + + def _testFullRead(self): + self.cli_file.write(MSG) + self.cli_file.close() + def testUnbufferedRead(self): ! # Performing unbuffered file read test buf = '' while 1: char = self.serv_file.read(1) ! if not char: break + buf += char + self.assertEqual(buf, MSG) def _testUnbufferedRead(self): *************** *** 552,556 **** def testReadline(self): ! """Performing file readline test.""" line = self.serv_file.readline() self.assertEqual(line, MSG) --- 561,565 ---- def testReadline(self): ! # Performing file readline test line = self.serv_file.readline() self.assertEqual(line, MSG) *************** *** 573,577 **** def testUnbufferedReadline(self): ! """Read a line, create a new file object, read another line with it.""" line = self.serv_file.readline() # first line self.assertEqual(line, "A. " + MSG) # first line --- 582,586 ---- def testUnbufferedReadline(self): ! # Read a line, create a new file object, read another line with it line = self.serv_file.readline() # first line self.assertEqual(line, "A. " + MSG) # first line *************** *** 585,588 **** --- 594,605 ---- self.cli_file.flush() + class LineBufferedFileObjectClassTestCase(FileObjectClassTestCase): + + bufsize = 1 # Default-buffered for reading; line-buffered for writing + + + class SmallBufferedFileObjectClassTestCase(FileObjectClassTestCase): + + bufsize = 2 # Exercise the buffering code def test_main(): *************** *** 594,597 **** --- 611,616 ---- suite.addTest(unittest.makeSuite(FileObjectClassTestCase)) suite.addTest(unittest.makeSuite(UnbufferedFileObjectClassTestCase)) + suite.addTest(unittest.makeSuite(LineBufferedFileObjectClassTestCase)) + suite.addTest(unittest.makeSuite(SmallBufferedFileObjectClassTestCase)) test_support.run_suite(suite) From gvanrossum@users.sourceforge.net Thu Aug 8 02:02:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 07 Aug 2002 18:02:19 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7755 Modified Files: socket.py Log Message: Major restructuring of _fileobject. Hopefully several things now work correctly (the test at least succeed, but they don't test everything yet). Also fix a performance problem in read(-1): in unbuffered mode, this would read 1 byte at a time. Since we're reading until EOF, that doesn't make sense. Use the default buffer size if _rbufsize is <= 1. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** socket.py 7 Aug 2002 19:03:35 -0000 1.26 --- socket.py 8 Aug 2002 01:02:16 -0000 1.27 *************** *** 173,190 **** class _fileobject: ! """Implements a file object on top of a regular socket object.""" def __init__(self, sock, mode='rb', bufsize=-1): self._sock = sock ! self._mode = mode ! if bufsize <= 0: ! if bufsize == 0: ! bufsize = 1 # Unbuffered mode ! else: ! bufsize = 8192 ! self._rbufsize = bufsize self._wbufsize = bufsize ! self._rbuf = [ ] ! self._wbuf = [ ] def close(self): --- 173,195 ---- class _fileobject: ! """Faux file object attached to a socket object.""" ! ! default_bufsize = 8192 def __init__(self, sock, mode='rb', bufsize=-1): self._sock = sock ! self._mode = mode # Not actually used in this version ! if bufsize < 0: ! bufsize = self.default_bufsize ! if bufsize == 0: ! self._rbufsize = 1 ! elif bufsize == 1: ! self._rbufsize = self.default_bufsize ! else: ! self._rbufsize = bufsize self._wbufsize = bufsize ! # The buffers are lists of non-empty strings ! self._rbuf = [] ! self._wbuf = [] def close(self): *************** *** 200,206 **** def flush(self): if self._wbuf: ! buffer = ''.join(self._wbuf) self._sock.sendall(buffer) - self._wbuf = [ ] def fileno(self): --- 205,211 ---- def flush(self): if self._wbuf: ! buffer = "".join(self._wbuf) ! self._wbuf = [] self._sock.sendall(buffer) def fileno(self): *************** *** 208,250 **** def write(self, data): ! self._wbuf.append (data) ! # A _wbufsize of 1 means we're doing unbuffered IO. ! # Flush accordingly. ! if self._wbufsize == 1: ! if '\n' in data: ! self.flush () ! elif self.__get_wbuf_len() >= self._wbufsize: self.flush() def writelines(self, list): ! filter(self._sock.sendall, list) ! self.flush() ! def __get_wbuf_len (self): buf_len = 0 ! for i in [len(x) for x in self._wbuf]: ! buf_len += i return buf_len ! def __get_rbuf_len(self): buf_len = 0 ! for i in [len(x) for x in self._rbuf]: ! buf_len += i return buf_len def read(self, size=-1): ! buf_len = self.__get_rbuf_len() ! while size < 0 or buf_len < size: ! recv_size = max(self._rbufsize, size - buf_len) ! data = self._sock.recv(recv_size) ! if not data: ! break ! buf_len += len(data) ! self._rbuf.append(data) ! # Clear the rbuf at the end so we're not affected by ! # an exception during a recv ! data = ''.join(self._rbuf) ! self._rbuf = [ ] ! if buf_len > size and size >= 0: self._rbuf.append(data[size:]) data = data[:size] --- 213,269 ---- def write(self, data): ! data = str(data) # XXX Should really reject non-string non-buffers ! if not data: ! return ! self._wbuf.append(data) ! if (self._wbufsize == 0 or ! self._wbufsize == 1 and '\n' in data or ! self._get_wbuf_len() >= self._wbufsize): self.flush() def writelines(self, list): ! # XXX We could do better here for very long lists ! # XXX Should really reject non-string non-buffers ! self._wbuf.extend(filter(None, map(str, list))) ! if (self._wbufsize <= 1 or ! self._get_wbuf_len() >= self._wbufsize): ! self.flush() ! def _get_wbuf_len(self): buf_len = 0 ! for x in self._wbuf: ! buf_len += len(x) return buf_len ! def _get_rbuf_len(self): buf_len = 0 ! for x in self._rbuf: ! buf_len += len(x) return buf_len def read(self, size=-1): ! if size < 0: ! # Read until EOF ! if self._rbufsize <= 1: ! recv_size = self.default_bufsize ! else: ! recv_size = self._rbufsize ! while 1: ! data = self._sock.recv(recv_size) ! if not data: ! break ! self._rbuf.append(data) ! else: ! buf_len = self._get_rbuf_len() ! while buf_len < size: ! recv_size = max(self._rbufsize, size - buf_len) ! data = self._sock.recv(recv_size) ! if not data: ! break ! buf_len += len(data) ! self._rbuf.append(data) ! data = "".join(self._rbuf) ! self._rbuf = [] ! if 0 <= size < buf_len: self._rbuf.append(data[size:]) data = data[:size] *************** *** 252,278 **** def readline(self, size=-1): ! index = -1 ! buf_len = self.__get_rbuf_len() ! if self._rbuf: ! index = min([x.find('\n') for x in self._rbuf]) ! while index < 0 and (size < 0 or buf_len < size): ! recv_size = max(self._rbufsize, size - buf_len) ! data = self._sock.recv(recv_size) ! if not data: break ! buf_len += len(data) ! self._rbuf.append(data) ! index = data.find('\n') ! data = ''.join(self._rbuf) ! self._rbuf = [ ] ! index = data.find('\n') ! if index >= 0: ! index += 1 ! elif buf_len > size: ! index = size else: ! index = buf_len ! self._rbuf.append(data[index:]) ! data = data[:index] return data --- 271,317 ---- def readline(self, size=-1): ! data_len = 0 ! for index, x in enumerate(self._rbuf): ! data_len += len(x) ! if '\n' in x or 0 <= size <= data_len: ! index += 1 ! data = "".join(self._rbuf[:index]) ! end = data.find('\n') ! if end < 0: ! end = len(data) ! else: ! end += 1 ! if 0 <= size < end: ! end = size ! data, rest = data[:end], data[end:] ! if rest: ! self._rbuf[:index] = [rest] ! else: ! del self._rbuf[:index] ! return data ! recv_size = self._rbufsize ! while 1: ! if size >= 0: ! recv_size = min(self._rbufsize, size - data_len) ! x = self._sock.recv(recv_size) ! if not x: break ! data_len += len(x) ! self._rbuf.append(x) ! if '\n' in x or 0 <= size <= data_len: ! break ! data = "".join(self._rbuf) ! end = data.find('\n') ! if end < 0: ! end = len(data) else: ! end += 1 ! if 0 <= size < end: ! end = size ! data, rest = data[:end], data[end:] ! if rest: ! self._rbuf = [rest] ! else: ! self._rbuf = [] return data *************** *** 289,290 **** --- 328,340 ---- break return list + + # Iterator protocols + + def __iter__(self): + return self + + def next(self): + line = self.readline() + if not line: + raise StopIteration + return line From tim_one@users.sourceforge.net Thu Aug 8 02:06:41 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 07 Aug 2002 18:06:41 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.132,2.133 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9909/python/Objects Modified Files: listobject.c Log Message: PyList_Reverse(): This was leaking a reference to Py_None on every call. I believe I introduced this bug when I refactored the reversal code so that the mergesort could use it too. It's not a problem on the 2.2 branch. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.132 retrieving revision 2.133 diff -C2 -d -r2.132 -r2.133 *** listobject.c 4 Aug 2002 17:47:26 -0000 2.132 --- listobject.c 8 Aug 2002 01:06:39 -0000 2.133 *************** *** 1719,1727 **** PyList_Reverse(PyObject *v) { if (v == NULL || !PyList_Check(v)) { PyErr_BadInternalCall(); return -1; } ! listreverse((PyListObject *)v); return 0; } --- 1719,1730 ---- PyList_Reverse(PyObject *v) { + PyListObject *self = (PyListObject *)v; + if (v == NULL || !PyList_Check(v)) { PyErr_BadInternalCall(); return -1; } ! if (self->ob_size > 1) ! reverse_slice(self->ob_item, self->ob_item + self->ob_size); return 0; } From tim_one@users.sourceforge.net Thu Aug 8 02:55:19 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 07 Aug 2002 18:55:19 -0700 Subject: [Python-checkins] python/dist/src/Objects listsort.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28833/python/Objects Modified Files: listsort.txt Log Message: Added info about highwater heap-memory use for the sortperf.py tests; + a couple of minor edits elsewhere. Index: listsort.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listsort.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** listsort.txt 1 Aug 2002 00:59:42 -0000 1.1 --- listsort.txt 8 Aug 2002 01:55:16 -0000 1.2 *************** *** 168,171 **** --- 168,199 ---- to count that it isn't on some boxes as a strike against it . + + Here's the highwater mark for the number of heap-based temp slots (4 + bytes each on this box) needed by each test, again with arguments + "15 20 1": + + + 2**i *sort \sort /sort 3sort +sort %sort ~sort =sort !sort + 32768 16384 0 0 6256 0 10821 12288 0 16383 + 65536 32766 0 0 21652 0 31276 24576 0 32767 + 131072 65534 0 0 17258 0 58112 49152 0 65535 + 262144 131072 0 0 35660 0 123561 98304 0 131071 + 524288 262142 0 0 31302 0 212057 196608 0 262143 + 1048576 524286 0 0 312438 0 484942 393216 0 524287 + + Discussion: The tests that end up doing (close to) perfectly balanced + merges (*sort, !sort) need all N//2 temp slots (or almost all). ~sort + also ends up doing balanced merges, but systematically benefits a lot from + the preliminary pre-merge searches described under "Merge Memory" later. + %sort approaches having a balanced merge at the end because the random + selection of elements to replace is expected to produce an out-of-order + element near the midpoint. \sort, /sort, =sort are the trivial one-run + cases, needing no merging at all. +sort ends up having one very long run + and one very short, and so gets all the temp space it needs from the small + temparray member of the MergeState struct (note that the same would be + true if the new random elements were prefixed to the sorted list instead, + but not if they appeared "in the middle"). 3sort approaches N//3 temp + slots twice, but the run lengths that remain after 3 random exchanges + clearly has very high variance. + A detailed description of timsort follows. *************** *** 461,471 **** So why don't we always gallop? Because it can lose, on two counts: ! 1. While we're willing to endure small per-run overheads, per-comparison overheads are a different story. Calling Yet Another Function per comparison is expensive, and gallop_left() and gallop_right() are too long-winded for sane inlining. ! 2. Ignoring function-call overhead, galloping can-- alas --require more ! comparisons than linear one-at-time search, depending on the data. #2 requires details. If A[0] belongs before B[0], galloping requires 1 --- 489,499 ---- So why don't we always gallop? Because it can lose, on two counts: ! 1. While we're willing to endure small per-merge overheads, per-comparison overheads are a different story. Calling Yet Another Function per comparison is expensive, and gallop_left() and gallop_right() are too long-winded for sane inlining. ! 2. Galloping can-- alas --require more comparisons than linear one-at-time ! search, depending on the data. #2 requires details. If A[0] belongs before B[0], galloping requires 1 From purcell@users.sourceforge.net Thu Aug 8 14:38:04 2002 From: purcell@users.sourceforge.net (purcell@users.sourceforge.net) Date: Thu, 08 Aug 2002 06:38:04 -0700 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28242/Lib Modified Files: unittest.py Log Message: Add module-wide "__metaclass__ = type", as requested by Jim Fulton. (Synched from pyunit CVS) Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** unittest.py 31 May 2002 14:15:11 -0000 1.16 --- unittest.py 8 Aug 2002 13:38:02 -0000 1.17 *************** *** 47,51 **** __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" ! __version__ = "#Revision: 1.43 $"[11:-2] import time --- 47,51 ---- __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" ! __version__ = "#Revision: 1.45 $"[11:-2] import time *************** *** 59,62 **** --- 59,65 ---- # Test framework core ############################################################################## + + # All classes defined herein are 'new-style' classes, allowing use of 'super()' + __metaclass__ = type class TestResult: From fdrake@users.sourceforge.net Thu Aug 8 15:34:14 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 08 Aug 2002 07:34:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/parsers expat.py,1.1,1.1.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/parsers In directory usw-pr-cvs1:/tmp/cvs-serv20361 Modified Files: Tag: release22-maint expat.py Log Message: Since pyexpat isn't always available in Python 2.2, allow repeated imports of xml.parsers.expat to raise ImportError if pyexpat isn't available. Not needed in Python 2.3, since pyexpat is always built there. Index: expat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/parsers/expat.py,v retrieving revision 1.1 retrieving revision 1.1.26.1 diff -C2 -d -r1.1 -r1.1.26.1 *** expat.py 23 Sep 2000 04:44:43 -0000 1.1 --- expat.py 8 Aug 2002 14:34:12 -0000 1.1.26.1 *************** *** 2,4 **** __version__ = '$Revision$' ! from pyexpat import * --- 2,13 ---- __version__ = '$Revision$' ! import sys ! ! try: ! from pyexpat import * ! except ImportError: ! del sys.modules[__name__] ! del sys ! raise ! ! del sys From gvanrossum@users.sourceforge.net Thu Aug 8 16:17:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 08:17:13 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6833 Modified Files: socket.py Log Message: Another refactoring. Changed 'socket' from being a factory function to being a new-style class, to be more similar to the socket class in the _socket module; it is now the same as the _socketobject class. Added __slots__. Added docstrings, copied from the real socket class where possible. The _fileobject class is now also a new-style class with __slots__ (though without docstrings). The mode, name, softspace, bufsize and closed attributes are properly supported (closed as a property; name as a class attributes; the softspace, mode and bufsize as slots). Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** socket.py 8 Aug 2002 01:02:16 -0000 1.27 --- socket.py 8 Aug 2002 15:16:20 -0000 1.28 *************** *** 44,53 **** from _socket import * ! SSL_EXISTS = 1 try: - import _ssl from _ssl import * except ImportError: ! SSL_EXISTS = 0 import os, sys --- 44,53 ---- from _socket import * ! _have_ssl = False try: from _ssl import * + _have_ssl = True except ImportError: ! pass import os, sys *************** *** 57,81 **** # XXX shouldn't there be something similar to the above for _ssl exports? if (sys.platform.lower().startswith("win") or (hasattr(os, 'uname') and os.uname()[0] == "BeOS") or sys.platform=="riscos"): ! _realsocketcall = _socket.socket ! ! def socket(family=AF_INET, type=SOCK_STREAM, proto=0): ! return _socketobject(_realsocketcall(family, type, proto)) ! socket.__doc__ = _realsocketcall.__doc__ ! if SSL_EXISTS: ! _realsslcall = _ssl.ssl def ssl(sock, keyfile=None, certfile=None): if hasattr(sock, "_sock"): sock = sock._sock ! return _realsslcall(sock, keyfile, certfile) ! ! del _socket ! if SSL_EXISTS: ! del _ssl ! del SSL_EXISTS # WSA error codes --- 57,74 ---- # XXX shouldn't there be something similar to the above for _ssl exports? + _realsocket = socket + _needwrapper = False if (sys.platform.lower().startswith("win") or (hasattr(os, 'uname') and os.uname()[0] == "BeOS") or sys.platform=="riscos"): ! _needwrapper = True ! if _have_ssl: ! _realssl = ssl def ssl(sock, keyfile=None, certfile=None): if hasattr(sock, "_sock"): sock = sock._sock ! return _realssl(sock, keyfile, certfile) # WSA error codes *************** *** 141,156 **** 'settimeout', 'gettimeout', 'shutdown') ! class _socketobject: ! class _closedsocket: def __getattr__(self, name): raise error(9, 'Bad file descriptor') ! def __init__(self, sock): ! self._sock = sock def close(self): # Avoid referencing globals here self._sock = self.__class__._closedsocket() def __del__(self): --- 134,157 ---- 'settimeout', 'gettimeout', 'shutdown') ! class _socketobject(object): ! __doc__ = _realsocket.__doc__ ! ! __slots__ = ["_sock"] ! ! class _closedsocket(object): ! __slots__ = [] def __getattr__(self, name): raise error(9, 'Bad file descriptor') ! def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): ! if _sock is None: ! _sock = _realsocket(family, type, proto) ! self._sock = _sock def close(self): # Avoid referencing globals here self._sock = self.__class__._closedsocket() + close.__doc__ = _realsocket.close.__doc__ def __del__(self): *************** *** 159,185 **** def accept(self): sock, addr = self._sock.accept() ! return _socketobject(sock), addr def dup(self): ! return _socketobject(self._sock) def makefile(self, mode='r', bufsize=-1): return _fileobject(self._sock, mode, bufsize) ! _s = "def %s(self, *args): return self._sock.%s(*args)\n\n" for _m in _socketmethods: ! exec _s % (_m, _m) ! class _fileobject: """Faux file object attached to a socket object.""" default_bufsize = 8192 def __init__(self, sock, mode='rb', bufsize=-1): self._sock = sock ! self._mode = mode # Not actually used in this version if bufsize < 0: bufsize = self.default_bufsize if bufsize == 0: self._rbufsize = 1 --- 160,204 ---- def accept(self): sock, addr = self._sock.accept() ! return _socketobject(_sock=sock), addr ! accept.__doc__ = _realsocket.accept.__doc__ def dup(self): ! """dup() -> socket object ! ! Return a new socket object connected to the same system resource.""" ! return _socketobject(_sock=self._sock) def makefile(self, mode='r', bufsize=-1): + """makefile([mode[, bufsize]]) -> file object + + Return a regular file object corresponding to the socket. The mode + and bufsize arguments are as for the built-in open() function.""" return _fileobject(self._sock, mode, bufsize) ! _s = ("def %s(self, *args): return self._sock.%s(*args)\n\n" ! "%s.__doc__ = _realsocket.%s.__doc__\n") for _m in _socketmethods: ! exec _s % (_m, _m, _m, _m) + if _needwrapper: + socket = _socketobject ! class _fileobject(object): """Faux file object attached to a socket object.""" default_bufsize = 8192 + name = "" + + __slots__ = ["mode", "bufsize", "softspace", + # "closed" is a property, see below + "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf"] def __init__(self, sock, mode='rb', bufsize=-1): self._sock = sock ! self.mode = mode # Not actually used in this version if bufsize < 0: bufsize = self.default_bufsize + self.bufsize = bufsize + self.softspace = False if bufsize == 0: self._rbufsize = 1 *************** *** 192,195 **** --- 211,218 ---- self._rbuf = [] self._wbuf = [] + + def _getclosed(self): + return self._sock is not None + closed = property(_getclosed, doc="True if the file is closed") def close(self): From gvanrossum@users.sourceforge.net Thu Aug 8 16:22:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 08:22:21 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10022 Modified Files: socket.py Log Message: Oops, stupid tabs. Sorry again. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** socket.py 8 Aug 2002 15:16:20 -0000 1.28 --- socket.py 8 Aug 2002 15:22:12 -0000 1.29 *************** *** 147,151 **** def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): if _sock is None: ! _sock = _realsocket(family, type, proto) self._sock = _sock --- 147,151 ---- def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): if _sock is None: ! _sock = _realsocket(family, type, proto) self._sock = _sock *************** *** 199,204 **** if bufsize < 0: bufsize = self.default_bufsize ! self.bufsize = bufsize ! self.softspace = False if bufsize == 0: self._rbufsize = 1 --- 199,204 ---- if bufsize < 0: bufsize = self.default_bufsize ! self.bufsize = bufsize ! self.softspace = False if bufsize == 0: self._rbufsize = 1 From gvanrossum@users.sourceforge.net Thu Aug 8 16:25:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 08:25:32 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11309 Modified Files: socket.py Log Message: Extend __all__ with the exports list of the _ssl module. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** socket.py 8 Aug 2002 15:22:12 -0000 1.29 --- socket.py 8 Aug 2002 15:25:28 -0000 1.30 *************** *** 46,49 **** --- 46,50 ---- _have_ssl = False try: + import _ssl from _ssl import * _have_ssl = True *************** *** 55,59 **** __all__ = ["getfqdn"] __all__.extend(os._get_exports_list(_socket)) ! # XXX shouldn't there be something similar to the above for _ssl exports? _realsocket = socket --- 56,61 ---- __all__ = ["getfqdn"] __all__.extend(os._get_exports_list(_socket)) ! if _have_ssl: ! __all__.extend(os._get_exports_list(_ssl)) _realsocket = socket *************** *** 91,94 **** --- 93,97 ---- errorTab[10065] = "The host is unreachable." __all__.append("errorTab") + del os, sys From gvanrossum@users.sourceforge.net Thu Aug 8 18:16:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 10:16:12 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13765 Modified Files: socket.py Log Message: Another refactoring of read() and readline(), this time based on the observation that _rbuf could never have more than one string in it. So make _rbuf a string. The code branches for size<0 and size>=0 are completely separate now, both in read() and in readline(). I checked for tabs this time. :-) Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** socket.py 8 Aug 2002 15:25:28 -0000 1.30 --- socket.py 8 Aug 2002 17:16:09 -0000 1.31 *************** *** 211,217 **** self._rbufsize = bufsize self._wbufsize = bufsize ! # The buffers are lists of non-empty strings ! self._rbuf = [] ! self._wbuf = [] def _getclosed(self): --- 211,216 ---- self._rbufsize = bufsize self._wbufsize = bufsize ! self._rbuf = "" # A string ! self._wbuf = [] # A list of strings def _getclosed(self): *************** *** 262,349 **** return buf_len - def _get_rbuf_len(self): - buf_len = 0 - for x in self._rbuf: - buf_len += len(x) - return buf_len - def read(self, size=-1): if size < 0: # Read until EOF if self._rbufsize <= 1: recv_size = self.default_bufsize else: recv_size = self._rbufsize ! while 1: data = self._sock.recv(recv_size) if not data: break ! self._rbuf.append(data) else: ! buf_len = self._get_rbuf_len() ! while buf_len < size: ! recv_size = max(self._rbufsize, size - buf_len) data = self._sock.recv(recv_size) if not data: break ! buf_len += len(data) ! self._rbuf.append(data) ! data = "".join(self._rbuf) ! self._rbuf = [] ! if 0 <= size < buf_len: ! self._rbuf.append(data[size:]) ! data = data[:size] ! return data def readline(self, size=-1): ! data_len = 0 ! for index, x in enumerate(self._rbuf): ! data_len += len(x) ! if '\n' in x or 0 <= size <= data_len: ! index += 1 ! data = "".join(self._rbuf[:index]) ! end = data.find('\n') ! if end < 0: ! end = len(data) ! else: ! end += 1 ! if 0 <= size < end: ! end = size ! data, rest = data[:end], data[end:] ! if rest: ! self._rbuf[:index] = [rest] ! else: ! del self._rbuf[:index] ! return data ! recv_size = self._rbufsize ! while 1: ! if size >= 0: ! recv_size = min(self._rbufsize, size - data_len) ! x = self._sock.recv(recv_size) ! if not x: ! break ! data_len += len(x) ! self._rbuf.append(x) ! if '\n' in x or 0 <= size <= data_len: ! break ! data = "".join(self._rbuf) ! end = data.find('\n') ! if end < 0: ! end = len(data) ! else: ! end += 1 ! if 0 <= size < end: ! end = size ! data, rest = data[:end], data[end:] ! if rest: ! self._rbuf = [rest] else: ! self._rbuf = [] ! return data def readlines(self, sizehint=0): total = 0 list = [] ! while 1: line = self.readline() if not line: --- 261,371 ---- return buf_len def read(self, size=-1): + data = self._rbuf if size < 0: # Read until EOF + buffers = [] + if data: + buffers.append(data) + self._rbuf = "" if self._rbufsize <= 1: recv_size = self.default_bufsize else: recv_size = self._rbufsize ! while True: data = self._sock.recv(recv_size) if not data: break ! buffers.append(data) ! return "".join(buffers) else: ! # Read until size bytes or EOF seen, whichever comes first ! buf_len = len(data) ! if buf_len >= size: ! self._rbuf = data[size:] ! return data[:size] ! buffers = [] ! if data: ! buffers.append(data) ! self._rbuf = "" ! while True: ! left = size - buf_len ! recv_size = max(self._rbufsize, left) data = self._sock.recv(recv_size) if not data: break ! buffers.append(data) ! n = len(data) ! if n >= left: ! self._rbuf = data[left:] ! buffers[-1] = data[:left] ! break ! buf_len += n ! return "".join(buffers) def readline(self, size=-1): ! data = self._rbuf ! if size < 0: ! # Read until \n or EOF, whichever comes first ! nl = data.find('\n') ! if nl >= 0: ! nl += 1 ! self._rbuf = data[nl:] ! return data[:nl] ! buffers = [] ! if data: ! buffers.append(data) ! self._rbuf = "" ! while True: ! data = self._sock.recv(self._rbufsize) ! if not data: ! break ! buffers.append(data) ! nl = data.find('\n') ! if nl >= 0: ! nl += 1 ! self._rbuf = data[nl:] ! buffers[-1] = data[:nl] ! break ! return "".join(buffers) else: ! # Read until size bytes or \n or EOF seen, whichever comes first ! nl = data.find('\n', 0, size) ! if nl >= 0: ! nl += 1 ! self._rbuf = data[nl:] ! return data[:nl] ! buf_len = len(data) ! if buf_len >= size: ! self._rbuf = data[size:] ! return data[:size] ! buffers = [] ! if data: ! buffers.append(data) ! self._rbuf = "" ! while True: ! data = self._sock.recv(self._rbufsize) ! if not data: ! break ! buffers.append(data) ! left = size - buf_len ! nl = data.find('\n', 0, left) ! if nl >= 0: ! nl += 1 ! self._rbuf = data[nl:] ! buffers[-1] = data[:nl] ! break ! n = len(data) ! if n >= left: ! self._rbuf = data[left:] ! buffers[-1] = data[:left] ! break ! buf_len += n ! return "".join(buffers) def readlines(self, sizehint=0): total = 0 list = [] ! while True: line = self.readline() if not line: From gvanrossum@users.sourceforge.net Thu Aug 8 18:34:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 10:34:21 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19388 Modified Files: socket.py Log Message: OK, one more hack: speed up the case of readline() in unbuffered mode. This is important IMO because httplib reads the headers this way. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** socket.py 8 Aug 2002 17:16:09 -0000 1.31 --- socket.py 8 Aug 2002 17:34:19 -0000 1.32 *************** *** 308,311 **** --- 308,322 ---- if size < 0: # Read until \n or EOF, whichever comes first + if self._rbufsize <= 1: + # Speed up unbuffered case + assert data == "" + buffers = [] + recv = self._sock.recv + while data != "\n": + data = recv(1) + if not data: + break + buffers.append(data) + return "".join(buffers) nl = data.find('\n') if nl >= 0: From gvanrossum@users.sourceforge.net Thu Aug 8 19:11:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 11:11:38 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30522 Modified Files: socket.py Log Message: The _socketobject class has no need for a __del__ method: all it did was to delete the reference to self._sock, and the regular destructor will do that just fine. This made some hacks in close() unnecessary. The _fileobject class still has a __del__ method, because it must flush. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** socket.py 8 Aug 2002 17:34:19 -0000 1.32 --- socket.py 8 Aug 2002 18:11:36 -0000 1.33 *************** *** 137,140 **** --- 137,145 ---- 'settimeout', 'gettimeout', 'shutdown') + class _closedsocket(object): + __slots__ = [] + def __getattr__(self, name): + raise error(9, 'Bad file descriptor') + class _socketobject(object): *************** *** 143,151 **** __slots__ = ["_sock"] - class _closedsocket(object): - __slots__ = [] - def __getattr__(self, name): - raise error(9, 'Bad file descriptor') - def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): if _sock is None: --- 148,151 ---- *************** *** 154,163 **** def close(self): ! # Avoid referencing globals here ! self._sock = self.__class__._closedsocket() close.__doc__ = _realsocket.close.__doc__ - - def __del__(self): - self.close() def accept(self): --- 154,159 ---- def close(self): ! self._sock = _closedsocket() close.__doc__ = _realsocket.close.__doc__ def accept(self): From gvanrossum@users.sourceforge.net Thu Aug 8 20:35:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:35:56 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.50.8.2,1.50.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24650 Modified Files: Tag: release22-maint os.py Log Message: Backport of SF patch 590294: os._execvpe security fix (Zack Weinberg). 1) Do not attempt to exec a file which does not exist just to find out what error the operating system returns. This is an exploitable race on all platforms that support symbolic links. 2) Immediately re-raise the exception if we get an error other than errno.ENOENT or errno.ENOTDIR. This may need to be adapted for other platforms. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.50.8.2 retrieving revision 1.50.8.3 diff -C2 -d -r1.50.8.2 -r1.50.8.3 *** os.py 16 Mar 2002 18:02:20 -0000 1.50.8.2 --- os.py 8 Aug 2002 19:35:53 -0000 1.50.8.3 *************** *** 309,314 **** __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) - _notfound = None def _execvpe(file, args, env=None): if env is not None: func = execve --- 309,315 ---- __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) def _execvpe(file, args, env=None): + from errno import ENOENT, ENOTDIR + if env is not None: func = execve *************** *** 318,322 **** argrest = (args,) env = environ ! global _notfound head, tail = path.split(file) if head: --- 319,323 ---- argrest = (args,) env = environ ! head, tail = path.split(file) if head: *************** *** 328,346 **** envpath = defpath PATH = envpath.split(pathsep) - if not _notfound: - if sys.platform[:4] == 'beos': - # Process handling (fork, wait) under BeOS (up to 5.0) - # doesn't interoperate reliably with the thread interlocking - # that happens during an import. The actual error we need - # is the same on BeOS for posix.open() et al., ENOENT. - try: unlink('/_#.# ## #.#') - except error, _notfound: pass - else: - import tempfile - t = tempfile.mktemp() - # Exec a file that is guaranteed not to exist - try: execv(t, ('blah',)) - except error, _notfound: pass - exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) --- 329,332 ---- *************** *** 348,355 **** apply(func, (fullname,) + argrest) except error, (errno, msg): ! if errno != arg[0]: ! exc, arg = error, (errno, msg) ! raise exc, arg ! # Change environ to automatically call putenv() if it exists --- 334,340 ---- 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 From jlt63@users.sourceforge.net Thu Aug 8 20:46:17 2002 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:46:17 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27790 Modified Files: _hotshot.c Log Message: Patch #588561: Cygwin _hotshot patch YA Cygwin module patch very similar to other patches that I have submitted. I tested under Cygwin and Red Hat Linux 7.1. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** _hotshot.c 20 Jul 2002 00:38:01 -0000 1.24 --- _hotshot.c 8 Aug 2002 19:46:15 -0000 1.25 *************** *** 1249,1253 **** 0, /* tp_call */ 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1249,1253 ---- 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 1334,1338 **** 0, /* tp_call */ 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 1334,1338 ---- 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 1625,1629 **** --- 1625,1631 ---- LogReaderType.ob_type = &PyType_Type; + LogReaderType.tp_getattro = PyObject_GenericGetAttr; ProfilerType.ob_type = &PyType_Type; + ProfilerType.tp_getattro = PyObject_GenericGetAttr; module = Py_InitModule("_hotshot", functions); if (module != NULL) { From gvanrossum@users.sourceforge.net Thu Aug 8 20:46:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:46:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_queue,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv28332 Added Files: Tag: release21-maint test_queue Log Message: Add a dummy test_queue output file to make regrtest happy. --- NEW FILE: test_queue --- test_queue From fdrake@users.sourceforge.net Thu Aug 8 20:52:44 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:52:44 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.73.4.6,1.73.4.7 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv30522 Modified Files: Tag: release22-maint setup.py Log Message: The errno module needs to be statically linked, since it is now needed during the extension building phase. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.6 retrieving revision 1.73.4.7 diff -C2 -d -r1.73.4.6 -r1.73.4.7 *** setup.py 17 Jun 2002 17:56:10 -0000 1.73.4.6 --- setup.py 8 Aug 2002 19:52:42 -0000 1.73.4.7 *************** *** 274,279 **** # grp(3) exts.append( Extension('grp', ['grpmodule.c']) ) - # posix (UNIX) errno values - exts.append( Extension('errno', ['errnomodule.c']) ) # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) --- 274,277 ---- From fdrake@users.sourceforge.net Thu Aug 8 20:52:44 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:52:44 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.24.10.1,1.24.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30522/Modules Modified Files: Tag: release22-maint Setup.dist Log Message: The errno module needs to be statically linked, since it is now needed during the extension building phase. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.24.10.1 retrieving revision 1.24.10.2 diff -C2 -d -r1.24.10.1 -r1.24.10.2 *** Setup.dist 10 Jul 2002 19:01:25 -0000 1.24.10.1 --- Setup.dist 8 Aug 2002 19:52:42 -0000 1.24.10.2 *************** *** 98,101 **** --- 98,102 ---- posix posixmodule.c # posix (UNIX) system calls + errno errnomodule.c # posix (UNIX) errno values _sre _sre.c # Fredrik Lundh's new regular expressions new newmodule.c # Tommy Burnette's 'new' module *************** *** 167,171 **** #pwd pwdmodule.c # pwd(3) #grp grpmodule.c # grp(3) - #errno errnomodule.c # posix (UNIX) errno values #select selectmodule.c # select(2); not on ancient System V --- 168,171 ---- From fdrake@users.sourceforge.net Thu Aug 8 20:56:30 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:56:30 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.38.2.3,1.38.2.4 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv31869 Modified Files: Tag: release21-maint setup.py Log Message: The errno module needs to be statically linked, since it is now needed during the extension building phase. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.38.2.3 retrieving revision 1.38.2.4 diff -C2 -d -r1.38.2.3 -r1.38.2.4 *** setup.py 27 Dec 2001 21:51:02 -0000 1.38.2.3 --- setup.py 8 Aug 2002 19:56:28 -0000 1.38.2.4 *************** *** 216,221 **** # grp(3) exts.append( Extension('grp', ['grpmodule.c']) ) - # posix (UNIX) errno values - exts.append( Extension('errno', ['errnomodule.c']) ) # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) --- 216,219 ---- From fdrake@users.sourceforge.net Thu Aug 8 20:56:30 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:56:30 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.21,1.21.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31869/Modules Modified Files: Tag: release21-maint Setup.dist Log Message: The errno module needs to be statically linked, since it is now needed during the extension building phase. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -C2 -d -r1.21 -r1.21.2.1 *** Setup.dist 22 Mar 2001 22:18:55 -0000 1.21 --- Setup.dist 8 Aug 2002 19:56:28 -0000 1.21.2.1 *************** *** 98,101 **** --- 98,102 ---- posix posixmodule.c # posix (UNIX) system calls + errno errnomodule.c # posix (UNIX) errno values _sre _sre.c # Fredrik Lundh's new regular expressions *************** *** 163,167 **** #pwd pwdmodule.c # pwd(3) #grp grpmodule.c # grp(3) - #errno errnomodule.c # posix (UNIX) errno values #select selectmodule.c # select(2); not on ancient System V --- 164,167 ---- From tim_one@users.sourceforge.net Thu Aug 8 21:07:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:07:05 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2694/python/Lib Modified Files: socket.py Log Message: Delete junk attributes left behind by _socketobject class construction. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** socket.py 8 Aug 2002 18:11:36 -0000 1.33 --- socket.py 8 Aug 2002 20:07:03 -0000 1.34 *************** *** 179,182 **** --- 179,183 ---- for _m in _socketmethods: exec _s % (_m, _m, _m, _m) + del _m, _s if _needwrapper: From gvanrossum@users.sourceforge.net Thu Aug 8 20:46:55 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 12:46:55 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.47,1.47.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28586 Modified Files: Tag: release21-maint os.py Log Message: Backport of SF patch 590294: os._execvpe security fix (Zack Weinberg). 1) Do not attempt to exec a file which does not exist just to find out what error the operating system returns. This is an exploitable race on all platforms that support symbolic links. 2) Immediately re-raise the exception if we get an error other than errno.ENOENT or errno.ENOTDIR. This may need to be adapted for other platforms. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.47 retrieving revision 1.47.4.1 diff -C2 -d -r1.47 -r1.47.4.1 *** os.py 7 Mar 2001 09:05:44 -0000 1.47 --- os.py 8 Aug 2002 19:46:52 -0000 1.47.4.1 *************** *** 302,307 **** __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) - _notfound = None def _execvpe(file, args, env=None): if env is not None: func = execve --- 302,308 ---- __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) def _execvpe(file, args, env=None): + from errno import ENOENT, ENOTDIR + if env is not None: func = execve *************** *** 311,315 **** argrest = (args,) env = environ ! global _notfound head, tail = path.split(file) if head: --- 312,316 ---- argrest = (args,) env = environ ! head, tail = path.split(file) if head: *************** *** 321,339 **** envpath = defpath PATH = envpath.split(pathsep) - if not _notfound: - if sys.platform[:4] == 'beos': - # Process handling (fork, wait) under BeOS (up to 5.0) - # doesn't interoperate reliably with the thread interlocking - # that happens during an import. The actual error we need - # is the same on BeOS for posix.open() et al., ENOENT. - try: unlink('/_#.# ## #.#') - except error, _notfound: pass - else: - import tempfile - t = tempfile.mktemp() - # Exec a file that is guaranteed not to exist - try: execv(t, ('blah',)) - except error, _notfound: pass - exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) --- 322,325 ---- *************** *** 341,348 **** apply(func, (fullname,) + argrest) except error, (errno, msg): ! if errno != arg[0]: ! exc, arg = error, (errno, msg) ! raise exc, arg ! # Change environ to automatically call putenv() if it exists --- 327,333 ---- 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 From tim_one@users.sourceforge.net Thu Aug 8 21:19:20 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:19:20 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.1,1.2 heapq.py,1.13,1.14 httplib.py,1.63,1.64 smtplib.py,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7339/python/Lib Modified Files: _strptime.py heapq.py httplib.py smtplib.py Log Message: Whitespace normalization. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _strptime.py 19 Jul 2002 17:04:46 -0000 1.1 --- _strptime.py 8 Aug 2002 20:19:18 -0000 1.2 *************** *** 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 string of text containing time information as is returned by time.strftime() *************** *** 11,15 **** gregorian -- Calculates the Gregorian date based on the Julian day and year ! julianday -- Calculates the Julian day since the first of the year based on the Gregorian date dayofweek -- Calculates the day of the week from the Gregorian date. --- 11,15 ---- gregorian -- Calculates the Gregorian date based on the Julian day and year ! julianday -- Calculates the Julian day since the first of the year based on the Gregorian date dayofweek -- Calculates the day of the week from the Gregorian date. *************** *** 41,47 **** f_weekday -- full weekday names (7-item list) a_weekday -- abbreviated weekday names (7-item list) ! f_month -- full weekday names (14-item list; dummy value in [0], which is added by code) ! a_month -- abbreviated weekday names (13-item list, dummy value in [0], which is added by code) am_pm -- AM/PM representation (2-item list) --- 41,47 ---- f_weekday -- full weekday names (7-item list) a_weekday -- abbreviated weekday names (7-item list) ! f_month -- full weekday names (14-item list; dummy value in [0], which is added by code) ! a_month -- abbreviated weekday names (13-item list, dummy value in [0], which is added by code) am_pm -- AM/PM representation (2-item list) *************** *** 49,61 **** LC_date -- format string for date representation (string) LC_time -- format string for time representation (string) ! timezone -- daylight- and non-daylight-savings timezone representation ! (3-item list; code tacks on blank item at end for possible lack of timezone such as UTC) lang -- Language used by instance (string) ! """ ! def __init__(self, f_weekday=None, a_weekday=None, f_month=None, ! a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None, timezone=None, lang=None): """Optionally set attributes with passed-in values.""" --- 49,61 ---- LC_date -- format string for date representation (string) LC_time -- format string for time representation (string) ! timezone -- daylight- and non-daylight-savings timezone representation ! (3-item list; code tacks on blank item at end for possible lack of timezone such as UTC) lang -- Language used by instance (string) ! """ ! def __init__(self, f_weekday=None, a_weekday=None, f_month=None, ! a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None, timezone=None, lang=None): """Optionally set attributes with passed-in values.""" *************** *** 118,124 **** return self.__a_weekday ! f_weekday = property(__get_f_weekday, __set_nothing, doc="Full weekday names") ! a_weekday = property(__get_a_weekday, __set_nothing, doc="Abbreviated weekday names") --- 118,124 ---- return self.__a_weekday ! f_weekday = property(__get_f_weekday, __set_nothing, doc="Full weekday names") ! a_weekday = property(__get_a_weekday, __set_nothing, doc="Abbreviated weekday names") *************** *** 188,192 **** if not self.__a_weekday: self.__a_weekday = a_weekday if not self.__f_weekday: self.__f_weekday = f_weekday ! def __calc_month(self): """Set self.__f_month and self.__a_month using the calendar module.""" --- 188,192 ---- if not self.__a_weekday: self.__a_weekday = a_weekday if not self.__f_weekday: self.__f_weekday = f_weekday ! def __calc_month(self): """Set self.__f_month and self.__a_month using the calendar module.""" *************** *** 198,206 **** def __calc_am_pm(self): """Set self.__am_pm by using time.strftime(). ! ! The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really ! that magical; just happened to have used it everywhere else where a static date was needed. ! """ am_pm = [] --- 198,206 ---- def __calc_am_pm(self): """Set self.__am_pm by using time.strftime(). ! ! The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really ! that magical; just happened to have used it everywhere else where a static date was needed. ! """ am_pm = [] *************** *** 212,219 **** def __calc_date_time(self): """Set self.__date_time, self.__date, & self.__time by using time.strftime(). ! ! Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of ! overloaded numbers is minimized. The order in which searches for ! values within the format string is very important; it eliminates possible ambiguity for what something represents. --- 212,219 ---- def __calc_date_time(self): """Set self.__date_time, self.__date, & self.__time by using time.strftime(). ! ! Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of ! overloaded numbers is minimized. The order in which searches for ! values within the format string is very important; it eliminates possible ambiguity for what something represents. *************** *** 256,261 **** def __calc_timezone(self): """Set self.__timezone by using time.tzname. ! ! Empty string used for matching when timezone is not used/needed such as with UTC. --- 256,261 ---- def __calc_timezone(self): """Set self.__timezone by using time.tzname. ! ! Empty string used for matching when timezone is not used/needed such as with UTC. *************** *** 264,270 **** def __calc_lang(self): ! """Set self.lang by using locale.getlocale() or locale.getdefaultlocale(). ! """ current_lang = locale.getlocale(locale.LC_TIME)[0] --- 264,270 ---- def __calc_lang(self): ! """Set self.lang by using locale.getlocale() or locale.getdefaultlocale(). ! """ current_lang = locale.getlocale(locale.LC_TIME)[0] *************** *** 278,282 **** """Initialize instance with non-locale regexes and store LocaleTime object.""" super(TimeRE,self).__init__({ ! 'd': r"(?P3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is #to make %c from ANSI #C work --- 278,282 ---- """Initialize instance with non-locale regexes and store LocaleTime object.""" super(TimeRE,self).__init__({ ! 'd': r"(?P3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is #to make %c from ANSI #C work *************** *** 300,313 **** 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': --- 300,313 ---- 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': *************** *** 320,338 **** 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): """Convert a list to a regex string for matching directive.""" def sorter(a, b): """Sort based on length. ! Done in case for some strange reason that names in the locale only differ by a suffix and thus want the name with the suffix to match first. ! """ try: a_length = len(a) --- 320,338 ---- 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): """Convert a list to a regex string for matching directive.""" def sorter(a, b): """Sort based on length. ! Done in case for some strange reason that names in the locale only differ by a suffix and thus want the name with the suffix to match first. ! """ try: a_length = len(a) *************** *** 341,345 **** except TypeError: b_length = 0 return cmp(b_length, a_length) ! to_convert = to_convert[:] #Don't want to change value in-place. to_convert.sort(sorter) --- 341,345 ---- except TypeError: b_length = 0 return cmp(b_length, a_length) ! to_convert = to_convert[:] #Don't want to change value in-place. to_convert.sort(sorter) *************** *** 358,362 **** while format.find('%') != -1: directive_index = format.index('%')+1 ! processed_format = "%s%s%s" % (processed_format, format[:directive_index-1], self[format[directive_index]]) --- 358,362 ---- while format.find('%') != -1: directive_index = format.index('%')+1 ! processed_format = "%s%s%s" % (processed_format, format[:directive_index-1], self[format[directive_index]]) *************** *** 372,381 **** def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Convert data_string to a time struct based on the format string or re object; will return an re object for format if data_string is False. ! ! The object passed in for format may either be a re object compiled by ! strptime() or a format string. If False is passed in for data_string ! then an re object for format will be returned. The re object must be used with the same language as used to compile the re object. ! """ locale_time = LocaleTime() --- 372,381 ---- def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Convert data_string to a time struct based on the format string or re object; will return an re object for format if data_string is False. ! ! The object passed in for format may either be a re object compiled by ! strptime() or a format string. If False is passed in for data_string ! then an re object for format will be returned. The re object must be used with the same language as used to compile the re object. ! """ locale_time = LocaleTime() Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** heapq.py 7 Aug 2002 18:58:11 -0000 1.13 --- heapq.py 8 Aug 2002 20:19:18 -0000 1.14 *************** *** 232,236 **** rightpos = childpos + 1 if rightpos < endpos and heap[rightpos] <= heap[childpos]: ! childpos = rightpos # Move the smaller child up. heap[pos] = heap[childpos] --- 232,236 ---- rightpos = childpos + 1 if rightpos < endpos and heap[rightpos] <= heap[childpos]: ! childpos = rightpos # Move the smaller child up. heap[pos] = heap[childpos] Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** httplib.py 25 Jul 2002 16:10:38 -0000 1.63 --- httplib.py 8 Aug 2002 20:19:18 -0000 1.64 *************** *** 561,565 **** def _output(self, s): """Add a line of output to the current request buffer. ! Assumes that the line does *not* end with \\r\\n. """ --- 561,565 ---- def _output(self, s): """Add a line of output to the current request buffer. ! Assumes that the line does *not* end with \\r\\n. """ Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** smtplib.py 28 Jul 2002 16:52:01 -0000 1.60 --- smtplib.py 8 Aug 2002 20:19:18 -0000 1.61 *************** *** 531,535 **** def encode_plain(user, password): return encode_base64("%s\0%s\0%s" % (user, user, password), eol="") ! AUTH_PLAIN = "PLAIN" --- 531,535 ---- def encode_plain(user, password): return encode_base64("%s\0%s\0%s" % (user, user, password), eol="") ! AUTH_PLAIN = "PLAIN" From tim_one@users.sourceforge.net Thu Aug 8 21:19:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:19:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.20,1.21 test_format.py,1.15,1.16 test_slice.py,1.2,1.3 test_socket.py,1.53,1.54 test_strptime.py,1.1,1.2 test_whichdb.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7339/python/Lib/test Modified Files: string_tests.py test_format.py test_slice.py test_socket.py test_strptime.py test_whichdb.py Log Message: Whitespace normalization. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** string_tests.py 6 Aug 2002 16:58:20 -0000 1.20 --- string_tests.py 8 Aug 2002 20:19:19 -0000 1.21 *************** *** 315,317 **** vereq('asdf' in 'asd', False) vereq('asdf' in '', False) - --- 315,316 ---- Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_format.py 28 Jul 2002 16:44:23 -0000 1.15 --- test_format.py 8 Aug 2002 20:19:19 -0000 1.16 *************** *** 222,224 **** test_exc('%d', '1', TypeError, "int argument required") test_exc('%g', '1', TypeError, "float argument required") - --- 222,223 ---- Index: test_slice.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_slice.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_slice.py 23 Jul 2002 19:04:02 -0000 1.2 --- test_slice.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 12,14 **** vereq(slice(100, -100, -1).indices(10), slice(None, None, -1).indices(10)) vereq(slice(-100L, 100L, 2L).indices(10), (0, 10, 2)) - --- 12,13 ---- Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** test_socket.py 8 Aug 2002 01:00:28 -0000 1.53 --- test_socket.py 8 Aug 2002 20:19:19 -0000 1.54 *************** *** 572,576 **** """Repeat the tests from FileObjectClassTestCase with bufsize==0. ! In this case (and in this case only), it should be possible to create a file object, read a line from it, create another file --- 572,576 ---- """Repeat the tests from FileObjectClassTestCase with bufsize==0. ! In this case (and in this case only), it should be possible to create a file object, read a line from it, create another file Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_strptime.py 19 Jul 2002 17:04:46 -0000 1.1 --- test_strptime.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 21,25 **** def compare_against_time(self, testing, directive, tuple_position, error_msg): ! """Helper method that tests testing against directive based on the tuple_position of time_tuple. Uses error_msg as error message. --- 21,25 ---- def compare_against_time(self, testing, directive, tuple_position, error_msg): ! """Helper method that tests testing against directive based on the tuple_position of time_tuple. Uses error_msg as error message. *************** *** 29,37 **** self.failUnless(strftime_output in testing, "%s: not found in tuple" % error_msg) self.failUnless(comparison == strftime_output, "%s: position within tuple incorrect; %s != %s" % (error_msg, comparison, strftime_output)) ! def test_weekday(self): ! """Make sure that full and abbreviated weekday names are correct in both string and position with tuple. ! """ self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, "Testing of full weekday name failed") --- 29,37 ---- self.failUnless(strftime_output in testing, "%s: not found in tuple" % error_msg) self.failUnless(comparison == strftime_output, "%s: position within tuple incorrect; %s != %s" % (error_msg, comparison, strftime_output)) ! def test_weekday(self): ! """Make sure that full and abbreviated weekday names are correct in both string and position with tuple. ! """ self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, "Testing of full weekday name failed") *************** *** 39,43 **** def test_month(self): ! """Test full and abbreviated month names; both string and position within the tuple. --- 39,43 ---- def test_month(self): ! """Test full and abbreviated month names; both string and position within the tuple. *************** *** 126,132 **** compiled = self.time_re.compile(r"%a %b") found = compiled.match("%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4])) ! self.failUnless(found, "Match failed with '%s' regex and '%s' string" % (compiled.pattern, "%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4]))) ! self.failUnless(found.group('a') == self.locale_time.a_weekday[4] and found.group('b') == self.locale_time.a_month[4], "re object couldn't find the abbreviated weekday month in '%s' using '%s'; group 'a' = '%s', group 'b' = %s'" % (found.string, found.re.pattern, found.group('a'), found.group('b'))) for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S','U','w','W','x','X','y','Y','Z','%'): --- 126,132 ---- compiled = self.time_re.compile(r"%a %b") found = compiled.match("%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4])) ! self.failUnless(found, "Match failed with '%s' regex and '%s' string" % (compiled.pattern, "%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4]))) ! self.failUnless(found.group('a') == self.locale_time.a_weekday[4] and found.group('b') == self.locale_time.a_month[4], "re object couldn't find the abbreviated weekday month in '%s' using '%s'; group 'a' = '%s', group 'b' = %s'" % (found.string, found.re.pattern, found.group('a'), found.group('b'))) for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S','U','w','W','x','X','y','Y','Z','%'): *************** *** 200,206 **** def test_timezone(self): """Test timezone directives. ! When gmtime() is used with %Z, entire result of strftime() is empty. ! """ time_tuple = time.localtime() --- 200,206 ---- def test_timezone(self): """Test timezone directives. ! When gmtime() is used with %Z, entire result of strftime() is empty. ! """ time_tuple = time.localtime() *************** *** 247,251 **** strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") self.failUnless(strp_output[7] == self.time_tuple[7], "strptime did not trigger julianday(); %s != %s" % (strp_output[7], self.time_tuple[7])) ! def test_gregorian_result(self): """Test gregorian.""" --- 247,251 ---- strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") self.failUnless(strp_output[7] == self.time_tuple[7], "strptime did not trigger julianday(); %s != %s" % (strp_output[7], self.time_tuple[7])) ! def test_gregorian_result(self): """Test gregorian.""" Index: test_whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_whichdb.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_whichdb.py 2 Aug 2002 17:10:10 -0000 1.1 --- test_whichdb.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 42,46 **** except ImportError: continue ! def test_whichdb_name(self,name=name,mod=mod): """Check whether whichdb correctly guesses module name --- 42,46 ---- except ImportError: continue ! def test_whichdb_name(self,name=name,mod=mod): """Check whether whichdb correctly guesses module name *************** *** 61,63 **** if __name__ == "__main__": test_main() - --- 61,62 ---- From tim_one@users.sourceforge.net Thu Aug 8 21:19:25 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:19:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.10,1.11 ascii.py,1.1,1.2 base64_codec.py,1.2,1.3 charmap.py,1.2,1.3 cp037.py,1.3,1.4 cp1006.py,1.3,1.4 cp1026.py,1.3,1.4 cp1140.py,1.1,1.2 cp1250.py,1.3,1.4 cp1251.py,1.3,1.4 cp1252.py,1.3,1.4 cp1253.py,1.3,1.4 cp1254.py,1.3,1.4 cp1255.py,1.3,1.4 cp1256.py,1.3,1.4 cp1257.py,1.3,1.4 cp1258.py,1.3,1.4 cp424.py,1.3,1.4 cp437.py,1.3,1.4 cp500.py,1.3,1.4 cp737.py,1.3,1.4 cp775.py,1.3,1.4 cp850.py,1.3,1.4 cp852.py,1.3,1.4 cp855.py,1.3,1.4 cp856.py,1.4,1.5 cp857.py,1.3,1.4 cp860.py,1.3,1.4 cp861.py,1.3,1.4 cp862.py,1.3,1.4 cp863.py,1.3,1.4 cp864.py,1.3,1.4 cp865.py,1.3,1.4 cp866.py,1.3,1.4 cp869.py,1.3,1.4 cp874.py,1.3,1.4 cp875.py,1.3,1.4 hex_codec.py,1.2,1.3 iso8859_1.py,1.3,1.4 iso8859_10.py,1.3,1.4 iso8859_13.py,1.3,1.4 iso8859_14.py,1.3,1.4 iso8859_15.py,1.3,1.4 iso8859_2.py,1.3,1.4 iso8859_3.py,1.3,1.4 iso8859_4.py,1.3,1.4 iso8859_5.py,1.3,1.4 iso8859_6.py,1.3,1.4 iso8859_7.py,1.3,1.4 iso8859_8.py,1.3,1.4 iso8859_9.py,1.3,1.4 koi8_r.py,1.3,1.4 latin_1.py,1.1,1.2 mac_cyrillic.py,1.3,1.4 mac_greek.py,1.3,1.4 mac_iceland.py,1.3,1.4 mac_latin2.py,1.3,1.4 mac_roman.py,1.3,1.4 mac_turkish.py,1.3,1.4 mbcs.py,1.2,1.3 palmos.py,1.1,1.2 raw_unicode_escape.py,1.1,1.2 rot_13.py,1.2,1.3 undefined.py,1.1,1.2 unicode_escape.py,1.1,1.2 unicode_internal.py,1.1,1.2 utf_16.py,1.3,1.4 utf_16_be.py,1.2,1.3 utf_16_le.py,1.2,1.3 utf_7.py,1.1,1.2 utf_8.py,1.1,1.2 uu_codec.py,1.2,1.3 zlib_codec.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv7339/python/Lib/encodings Modified Files: __init__.py ascii.py base64_codec.py charmap.py cp037.py cp1006.py cp1026.py cp1140.py cp1250.py cp1251.py cp1252.py cp1253.py cp1254.py cp1255.py cp1256.py cp1257.py cp1258.py cp424.py cp437.py cp500.py cp737.py cp775.py cp850.py cp852.py cp855.py cp856.py cp857.py cp860.py cp861.py cp862.py cp863.py cp864.py cp865.py cp866.py cp869.py cp874.py cp875.py hex_codec.py iso8859_1.py iso8859_10.py iso8859_13.py iso8859_14.py iso8859_15.py iso8859_2.py iso8859_3.py iso8859_4.py iso8859_5.py iso8859_6.py iso8859_7.py iso8859_8.py iso8859_9.py koi8_r.py latin_1.py mac_cyrillic.py mac_greek.py mac_iceland.py mac_latin2.py mac_roman.py mac_turkish.py mbcs.py palmos.py raw_unicode_escape.py rot_13.py undefined.py unicode_escape.py unicode_internal.py utf_16.py utf_16_be.py utf_16_le.py utf_7.py utf_8.py uu_codec.py zlib_codec.py Log Message: Whitespace normalization. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** __init__.py 29 Jul 2002 14:05:24 -0000 1.10 --- __init__.py 8 Aug 2002 20:19:18 -0000 1.11 *************** *** 40,44 **** def search_function(encoding): ! # Cache lookup entry = _cache.get(encoding, _unknown) --- 40,44 ---- def search_function(encoding): ! # Cache lookup entry = _cache.get(encoding, _unknown) *************** *** 73,78 **** # Cache misses _cache[encoding] = None ! return None ! # Now ask the module for the registry entry entry = tuple(getregentry()) --- 73,78 ---- # Cache misses _cache[encoding] = None ! return None ! # Now ask the module for the registry entry entry = tuple(getregentry()) Index: ascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/ascii.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ascii.py 10 Mar 2000 23:17:18 -0000 1.1 --- ascii.py 8 Aug 2002 20:19:18 -0000 1.2 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: base64_codec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/base64_codec.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** base64_codec.py 20 Sep 2001 10:33:38 -0000 1.2 --- base64_codec.py 8 Aug 2002 20:19:18 -0000 1.3 *************** *** 52,56 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 52,56 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: charmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/charmap.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** charmap.py 13 Aug 2001 13:48:55 -0000 1.2 --- charmap.py 8 Aug 2002 20:19:18 -0000 1.3 *************** *** 3,7 **** Use this codec directly rather than through the automatic conversion mechanisms supplied by unicode() and .encode(). ! Written by Marc-Andre Lemburg (mal@lemburg.com). --- 3,7 ---- Use this codec directly rather than through the automatic conversion mechanisms supplied by unicode() and .encode(). ! Written by Marc-Andre Lemburg (mal@lemburg.com). *************** *** 32,36 **** return Codec.encode(input,errors,self.mapping) ! class StreamReader(Codec,codecs.StreamReader): --- 32,36 ---- return Codec.encode(input,errors,self.mapping) ! class StreamReader(Codec,codecs.StreamReader): *************** *** 49,51 **** return (Codec.encode,Codec.decode,StreamReader,StreamWriter) - --- 49,50 ---- Index: cp037.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp037.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp037.py 16 May 2001 09:41:45 -0000 1.3 --- cp037.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,277 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x00a0, # NO-BREAK SPACE ! 0x0042: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0043: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0044: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0045: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0046: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0047: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0048: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0049: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x004a: 0x00a2, # CENT SIGN ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x007c, # VERTICAL LINE ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0052: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0053: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0054: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0055: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0056: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0057: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0058: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0059: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x005a: 0x0021, # EXCLAMATION MARK ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x00ac, # NOT SIGN ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0063: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0064: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0065: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0066: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x0067: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0068: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0069: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x006a: 0x00a6, # BROKEN BAR ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x0071: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0072: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0073: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0074: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0075: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x0076: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x0077: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0078: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: 0x00f0, # LATIN SMALL LETTER ETH (ICELANDIC) ! 0x008d: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x008e: 0x00fe, # LATIN SMALL LETTER THORN (ICELANDIC) ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x009b: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x009c: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ab: 0x00bf, # INVERTED QUESTION MARK ! 0x00ac: 0x00d0, # LATIN CAPITAL LETTER ETH (ICELANDIC) ! 0x00ad: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ae: 0x00de, # LATIN CAPITAL LETTER THORN (ICELANDIC) ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x005e, # CIRCUMFLEX ACCENT ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x005b, # LEFT SQUARE BRACKET ! 0x00bb: 0x005d, # RIGHT SQUARE BRACKET ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x00cc: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x00cd: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x00ce: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00cf: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x00dc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00dd: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x00de: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00df: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00ec: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x00ed: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00fc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x00fd: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00fe: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ff: 0x009f, # CONTROL }) --- 38,277 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x00a0, # NO-BREAK SPACE ! 0x0042: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0043: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0044: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0045: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0046: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0047: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0048: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0049: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x004a: 0x00a2, # CENT SIGN ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x007c, # VERTICAL LINE ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0052: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0053: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0054: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0055: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0056: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0057: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0058: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0059: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x005a: 0x0021, # EXCLAMATION MARK ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x00ac, # NOT SIGN ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0063: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0064: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0065: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0066: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x0067: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0068: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0069: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x006a: 0x00a6, # BROKEN BAR ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x0071: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0072: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0073: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0074: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0075: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x0076: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x0077: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0078: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: 0x00f0, # LATIN SMALL LETTER ETH (ICELANDIC) ! 0x008d: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x008e: 0x00fe, # LATIN SMALL LETTER THORN (ICELANDIC) ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x009b: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x009c: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ab: 0x00bf, # INVERTED QUESTION MARK ! 0x00ac: 0x00d0, # LATIN CAPITAL LETTER ETH (ICELANDIC) ! 0x00ad: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ae: 0x00de, # LATIN CAPITAL LETTER THORN (ICELANDIC) ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x005e, # CIRCUMFLEX ACCENT ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x005b, # LEFT SQUARE BRACKET ! 0x00bb: 0x005d, # RIGHT SQUARE BRACKET ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x00cc: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x00cd: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x00ce: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00cf: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x00dc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00dd: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x00de: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00df: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00ec: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x00ed: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00fc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x00fd: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00fe: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ff: 0x009f, # CONTROL }) Index: cp1006.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1006.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1006.py 16 May 2001 09:41:45 -0000 1.3 --- cp1006.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,135 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x06f0, # EXTENDED ARABIC-INDIC DIGIT ZERO ! 0x00a2: 0x06f1, # EXTENDED ARABIC-INDIC DIGIT ONE ! 0x00a3: 0x06f2, # EXTENDED ARABIC-INDIC DIGIT TWO ! 0x00a4: 0x06f3, # EXTENDED ARABIC-INDIC DIGIT THREE ! 0x00a5: 0x06f4, # EXTENDED ARABIC-INDIC DIGIT FOUR ! 0x00a6: 0x06f5, # EXTENDED ARABIC-INDIC DIGIT FIVE ! 0x00a7: 0x06f6, # EXTENDED ARABIC-INDIC DIGIT SIX ! 0x00a8: 0x06f7, # EXTENDED ARABIC-INDIC DIGIT SEVEN ! 0x00a9: 0x06f8, # EXTENDED ARABIC-INDIC DIGIT EIGHT ! 0x00aa: 0x06f9, # EXTENDED ARABIC-INDIC DIGIT NINE ! 0x00ab: 0x060c, # ARABIC COMMA ! 0x00ac: 0x061b, # ARABIC SEMICOLON ! 0x00ae: 0x061f, # ARABIC QUESTION MARK ! 0x00af: 0xfe81, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM ! 0x00b0: 0xfe8d, # ARABIC LETTER ALEF ISOLATED FORM ! 0x00b1: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM ! 0x00b2: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM ! 0x00b3: 0xfe8f, # ARABIC LETTER BEH ISOLATED FORM ! 0x00b4: 0xfe91, # ARABIC LETTER BEH INITIAL FORM ! 0x00b5: 0xfb56, # ARABIC LETTER PEH ISOLATED FORM ! 0x00b6: 0xfb58, # ARABIC LETTER PEH INITIAL FORM ! 0x00b7: 0xfe93, # ARABIC LETTER TEH MARBUTA ISOLATED FORM ! 0x00b8: 0xfe95, # ARABIC LETTER TEH ISOLATED FORM ! 0x00b9: 0xfe97, # ARABIC LETTER TEH INITIAL FORM ! 0x00ba: 0xfb66, # ARABIC LETTER TTEH ISOLATED FORM ! 0x00bb: 0xfb68, # ARABIC LETTER TTEH INITIAL FORM ! 0x00bc: 0xfe99, # ARABIC LETTER THEH ISOLATED FORM ! 0x00bd: 0xfe9b, # ARABIC LETTER THEH INITIAL FORM ! 0x00be: 0xfe9d, # ARABIC LETTER JEEM ISOLATED FORM ! 0x00bf: 0xfe9f, # ARABIC LETTER JEEM INITIAL FORM ! 0x00c0: 0xfb7a, # ARABIC LETTER TCHEH ISOLATED FORM ! 0x00c1: 0xfb7c, # ARABIC LETTER TCHEH INITIAL FORM ! 0x00c2: 0xfea1, # ARABIC LETTER HAH ISOLATED FORM ! 0x00c3: 0xfea3, # ARABIC LETTER HAH INITIAL FORM ! 0x00c4: 0xfea5, # ARABIC LETTER KHAH ISOLATED FORM ! 0x00c5: 0xfea7, # ARABIC LETTER KHAH INITIAL FORM ! 0x00c6: 0xfea9, # ARABIC LETTER DAL ISOLATED FORM ! 0x00c7: 0xfb84, # ARABIC LETTER DAHAL ISOLATED FORMN ! 0x00c8: 0xfeab, # ARABIC LETTER THAL ISOLATED FORM ! 0x00c9: 0xfead, # ARABIC LETTER REH ISOLATED FORM ! 0x00ca: 0xfb8c, # ARABIC LETTER RREH ISOLATED FORM ! 0x00cb: 0xfeaf, # ARABIC LETTER ZAIN ISOLATED FORM ! 0x00cc: 0xfb8a, # ARABIC LETTER JEH ISOLATED FORM ! 0x00cd: 0xfeb1, # ARABIC LETTER SEEN ISOLATED FORM ! 0x00ce: 0xfeb3, # ARABIC LETTER SEEN INITIAL FORM ! 0x00cf: 0xfeb5, # ARABIC LETTER SHEEN ISOLATED FORM ! 0x00d0: 0xfeb7, # ARABIC LETTER SHEEN INITIAL FORM ! 0x00d1: 0xfeb9, # ARABIC LETTER SAD ISOLATED FORM ! 0x00d2: 0xfebb, # ARABIC LETTER SAD INITIAL FORM ! 0x00d3: 0xfebd, # ARABIC LETTER DAD ISOLATED FORM ! 0x00d4: 0xfebf, # ARABIC LETTER DAD INITIAL FORM ! 0x00d5: 0xfec1, # ARABIC LETTER TAH ISOLATED FORM ! 0x00d6: 0xfec5, # ARABIC LETTER ZAH ISOLATED FORM ! 0x00d7: 0xfec9, # ARABIC LETTER AIN ISOLATED FORM ! 0x00d8: 0xfeca, # ARABIC LETTER AIN FINAL FORM ! 0x00d9: 0xfecb, # ARABIC LETTER AIN INITIAL FORM ! 0x00da: 0xfecc, # ARABIC LETTER AIN MEDIAL FORM ! 0x00db: 0xfecd, # ARABIC LETTER GHAIN ISOLATED FORM ! 0x00dc: 0xfece, # ARABIC LETTER GHAIN FINAL FORM ! 0x00dd: 0xfecf, # ARABIC LETTER GHAIN INITIAL FORM ! 0x00de: 0xfed0, # ARABIC LETTER GHAIN MEDIAL FORM ! 0x00df: 0xfed1, # ARABIC LETTER FEH ISOLATED FORM ! 0x00e0: 0xfed3, # ARABIC LETTER FEH INITIAL FORM ! 0x00e1: 0xfed5, # ARABIC LETTER QAF ISOLATED FORM ! 0x00e2: 0xfed7, # ARABIC LETTER QAF INITIAL FORM ! 0x00e3: 0xfed9, # ARABIC LETTER KAF ISOLATED FORM ! 0x00e4: 0xfedb, # ARABIC LETTER KAF INITIAL FORM ! 0x00e5: 0xfb92, # ARABIC LETTER GAF ISOLATED FORM ! 0x00e6: 0xfb94, # ARABIC LETTER GAF INITIAL FORM ! 0x00e7: 0xfedd, # ARABIC LETTER LAM ISOLATED FORM ! 0x00e8: 0xfedf, # ARABIC LETTER LAM INITIAL FORM ! 0x00e9: 0xfee0, # ARABIC LETTER LAM MEDIAL FORM ! 0x00ea: 0xfee1, # ARABIC LETTER MEEM ISOLATED FORM ! 0x00eb: 0xfee3, # ARABIC LETTER MEEM INITIAL FORM ! 0x00ec: 0xfb9e, # ARABIC LETTER NOON GHUNNA ISOLATED FORM ! 0x00ed: 0xfee5, # ARABIC LETTER NOON ISOLATED FORM ! 0x00ee: 0xfee7, # ARABIC LETTER NOON INITIAL FORM ! 0x00ef: 0xfe85, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM ! 0x00f0: 0xfeed, # ARABIC LETTER WAW ISOLATED FORM ! 0x00f1: 0xfba6, # ARABIC LETTER HEH GOAL ISOLATED FORM ! 0x00f2: 0xfba8, # ARABIC LETTER HEH GOAL INITIAL FORM ! 0x00f3: 0xfba9, # ARABIC LETTER HEH GOAL MEDIAL FORM ! 0x00f4: 0xfbaa, # ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM ! 0x00f5: 0xfe80, # ARABIC LETTER HAMZA ISOLATED FORM ! 0x00f6: 0xfe89, # ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM ! 0x00f7: 0xfe8a, # ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM ! 0x00f8: 0xfe8b, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM ! 0x00f9: 0xfef1, # ARABIC LETTER YEH ISOLATED FORM ! 0x00fa: 0xfef2, # ARABIC LETTER YEH FINAL FORM ! 0x00fb: 0xfef3, # ARABIC LETTER YEH INITIAL FORM ! 0x00fc: 0xfbb0, # ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM ! 0x00fd: 0xfbae, # ARABIC LETTER YEH BARREE ISOLATED FORM ! 0x00fe: 0xfe7c, # ARABIC SHADDA ISOLATED FORM ! 0x00ff: 0xfe7d, # ARABIC SHADDA MEDIAL FORM }) --- 38,135 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x06f0, # EXTENDED ARABIC-INDIC DIGIT ZERO ! 0x00a2: 0x06f1, # EXTENDED ARABIC-INDIC DIGIT ONE ! 0x00a3: 0x06f2, # EXTENDED ARABIC-INDIC DIGIT TWO ! 0x00a4: 0x06f3, # EXTENDED ARABIC-INDIC DIGIT THREE ! 0x00a5: 0x06f4, # EXTENDED ARABIC-INDIC DIGIT FOUR ! 0x00a6: 0x06f5, # EXTENDED ARABIC-INDIC DIGIT FIVE ! 0x00a7: 0x06f6, # EXTENDED ARABIC-INDIC DIGIT SIX ! 0x00a8: 0x06f7, # EXTENDED ARABIC-INDIC DIGIT SEVEN ! 0x00a9: 0x06f8, # EXTENDED ARABIC-INDIC DIGIT EIGHT ! 0x00aa: 0x06f9, # EXTENDED ARABIC-INDIC DIGIT NINE ! 0x00ab: 0x060c, # ARABIC COMMA ! 0x00ac: 0x061b, # ARABIC SEMICOLON ! 0x00ae: 0x061f, # ARABIC QUESTION MARK ! 0x00af: 0xfe81, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM ! 0x00b0: 0xfe8d, # ARABIC LETTER ALEF ISOLATED FORM ! 0x00b1: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM ! 0x00b2: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM ! 0x00b3: 0xfe8f, # ARABIC LETTER BEH ISOLATED FORM ! 0x00b4: 0xfe91, # ARABIC LETTER BEH INITIAL FORM ! 0x00b5: 0xfb56, # ARABIC LETTER PEH ISOLATED FORM ! 0x00b6: 0xfb58, # ARABIC LETTER PEH INITIAL FORM ! 0x00b7: 0xfe93, # ARABIC LETTER TEH MARBUTA ISOLATED FORM ! 0x00b8: 0xfe95, # ARABIC LETTER TEH ISOLATED FORM ! 0x00b9: 0xfe97, # ARABIC LETTER TEH INITIAL FORM ! 0x00ba: 0xfb66, # ARABIC LETTER TTEH ISOLATED FORM ! 0x00bb: 0xfb68, # ARABIC LETTER TTEH INITIAL FORM ! 0x00bc: 0xfe99, # ARABIC LETTER THEH ISOLATED FORM ! 0x00bd: 0xfe9b, # ARABIC LETTER THEH INITIAL FORM ! 0x00be: 0xfe9d, # ARABIC LETTER JEEM ISOLATED FORM ! 0x00bf: 0xfe9f, # ARABIC LETTER JEEM INITIAL FORM ! 0x00c0: 0xfb7a, # ARABIC LETTER TCHEH ISOLATED FORM ! 0x00c1: 0xfb7c, # ARABIC LETTER TCHEH INITIAL FORM ! 0x00c2: 0xfea1, # ARABIC LETTER HAH ISOLATED FORM ! 0x00c3: 0xfea3, # ARABIC LETTER HAH INITIAL FORM ! 0x00c4: 0xfea5, # ARABIC LETTER KHAH ISOLATED FORM ! 0x00c5: 0xfea7, # ARABIC LETTER KHAH INITIAL FORM ! 0x00c6: 0xfea9, # ARABIC LETTER DAL ISOLATED FORM ! 0x00c7: 0xfb84, # ARABIC LETTER DAHAL ISOLATED FORMN ! 0x00c8: 0xfeab, # ARABIC LETTER THAL ISOLATED FORM ! 0x00c9: 0xfead, # ARABIC LETTER REH ISOLATED FORM ! 0x00ca: 0xfb8c, # ARABIC LETTER RREH ISOLATED FORM ! 0x00cb: 0xfeaf, # ARABIC LETTER ZAIN ISOLATED FORM ! 0x00cc: 0xfb8a, # ARABIC LETTER JEH ISOLATED FORM ! 0x00cd: 0xfeb1, # ARABIC LETTER SEEN ISOLATED FORM ! 0x00ce: 0xfeb3, # ARABIC LETTER SEEN INITIAL FORM ! 0x00cf: 0xfeb5, # ARABIC LETTER SHEEN ISOLATED FORM ! 0x00d0: 0xfeb7, # ARABIC LETTER SHEEN INITIAL FORM ! 0x00d1: 0xfeb9, # ARABIC LETTER SAD ISOLATED FORM ! 0x00d2: 0xfebb, # ARABIC LETTER SAD INITIAL FORM ! 0x00d3: 0xfebd, # ARABIC LETTER DAD ISOLATED FORM ! 0x00d4: 0xfebf, # ARABIC LETTER DAD INITIAL FORM ! 0x00d5: 0xfec1, # ARABIC LETTER TAH ISOLATED FORM ! 0x00d6: 0xfec5, # ARABIC LETTER ZAH ISOLATED FORM ! 0x00d7: 0xfec9, # ARABIC LETTER AIN ISOLATED FORM ! 0x00d8: 0xfeca, # ARABIC LETTER AIN FINAL FORM ! 0x00d9: 0xfecb, # ARABIC LETTER AIN INITIAL FORM ! 0x00da: 0xfecc, # ARABIC LETTER AIN MEDIAL FORM ! 0x00db: 0xfecd, # ARABIC LETTER GHAIN ISOLATED FORM ! 0x00dc: 0xfece, # ARABIC LETTER GHAIN FINAL FORM ! 0x00dd: 0xfecf, # ARABIC LETTER GHAIN INITIAL FORM ! 0x00de: 0xfed0, # ARABIC LETTER GHAIN MEDIAL FORM ! 0x00df: 0xfed1, # ARABIC LETTER FEH ISOLATED FORM ! 0x00e0: 0xfed3, # ARABIC LETTER FEH INITIAL FORM ! 0x00e1: 0xfed5, # ARABIC LETTER QAF ISOLATED FORM ! 0x00e2: 0xfed7, # ARABIC LETTER QAF INITIAL FORM ! 0x00e3: 0xfed9, # ARABIC LETTER KAF ISOLATED FORM ! 0x00e4: 0xfedb, # ARABIC LETTER KAF INITIAL FORM ! 0x00e5: 0xfb92, # ARABIC LETTER GAF ISOLATED FORM ! 0x00e6: 0xfb94, # ARABIC LETTER GAF INITIAL FORM ! 0x00e7: 0xfedd, # ARABIC LETTER LAM ISOLATED FORM ! 0x00e8: 0xfedf, # ARABIC LETTER LAM INITIAL FORM ! 0x00e9: 0xfee0, # ARABIC LETTER LAM MEDIAL FORM ! 0x00ea: 0xfee1, # ARABIC LETTER MEEM ISOLATED FORM ! 0x00eb: 0xfee3, # ARABIC LETTER MEEM INITIAL FORM ! 0x00ec: 0xfb9e, # ARABIC LETTER NOON GHUNNA ISOLATED FORM ! 0x00ed: 0xfee5, # ARABIC LETTER NOON ISOLATED FORM ! 0x00ee: 0xfee7, # ARABIC LETTER NOON INITIAL FORM ! 0x00ef: 0xfe85, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM ! 0x00f0: 0xfeed, # ARABIC LETTER WAW ISOLATED FORM ! 0x00f1: 0xfba6, # ARABIC LETTER HEH GOAL ISOLATED FORM ! 0x00f2: 0xfba8, # ARABIC LETTER HEH GOAL INITIAL FORM ! 0x00f3: 0xfba9, # ARABIC LETTER HEH GOAL MEDIAL FORM ! 0x00f4: 0xfbaa, # ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM ! 0x00f5: 0xfe80, # ARABIC LETTER HAMZA ISOLATED FORM ! 0x00f6: 0xfe89, # ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM ! 0x00f7: 0xfe8a, # ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM ! 0x00f8: 0xfe8b, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM ! 0x00f9: 0xfef1, # ARABIC LETTER YEH ISOLATED FORM ! 0x00fa: 0xfef2, # ARABIC LETTER YEH FINAL FORM ! 0x00fb: 0xfef3, # ARABIC LETTER YEH INITIAL FORM ! 0x00fc: 0xfbb0, # ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM ! 0x00fd: 0xfbae, # ARABIC LETTER YEH BARREE ISOLATED FORM ! 0x00fe: 0xfe7c, # ARABIC SHADDA ISOLATED FORM ! 0x00ff: 0xfe7d, # ARABIC SHADDA MEDIAL FORM }) Index: cp1026.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1026.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1026.py 16 May 2001 09:41:45 -0000 1.3 --- cp1026.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,277 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x00a0, # NO-BREAK SPACE ! 0x0042: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0043: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0044: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0045: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0046: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0047: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0048: 0x007b, # LEFT CURLY BRACKET ! 0x0049: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x004a: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x0021, # EXCLAMATION MARK ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0052: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0053: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0054: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0055: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0056: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0057: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0058: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0059: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x005a: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x005b: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x005e, # CIRCUMFLEX ACCENT ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0063: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0064: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0065: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0066: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x0067: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0068: 0x005b, # LEFT SQUARE BRACKET ! 0x0069: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x006a: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x0071: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0072: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0073: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0074: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0075: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x0076: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x0077: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0078: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0079: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x007a: 0x003a, # COLON ! 0x007b: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x007c: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0080: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: 0x007d, # RIGHT CURLY BRACKET ! 0x008d: 0x0060, # GRAVE ACCENT ! 0x008e: 0x00a6, # BROKEN BAR ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x009b: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x009c: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ab: 0x00bf, # INVERTED QUESTION MARK ! 0x00ac: 0x005d, # RIGHT SQUARE BRACKET ! 0x00ad: 0x0024, # DOLLAR SIGN ! 0x00ae: 0x0040, # COMMERCIAL AT ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x00a2, # CENT SIGN ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x00ac, # NOT SIGN ! 0x00bb: 0x007c, # VERTICAL LINE ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x00cc: 0x007e, # TILDE ! 0x00cd: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x00ce: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00cf: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00d0: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x00dc: 0x005c, # REVERSE SOLIDUS ! 0x00dd: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x00de: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00df: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00e0: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00ec: 0x0023, # NUMBER SIGN ! 0x00ed: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00fc: 0x0022, # QUOTATION MARK ! 0x00fd: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00fe: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ff: 0x009f, # CONTROL }) --- 38,277 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x00a0, # NO-BREAK SPACE ! 0x0042: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0043: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0044: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0045: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0046: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0047: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0048: 0x007b, # LEFT CURLY BRACKET ! 0x0049: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x004a: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x0021, # EXCLAMATION MARK ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0052: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0053: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0054: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0055: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0056: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0057: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0058: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0059: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x005a: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x005b: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x005e, # CIRCUMFLEX ACCENT ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0063: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0064: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0065: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0066: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x0067: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0068: 0x005b, # LEFT SQUARE BRACKET ! 0x0069: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x006a: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x0071: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0072: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0073: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0074: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0075: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x0076: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x0077: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0078: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0079: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x007a: 0x003a, # COLON ! 0x007b: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x007c: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0080: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: 0x007d, # RIGHT CURLY BRACKET ! 0x008d: 0x0060, # GRAVE ACCENT ! 0x008e: 0x00a6, # BROKEN BAR ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x009b: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x009c: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ab: 0x00bf, # INVERTED QUESTION MARK ! 0x00ac: 0x005d, # RIGHT SQUARE BRACKET ! 0x00ad: 0x0024, # DOLLAR SIGN ! 0x00ae: 0x0040, # COMMERCIAL AT ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x00a2, # CENT SIGN ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x00ac, # NOT SIGN ! 0x00bb: 0x007c, # VERTICAL LINE ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x00cc: 0x007e, # TILDE ! 0x00cd: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x00ce: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00cf: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00d0: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x00dc: 0x005c, # REVERSE SOLIDUS ! 0x00dd: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x00de: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00df: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00e0: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00ec: 0x0023, # NUMBER SIGN ! 0x00ed: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00fc: 0x0022, # QUOTATION MARK ! 0x00fd: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00fe: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ff: 0x009f, # CONTROL }) Index: cp1140.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1140.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cp1140.py 7 Jun 2001 19:39:25 -0000 1.1 --- cp1140.py 8 Aug 2002 20:19:18 -0000 1.2 *************** *** 15,19 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 15,19 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 22,26 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 22,26 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 37,41 **** decoding_map.update({ ! 0x009f: 0x20ac # EURO SIGN }) --- 37,41 ---- decoding_map.update({ ! 0x009f: 0x20ac # EURO SIGN }) *************** *** 43,45 **** encoding_map = codecs.make_encoding_map(decoding_map) - --- 43,44 ---- Index: cp1250.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1250.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1250.py 16 May 2001 09:41:45 -0000 1.3 --- cp1250.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,120 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: None, # UNDEFINED ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: None, # UNDEFINED ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x008d: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x008e: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x009d: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x009e: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x009f: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00a1: 0x02c7, # CARON ! 0x00a2: 0x02d8, # BREVE ! 0x00a3: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00a5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00aa: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00af: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00b2: 0x02db, # OGONEK ! 0x00b3: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00b9: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00ba: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00bc: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x00bd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00be: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x00bf: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00c0: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00c3: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00c5: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x00c6: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x00cf: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00d5: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x00d8: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00d9: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00db: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00de: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA ! 0x00e0: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00e3: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00e5: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x00e6: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x00ef: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00f5: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x00f8: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00f9: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00fe: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA ! 0x00ff: 0x02d9, # DOT ABOVE }) --- 38,120 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: None, # UNDEFINED ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: None, # UNDEFINED ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x008d: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x008e: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x009d: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x009e: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x009f: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00a1: 0x02c7, # CARON ! 0x00a2: 0x02d8, # BREVE ! 0x00a3: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00a5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00aa: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00af: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00b2: 0x02db, # OGONEK ! 0x00b3: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00b9: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00ba: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00bc: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x00bd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00be: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x00bf: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00c0: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00c3: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00c5: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x00c6: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x00cf: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00d5: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x00d8: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00d9: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00db: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00de: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA ! 0x00e0: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00e3: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00e5: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x00e6: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x00ef: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00f5: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x00f8: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00f9: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00fe: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA ! 0x00ff: 0x02d9, # DOT ABOVE }) Index: cp1251.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1251.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1251.py 16 May 2001 09:41:45 -0000 1.3 --- cp1251.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,154 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x0081: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x20ac, # EURO SIGN ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x008d: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x008e: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x008f: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x0090: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x009d: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x009e: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x009f: 0x045f, # CYRILLIC SMALL LETTER DZHE ! 0x00a1: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00a2: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00a3: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x00a5: 0x0490, # CYRILLIC CAPITAL LETTER GHE WITH UPTURN ! 0x00a8: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00aa: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00af: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00b2: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00b3: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00b4: 0x0491, # CYRILLIC SMALL LETTER GHE WITH UPTURN ! 0x00b8: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00b9: 0x2116, # NUMERO SIGN ! 0x00ba: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00bc: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x00bd: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x00be: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x00bf: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00c0: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00c1: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00c2: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00c3: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00c4: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00c5: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00c6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00c7: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00c8: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00c9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00ca: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00cb: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00cc: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00cd: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00ce: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00cf: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00d0: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00d1: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00d2: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00d3: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00d4: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00d5: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00d6: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00d7: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00d8: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00d9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00da: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x00db: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00dc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00dd: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00de: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x00df: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ff: 0x044f, # CYRILLIC SMALL LETTER YA }) --- 38,154 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x0081: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x20ac, # EURO SIGN ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x008d: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x008e: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x008f: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x0090: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x009d: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x009e: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x009f: 0x045f, # CYRILLIC SMALL LETTER DZHE ! 0x00a1: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00a2: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00a3: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x00a5: 0x0490, # CYRILLIC CAPITAL LETTER GHE WITH UPTURN ! 0x00a8: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00aa: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00af: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00b2: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00b3: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00b4: 0x0491, # CYRILLIC SMALL LETTER GHE WITH UPTURN ! 0x00b8: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00b9: 0x2116, # NUMERO SIGN ! 0x00ba: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00bc: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x00bd: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x00be: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x00bf: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00c0: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00c1: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00c2: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00c3: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00c4: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00c5: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00c6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00c7: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00c8: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00c9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00ca: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00cb: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00cc: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00cd: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00ce: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00cf: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00d0: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00d1: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00d2: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00d3: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00d4: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00d5: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00d6: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00d7: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00d8: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00d9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00da: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x00db: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00dc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00dd: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00de: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x00df: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ff: 0x044f, # CYRILLIC SMALL LETTER YA }) Index: cp1252.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1252.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1252.py 16 May 2001 09:41:45 -0000 1.3 --- cp1252.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,73 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: None, # UNDEFINED ! 0x008e: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: None, # UNDEFINED ! 0x009e: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS }) --- 38,73 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: None, # UNDEFINED ! 0x008e: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: None, # UNDEFINED ! 0x009e: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS }) Index: cp1253.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1253.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1253.py 16 May 2001 09:41:45 -0000 1.3 --- cp1253.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,148 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: None, # UNDEFINED ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: None, # UNDEFINED ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: None, # UNDEFINED ! 0x00a1: 0x0385, # GREEK DIALYTIKA TONOS ! 0x00a2: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00aa: None, # UNDEFINED ! 0x00af: 0x2015, # HORIZONTAL BAR ! 0x00b4: 0x0384, # GREEK TONOS ! 0x00b8: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00b9: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00ba: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00bc: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00be: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00bf: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00c0: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00c1: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00c2: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00c3: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00c4: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00c5: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00c6: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00c7: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00c8: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00c9: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ca: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00cb: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x00cc: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00cd: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00ce: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00cf: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00d0: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00d1: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00d2: None, # UNDEFINED ! 0x00d3: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00d4: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00d5: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00d6: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00d7: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00d8: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00d9: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00da: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00db: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00dc: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00dd: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00de: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00df: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00e0: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00e1: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e2: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00e3: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00e4: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00e5: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00e6: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00e7: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e8: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00e9: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00ea: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00eb: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00ec: 0x03bc, # GREEK SMALL LETTER MU ! 0x00ed: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ee: 0x03be, # GREEK SMALL LETTER XI ! 0x00ef: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00f0: 0x03c0, # GREEK SMALL LETTER PI ! 0x00f1: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00f2: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00f3: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00f4: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00f5: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00f6: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00f7: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f8: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00f9: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00fa: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fc: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00fd: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00fe: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ff: None, # UNDEFINED }) --- 38,148 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: None, # UNDEFINED ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: None, # UNDEFINED ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: None, # UNDEFINED ! 0x00a1: 0x0385, # GREEK DIALYTIKA TONOS ! 0x00a2: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00aa: None, # UNDEFINED ! 0x00af: 0x2015, # HORIZONTAL BAR ! 0x00b4: 0x0384, # GREEK TONOS ! 0x00b8: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00b9: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00ba: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00bc: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00be: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00bf: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00c0: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00c1: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00c2: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00c3: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00c4: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00c5: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00c6: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00c7: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00c8: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00c9: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ca: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00cb: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x00cc: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00cd: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00ce: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00cf: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00d0: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00d1: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00d2: None, # UNDEFINED ! 0x00d3: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00d4: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00d5: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00d6: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00d7: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00d8: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00d9: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00da: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00db: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00dc: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00dd: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00de: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00df: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00e0: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00e1: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e2: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00e3: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00e4: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00e5: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00e6: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00e7: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e8: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00e9: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00ea: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00eb: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00ec: 0x03bc, # GREEK SMALL LETTER MU ! 0x00ed: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ee: 0x03be, # GREEK SMALL LETTER XI ! 0x00ef: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00f0: 0x03c0, # GREEK SMALL LETTER PI ! 0x00f1: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00f2: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00f3: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00f4: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00f5: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00f6: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00f7: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f8: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00f9: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00fa: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fc: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00fd: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00fe: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ff: None, # UNDEFINED }) Index: cp1254.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1254.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1254.py 16 May 2001 09:41:45 -0000 1.3 --- cp1254.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,79 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00d0: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00dd: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00f0: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00fd: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00fe: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA }) --- 38,79 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00d0: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00dd: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00f0: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00fd: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00fe: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA }) Index: cp1255.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1255.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1255.py 16 May 2001 09:41:45 -0000 1.3 --- cp1255.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,140 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: None, # UNDEFINED ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: None, # UNDEFINED ! 0x00a4: 0x20aa, # NEW SHEQEL SIGN ! 0x00aa: 0x00d7, # MULTIPLICATION SIGN ! 0x00ba: 0x00f7, # DIVISION SIGN ! 0x00c0: 0x05b0, # HEBREW POINT SHEVA ! 0x00c1: 0x05b1, # HEBREW POINT HATAF SEGOL ! 0x00c2: 0x05b2, # HEBREW POINT HATAF PATAH ! 0x00c3: 0x05b3, # HEBREW POINT HATAF QAMATS ! 0x00c4: 0x05b4, # HEBREW POINT HIRIQ ! 0x00c5: 0x05b5, # HEBREW POINT TSERE ! 0x00c6: 0x05b6, # HEBREW POINT SEGOL ! 0x00c7: 0x05b7, # HEBREW POINT PATAH ! 0x00c8: 0x05b8, # HEBREW POINT QAMATS ! 0x00c9: 0x05b9, # HEBREW POINT HOLAM ! 0x00ca: None, # UNDEFINED ! 0x00cb: 0x05bb, # HEBREW POINT QUBUTS ! 0x00cc: 0x05bc, # HEBREW POINT DAGESH OR MAPIQ ! 0x00cd: 0x05bd, # HEBREW POINT METEG ! 0x00ce: 0x05be, # HEBREW PUNCTUATION MAQAF ! 0x00cf: 0x05bf, # HEBREW POINT RAFE ! 0x00d0: 0x05c0, # HEBREW PUNCTUATION PASEQ ! 0x00d1: 0x05c1, # HEBREW POINT SHIN DOT ! 0x00d2: 0x05c2, # HEBREW POINT SIN DOT ! 0x00d3: 0x05c3, # HEBREW PUNCTUATION SOF PASUQ ! 0x00d4: 0x05f0, # HEBREW LIGATURE YIDDISH DOUBLE VAV ! 0x00d5: 0x05f1, # HEBREW LIGATURE YIDDISH VAV YOD ! 0x00d6: 0x05f2, # HEBREW LIGATURE YIDDISH DOUBLE YOD ! 0x00d7: 0x05f3, # HEBREW PUNCTUATION GERESH ! 0x00d8: 0x05f4, # HEBREW PUNCTUATION GERSHAYIM ! 0x00d9: None, # UNDEFINED ! 0x00da: None, # UNDEFINED ! 0x00db: None, # UNDEFINED ! 0x00dc: None, # UNDEFINED ! 0x00dd: None, # UNDEFINED ! 0x00de: None, # UNDEFINED ! 0x00df: None, # UNDEFINED ! 0x00e0: 0x05d0, # HEBREW LETTER ALEF ! 0x00e1: 0x05d1, # HEBREW LETTER BET ! 0x00e2: 0x05d2, # HEBREW LETTER GIMEL ! 0x00e3: 0x05d3, # HEBREW LETTER DALET ! 0x00e4: 0x05d4, # HEBREW LETTER HE ! 0x00e5: 0x05d5, # HEBREW LETTER VAV ! 0x00e6: 0x05d6, # HEBREW LETTER ZAYIN ! 0x00e7: 0x05d7, # HEBREW LETTER HET ! 0x00e8: 0x05d8, # HEBREW LETTER TET ! 0x00e9: 0x05d9, # HEBREW LETTER YOD ! 0x00ea: 0x05da, # HEBREW LETTER FINAL KAF ! 0x00eb: 0x05db, # HEBREW LETTER KAF ! 0x00ec: 0x05dc, # HEBREW LETTER LAMED ! 0x00ed: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x00ee: 0x05de, # HEBREW LETTER MEM ! 0x00ef: 0x05df, # HEBREW LETTER FINAL NUN ! 0x00f0: 0x05e0, # HEBREW LETTER NUN ! 0x00f1: 0x05e1, # HEBREW LETTER SAMEKH ! 0x00f2: 0x05e2, # HEBREW LETTER AYIN ! 0x00f3: 0x05e3, # HEBREW LETTER FINAL PE ! 0x00f4: 0x05e4, # HEBREW LETTER PE ! 0x00f5: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x00f6: 0x05e6, # HEBREW LETTER TSADI ! 0x00f7: 0x05e7, # HEBREW LETTER QOF ! 0x00f8: 0x05e8, # HEBREW LETTER RESH ! 0x00f9: 0x05e9, # HEBREW LETTER SHIN ! 0x00fa: 0x05ea, # HEBREW LETTER TAV ! 0x00fb: None, # UNDEFINED ! 0x00fc: None, # UNDEFINED ! 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK ! 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK ! 0x00ff: None, # UNDEFINED }) --- 38,140 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: None, # UNDEFINED ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: None, # UNDEFINED ! 0x00a4: 0x20aa, # NEW SHEQEL SIGN ! 0x00aa: 0x00d7, # MULTIPLICATION SIGN ! 0x00ba: 0x00f7, # DIVISION SIGN ! 0x00c0: 0x05b0, # HEBREW POINT SHEVA ! 0x00c1: 0x05b1, # HEBREW POINT HATAF SEGOL ! 0x00c2: 0x05b2, # HEBREW POINT HATAF PATAH ! 0x00c3: 0x05b3, # HEBREW POINT HATAF QAMATS ! 0x00c4: 0x05b4, # HEBREW POINT HIRIQ ! 0x00c5: 0x05b5, # HEBREW POINT TSERE ! 0x00c6: 0x05b6, # HEBREW POINT SEGOL ! 0x00c7: 0x05b7, # HEBREW POINT PATAH ! 0x00c8: 0x05b8, # HEBREW POINT QAMATS ! 0x00c9: 0x05b9, # HEBREW POINT HOLAM ! 0x00ca: None, # UNDEFINED ! 0x00cb: 0x05bb, # HEBREW POINT QUBUTS ! 0x00cc: 0x05bc, # HEBREW POINT DAGESH OR MAPIQ ! 0x00cd: 0x05bd, # HEBREW POINT METEG ! 0x00ce: 0x05be, # HEBREW PUNCTUATION MAQAF ! 0x00cf: 0x05bf, # HEBREW POINT RAFE ! 0x00d0: 0x05c0, # HEBREW PUNCTUATION PASEQ ! 0x00d1: 0x05c1, # HEBREW POINT SHIN DOT ! 0x00d2: 0x05c2, # HEBREW POINT SIN DOT ! 0x00d3: 0x05c3, # HEBREW PUNCTUATION SOF PASUQ ! 0x00d4: 0x05f0, # HEBREW LIGATURE YIDDISH DOUBLE VAV ! 0x00d5: 0x05f1, # HEBREW LIGATURE YIDDISH VAV YOD ! 0x00d6: 0x05f2, # HEBREW LIGATURE YIDDISH DOUBLE YOD ! 0x00d7: 0x05f3, # HEBREW PUNCTUATION GERESH ! 0x00d8: 0x05f4, # HEBREW PUNCTUATION GERSHAYIM ! 0x00d9: None, # UNDEFINED ! 0x00da: None, # UNDEFINED ! 0x00db: None, # UNDEFINED ! 0x00dc: None, # UNDEFINED ! 0x00dd: None, # UNDEFINED ! 0x00de: None, # UNDEFINED ! 0x00df: None, # UNDEFINED ! 0x00e0: 0x05d0, # HEBREW LETTER ALEF ! 0x00e1: 0x05d1, # HEBREW LETTER BET ! 0x00e2: 0x05d2, # HEBREW LETTER GIMEL ! 0x00e3: 0x05d3, # HEBREW LETTER DALET ! 0x00e4: 0x05d4, # HEBREW LETTER HE ! 0x00e5: 0x05d5, # HEBREW LETTER VAV ! 0x00e6: 0x05d6, # HEBREW LETTER ZAYIN ! 0x00e7: 0x05d7, # HEBREW LETTER HET ! 0x00e8: 0x05d8, # HEBREW LETTER TET ! 0x00e9: 0x05d9, # HEBREW LETTER YOD ! 0x00ea: 0x05da, # HEBREW LETTER FINAL KAF ! 0x00eb: 0x05db, # HEBREW LETTER KAF ! 0x00ec: 0x05dc, # HEBREW LETTER LAMED ! 0x00ed: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x00ee: 0x05de, # HEBREW LETTER MEM ! 0x00ef: 0x05df, # HEBREW LETTER FINAL NUN ! 0x00f0: 0x05e0, # HEBREW LETTER NUN ! 0x00f1: 0x05e1, # HEBREW LETTER SAMEKH ! 0x00f2: 0x05e2, # HEBREW LETTER AYIN ! 0x00f3: 0x05e3, # HEBREW LETTER FINAL PE ! 0x00f4: 0x05e4, # HEBREW LETTER PE ! 0x00f5: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x00f6: 0x05e6, # HEBREW LETTER TSADI ! 0x00f7: 0x05e7, # HEBREW LETTER QOF ! 0x00f8: 0x05e8, # HEBREW LETTER RESH ! 0x00f9: 0x05e9, # HEBREW LETTER SHIN ! 0x00fa: 0x05ea, # HEBREW LETTER TAV ! 0x00fb: None, # UNDEFINED ! 0x00fc: None, # UNDEFINED ! 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK ! 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK ! 0x00ff: None, # UNDEFINED }) Index: cp1256.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1256.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1256.py 16 May 2001 09:41:45 -0000 1.3 --- cp1256.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,126 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: 0x067e, # ARABIC LETTER PEH ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0679, # ARABIC LETTER TTEH ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: 0x0686, # ARABIC LETTER TCHEH ! 0x008e: 0x0698, # ARABIC LETTER JEH ! 0x008f: 0x0688, # ARABIC LETTER DDAL ! 0x0090: 0x06af, # ARABIC LETTER GAF ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x06a9, # ARABIC LETTER KEHEH ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0691, # ARABIC LETTER RREH ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: 0x200c, # ZERO WIDTH NON-JOINER ! 0x009e: 0x200d, # ZERO WIDTH JOINER ! 0x009f: 0x06ba, # ARABIC LETTER NOON GHUNNA ! 0x00a1: 0x060c, # ARABIC COMMA ! 0x00aa: 0x06be, # ARABIC LETTER HEH DOACHASHMEE ! 0x00ba: 0x061b, # ARABIC SEMICOLON ! 0x00bf: 0x061f, # ARABIC QUESTION MARK ! 0x00c0: 0x06c1, # ARABIC LETTER HEH GOAL ! 0x00c1: 0x0621, # ARABIC LETTER HAMZA ! 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE ! 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE ! 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE ! 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW ! 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE ! 0x00c7: 0x0627, # ARABIC LETTER ALEF ! 0x00c8: 0x0628, # ARABIC LETTER BEH ! 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA ! 0x00ca: 0x062a, # ARABIC LETTER TEH ! 0x00cb: 0x062b, # ARABIC LETTER THEH ! 0x00cc: 0x062c, # ARABIC LETTER JEEM ! 0x00cd: 0x062d, # ARABIC LETTER HAH ! 0x00ce: 0x062e, # ARABIC LETTER KHAH ! 0x00cf: 0x062f, # ARABIC LETTER DAL ! 0x00d0: 0x0630, # ARABIC LETTER THAL ! 0x00d1: 0x0631, # ARABIC LETTER REH ! 0x00d2: 0x0632, # ARABIC LETTER ZAIN ! 0x00d3: 0x0633, # ARABIC LETTER SEEN ! 0x00d4: 0x0634, # ARABIC LETTER SHEEN ! 0x00d5: 0x0635, # ARABIC LETTER SAD ! 0x00d6: 0x0636, # ARABIC LETTER DAD ! 0x00d8: 0x0637, # ARABIC LETTER TAH ! 0x00d9: 0x0638, # ARABIC LETTER ZAH ! 0x00da: 0x0639, # ARABIC LETTER AIN ! 0x00db: 0x063a, # ARABIC LETTER GHAIN ! 0x00dc: 0x0640, # ARABIC TATWEEL ! 0x00dd: 0x0641, # ARABIC LETTER FEH ! 0x00de: 0x0642, # ARABIC LETTER QAF ! 0x00df: 0x0643, # ARABIC LETTER KAF ! 0x00e1: 0x0644, # ARABIC LETTER LAM ! 0x00e3: 0x0645, # ARABIC LETTER MEEM ! 0x00e4: 0x0646, # ARABIC LETTER NOON ! 0x00e5: 0x0647, # ARABIC LETTER HEH ! 0x00e6: 0x0648, # ARABIC LETTER WAW ! 0x00ec: 0x0649, # ARABIC LETTER ALEF MAKSURA ! 0x00ed: 0x064a, # ARABIC LETTER YEH ! 0x00f0: 0x064b, # ARABIC FATHATAN ! 0x00f1: 0x064c, # ARABIC DAMMATAN ! 0x00f2: 0x064d, # ARABIC KASRATAN ! 0x00f3: 0x064e, # ARABIC FATHA ! 0x00f5: 0x064f, # ARABIC DAMMA ! 0x00f6: 0x0650, # ARABIC KASRA ! 0x00f8: 0x0651, # ARABIC SHADDA ! 0x00fa: 0x0652, # ARABIC SUKUN ! 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK ! 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK ! 0x00ff: 0x06d2, # ARABIC LETTER YEH BARREE }) --- 38,126 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: 0x067e, # ARABIC LETTER PEH ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: 0x0679, # ARABIC LETTER TTEH ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: 0x0686, # ARABIC LETTER TCHEH ! 0x008e: 0x0698, # ARABIC LETTER JEH ! 0x008f: 0x0688, # ARABIC LETTER DDAL ! 0x0090: 0x06af, # ARABIC LETTER GAF ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x06a9, # ARABIC LETTER KEHEH ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: 0x0691, # ARABIC LETTER RREH ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: 0x200c, # ZERO WIDTH NON-JOINER ! 0x009e: 0x200d, # ZERO WIDTH JOINER ! 0x009f: 0x06ba, # ARABIC LETTER NOON GHUNNA ! 0x00a1: 0x060c, # ARABIC COMMA ! 0x00aa: 0x06be, # ARABIC LETTER HEH DOACHASHMEE ! 0x00ba: 0x061b, # ARABIC SEMICOLON ! 0x00bf: 0x061f, # ARABIC QUESTION MARK ! 0x00c0: 0x06c1, # ARABIC LETTER HEH GOAL ! 0x00c1: 0x0621, # ARABIC LETTER HAMZA ! 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE ! 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE ! 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE ! 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW ! 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE ! 0x00c7: 0x0627, # ARABIC LETTER ALEF ! 0x00c8: 0x0628, # ARABIC LETTER BEH ! 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA ! 0x00ca: 0x062a, # ARABIC LETTER TEH ! 0x00cb: 0x062b, # ARABIC LETTER THEH ! 0x00cc: 0x062c, # ARABIC LETTER JEEM ! 0x00cd: 0x062d, # ARABIC LETTER HAH ! 0x00ce: 0x062e, # ARABIC LETTER KHAH ! 0x00cf: 0x062f, # ARABIC LETTER DAL ! 0x00d0: 0x0630, # ARABIC LETTER THAL ! 0x00d1: 0x0631, # ARABIC LETTER REH ! 0x00d2: 0x0632, # ARABIC LETTER ZAIN ! 0x00d3: 0x0633, # ARABIC LETTER SEEN ! 0x00d4: 0x0634, # ARABIC LETTER SHEEN ! 0x00d5: 0x0635, # ARABIC LETTER SAD ! 0x00d6: 0x0636, # ARABIC LETTER DAD ! 0x00d8: 0x0637, # ARABIC LETTER TAH ! 0x00d9: 0x0638, # ARABIC LETTER ZAH ! 0x00da: 0x0639, # ARABIC LETTER AIN ! 0x00db: 0x063a, # ARABIC LETTER GHAIN ! 0x00dc: 0x0640, # ARABIC TATWEEL ! 0x00dd: 0x0641, # ARABIC LETTER FEH ! 0x00de: 0x0642, # ARABIC LETTER QAF ! 0x00df: 0x0643, # ARABIC LETTER KAF ! 0x00e1: 0x0644, # ARABIC LETTER LAM ! 0x00e3: 0x0645, # ARABIC LETTER MEEM ! 0x00e4: 0x0646, # ARABIC LETTER NOON ! 0x00e5: 0x0647, # ARABIC LETTER HEH ! 0x00e6: 0x0648, # ARABIC LETTER WAW ! 0x00ec: 0x0649, # ARABIC LETTER ALEF MAKSURA ! 0x00ed: 0x064a, # ARABIC LETTER YEH ! 0x00f0: 0x064b, # ARABIC FATHATAN ! 0x00f1: 0x064c, # ARABIC DAMMATAN ! 0x00f2: 0x064d, # ARABIC KASRATAN ! 0x00f3: 0x064e, # ARABIC FATHA ! 0x00f5: 0x064f, # ARABIC DAMMA ! 0x00f6: 0x0650, # ARABIC KASRA ! 0x00f8: 0x0651, # ARABIC SHADDA ! 0x00fa: 0x0652, # ARABIC SUKUN ! 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK ! 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK ! 0x00ff: 0x06d2, # ARABIC LETTER YEH BARREE }) Index: cp1257.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1257.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1257.py 16 May 2001 09:41:45 -0000 1.3 --- cp1257.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,128 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: None, # UNDEFINED ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: None, # UNDEFINED ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: 0x00a8, # DIAERESIS ! 0x008e: 0x02c7, # CARON ! 0x008f: 0x00b8, # CEDILLA ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: None, # UNDEFINED ! 0x009d: 0x00af, # MACRON ! 0x009e: 0x02db, # OGONEK ! 0x009f: None, # UNDEFINED ! 0x00a1: None, # UNDEFINED ! 0x00a5: None, # UNDEFINED ! 0x00a8: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00aa: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00af: 0x00c6, # LATIN CAPITAL LETTER AE ! 0x00b8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00ba: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00bf: 0x00e6, # LATIN SMALL LETTER AE ! 0x00c0: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00c1: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c2: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c3: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c6: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00c7: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x00cb: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00cc: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00cd: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00ce: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00cf: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00d0: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d4: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d8: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00d9: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00da: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00db: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00dd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00de: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00e0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00e1: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e2: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e3: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e6: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00e7: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00eb: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00ec: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00ed: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00ee: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00ef: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00f0: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f4: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f8: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00f9: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00fa: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00fb: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00fe: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00ff: 0x02d9, # DOT ABOVE }) --- 38,128 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: None, # UNDEFINED ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: None, # UNDEFINED ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: 0x00a8, # DIAERESIS ! 0x008e: 0x02c7, # CARON ! 0x008f: 0x00b8, # CEDILLA ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: None, # UNDEFINED ! 0x009d: 0x00af, # MACRON ! 0x009e: 0x02db, # OGONEK ! 0x009f: None, # UNDEFINED ! 0x00a1: None, # UNDEFINED ! 0x00a5: None, # UNDEFINED ! 0x00a8: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00aa: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00af: 0x00c6, # LATIN CAPITAL LETTER AE ! 0x00b8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00ba: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00bf: 0x00e6, # LATIN SMALL LETTER AE ! 0x00c0: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00c1: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c2: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c3: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c6: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00c7: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x00cb: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00cc: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00cd: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00ce: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00cf: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00d0: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d4: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d8: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00d9: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00da: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00db: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00dd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00de: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00e0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00e1: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e2: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e3: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e6: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00e7: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00eb: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00ec: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00ed: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00ee: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00ef: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00f0: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f4: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f8: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00f9: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00fa: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00fb: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00fe: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00ff: 0x02d9, # DOT ABOVE }) Index: cp1258.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1258.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp1258.py 16 May 2001 09:41:45 -0000 1.3 --- cp1258.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,87 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00c3: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00cc: 0x0300, # COMBINING GRAVE ACCENT ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d2: 0x0309, # COMBINING HOOK ABOVE ! 0x00d5: 0x01a0, # LATIN CAPITAL LETTER O WITH HORN ! 0x00dd: 0x01af, # LATIN CAPITAL LETTER U WITH HORN ! 0x00de: 0x0303, # COMBINING TILDE ! 0x00e3: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00ec: 0x0301, # COMBINING ACUTE ACCENT ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f2: 0x0323, # COMBINING DOT BELOW ! 0x00f5: 0x01a1, # LATIN SMALL LETTER O WITH HORN ! 0x00fd: 0x01b0, # LATIN SMALL LETTER U WITH HORN ! 0x00fe: 0x20ab, # DONG SIGN }) --- 38,87 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: 0x2020, # DAGGER ! 0x0087: 0x2021, # DOUBLE DAGGER ! 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x0089: 0x2030, # PER MILLE SIGN ! 0x008a: None, # UNDEFINED ! 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: 0x02dc, # SMALL TILDE ! 0x0099: 0x2122, # TRADE MARK SIGN ! 0x009a: None, # UNDEFINED ! 0x009b: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x009c: 0x0153, # LATIN SMALL LIGATURE OE ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00c3: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00cc: 0x0300, # COMBINING GRAVE ACCENT ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d2: 0x0309, # COMBINING HOOK ABOVE ! 0x00d5: 0x01a0, # LATIN CAPITAL LETTER O WITH HORN ! 0x00dd: 0x01af, # LATIN CAPITAL LETTER U WITH HORN ! 0x00de: 0x0303, # COMBINING TILDE ! 0x00e3: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00ec: 0x0301, # COMBINING ACUTE ACCENT ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f2: 0x0323, # COMBINING DOT BELOW ! 0x00f5: 0x01a1, # LATIN SMALL LETTER O WITH HORN ! 0x00fd: 0x01b0, # LATIN SMALL LETTER U WITH HORN ! 0x00fe: 0x20ab, # DONG SIGN }) Index: cp424.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp424.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp424.py 16 May 2001 09:41:45 -0000 1.3 --- cp424.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,277 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # SELECT ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # REQUIRED NEW LINE ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # GRAPHIC ESCAPE ! 0x0009: 0x008d, # SUPERSCRIPT ! 0x000a: 0x008e, # REPEAT ! 0x0014: 0x009d, # RESTORE/ENABLE PRESENTATION ! 0x0015: 0x0085, # NEW LINE ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # PROGRAM OPERATOR COMMUNICATION ! 0x001a: 0x0092, # UNIT BACK SPACE ! 0x001b: 0x008f, # CUSTOMER USE ONE ! 0x0020: 0x0080, # DIGIT SELECT ! 0x0021: 0x0081, # START OF SIGNIFICANCE ! 0x0022: 0x0082, # FIELD SEPARATOR ! 0x0023: 0x0083, # WORD UNDERSCORE ! 0x0024: 0x0084, # BYPASS OR INHIBIT PRESENTATION ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # SET ATTRIBUTE ! 0x0029: 0x0089, # START FIELD EXTENDED ! 0x002a: 0x008a, # SET MODE OR SWITCH ! 0x002b: 0x008b, # CONTROL SEQUENCE PREFIX ! 0x002c: 0x008c, # MODIFY FIELD ATTRIBUTE ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # ! 0x0031: 0x0091, # ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # INDEX RETURN ! 0x0034: 0x0094, # PRESENTATION POSITION ! 0x0035: 0x0095, # TRANSPARENT ! 0x0036: 0x0096, # NUMERIC BACKSPACE ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # SUBSCRIPT ! 0x0039: 0x0099, # INDENT TABULATION ! 0x003a: 0x009a, # REVERSE FORM FEED ! 0x003b: 0x009b, # CUSTOMER USE THREE ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x05d0, # HEBREW LETTER ALEF ! 0x0042: 0x05d1, # HEBREW LETTER BET ! 0x0043: 0x05d2, # HEBREW LETTER GIMEL ! 0x0044: 0x05d3, # HEBREW LETTER DALET ! 0x0045: 0x05d4, # HEBREW LETTER HE ! 0x0046: 0x05d5, # HEBREW LETTER VAV ! 0x0047: 0x05d6, # HEBREW LETTER ZAYIN ! 0x0048: 0x05d7, # HEBREW LETTER HET ! 0x0049: 0x05d8, # HEBREW LETTER TET ! 0x004a: 0x00a2, # CENT SIGN ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x007c, # VERTICAL LINE ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x05d9, # HEBREW LETTER YOD ! 0x0052: 0x05da, # HEBREW LETTER FINAL KAF ! 0x0053: 0x05db, # HEBREW LETTER KAF ! 0x0054: 0x05dc, # HEBREW LETTER LAMED ! 0x0055: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x0056: 0x05de, # HEBREW LETTER MEM ! 0x0057: 0x05df, # HEBREW LETTER FINAL NUN ! 0x0058: 0x05e0, # HEBREW LETTER NUN ! 0x0059: 0x05e1, # HEBREW LETTER SAMEKH ! 0x005a: 0x0021, # EXCLAMATION MARK ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x00ac, # NOT SIGN ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x05e2, # HEBREW LETTER AYIN ! 0x0063: 0x05e3, # HEBREW LETTER FINAL PE ! 0x0064: 0x05e4, # HEBREW LETTER PE ! 0x0065: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x0066: 0x05e6, # HEBREW LETTER TSADI ! 0x0067: 0x05e7, # HEBREW LETTER QOF ! 0x0068: 0x05e8, # HEBREW LETTER RESH ! 0x0069: 0x05e9, # HEBREW LETTER SHIN ! 0x006a: 0x00a6, # BROKEN BAR ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: None, # UNDEFINED ! 0x0071: 0x05ea, # HEBREW LETTER TAV ! 0x0072: None, # UNDEFINED ! 0x0073: None, # UNDEFINED ! 0x0074: 0x00a0, # NO-BREAK SPACE ! 0x0075: None, # UNDEFINED ! 0x0076: None, # UNDEFINED ! 0x0077: None, # UNDEFINED ! 0x0078: 0x2017, # DOUBLE LOW LINE ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: None, # UNDEFINED ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: None, # UNDEFINED ! 0x009b: None, # UNDEFINED ! 0x009c: None, # UNDEFINED ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: None, # UNDEFINED ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: None, # UNDEFINED ! 0x00ab: None, # UNDEFINED ! 0x00ac: None, # UNDEFINED ! 0x00ad: None, # UNDEFINED ! 0x00ae: None, # UNDEFINED ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x005e, # CIRCUMFLEX ACCENT ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x005b, # LEFT SQUARE BRACKET ! 0x00bb: 0x005d, # RIGHT SQUARE BRACKET ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: None, # UNDEFINED ! 0x00cc: None, # UNDEFINED ! 0x00cd: None, # UNDEFINED ! 0x00ce: None, # UNDEFINED ! 0x00cf: None, # UNDEFINED ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: None, # UNDEFINED ! 0x00dc: None, # UNDEFINED ! 0x00dd: None, # UNDEFINED ! 0x00de: None, # UNDEFINED ! 0x00df: None, # UNDEFINED ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: None, # UNDEFINED ! 0x00ec: None, # UNDEFINED ! 0x00ed: None, # UNDEFINED ! 0x00ee: None, # UNDEFINED ! 0x00ef: None, # UNDEFINED ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: None, # UNDEFINED ! 0x00fc: None, # UNDEFINED ! 0x00fd: None, # UNDEFINED ! 0x00fe: None, # UNDEFINED ! 0x00ff: 0x009f, # EIGHT ONES }) --- 38,277 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # SELECT ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # REQUIRED NEW LINE ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # GRAPHIC ESCAPE ! 0x0009: 0x008d, # SUPERSCRIPT ! 0x000a: 0x008e, # REPEAT ! 0x0014: 0x009d, # RESTORE/ENABLE PRESENTATION ! 0x0015: 0x0085, # NEW LINE ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # PROGRAM OPERATOR COMMUNICATION ! 0x001a: 0x0092, # UNIT BACK SPACE ! 0x001b: 0x008f, # CUSTOMER USE ONE ! 0x0020: 0x0080, # DIGIT SELECT ! 0x0021: 0x0081, # START OF SIGNIFICANCE ! 0x0022: 0x0082, # FIELD SEPARATOR ! 0x0023: 0x0083, # WORD UNDERSCORE ! 0x0024: 0x0084, # BYPASS OR INHIBIT PRESENTATION ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # SET ATTRIBUTE ! 0x0029: 0x0089, # START FIELD EXTENDED ! 0x002a: 0x008a, # SET MODE OR SWITCH ! 0x002b: 0x008b, # CONTROL SEQUENCE PREFIX ! 0x002c: 0x008c, # MODIFY FIELD ATTRIBUTE ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # ! 0x0031: 0x0091, # ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # INDEX RETURN ! 0x0034: 0x0094, # PRESENTATION POSITION ! 0x0035: 0x0095, # TRANSPARENT ! 0x0036: 0x0096, # NUMERIC BACKSPACE ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # SUBSCRIPT ! 0x0039: 0x0099, # INDENT TABULATION ! 0x003a: 0x009a, # REVERSE FORM FEED ! 0x003b: 0x009b, # CUSTOMER USE THREE ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x05d0, # HEBREW LETTER ALEF ! 0x0042: 0x05d1, # HEBREW LETTER BET ! 0x0043: 0x05d2, # HEBREW LETTER GIMEL ! 0x0044: 0x05d3, # HEBREW LETTER DALET ! 0x0045: 0x05d4, # HEBREW LETTER HE ! 0x0046: 0x05d5, # HEBREW LETTER VAV ! 0x0047: 0x05d6, # HEBREW LETTER ZAYIN ! 0x0048: 0x05d7, # HEBREW LETTER HET ! 0x0049: 0x05d8, # HEBREW LETTER TET ! 0x004a: 0x00a2, # CENT SIGN ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x007c, # VERTICAL LINE ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x05d9, # HEBREW LETTER YOD ! 0x0052: 0x05da, # HEBREW LETTER FINAL KAF ! 0x0053: 0x05db, # HEBREW LETTER KAF ! 0x0054: 0x05dc, # HEBREW LETTER LAMED ! 0x0055: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x0056: 0x05de, # HEBREW LETTER MEM ! 0x0057: 0x05df, # HEBREW LETTER FINAL NUN ! 0x0058: 0x05e0, # HEBREW LETTER NUN ! 0x0059: 0x05e1, # HEBREW LETTER SAMEKH ! 0x005a: 0x0021, # EXCLAMATION MARK ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x00ac, # NOT SIGN ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x05e2, # HEBREW LETTER AYIN ! 0x0063: 0x05e3, # HEBREW LETTER FINAL PE ! 0x0064: 0x05e4, # HEBREW LETTER PE ! 0x0065: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x0066: 0x05e6, # HEBREW LETTER TSADI ! 0x0067: 0x05e7, # HEBREW LETTER QOF ! 0x0068: 0x05e8, # HEBREW LETTER RESH ! 0x0069: 0x05e9, # HEBREW LETTER SHIN ! 0x006a: 0x00a6, # BROKEN BAR ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: None, # UNDEFINED ! 0x0071: 0x05ea, # HEBREW LETTER TAV ! 0x0072: None, # UNDEFINED ! 0x0073: None, # UNDEFINED ! 0x0074: 0x00a0, # NO-BREAK SPACE ! 0x0075: None, # UNDEFINED ! 0x0076: None, # UNDEFINED ! 0x0077: None, # UNDEFINED ! 0x0078: 0x2017, # DOUBLE LOW LINE ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: None, # UNDEFINED ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: None, # UNDEFINED ! 0x009b: None, # UNDEFINED ! 0x009c: None, # UNDEFINED ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: None, # UNDEFINED ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: None, # UNDEFINED ! 0x00ab: None, # UNDEFINED ! 0x00ac: None, # UNDEFINED ! 0x00ad: None, # UNDEFINED ! 0x00ae: None, # UNDEFINED ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x005e, # CIRCUMFLEX ACCENT ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x005b, # LEFT SQUARE BRACKET ! 0x00bb: 0x005d, # RIGHT SQUARE BRACKET ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: None, # UNDEFINED ! 0x00cc: None, # UNDEFINED ! 0x00cd: None, # UNDEFINED ! 0x00ce: None, # UNDEFINED ! 0x00cf: None, # UNDEFINED ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: None, # UNDEFINED ! 0x00dc: None, # UNDEFINED ! 0x00dd: None, # UNDEFINED ! 0x00de: None, # UNDEFINED ! 0x00df: None, # UNDEFINED ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: None, # UNDEFINED ! 0x00ec: None, # UNDEFINED ! 0x00ed: None, # UNDEFINED ! 0x00ee: None, # UNDEFINED ! 0x00ef: None, # UNDEFINED ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: None, # UNDEFINED ! 0x00fc: None, # UNDEFINED ! 0x00fd: None, # UNDEFINED ! 0x00fe: None, # UNDEFINED ! 0x00ff: 0x009f, # EIGHT ONES }) Index: cp437.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp437.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp437.py 16 May 2001 09:41:45 -0000 1.3 --- cp437.py 8 Aug 2002 20:19:18 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00a5, # YEN SIGN ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00a5, # YEN SIGN ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp500.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp500.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp500.py 16 May 2001 09:41:45 -0000 1.3 --- cp500.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,277 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x00a0, # NO-BREAK SPACE ! 0x0042: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0043: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0044: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0045: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0046: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0047: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0048: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0049: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x004a: 0x005b, # LEFT SQUARE BRACKET ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x0021, # EXCLAMATION MARK ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0052: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0053: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0054: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0055: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0056: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0057: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0058: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0059: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x005a: 0x005d, # RIGHT SQUARE BRACKET ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x005e, # CIRCUMFLEX ACCENT ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0063: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0064: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0065: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0066: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x0067: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0068: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0069: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x006a: 0x00a6, # BROKEN BAR ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x0071: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0072: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0073: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0074: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0075: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x0076: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x0077: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0078: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: 0x00f0, # LATIN SMALL LETTER ETH (ICELANDIC) ! 0x008d: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x008e: 0x00fe, # LATIN SMALL LETTER THORN (ICELANDIC) ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x009b: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x009c: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ab: 0x00bf, # INVERTED QUESTION MARK ! 0x00ac: 0x00d0, # LATIN CAPITAL LETTER ETH (ICELANDIC) ! 0x00ad: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ae: 0x00de, # LATIN CAPITAL LETTER THORN (ICELANDIC) ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x00a2, # CENT SIGN ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x00ac, # NOT SIGN ! 0x00bb: 0x007c, # VERTICAL LINE ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x00cc: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x00cd: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x00ce: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00cf: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x00dc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00dd: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x00de: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00df: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00ec: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x00ed: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00fc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x00fd: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00fe: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ff: 0x009f, # CONTROL }) --- 38,277 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x00a0, # NO-BREAK SPACE ! 0x0042: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0043: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0044: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0045: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0046: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0047: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0048: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0049: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x004a: 0x005b, # LEFT SQUARE BRACKET ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x0021, # EXCLAMATION MARK ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0052: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0053: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0054: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0055: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0056: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0057: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0058: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0059: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x005a: 0x005d, # RIGHT SQUARE BRACKET ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x005e, # CIRCUMFLEX ACCENT ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0063: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0064: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0065: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0066: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x0067: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0068: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0069: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x006a: 0x00a6, # BROKEN BAR ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x0071: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0072: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0073: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0074: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0075: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x0076: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x0077: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0078: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008b: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x008c: 0x00f0, # LATIN SMALL LETTER ETH (ICELANDIC) ! 0x008d: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x008e: 0x00fe, # LATIN SMALL LETTER THORN (ICELANDIC) ! 0x008f: 0x00b1, # PLUS-MINUS SIGN ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x009b: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x009c: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x009d: 0x00b8, # CEDILLA ! 0x009e: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x00b5, # MICRO SIGN ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ab: 0x00bf, # INVERTED QUESTION MARK ! 0x00ac: 0x00d0, # LATIN CAPITAL LETTER ETH (ICELANDIC) ! 0x00ad: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ae: 0x00de, # LATIN CAPITAL LETTER THORN (ICELANDIC) ! 0x00af: 0x00ae, # REGISTERED SIGN ! 0x00b0: 0x00a2, # CENT SIGN ! 0x00b1: 0x00a3, # POUND SIGN ! 0x00b2: 0x00a5, # YEN SIGN ! 0x00b3: 0x00b7, # MIDDLE DOT ! 0x00b4: 0x00a9, # COPYRIGHT SIGN ! 0x00b5: 0x00a7, # SECTION SIGN ! 0x00b7: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00b8: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00b9: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ba: 0x00ac, # NOT SIGN ! 0x00bb: 0x007c, # VERTICAL LINE ! 0x00bc: 0x00af, # MACRON ! 0x00bd: 0x00a8, # DIAERESIS ! 0x00be: 0x00b4, # ACUTE ACCENT ! 0x00bf: 0x00d7, # MULTIPLICATION SIGN ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x00cc: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x00cd: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x00ce: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00cf: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b9, # SUPERSCRIPT ONE ! 0x00db: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x00dc: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00dd: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x00de: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00df: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x00f7, # DIVISION SIGN ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00ec: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x00ed: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00fc: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x00fd: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00fe: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ff: 0x009f, # CONTROL }) Index: cp737.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp737.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp737.py 16 May 2001 09:41:45 -0000 1.3 --- cp737.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x0081: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x0082: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x0083: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x0084: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x0085: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x0086: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x0087: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x0088: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x0089: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x008a: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x008b: 0x039c, # GREEK CAPITAL LETTER MU ! 0x008c: 0x039d, # GREEK CAPITAL LETTER NU ! 0x008d: 0x039e, # GREEK CAPITAL LETTER XI ! 0x008e: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x008f: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x0090: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x0091: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x0092: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x0093: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x0094: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x0095: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x0096: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x0097: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x0098: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x0099: 0x03b2, # GREEK SMALL LETTER BETA ! 0x009a: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x009b: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x009c: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x009d: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x009e: 0x03b7, # GREEK SMALL LETTER ETA ! 0x009f: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00a0: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00a1: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00a2: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00a3: 0x03bc, # GREEK SMALL LETTER MU ! 0x00a4: 0x03bd, # GREEK SMALL LETTER NU ! 0x00a5: 0x03be, # GREEK SMALL LETTER XI ! 0x00a6: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00a7: 0x03c0, # GREEK SMALL LETTER PI ! 0x00a8: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00a9: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00aa: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00ab: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00ac: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00ad: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ae: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00af: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00e1: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00e2: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00e3: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00e4: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00e5: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00e6: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00e7: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00e8: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00e9: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ea: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00eb: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00ec: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00ed: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00ee: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00ef: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00f0: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00f5: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x0081: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x0082: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x0083: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x0084: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x0085: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x0086: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x0087: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x0088: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x0089: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x008a: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x008b: 0x039c, # GREEK CAPITAL LETTER MU ! 0x008c: 0x039d, # GREEK CAPITAL LETTER NU ! 0x008d: 0x039e, # GREEK CAPITAL LETTER XI ! 0x008e: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x008f: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x0090: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x0091: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x0092: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x0093: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x0094: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x0095: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x0096: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x0097: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x0098: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x0099: 0x03b2, # GREEK SMALL LETTER BETA ! 0x009a: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x009b: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x009c: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x009d: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x009e: 0x03b7, # GREEK SMALL LETTER ETA ! 0x009f: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00a0: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00a1: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00a2: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00a3: 0x03bc, # GREEK SMALL LETTER MU ! 0x00a4: 0x03bd, # GREEK SMALL LETTER NU ! 0x00a5: 0x03be, # GREEK SMALL LETTER XI ! 0x00a6: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00a7: 0x03c0, # GREEK SMALL LETTER PI ! 0x00a8: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00a9: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00aa: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00ab: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00ac: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00ad: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ae: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00af: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00e1: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00e2: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00e3: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00e4: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00e5: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00e6: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00e7: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00e8: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00e9: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ea: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00eb: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00ec: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00ed: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00ee: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00ef: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00f0: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00f5: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp775.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp775.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp775.py 16 May 2001 09:41:45 -0000 1.3 --- cp775.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x0089: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x008a: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x008b: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x008c: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x0096: 0x00a2, # CENT SIGN ! 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00a1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00a4: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00a5: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00a6: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00a7: 0x00a6, # BROKEN BAR ! 0x00a8: 0x00a9, # COPYRIGHT SIGN ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00b6: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00b7: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00b8: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00be: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00c7: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00d0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00d1: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00d2: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00d3: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00d4: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00d5: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00d6: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00d7: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00d8: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x00e2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00e8: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00e9: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00ea: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00eb: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00ec: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00ed: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00ee: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00ef: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x0089: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x008a: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x008b: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x008c: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x0096: 0x00a2, # CENT SIGN ! 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: 0x00a4, # CURRENCY SIGN ! 0x00a0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00a1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00a4: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00a5: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00a6: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00a7: 0x00a6, # BROKEN BAR ! 0x00a8: 0x00a9, # COPYRIGHT SIGN ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00b6: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00b7: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00b8: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00be: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00c7: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00d0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00d1: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00d2: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00d3: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00d4: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00d5: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00d6: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00d7: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00d8: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x00e2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00e8: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00e9: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00ea: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00eb: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00ec: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00ed: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00ee: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00ef: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp850.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp850.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp850.py 16 May 2001 09:41:45 -0000 1.3 --- cp850.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00b8: 0x00a9, # COPYRIGHT SIGN ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x00a2, # CENT SIGN ! 0x00be: 0x00a5, # YEN SIGN ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x00f0, # LATIN SMALL LETTER ETH ! 0x00d1: 0x00d0, # LATIN CAPITAL LETTER ETH ! 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00d5: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x00a6, # BROKEN BAR ! 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x00fe, # LATIN SMALL LETTER THORN ! 0x00e8: 0x00de, # LATIN CAPITAL LETTER THORN ! 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ee: 0x00af, # MACRON ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2017, # DOUBLE LOW LINE ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00b8: 0x00a9, # COPYRIGHT SIGN ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x00a2, # CENT SIGN ! 0x00be: 0x00a5, # YEN SIGN ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x00f0, # LATIN SMALL LETTER ETH ! 0x00d1: 0x00d0, # LATIN CAPITAL LETTER ETH ! 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00d5: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x00a6, # BROKEN BAR ! 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x00fe, # LATIN SMALL LETTER THORN ! 0x00e8: 0x00de, # LATIN CAPITAL LETTER THORN ! 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ee: 0x00af, # MACRON ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2017, # DOUBLE LOW LINE ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp852.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp852.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp852.py 16 May 2001 09:41:45 -0000 1.3 --- cp852.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA ! 0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00f2: 0x02db, # OGONEK ! 0x00f3: 0x02c7, # CARON ! 0x00f4: 0x02d8, # BREVE ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA ! 0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00f2: 0x02db, # OGONEK ! 0x00f3: 0x02c7, # CARON ! 0x00f4: 0x02d8, # BREVE ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp855.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp855.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp855.py 16 May 2001 09:41:45 -0000 1.3 --- cp855.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x0081: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x0082: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x0083: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x0084: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x0085: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x0086: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x0087: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x0088: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x0089: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x008a: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x008b: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x008c: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x008d: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x008e: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x008f: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x0090: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x0091: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x0092: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x0093: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x0094: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x0095: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x0096: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x0097: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x0098: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x0099: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x009a: 0x045f, # CYRILLIC SMALL LETTER DZHE ! 0x009b: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x009c: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x009d: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x009e: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x009f: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00a1: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00a2: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00a3: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00a4: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00a5: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00a6: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00a7: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00a8: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00a9: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00aa: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00ab: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00ac: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00ad: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00b6: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00b7: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00b8: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00be: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00c7: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00d1: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00d2: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00d3: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00d4: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00d5: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00d6: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00d7: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00d8: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00de: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00e1: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00e2: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00e3: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00e4: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00e5: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00e6: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00e7: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00e8: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00e9: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00ea: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00eb: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00ec: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00ed: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00ee: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00ef: 0x2116, # NUMERO SIGN ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00f2: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00f3: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00f4: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00f5: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00f6: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00f7: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00f8: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00fa: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00fb: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00fc: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00fd: 0x00a7, # SECTION SIGN ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x0081: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x0082: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x0083: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x0084: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x0085: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x0086: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x0087: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x0088: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x0089: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x008a: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x008b: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x008c: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x008d: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x008e: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x008f: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x0090: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x0091: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x0092: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x0093: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x0094: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x0095: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x0096: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x0097: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x0098: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x0099: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x009a: 0x045f, # CYRILLIC SMALL LETTER DZHE ! 0x009b: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x009c: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x009d: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x009e: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x009f: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00a1: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00a2: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00a3: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00a4: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00a5: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00a6: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00a7: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00a8: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00a9: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00aa: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00ab: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00ac: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00ad: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00b6: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00b7: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00b8: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00be: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00c7: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00d1: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00d2: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00d3: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00d4: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00d5: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00d6: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00d7: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00d8: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00de: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00e1: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00e2: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00e3: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00e4: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00e5: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00e6: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00e7: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00e8: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00e9: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00ea: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00eb: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00ec: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00ed: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00ee: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00ef: 0x2116, # NUMERO SIGN ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00f2: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00f3: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00f4: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00f5: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00f6: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00f7: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00f8: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00fa: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00fb: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00fc: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00fd: 0x00a7, # SECTION SIGN ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp856.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp856.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cp856.py 16 May 2001 09:41:45 -0000 1.4 --- cp856.py 8 Aug 2002 20:19:19 -0000 1.5 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x05d0, # HEBREW LETTER ALEF ! 0x0081: 0x05d1, # HEBREW LETTER BET ! 0x0082: 0x05d2, # HEBREW LETTER GIMEL ! 0x0083: 0x05d3, # HEBREW LETTER DALET ! 0x0084: 0x05d4, # HEBREW LETTER HE ! 0x0085: 0x05d5, # HEBREW LETTER VAV ! 0x0086: 0x05d6, # HEBREW LETTER ZAYIN ! 0x0087: 0x05d7, # HEBREW LETTER HET ! 0x0088: 0x05d8, # HEBREW LETTER TET ! 0x0089: 0x05d9, # HEBREW LETTER YOD ! 0x008a: 0x05da, # HEBREW LETTER FINAL KAF ! 0x008b: 0x05db, # HEBREW LETTER KAF ! 0x008c: 0x05dc, # HEBREW LETTER LAMED ! 0x008d: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x008e: 0x05de, # HEBREW LETTER MEM ! 0x008f: 0x05df, # HEBREW LETTER FINAL NUN ! 0x0090: 0x05e0, # HEBREW LETTER NUN ! 0x0091: 0x05e1, # HEBREW LETTER SAMEKH ! 0x0092: 0x05e2, # HEBREW LETTER AYIN ! 0x0093: 0x05e3, # HEBREW LETTER FINAL PE ! 0x0094: 0x05e4, # HEBREW LETTER PE ! 0x0095: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x0096: 0x05e6, # HEBREW LETTER TSADI ! 0x0097: 0x05e7, # HEBREW LETTER QOF ! 0x0098: 0x05e8, # HEBREW LETTER RESH ! 0x0099: 0x05e9, # HEBREW LETTER SHIN ! 0x009a: 0x05ea, # HEBREW LETTER TAV ! 0x009b: None, # UNDEFINED ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: None, # UNDEFINED ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: None, # UNDEFINED ! 0x00a0: None, # UNDEFINED ! 0x00a1: None, # UNDEFINED ! 0x00a2: None, # UNDEFINED ! 0x00a3: None, # UNDEFINED ! 0x00a4: None, # UNDEFINED ! 0x00a5: None, # UNDEFINED ! 0x00a6: None, # UNDEFINED ! 0x00a7: None, # UNDEFINED ! 0x00a8: None, # UNDEFINED ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: None, # UNDEFINED ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: None, # UNDEFINED ! 0x00b6: None, # UNDEFINED ! 0x00b7: None, # UNDEFINED ! 0x00b8: 0x00a9, # COPYRIGHT SIGN ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x00a2, # CENT SIGN ! 0x00be: 0x00a5, # YEN SIGN ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: None, # UNDEFINED ! 0x00c7: None, # UNDEFINED ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: None, # UNDEFINED ! 0x00d1: None, # UNDEFINED ! 0x00d2: None, # UNDEFINED ! 0x00d3: None, # UNDEFINEDS ! 0x00d4: None, # UNDEFINED ! 0x00d5: None, # UNDEFINED ! 0x00d6: None, # UNDEFINEDE ! 0x00d7: None, # UNDEFINED ! 0x00d8: None, # UNDEFINED ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x00a6, # BROKEN BAR ! 0x00de: None, # UNDEFINED ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: None, # UNDEFINED ! 0x00e1: None, # UNDEFINED ! 0x00e2: None, # UNDEFINED ! 0x00e3: None, # UNDEFINED ! 0x00e4: None, # UNDEFINED ! 0x00e5: None, # UNDEFINED ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: None, # UNDEFINED ! 0x00e8: None, # UNDEFINED ! 0x00e9: None, # UNDEFINED ! 0x00ea: None, # UNDEFINED ! 0x00eb: None, # UNDEFINED ! 0x00ec: None, # UNDEFINED ! 0x00ed: None, # UNDEFINED ! 0x00ee: 0x00af, # MACRON ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2017, # DOUBLE LOW LINE ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x05d0, # HEBREW LETTER ALEF ! 0x0081: 0x05d1, # HEBREW LETTER BET ! 0x0082: 0x05d2, # HEBREW LETTER GIMEL ! 0x0083: 0x05d3, # HEBREW LETTER DALET ! 0x0084: 0x05d4, # HEBREW LETTER HE ! 0x0085: 0x05d5, # HEBREW LETTER VAV ! 0x0086: 0x05d6, # HEBREW LETTER ZAYIN ! 0x0087: 0x05d7, # HEBREW LETTER HET ! 0x0088: 0x05d8, # HEBREW LETTER TET ! 0x0089: 0x05d9, # HEBREW LETTER YOD ! 0x008a: 0x05da, # HEBREW LETTER FINAL KAF ! 0x008b: 0x05db, # HEBREW LETTER KAF ! 0x008c: 0x05dc, # HEBREW LETTER LAMED ! 0x008d: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x008e: 0x05de, # HEBREW LETTER MEM ! 0x008f: 0x05df, # HEBREW LETTER FINAL NUN ! 0x0090: 0x05e0, # HEBREW LETTER NUN ! 0x0091: 0x05e1, # HEBREW LETTER SAMEKH ! 0x0092: 0x05e2, # HEBREW LETTER AYIN ! 0x0093: 0x05e3, # HEBREW LETTER FINAL PE ! 0x0094: 0x05e4, # HEBREW LETTER PE ! 0x0095: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x0096: 0x05e6, # HEBREW LETTER TSADI ! 0x0097: 0x05e7, # HEBREW LETTER QOF ! 0x0098: 0x05e8, # HEBREW LETTER RESH ! 0x0099: 0x05e9, # HEBREW LETTER SHIN ! 0x009a: 0x05ea, # HEBREW LETTER TAV ! 0x009b: None, # UNDEFINED ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: None, # UNDEFINED ! 0x009e: 0x00d7, # MULTIPLICATION SIGN ! 0x009f: None, # UNDEFINED ! 0x00a0: None, # UNDEFINED ! 0x00a1: None, # UNDEFINED ! 0x00a2: None, # UNDEFINED ! 0x00a3: None, # UNDEFINED ! 0x00a4: None, # UNDEFINED ! 0x00a5: None, # UNDEFINED ! 0x00a6: None, # UNDEFINED ! 0x00a7: None, # UNDEFINED ! 0x00a8: None, # UNDEFINED ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: None, # UNDEFINED ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: None, # UNDEFINED ! 0x00b6: None, # UNDEFINED ! 0x00b7: None, # UNDEFINED ! 0x00b8: 0x00a9, # COPYRIGHT SIGN ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x00a2, # CENT SIGN ! 0x00be: 0x00a5, # YEN SIGN ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: None, # UNDEFINED ! 0x00c7: None, # UNDEFINED ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: None, # UNDEFINED ! 0x00d1: None, # UNDEFINED ! 0x00d2: None, # UNDEFINED ! 0x00d3: None, # UNDEFINEDS ! 0x00d4: None, # UNDEFINED ! 0x00d5: None, # UNDEFINED ! 0x00d6: None, # UNDEFINEDE ! 0x00d7: None, # UNDEFINED ! 0x00d8: None, # UNDEFINED ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x00a6, # BROKEN BAR ! 0x00de: None, # UNDEFINED ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: None, # UNDEFINED ! 0x00e1: None, # UNDEFINED ! 0x00e2: None, # UNDEFINED ! 0x00e3: None, # UNDEFINED ! 0x00e4: None, # UNDEFINED ! 0x00e5: None, # UNDEFINED ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: None, # UNDEFINED ! 0x00e8: None, # UNDEFINED ! 0x00e9: None, # UNDEFINED ! 0x00ea: None, # UNDEFINED ! 0x00eb: None, # UNDEFINED ! 0x00ec: None, # UNDEFINED ! 0x00ed: None, # UNDEFINED ! 0x00ee: 0x00af, # MACRON ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2017, # DOUBLE LOW LINE ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp857.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp857.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp857.py 16 May 2001 09:41:45 -0000 1.3 --- cp857.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,168 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x009f: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00a7: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00b8: 0x00a9, # COPYRIGHT SIGN ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x00a2, # CENT SIGN ! 0x00be: 0x00a5, # YEN SIGN ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00d1: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00d5: None, # UNDEFINED ! 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x00a6, # BROKEN BAR ! 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: None, # UNDEFINED ! 0x00e8: 0x00d7, # MULTIPLICATION SIGN ! 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00ed: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00ee: 0x00af, # MACRON ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: None, # UNDEFINED ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,168 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x009f: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00a7: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00b8: 0x00a9, # COPYRIGHT SIGN ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x00a2, # CENT SIGN ! 0x00be: 0x00a5, # YEN SIGN ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x00a4, # CURRENCY SIGN ! 0x00d0: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00d1: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00d5: None, # UNDEFINED ! 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x00a6, # BROKEN BAR ! 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: None, # UNDEFINED ! 0x00e8: 0x00d7, # MULTIPLICATION SIGN ! 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00ed: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00ee: 0x00af, # MACRON ! 0x00ef: 0x00b4, # ACUTE ACCENT ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: None, # UNDEFINED ! 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00f4: 0x00b6, # PILCROW SIGN ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x00b8, # CEDILLA ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x00b9, # SUPERSCRIPT ONE ! 0x00fc: 0x00b3, # SUPERSCRIPT THREE ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp860.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp860.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp860.py 16 May 2001 09:41:45 -0000 1.3 --- cp860.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x008c: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x008f: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0092: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0099: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x008c: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x008f: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x0092: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x0099: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp861.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp861.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp861.py 16 May 2001 09:41:45 -0000 1.3 --- cp861.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00d0, # LATIN CAPITAL LETTER ETH ! 0x008c: 0x00f0, # LATIN SMALL LETTER ETH ! 0x008d: 0x00de, # LATIN CAPITAL LETTER THORN ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00fe, # LATIN SMALL LETTER THORN ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x0098: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00a5: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00a6: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00a7: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00d0, # LATIN CAPITAL LETTER ETH ! 0x008c: 0x00f0, # LATIN SMALL LETTER ETH ! 0x008d: 0x00de, # LATIN CAPITAL LETTER THORN ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00fe, # LATIN SMALL LETTER THORN ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x0098: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00a5: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00a6: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00a7: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp862.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp862.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp862.py 16 May 2001 09:41:45 -0000 1.3 --- cp862.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x05d0, # HEBREW LETTER ALEF ! 0x0081: 0x05d1, # HEBREW LETTER BET ! 0x0082: 0x05d2, # HEBREW LETTER GIMEL ! 0x0083: 0x05d3, # HEBREW LETTER DALET ! 0x0084: 0x05d4, # HEBREW LETTER HE ! 0x0085: 0x05d5, # HEBREW LETTER VAV ! 0x0086: 0x05d6, # HEBREW LETTER ZAYIN ! 0x0087: 0x05d7, # HEBREW LETTER HET ! 0x0088: 0x05d8, # HEBREW LETTER TET ! 0x0089: 0x05d9, # HEBREW LETTER YOD ! 0x008a: 0x05da, # HEBREW LETTER FINAL KAF ! 0x008b: 0x05db, # HEBREW LETTER KAF ! 0x008c: 0x05dc, # HEBREW LETTER LAMED ! 0x008d: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x008e: 0x05de, # HEBREW LETTER MEM ! 0x008f: 0x05df, # HEBREW LETTER FINAL NUN ! 0x0090: 0x05e0, # HEBREW LETTER NUN ! 0x0091: 0x05e1, # HEBREW LETTER SAMEKH ! 0x0092: 0x05e2, # HEBREW LETTER AYIN ! 0x0093: 0x05e3, # HEBREW LETTER FINAL PE ! 0x0094: 0x05e4, # HEBREW LETTER PE ! 0x0095: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x0096: 0x05e6, # HEBREW LETTER TSADI ! 0x0097: 0x05e7, # HEBREW LETTER QOF ! 0x0098: 0x05e8, # HEBREW LETTER RESH ! 0x0099: 0x05e9, # HEBREW LETTER SHIN ! 0x009a: 0x05ea, # HEBREW LETTER TAV ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00a5, # YEN SIGN ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x05d0, # HEBREW LETTER ALEF ! 0x0081: 0x05d1, # HEBREW LETTER BET ! 0x0082: 0x05d2, # HEBREW LETTER GIMEL ! 0x0083: 0x05d3, # HEBREW LETTER DALET ! 0x0084: 0x05d4, # HEBREW LETTER HE ! 0x0085: 0x05d5, # HEBREW LETTER VAV ! 0x0086: 0x05d6, # HEBREW LETTER ZAYIN ! 0x0087: 0x05d7, # HEBREW LETTER HET ! 0x0088: 0x05d8, # HEBREW LETTER TET ! 0x0089: 0x05d9, # HEBREW LETTER YOD ! 0x008a: 0x05da, # HEBREW LETTER FINAL KAF ! 0x008b: 0x05db, # HEBREW LETTER KAF ! 0x008c: 0x05dc, # HEBREW LETTER LAMED ! 0x008d: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x008e: 0x05de, # HEBREW LETTER MEM ! 0x008f: 0x05df, # HEBREW LETTER FINAL NUN ! 0x0090: 0x05e0, # HEBREW LETTER NUN ! 0x0091: 0x05e1, # HEBREW LETTER SAMEKH ! 0x0092: 0x05e2, # HEBREW LETTER AYIN ! 0x0093: 0x05e3, # HEBREW LETTER FINAL PE ! 0x0094: 0x05e4, # HEBREW LETTER PE ! 0x0095: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x0096: 0x05e6, # HEBREW LETTER TSADI ! 0x0097: 0x05e7, # HEBREW LETTER QOF ! 0x0098: 0x05e8, # HEBREW LETTER RESH ! 0x0099: 0x05e9, # HEBREW LETTER SHIN ! 0x009a: 0x05ea, # HEBREW LETTER TAV ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00a5, # YEN SIGN ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp863.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp863.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp863.py 16 May 2001 09:41:45 -0000 1.3 --- cp863.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00b6, # PILCROW SIGN ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x2017, # DOUBLE LOW LINE ! 0x008e: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x008f: 0x00a7, # SECTION SIGN ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0092: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0095: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00a4, # CURRENCY SIGN ! 0x0099: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x009e: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00a6, # BROKEN BAR ! 0x00a1: 0x00b4, # ACUTE ACCENT ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00a8, # DIAERESIS ! 0x00a5: 0x00b8, # CEDILLA ! 0x00a6: 0x00b3, # SUPERSCRIPT THREE ! 0x00a7: 0x00af, # MACRON ! 0x00a8: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00b6, # PILCROW SIGN ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x2017, # DOUBLE LOW LINE ! 0x008e: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x008f: 0x00a7, # SECTION SIGN ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x0092: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x0095: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00a4, # CURRENCY SIGN ! 0x0099: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00a2, # CENT SIGN ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x009e: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00a6, # BROKEN BAR ! 0x00a1: 0x00b4, # ACUTE ACCENT ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00a8, # DIAERESIS ! 0x00a5: 0x00b8, # CEDILLA ! 0x00a6: 0x00b3, # SUPERSCRIPT THREE ! 0x00a7: 0x00af, # MACRON ! 0x00a8: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00be, # VULGAR FRACTION THREE QUARTERS ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp864.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp864.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp864.py 16 May 2001 09:41:45 -0000 1.3 --- cp864.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,167 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0025: 0x066a, # ARABIC PERCENT SIGN ! 0x0080: 0x00b0, # DEGREE SIGN ! 0x0081: 0x00b7, # MIDDLE DOT ! 0x0082: 0x2219, # BULLET OPERATOR ! 0x0083: 0x221a, # SQUARE ROOT ! 0x0084: 0x2592, # MEDIUM SHADE ! 0x0085: 0x2500, # FORMS LIGHT HORIZONTAL ! 0x0086: 0x2502, # FORMS LIGHT VERTICAL ! 0x0087: 0x253c, # FORMS LIGHT VERTICAL AND HORIZONTAL ! 0x0088: 0x2524, # FORMS LIGHT VERTICAL AND LEFT ! 0x0089: 0x252c, # FORMS LIGHT DOWN AND HORIZONTAL ! 0x008a: 0x251c, # FORMS LIGHT VERTICAL AND RIGHT ! 0x008b: 0x2534, # FORMS LIGHT UP AND HORIZONTAL ! 0x008c: 0x2510, # FORMS LIGHT DOWN AND LEFT ! 0x008d: 0x250c, # FORMS LIGHT DOWN AND RIGHT ! 0x008e: 0x2514, # FORMS LIGHT UP AND RIGHT ! 0x008f: 0x2518, # FORMS LIGHT UP AND LEFT ! 0x0090: 0x03b2, # GREEK SMALL BETA ! 0x0091: 0x221e, # INFINITY ! 0x0092: 0x03c6, # GREEK SMALL PHI ! 0x0093: 0x00b1, # PLUS-OR-MINUS SIGN ! 0x0094: 0x00bd, # FRACTION 1/2 ! 0x0095: 0x00bc, # FRACTION 1/4 ! 0x0096: 0x2248, # ALMOST EQUAL TO ! 0x0097: 0x00ab, # LEFT POINTING GUILLEMET ! 0x0098: 0x00bb, # RIGHT POINTING GUILLEMET ! 0x0099: 0xfef7, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM ! 0x009a: 0xfef8, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM ! 0x009b: None, # UNDEFINED ! 0x009c: None, # UNDEFINED ! 0x009d: 0xfefb, # ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM ! 0x009e: 0xfefc, # ARABIC LIGATURE LAM WITH ALEF FINAL FORM ! 0x009f: None, # UNDEFINED ! 0x00a1: 0x00ad, # SOFT HYPHEN ! 0x00a2: 0xfe82, # ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM ! 0x00a5: 0xfe84, # ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM ! 0x00a6: None, # UNDEFINED ! 0x00a7: None, # UNDEFINED ! 0x00a8: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM ! 0x00a9: 0xfe8f, # ARABIC LETTER BEH ISOLATED FORM ! 0x00aa: 0xfe95, # ARABIC LETTER TEH ISOLATED FORM ! 0x00ab: 0xfe99, # ARABIC LETTER THEH ISOLATED FORM ! 0x00ac: 0x060c, # ARABIC COMMA ! 0x00ad: 0xfe9d, # ARABIC LETTER JEEM ISOLATED FORM ! 0x00ae: 0xfea1, # ARABIC LETTER HAH ISOLATED FORM ! 0x00af: 0xfea5, # ARABIC LETTER KHAH ISOLATED FORM ! 0x00b0: 0x0660, # ARABIC-INDIC DIGIT ZERO ! 0x00b1: 0x0661, # ARABIC-INDIC DIGIT ONE ! 0x00b2: 0x0662, # ARABIC-INDIC DIGIT TWO ! 0x00b3: 0x0663, # ARABIC-INDIC DIGIT THREE ! 0x00b4: 0x0664, # ARABIC-INDIC DIGIT FOUR ! 0x00b5: 0x0665, # ARABIC-INDIC DIGIT FIVE ! 0x00b6: 0x0666, # ARABIC-INDIC DIGIT SIX ! 0x00b7: 0x0667, # ARABIC-INDIC DIGIT SEVEN ! 0x00b8: 0x0668, # ARABIC-INDIC DIGIT EIGHT ! 0x00b9: 0x0669, # ARABIC-INDIC DIGIT NINE ! 0x00ba: 0xfed1, # ARABIC LETTER FEH ISOLATED FORM ! 0x00bb: 0x061b, # ARABIC SEMICOLON ! 0x00bc: 0xfeb1, # ARABIC LETTER SEEN ISOLATED FORM ! 0x00bd: 0xfeb5, # ARABIC LETTER SHEEN ISOLATED FORM ! 0x00be: 0xfeb9, # ARABIC LETTER SAD ISOLATED FORM ! 0x00bf: 0x061f, # ARABIC QUESTION MARK ! 0x00c0: 0x00a2, # CENT SIGN ! 0x00c1: 0xfe80, # ARABIC LETTER HAMZA ISOLATED FORM ! 0x00c2: 0xfe81, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM ! 0x00c3: 0xfe83, # ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM ! 0x00c4: 0xfe85, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM ! 0x00c5: 0xfeca, # ARABIC LETTER AIN FINAL FORM ! 0x00c6: 0xfe8b, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM ! 0x00c7: 0xfe8d, # ARABIC LETTER ALEF ISOLATED FORM ! 0x00c8: 0xfe91, # ARABIC LETTER BEH INITIAL FORM ! 0x00c9: 0xfe93, # ARABIC LETTER TEH MARBUTA ISOLATED FORM ! 0x00ca: 0xfe97, # ARABIC LETTER TEH INITIAL FORM ! 0x00cb: 0xfe9b, # ARABIC LETTER THEH INITIAL FORM ! 0x00cc: 0xfe9f, # ARABIC LETTER JEEM INITIAL FORM ! 0x00cd: 0xfea3, # ARABIC LETTER HAH INITIAL FORM ! 0x00ce: 0xfea7, # ARABIC LETTER KHAH INITIAL FORM ! 0x00cf: 0xfea9, # ARABIC LETTER DAL ISOLATED FORM ! 0x00d0: 0xfeab, # ARABIC LETTER THAL ISOLATED FORM ! 0x00d1: 0xfead, # ARABIC LETTER REH ISOLATED FORM ! 0x00d2: 0xfeaf, # ARABIC LETTER ZAIN ISOLATED FORM ! 0x00d3: 0xfeb3, # ARABIC LETTER SEEN INITIAL FORM ! 0x00d4: 0xfeb7, # ARABIC LETTER SHEEN INITIAL FORM ! 0x00d5: 0xfebb, # ARABIC LETTER SAD INITIAL FORM ! 0x00d6: 0xfebf, # ARABIC LETTER DAD INITIAL FORM ! 0x00d7: 0xfec1, # ARABIC LETTER TAH ISOLATED FORM ! 0x00d8: 0xfec5, # ARABIC LETTER ZAH ISOLATED FORM ! 0x00d9: 0xfecb, # ARABIC LETTER AIN INITIAL FORM ! 0x00da: 0xfecf, # ARABIC LETTER GHAIN INITIAL FORM ! 0x00db: 0x00a6, # BROKEN VERTICAL BAR ! 0x00dc: 0x00ac, # NOT SIGN ! 0x00dd: 0x00f7, # DIVISION SIGN ! 0x00de: 0x00d7, # MULTIPLICATION SIGN ! 0x00df: 0xfec9, # ARABIC LETTER AIN ISOLATED FORM ! 0x00e0: 0x0640, # ARABIC TATWEEL ! 0x00e1: 0xfed3, # ARABIC LETTER FEH INITIAL FORM ! 0x00e2: 0xfed7, # ARABIC LETTER QAF INITIAL FORM ! 0x00e3: 0xfedb, # ARABIC LETTER KAF INITIAL FORM ! 0x00e4: 0xfedf, # ARABIC LETTER LAM INITIAL FORM ! 0x00e5: 0xfee3, # ARABIC LETTER MEEM INITIAL FORM ! 0x00e6: 0xfee7, # ARABIC LETTER NOON INITIAL FORM ! 0x00e7: 0xfeeb, # ARABIC LETTER HEH INITIAL FORM ! 0x00e8: 0xfeed, # ARABIC LETTER WAW ISOLATED FORM ! 0x00e9: 0xfeef, # ARABIC LETTER ALEF MAKSURA ISOLATED FORM ! 0x00ea: 0xfef3, # ARABIC LETTER YEH INITIAL FORM ! 0x00eb: 0xfebd, # ARABIC LETTER DAD ISOLATED FORM ! 0x00ec: 0xfecc, # ARABIC LETTER AIN MEDIAL FORM ! 0x00ed: 0xfece, # ARABIC LETTER GHAIN FINAL FORM ! 0x00ee: 0xfecd, # ARABIC LETTER GHAIN ISOLATED FORM ! 0x00ef: 0xfee1, # ARABIC LETTER MEEM ISOLATED FORM ! 0x00f0: 0xfe7d, # ARABIC SHADDA MEDIAL FORM ! 0x00f1: 0x0651, # ARABIC SHADDAH ! 0x00f2: 0xfee5, # ARABIC LETTER NOON ISOLATED FORM ! 0x00f3: 0xfee9, # ARABIC LETTER HEH ISOLATED FORM ! 0x00f4: 0xfeec, # ARABIC LETTER HEH MEDIAL FORM ! 0x00f5: 0xfef0, # ARABIC LETTER ALEF MAKSURA FINAL FORM ! 0x00f6: 0xfef2, # ARABIC LETTER YEH FINAL FORM ! 0x00f7: 0xfed0, # ARABIC LETTER GHAIN MEDIAL FORM ! 0x00f8: 0xfed5, # ARABIC LETTER QAF ISOLATED FORM ! 0x00f9: 0xfef5, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM ! 0x00fa: 0xfef6, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM ! 0x00fb: 0xfedd, # ARABIC LETTER LAM ISOLATED FORM ! 0x00fc: 0xfed9, # ARABIC LETTER KAF ISOLATED FORM ! 0x00fd: 0xfef1, # ARABIC LETTER YEH ISOLATED FORM ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: None, # UNDEFINED }) --- 38,167 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0025: 0x066a, # ARABIC PERCENT SIGN ! 0x0080: 0x00b0, # DEGREE SIGN ! 0x0081: 0x00b7, # MIDDLE DOT ! 0x0082: 0x2219, # BULLET OPERATOR ! 0x0083: 0x221a, # SQUARE ROOT ! 0x0084: 0x2592, # MEDIUM SHADE ! 0x0085: 0x2500, # FORMS LIGHT HORIZONTAL ! 0x0086: 0x2502, # FORMS LIGHT VERTICAL ! 0x0087: 0x253c, # FORMS LIGHT VERTICAL AND HORIZONTAL ! 0x0088: 0x2524, # FORMS LIGHT VERTICAL AND LEFT ! 0x0089: 0x252c, # FORMS LIGHT DOWN AND HORIZONTAL ! 0x008a: 0x251c, # FORMS LIGHT VERTICAL AND RIGHT ! 0x008b: 0x2534, # FORMS LIGHT UP AND HORIZONTAL ! 0x008c: 0x2510, # FORMS LIGHT DOWN AND LEFT ! 0x008d: 0x250c, # FORMS LIGHT DOWN AND RIGHT ! 0x008e: 0x2514, # FORMS LIGHT UP AND RIGHT ! 0x008f: 0x2518, # FORMS LIGHT UP AND LEFT ! 0x0090: 0x03b2, # GREEK SMALL BETA ! 0x0091: 0x221e, # INFINITY ! 0x0092: 0x03c6, # GREEK SMALL PHI ! 0x0093: 0x00b1, # PLUS-OR-MINUS SIGN ! 0x0094: 0x00bd, # FRACTION 1/2 ! 0x0095: 0x00bc, # FRACTION 1/4 ! 0x0096: 0x2248, # ALMOST EQUAL TO ! 0x0097: 0x00ab, # LEFT POINTING GUILLEMET ! 0x0098: 0x00bb, # RIGHT POINTING GUILLEMET ! 0x0099: 0xfef7, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM ! 0x009a: 0xfef8, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM ! 0x009b: None, # UNDEFINED ! 0x009c: None, # UNDEFINED ! 0x009d: 0xfefb, # ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM ! 0x009e: 0xfefc, # ARABIC LIGATURE LAM WITH ALEF FINAL FORM ! 0x009f: None, # UNDEFINED ! 0x00a1: 0x00ad, # SOFT HYPHEN ! 0x00a2: 0xfe82, # ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM ! 0x00a5: 0xfe84, # ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM ! 0x00a6: None, # UNDEFINED ! 0x00a7: None, # UNDEFINED ! 0x00a8: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM ! 0x00a9: 0xfe8f, # ARABIC LETTER BEH ISOLATED FORM ! 0x00aa: 0xfe95, # ARABIC LETTER TEH ISOLATED FORM ! 0x00ab: 0xfe99, # ARABIC LETTER THEH ISOLATED FORM ! 0x00ac: 0x060c, # ARABIC COMMA ! 0x00ad: 0xfe9d, # ARABIC LETTER JEEM ISOLATED FORM ! 0x00ae: 0xfea1, # ARABIC LETTER HAH ISOLATED FORM ! 0x00af: 0xfea5, # ARABIC LETTER KHAH ISOLATED FORM ! 0x00b0: 0x0660, # ARABIC-INDIC DIGIT ZERO ! 0x00b1: 0x0661, # ARABIC-INDIC DIGIT ONE ! 0x00b2: 0x0662, # ARABIC-INDIC DIGIT TWO ! 0x00b3: 0x0663, # ARABIC-INDIC DIGIT THREE ! 0x00b4: 0x0664, # ARABIC-INDIC DIGIT FOUR ! 0x00b5: 0x0665, # ARABIC-INDIC DIGIT FIVE ! 0x00b6: 0x0666, # ARABIC-INDIC DIGIT SIX ! 0x00b7: 0x0667, # ARABIC-INDIC DIGIT SEVEN ! 0x00b8: 0x0668, # ARABIC-INDIC DIGIT EIGHT ! 0x00b9: 0x0669, # ARABIC-INDIC DIGIT NINE ! 0x00ba: 0xfed1, # ARABIC LETTER FEH ISOLATED FORM ! 0x00bb: 0x061b, # ARABIC SEMICOLON ! 0x00bc: 0xfeb1, # ARABIC LETTER SEEN ISOLATED FORM ! 0x00bd: 0xfeb5, # ARABIC LETTER SHEEN ISOLATED FORM ! 0x00be: 0xfeb9, # ARABIC LETTER SAD ISOLATED FORM ! 0x00bf: 0x061f, # ARABIC QUESTION MARK ! 0x00c0: 0x00a2, # CENT SIGN ! 0x00c1: 0xfe80, # ARABIC LETTER HAMZA ISOLATED FORM ! 0x00c2: 0xfe81, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM ! 0x00c3: 0xfe83, # ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM ! 0x00c4: 0xfe85, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM ! 0x00c5: 0xfeca, # ARABIC LETTER AIN FINAL FORM ! 0x00c6: 0xfe8b, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM ! 0x00c7: 0xfe8d, # ARABIC LETTER ALEF ISOLATED FORM ! 0x00c8: 0xfe91, # ARABIC LETTER BEH INITIAL FORM ! 0x00c9: 0xfe93, # ARABIC LETTER TEH MARBUTA ISOLATED FORM ! 0x00ca: 0xfe97, # ARABIC LETTER TEH INITIAL FORM ! 0x00cb: 0xfe9b, # ARABIC LETTER THEH INITIAL FORM ! 0x00cc: 0xfe9f, # ARABIC LETTER JEEM INITIAL FORM ! 0x00cd: 0xfea3, # ARABIC LETTER HAH INITIAL FORM ! 0x00ce: 0xfea7, # ARABIC LETTER KHAH INITIAL FORM ! 0x00cf: 0xfea9, # ARABIC LETTER DAL ISOLATED FORM ! 0x00d0: 0xfeab, # ARABIC LETTER THAL ISOLATED FORM ! 0x00d1: 0xfead, # ARABIC LETTER REH ISOLATED FORM ! 0x00d2: 0xfeaf, # ARABIC LETTER ZAIN ISOLATED FORM ! 0x00d3: 0xfeb3, # ARABIC LETTER SEEN INITIAL FORM ! 0x00d4: 0xfeb7, # ARABIC LETTER SHEEN INITIAL FORM ! 0x00d5: 0xfebb, # ARABIC LETTER SAD INITIAL FORM ! 0x00d6: 0xfebf, # ARABIC LETTER DAD INITIAL FORM ! 0x00d7: 0xfec1, # ARABIC LETTER TAH ISOLATED FORM ! 0x00d8: 0xfec5, # ARABIC LETTER ZAH ISOLATED FORM ! 0x00d9: 0xfecb, # ARABIC LETTER AIN INITIAL FORM ! 0x00da: 0xfecf, # ARABIC LETTER GHAIN INITIAL FORM ! 0x00db: 0x00a6, # BROKEN VERTICAL BAR ! 0x00dc: 0x00ac, # NOT SIGN ! 0x00dd: 0x00f7, # DIVISION SIGN ! 0x00de: 0x00d7, # MULTIPLICATION SIGN ! 0x00df: 0xfec9, # ARABIC LETTER AIN ISOLATED FORM ! 0x00e0: 0x0640, # ARABIC TATWEEL ! 0x00e1: 0xfed3, # ARABIC LETTER FEH INITIAL FORM ! 0x00e2: 0xfed7, # ARABIC LETTER QAF INITIAL FORM ! 0x00e3: 0xfedb, # ARABIC LETTER KAF INITIAL FORM ! 0x00e4: 0xfedf, # ARABIC LETTER LAM INITIAL FORM ! 0x00e5: 0xfee3, # ARABIC LETTER MEEM INITIAL FORM ! 0x00e6: 0xfee7, # ARABIC LETTER NOON INITIAL FORM ! 0x00e7: 0xfeeb, # ARABIC LETTER HEH INITIAL FORM ! 0x00e8: 0xfeed, # ARABIC LETTER WAW ISOLATED FORM ! 0x00e9: 0xfeef, # ARABIC LETTER ALEF MAKSURA ISOLATED FORM ! 0x00ea: 0xfef3, # ARABIC LETTER YEH INITIAL FORM ! 0x00eb: 0xfebd, # ARABIC LETTER DAD ISOLATED FORM ! 0x00ec: 0xfecc, # ARABIC LETTER AIN MEDIAL FORM ! 0x00ed: 0xfece, # ARABIC LETTER GHAIN FINAL FORM ! 0x00ee: 0xfecd, # ARABIC LETTER GHAIN ISOLATED FORM ! 0x00ef: 0xfee1, # ARABIC LETTER MEEM ISOLATED FORM ! 0x00f0: 0xfe7d, # ARABIC SHADDA MEDIAL FORM ! 0x00f1: 0x0651, # ARABIC SHADDAH ! 0x00f2: 0xfee5, # ARABIC LETTER NOON ISOLATED FORM ! 0x00f3: 0xfee9, # ARABIC LETTER HEH ISOLATED FORM ! 0x00f4: 0xfeec, # ARABIC LETTER HEH MEDIAL FORM ! 0x00f5: 0xfef0, # ARABIC LETTER ALEF MAKSURA FINAL FORM ! 0x00f6: 0xfef2, # ARABIC LETTER YEH FINAL FORM ! 0x00f7: 0xfed0, # ARABIC LETTER GHAIN MEDIAL FORM ! 0x00f8: 0xfed5, # ARABIC LETTER QAF ISOLATED FORM ! 0x00f9: 0xfef5, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM ! 0x00fa: 0xfef6, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM ! 0x00fb: 0xfedd, # ARABIC LETTER LAM ISOLATED FORM ! 0x00fc: 0xfed9, # ARABIC LETTER KAF ISOLATED FORM ! 0x00fd: 0xfef1, # ARABIC LETTER YEH ISOLATED FORM ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: None, # UNDEFINED }) Index: cp865.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp865.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp865.py 16 May 2001 09:41:45 -0000 1.3 --- cp865.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00a4, # CURRENCY SIGN ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x009e: 0x20a7, # PESETA SIGN ! 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00a8: 0x00bf, # INVERTED QUESTION MARK ! 0x00a9: 0x2310, # REVERSED NOT SIGN ! 0x00aa: 0x00ac, # NOT SIGN ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER ! 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00a4, # CURRENCY SIGN ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00e3: 0x03c0, # GREEK SMALL LETTER PI ! 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00e6: 0x00b5, # MICRO SIGN ! 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00ec: 0x221e, # INFINITY ! 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00ef: 0x2229, # INTERSECTION ! 0x00f0: 0x2261, # IDENTICAL TO ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00f4: 0x2320, # TOP HALF INTEGRAL ! 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL ! 0x00f6: 0x00f7, # DIVISION SIGN ! 0x00f7: 0x2248, # ALMOST EQUAL TO ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N ! 0x00fd: 0x00b2, # SUPERSCRIPT TWO ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp866.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp866.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp866.py 16 May 2001 09:41:45 -0000 1.3 --- cp866.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00a1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00a2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00a3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00a4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00a5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00a6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00a7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00a8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00a9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00aa: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00ab: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00ac: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ad: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00ae: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00af: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00f0: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00f2: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00f3: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00f4: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00f5: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00f6: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00f7: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x2116, # NUMERO SIGN ! 0x00fd: 0x00a4, # CURRENCY SIGN ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00a1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00a2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00a3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00a4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00a5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00a6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00a7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00a8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00a9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00aa: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00ab: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00ac: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ad: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00ae: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00af: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x258c, # LEFT HALF BLOCK ! 0x00de: 0x2590, # RIGHT HALF BLOCK ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00f0: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00f2: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00f3: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00f4: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00f5: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00f6: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00f7: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x2219, # BULLET OPERATOR ! 0x00fa: 0x00b7, # MIDDLE DOT ! 0x00fb: 0x221a, # SQUARE ROOT ! 0x00fc: 0x2116, # NUMERO SIGN ! 0x00fd: 0x00a4, # CURRENCY SIGN ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp869.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp869.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp869.py 16 May 2001 09:41:45 -0000 1.3 --- cp869.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: None, # UNDEFINED ! 0x0081: None, # UNDEFINED ! 0x0082: None, # UNDEFINED ! 0x0083: None, # UNDEFINED ! 0x0084: None, # UNDEFINED ! 0x0085: None, # UNDEFINED ! 0x0086: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x0087: None, # UNDEFINED ! 0x0088: 0x00b7, # MIDDLE DOT ! 0x0089: 0x00ac, # NOT SIGN ! 0x008a: 0x00a6, # BROKEN BAR ! 0x008b: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x008c: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x008d: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x008e: 0x2015, # HORIZONTAL BAR ! 0x008f: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x0090: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x0091: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x0092: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x0093: None, # UNDEFINED ! 0x0094: None, # UNDEFINED ! 0x0095: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x0096: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x0097: 0x00a9, # COPYRIGHT SIGN ! 0x0098: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x0099: 0x00b2, # SUPERSCRIPT TWO ! 0x009a: 0x00b3, # SUPERSCRIPT THREE ! 0x009b: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x009e: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x009f: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00a0: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00a1: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00a2: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00a3: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00a4: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00a5: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00a6: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00a7: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00a8: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00a9: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00aa: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ad: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00b6: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x00b7: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00b8: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00be: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00c7: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00d0: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00d1: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00d2: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00d3: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00d4: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00d5: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00d6: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00d7: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00d8: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00de: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00e1: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e2: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00e3: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00e4: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00e5: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00e6: 0x03bc, # GREEK SMALL LETTER MU ! 0x00e7: 0x03bd, # GREEK SMALL LETTER NU ! 0x00e8: 0x03be, # GREEK SMALL LETTER XI ! 0x00e9: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00ea: 0x03c0, # GREEK SMALL LETTER PI ! 0x00eb: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00ec: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00ed: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00ee: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00ef: 0x0384, # GREEK TONOS ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00f3: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00f4: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00f7: 0x0385, # GREEK DIALYTIKA TONOS ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fc: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00fd: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: None, # UNDEFINED ! 0x0081: None, # UNDEFINED ! 0x0082: None, # UNDEFINED ! 0x0083: None, # UNDEFINED ! 0x0084: None, # UNDEFINED ! 0x0085: None, # UNDEFINED ! 0x0086: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x0087: None, # UNDEFINED ! 0x0088: 0x00b7, # MIDDLE DOT ! 0x0089: 0x00ac, # NOT SIGN ! 0x008a: 0x00a6, # BROKEN BAR ! 0x008b: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x008c: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x008d: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x008e: 0x2015, # HORIZONTAL BAR ! 0x008f: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x0090: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x0091: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x0092: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x0093: None, # UNDEFINED ! 0x0094: None, # UNDEFINED ! 0x0095: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x0096: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x0097: 0x00a9, # COPYRIGHT SIGN ! 0x0098: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x0099: 0x00b2, # SUPERSCRIPT TWO ! 0x009a: 0x00b3, # SUPERSCRIPT THREE ! 0x009b: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x009c: 0x00a3, # POUND SIGN ! 0x009d: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x009e: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x009f: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00a0: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00a1: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00a2: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00a3: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00a4: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00a5: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00a6: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00a7: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00a8: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00a9: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00aa: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00ac: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00ad: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00b0: 0x2591, # LIGHT SHADE ! 0x00b1: 0x2592, # MEDIUM SHADE ! 0x00b2: 0x2593, # DARK SHADE ! 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x00b5: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00b6: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x00b7: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00b8: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00bd: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00be: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x00c6: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00c7: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00cf: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00d0: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00d1: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00d2: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00d3: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00d4: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00d5: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00d6: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00d7: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00d8: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x00db: 0x2588, # FULL BLOCK ! 0x00dc: 0x2584, # LOWER HALF BLOCK ! 0x00dd: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00de: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00df: 0x2580, # UPPER HALF BLOCK ! 0x00e0: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00e1: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e2: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00e3: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00e4: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00e5: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00e6: 0x03bc, # GREEK SMALL LETTER MU ! 0x00e7: 0x03bd, # GREEK SMALL LETTER NU ! 0x00e8: 0x03be, # GREEK SMALL LETTER XI ! 0x00e9: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00ea: 0x03c0, # GREEK SMALL LETTER PI ! 0x00eb: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00ec: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00ed: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00ee: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00ef: 0x0384, # GREEK TONOS ! 0x00f0: 0x00ad, # SOFT HYPHEN ! 0x00f1: 0x00b1, # PLUS-MINUS SIGN ! 0x00f2: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00f3: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00f4: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f5: 0x00a7, # SECTION SIGN ! 0x00f6: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00f7: 0x0385, # GREEK DIALYTIKA TONOS ! 0x00f8: 0x00b0, # DEGREE SIGN ! 0x00f9: 0x00a8, # DIAERESIS ! 0x00fa: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fc: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00fd: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00fe: 0x25a0, # BLACK SQUARE ! 0x00ff: 0x00a0, # NO-BREAK SPACE }) Index: cp874.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp874.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp874.py 16 May 2001 09:41:45 -0000 1.3 --- cp874.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,168 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: None, # UNDEFINED ! 0x0083: None, # UNDEFINED ! 0x0084: None, # UNDEFINED ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: None, # UNDEFINED ! 0x0087: None, # UNDEFINED ! 0x0088: None, # UNDEFINED ! 0x0089: None, # UNDEFINED ! 0x008a: None, # UNDEFINED ! 0x008b: None, # UNDEFINED ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: None, # UNDEFINED ! 0x009a: None, # UNDEFINED ! 0x009b: None, # UNDEFINED ! 0x009c: None, # UNDEFINED ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: None, # UNDEFINED ! 0x00a1: 0x0e01, # THAI CHARACTER KO KAI ! 0x00a2: 0x0e02, # THAI CHARACTER KHO KHAI ! 0x00a3: 0x0e03, # THAI CHARACTER KHO KHUAT ! 0x00a4: 0x0e04, # THAI CHARACTER KHO KHWAI ! 0x00a5: 0x0e05, # THAI CHARACTER KHO KHON ! 0x00a6: 0x0e06, # THAI CHARACTER KHO RAKHANG ! 0x00a7: 0x0e07, # THAI CHARACTER NGO NGU ! 0x00a8: 0x0e08, # THAI CHARACTER CHO CHAN ! 0x00a9: 0x0e09, # THAI CHARACTER CHO CHING ! 0x00aa: 0x0e0a, # THAI CHARACTER CHO CHANG ! 0x00ab: 0x0e0b, # THAI CHARACTER SO SO ! 0x00ac: 0x0e0c, # THAI CHARACTER CHO CHOE ! 0x00ad: 0x0e0d, # THAI CHARACTER YO YING ! 0x00ae: 0x0e0e, # THAI CHARACTER DO CHADA ! 0x00af: 0x0e0f, # THAI CHARACTER TO PATAK ! 0x00b0: 0x0e10, # THAI CHARACTER THO THAN ! 0x00b1: 0x0e11, # THAI CHARACTER THO NANGMONTHO ! 0x00b2: 0x0e12, # THAI CHARACTER THO PHUTHAO ! 0x00b3: 0x0e13, # THAI CHARACTER NO NEN ! 0x00b4: 0x0e14, # THAI CHARACTER DO DEK ! 0x00b5: 0x0e15, # THAI CHARACTER TO TAO ! 0x00b6: 0x0e16, # THAI CHARACTER THO THUNG ! 0x00b7: 0x0e17, # THAI CHARACTER THO THAHAN ! 0x00b8: 0x0e18, # THAI CHARACTER THO THONG ! 0x00b9: 0x0e19, # THAI CHARACTER NO NU ! 0x00ba: 0x0e1a, # THAI CHARACTER BO BAIMAI ! 0x00bb: 0x0e1b, # THAI CHARACTER PO PLA ! 0x00bc: 0x0e1c, # THAI CHARACTER PHO PHUNG ! 0x00bd: 0x0e1d, # THAI CHARACTER FO FA ! 0x00be: 0x0e1e, # THAI CHARACTER PHO PHAN ! 0x00bf: 0x0e1f, # THAI CHARACTER FO FAN ! 0x00c0: 0x0e20, # THAI CHARACTER PHO SAMPHAO ! 0x00c1: 0x0e21, # THAI CHARACTER MO MA ! 0x00c2: 0x0e22, # THAI CHARACTER YO YAK ! 0x00c3: 0x0e23, # THAI CHARACTER RO RUA ! 0x00c4: 0x0e24, # THAI CHARACTER RU ! 0x00c5: 0x0e25, # THAI CHARACTER LO LING ! 0x00c6: 0x0e26, # THAI CHARACTER LU ! 0x00c7: 0x0e27, # THAI CHARACTER WO WAEN ! 0x00c8: 0x0e28, # THAI CHARACTER SO SALA ! 0x00c9: 0x0e29, # THAI CHARACTER SO RUSI ! 0x00ca: 0x0e2a, # THAI CHARACTER SO SUA ! 0x00cb: 0x0e2b, # THAI CHARACTER HO HIP ! 0x00cc: 0x0e2c, # THAI CHARACTER LO CHULA ! 0x00cd: 0x0e2d, # THAI CHARACTER O ANG ! 0x00ce: 0x0e2e, # THAI CHARACTER HO NOKHUK ! 0x00cf: 0x0e2f, # THAI CHARACTER PAIYANNOI ! 0x00d0: 0x0e30, # THAI CHARACTER SARA A ! 0x00d1: 0x0e31, # THAI CHARACTER MAI HAN-AKAT ! 0x00d2: 0x0e32, # THAI CHARACTER SARA AA ! 0x00d3: 0x0e33, # THAI CHARACTER SARA AM ! 0x00d4: 0x0e34, # THAI CHARACTER SARA I ! 0x00d5: 0x0e35, # THAI CHARACTER SARA II ! 0x00d6: 0x0e36, # THAI CHARACTER SARA UE ! 0x00d7: 0x0e37, # THAI CHARACTER SARA UEE ! 0x00d8: 0x0e38, # THAI CHARACTER SARA U ! 0x00d9: 0x0e39, # THAI CHARACTER SARA UU ! 0x00da: 0x0e3a, # THAI CHARACTER PHINTHU ! 0x00db: None, # UNDEFINED ! 0x00dc: None, # UNDEFINED ! 0x00dd: None, # UNDEFINED ! 0x00de: None, # UNDEFINED ! 0x00df: 0x0e3f, # THAI CURRENCY SYMBOL BAHT ! 0x00e0: 0x0e40, # THAI CHARACTER SARA E ! 0x00e1: 0x0e41, # THAI CHARACTER SARA AE ! 0x00e2: 0x0e42, # THAI CHARACTER SARA O ! 0x00e3: 0x0e43, # THAI CHARACTER SARA AI MAIMUAN ! 0x00e4: 0x0e44, # THAI CHARACTER SARA AI MAIMALAI ! 0x00e5: 0x0e45, # THAI CHARACTER LAKKHANGYAO ! 0x00e6: 0x0e46, # THAI CHARACTER MAIYAMOK ! 0x00e7: 0x0e47, # THAI CHARACTER MAITAIKHU ! 0x00e8: 0x0e48, # THAI CHARACTER MAI EK ! 0x00e9: 0x0e49, # THAI CHARACTER MAI THO ! 0x00ea: 0x0e4a, # THAI CHARACTER MAI TRI ! 0x00eb: 0x0e4b, # THAI CHARACTER MAI CHATTAWA ! 0x00ec: 0x0e4c, # THAI CHARACTER THANTHAKHAT ! 0x00ed: 0x0e4d, # THAI CHARACTER NIKHAHIT ! 0x00ee: 0x0e4e, # THAI CHARACTER YAMAKKAN ! 0x00ef: 0x0e4f, # THAI CHARACTER FONGMAN ! 0x00f0: 0x0e50, # THAI DIGIT ZERO ! 0x00f1: 0x0e51, # THAI DIGIT ONE ! 0x00f2: 0x0e52, # THAI DIGIT TWO ! 0x00f3: 0x0e53, # THAI DIGIT THREE ! 0x00f4: 0x0e54, # THAI DIGIT FOUR ! 0x00f5: 0x0e55, # THAI DIGIT FIVE ! 0x00f6: 0x0e56, # THAI DIGIT SIX ! 0x00f7: 0x0e57, # THAI DIGIT SEVEN ! 0x00f8: 0x0e58, # THAI DIGIT EIGHT ! 0x00f9: 0x0e59, # THAI DIGIT NINE ! 0x00fa: 0x0e5a, # THAI CHARACTER ANGKHANKHU ! 0x00fb: 0x0e5b, # THAI CHARACTER KHOMUT ! 0x00fc: None, # UNDEFINED ! 0x00fd: None, # UNDEFINED ! 0x00fe: None, # UNDEFINED ! 0x00ff: None, # UNDEFINED }) --- 38,168 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x20ac, # EURO SIGN ! 0x0081: None, # UNDEFINED ! 0x0082: None, # UNDEFINED ! 0x0083: None, # UNDEFINED ! 0x0084: None, # UNDEFINED ! 0x0085: 0x2026, # HORIZONTAL ELLIPSIS ! 0x0086: None, # UNDEFINED ! 0x0087: None, # UNDEFINED ! 0x0088: None, # UNDEFINED ! 0x0089: None, # UNDEFINED ! 0x008a: None, # UNDEFINED ! 0x008b: None, # UNDEFINED ! 0x008c: None, # UNDEFINED ! 0x008d: None, # UNDEFINED ! 0x008e: None, # UNDEFINED ! 0x008f: None, # UNDEFINED ! 0x0090: None, # UNDEFINED ! 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x0095: 0x2022, # BULLET ! 0x0096: 0x2013, # EN DASH ! 0x0097: 0x2014, # EM DASH ! 0x0098: None, # UNDEFINED ! 0x0099: None, # UNDEFINED ! 0x009a: None, # UNDEFINED ! 0x009b: None, # UNDEFINED ! 0x009c: None, # UNDEFINED ! 0x009d: None, # UNDEFINED ! 0x009e: None, # UNDEFINED ! 0x009f: None, # UNDEFINED ! 0x00a1: 0x0e01, # THAI CHARACTER KO KAI ! 0x00a2: 0x0e02, # THAI CHARACTER KHO KHAI ! 0x00a3: 0x0e03, # THAI CHARACTER KHO KHUAT ! 0x00a4: 0x0e04, # THAI CHARACTER KHO KHWAI ! 0x00a5: 0x0e05, # THAI CHARACTER KHO KHON ! 0x00a6: 0x0e06, # THAI CHARACTER KHO RAKHANG ! 0x00a7: 0x0e07, # THAI CHARACTER NGO NGU ! 0x00a8: 0x0e08, # THAI CHARACTER CHO CHAN ! 0x00a9: 0x0e09, # THAI CHARACTER CHO CHING ! 0x00aa: 0x0e0a, # THAI CHARACTER CHO CHANG ! 0x00ab: 0x0e0b, # THAI CHARACTER SO SO ! 0x00ac: 0x0e0c, # THAI CHARACTER CHO CHOE ! 0x00ad: 0x0e0d, # THAI CHARACTER YO YING ! 0x00ae: 0x0e0e, # THAI CHARACTER DO CHADA ! 0x00af: 0x0e0f, # THAI CHARACTER TO PATAK ! 0x00b0: 0x0e10, # THAI CHARACTER THO THAN ! 0x00b1: 0x0e11, # THAI CHARACTER THO NANGMONTHO ! 0x00b2: 0x0e12, # THAI CHARACTER THO PHUTHAO ! 0x00b3: 0x0e13, # THAI CHARACTER NO NEN ! 0x00b4: 0x0e14, # THAI CHARACTER DO DEK ! 0x00b5: 0x0e15, # THAI CHARACTER TO TAO ! 0x00b6: 0x0e16, # THAI CHARACTER THO THUNG ! 0x00b7: 0x0e17, # THAI CHARACTER THO THAHAN ! 0x00b8: 0x0e18, # THAI CHARACTER THO THONG ! 0x00b9: 0x0e19, # THAI CHARACTER NO NU ! 0x00ba: 0x0e1a, # THAI CHARACTER BO BAIMAI ! 0x00bb: 0x0e1b, # THAI CHARACTER PO PLA ! 0x00bc: 0x0e1c, # THAI CHARACTER PHO PHUNG ! 0x00bd: 0x0e1d, # THAI CHARACTER FO FA ! 0x00be: 0x0e1e, # THAI CHARACTER PHO PHAN ! 0x00bf: 0x0e1f, # THAI CHARACTER FO FAN ! 0x00c0: 0x0e20, # THAI CHARACTER PHO SAMPHAO ! 0x00c1: 0x0e21, # THAI CHARACTER MO MA ! 0x00c2: 0x0e22, # THAI CHARACTER YO YAK ! 0x00c3: 0x0e23, # THAI CHARACTER RO RUA ! 0x00c4: 0x0e24, # THAI CHARACTER RU ! 0x00c5: 0x0e25, # THAI CHARACTER LO LING ! 0x00c6: 0x0e26, # THAI CHARACTER LU ! 0x00c7: 0x0e27, # THAI CHARACTER WO WAEN ! 0x00c8: 0x0e28, # THAI CHARACTER SO SALA ! 0x00c9: 0x0e29, # THAI CHARACTER SO RUSI ! 0x00ca: 0x0e2a, # THAI CHARACTER SO SUA ! 0x00cb: 0x0e2b, # THAI CHARACTER HO HIP ! 0x00cc: 0x0e2c, # THAI CHARACTER LO CHULA ! 0x00cd: 0x0e2d, # THAI CHARACTER O ANG ! 0x00ce: 0x0e2e, # THAI CHARACTER HO NOKHUK ! 0x00cf: 0x0e2f, # THAI CHARACTER PAIYANNOI ! 0x00d0: 0x0e30, # THAI CHARACTER SARA A ! 0x00d1: 0x0e31, # THAI CHARACTER MAI HAN-AKAT ! 0x00d2: 0x0e32, # THAI CHARACTER SARA AA ! 0x00d3: 0x0e33, # THAI CHARACTER SARA AM ! 0x00d4: 0x0e34, # THAI CHARACTER SARA I ! 0x00d5: 0x0e35, # THAI CHARACTER SARA II ! 0x00d6: 0x0e36, # THAI CHARACTER SARA UE ! 0x00d7: 0x0e37, # THAI CHARACTER SARA UEE ! 0x00d8: 0x0e38, # THAI CHARACTER SARA U ! 0x00d9: 0x0e39, # THAI CHARACTER SARA UU ! 0x00da: 0x0e3a, # THAI CHARACTER PHINTHU ! 0x00db: None, # UNDEFINED ! 0x00dc: None, # UNDEFINED ! 0x00dd: None, # UNDEFINED ! 0x00de: None, # UNDEFINED ! 0x00df: 0x0e3f, # THAI CURRENCY SYMBOL BAHT ! 0x00e0: 0x0e40, # THAI CHARACTER SARA E ! 0x00e1: 0x0e41, # THAI CHARACTER SARA AE ! 0x00e2: 0x0e42, # THAI CHARACTER SARA O ! 0x00e3: 0x0e43, # THAI CHARACTER SARA AI MAIMUAN ! 0x00e4: 0x0e44, # THAI CHARACTER SARA AI MAIMALAI ! 0x00e5: 0x0e45, # THAI CHARACTER LAKKHANGYAO ! 0x00e6: 0x0e46, # THAI CHARACTER MAIYAMOK ! 0x00e7: 0x0e47, # THAI CHARACTER MAITAIKHU ! 0x00e8: 0x0e48, # THAI CHARACTER MAI EK ! 0x00e9: 0x0e49, # THAI CHARACTER MAI THO ! 0x00ea: 0x0e4a, # THAI CHARACTER MAI TRI ! 0x00eb: 0x0e4b, # THAI CHARACTER MAI CHATTAWA ! 0x00ec: 0x0e4c, # THAI CHARACTER THANTHAKHAT ! 0x00ed: 0x0e4d, # THAI CHARACTER NIKHAHIT ! 0x00ee: 0x0e4e, # THAI CHARACTER YAMAKKAN ! 0x00ef: 0x0e4f, # THAI CHARACTER FONGMAN ! 0x00f0: 0x0e50, # THAI DIGIT ZERO ! 0x00f1: 0x0e51, # THAI DIGIT ONE ! 0x00f2: 0x0e52, # THAI DIGIT TWO ! 0x00f3: 0x0e53, # THAI DIGIT THREE ! 0x00f4: 0x0e54, # THAI DIGIT FOUR ! 0x00f5: 0x0e55, # THAI DIGIT FIVE ! 0x00f6: 0x0e56, # THAI DIGIT SIX ! 0x00f7: 0x0e57, # THAI DIGIT SEVEN ! 0x00f8: 0x0e58, # THAI DIGIT EIGHT ! 0x00f9: 0x0e59, # THAI DIGIT NINE ! 0x00fa: 0x0e5a, # THAI CHARACTER ANGKHANKHU ! 0x00fb: 0x0e5b, # THAI CHARACTER KHOMUT ! 0x00fc: None, # UNDEFINED ! 0x00fd: None, # UNDEFINED ! 0x00fe: None, # UNDEFINED ! 0x00ff: None, # UNDEFINED }) Index: cp875.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp875.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cp875.py 16 May 2001 09:41:45 -0000 1.3 --- cp875.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,278 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x0042: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x0043: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x0044: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x0045: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x0046: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x0047: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x0048: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x0049: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x004a: 0x005b, # LEFT SQUARE BRACKET ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x0021, # EXCLAMATION MARK ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x0052: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x0053: 0x039c, # GREEK CAPITAL LETTER MU ! 0x0054: 0x039d, # GREEK CAPITAL LETTER NU ! 0x0055: 0x039e, # GREEK CAPITAL LETTER XI ! 0x0056: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x0057: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x0058: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x0059: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x005a: 0x005d, # RIGHT SQUARE BRACKET ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x005e, # CIRCUMFLEX ACCENT ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x0063: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x0064: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x0065: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x0066: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x0067: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x0068: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x0069: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x006a: 0x007c, # VERTICAL LINE ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00a8, # DIAERESIS ! 0x0071: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x0072: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x0073: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x0074: 0x00a0, # NO-BREAK SPACE ! 0x0075: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x0076: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x0077: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x0078: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: 0x0385, # GREEK DIALYTIKA TONOS ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x008b: 0x03b2, # GREEK SMALL LETTER BETA ! 0x008c: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x008d: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x008e: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x008f: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x03b7, # GREEK SMALL LETTER ETA ! 0x009b: 0x03b8, # GREEK SMALL LETTER THETA ! 0x009c: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x009d: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x009e: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x009f: 0x03bc, # GREEK SMALL LETTER MU ! 0x00a0: 0x00b4, # ACUTE ACCENT ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ab: 0x03be, # GREEK SMALL LETTER XI ! 0x00ac: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00ad: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ae: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00af: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00b0: 0x00a3, # POUND SIGN ! 0x00b1: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00b2: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00b3: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00b4: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00b5: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00b6: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00b7: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00b8: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00b9: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ba: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00bb: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00bc: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00bd: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00be: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00bf: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00cc: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00cd: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00ce: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00cf: 0x2015, # HORIZONTAL BAR ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b1, # PLUS-MINUS SIGN ! 0x00db: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00dc: 0x001a, # SUBSTITUTE ! 0x00dd: 0x0387, # GREEK ANO TELEIA ! 0x00de: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00df: 0x00a6, # BROKEN BAR ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x001a, # SUBSTITUTE ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00a7, # SECTION SIGN ! 0x00ec: 0x001a, # SUBSTITUTE ! 0x00ed: 0x001a, # SUBSTITUTE ! 0x00ee: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00ef: 0x00ac, # NOT SIGN ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00a9, # COPYRIGHT SIGN ! 0x00fc: 0x001a, # SUBSTITUTE ! 0x00fd: 0x001a, # SUBSTITUTE ! 0x00fe: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00ff: 0x009f, # CONTROL }) --- 38,278 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0004: 0x009c, # CONTROL ! 0x0005: 0x0009, # HORIZONTAL TABULATION ! 0x0006: 0x0086, # CONTROL ! 0x0007: 0x007f, # DELETE ! 0x0008: 0x0097, # CONTROL ! 0x0009: 0x008d, # CONTROL ! 0x000a: 0x008e, # CONTROL ! 0x0014: 0x009d, # CONTROL ! 0x0015: 0x0085, # CONTROL ! 0x0016: 0x0008, # BACKSPACE ! 0x0017: 0x0087, # CONTROL ! 0x001a: 0x0092, # CONTROL ! 0x001b: 0x008f, # CONTROL ! 0x0020: 0x0080, # CONTROL ! 0x0021: 0x0081, # CONTROL ! 0x0022: 0x0082, # CONTROL ! 0x0023: 0x0083, # CONTROL ! 0x0024: 0x0084, # CONTROL ! 0x0025: 0x000a, # LINE FEED ! 0x0026: 0x0017, # END OF TRANSMISSION BLOCK ! 0x0027: 0x001b, # ESCAPE ! 0x0028: 0x0088, # CONTROL ! 0x0029: 0x0089, # CONTROL ! 0x002a: 0x008a, # CONTROL ! 0x002b: 0x008b, # CONTROL ! 0x002c: 0x008c, # CONTROL ! 0x002d: 0x0005, # ENQUIRY ! 0x002e: 0x0006, # ACKNOWLEDGE ! 0x002f: 0x0007, # BELL ! 0x0030: 0x0090, # CONTROL ! 0x0031: 0x0091, # CONTROL ! 0x0032: 0x0016, # SYNCHRONOUS IDLE ! 0x0033: 0x0093, # CONTROL ! 0x0034: 0x0094, # CONTROL ! 0x0035: 0x0095, # CONTROL ! 0x0036: 0x0096, # CONTROL ! 0x0037: 0x0004, # END OF TRANSMISSION ! 0x0038: 0x0098, # CONTROL ! 0x0039: 0x0099, # CONTROL ! 0x003a: 0x009a, # CONTROL ! 0x003b: 0x009b, # CONTROL ! 0x003c: 0x0014, # DEVICE CONTROL FOUR ! 0x003d: 0x0015, # NEGATIVE ACKNOWLEDGE ! 0x003e: 0x009e, # CONTROL ! 0x003f: 0x001a, # SUBSTITUTE ! 0x0040: 0x0020, # SPACE ! 0x0041: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x0042: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x0043: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x0044: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x0045: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x0046: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x0047: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x0048: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x0049: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x004a: 0x005b, # LEFT SQUARE BRACKET ! 0x004b: 0x002e, # FULL STOP ! 0x004c: 0x003c, # LESS-THAN SIGN ! 0x004d: 0x0028, # LEFT PARENTHESIS ! 0x004e: 0x002b, # PLUS SIGN ! 0x004f: 0x0021, # EXCLAMATION MARK ! 0x0050: 0x0026, # AMPERSAND ! 0x0051: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x0052: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x0053: 0x039c, # GREEK CAPITAL LETTER MU ! 0x0054: 0x039d, # GREEK CAPITAL LETTER NU ! 0x0055: 0x039e, # GREEK CAPITAL LETTER XI ! 0x0056: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x0057: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x0058: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x0059: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x005a: 0x005d, # RIGHT SQUARE BRACKET ! 0x005b: 0x0024, # DOLLAR SIGN ! 0x005c: 0x002a, # ASTERISK ! 0x005d: 0x0029, # RIGHT PARENTHESIS ! 0x005e: 0x003b, # SEMICOLON ! 0x005f: 0x005e, # CIRCUMFLEX ACCENT ! 0x0060: 0x002d, # HYPHEN-MINUS ! 0x0061: 0x002f, # SOLIDUS ! 0x0062: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x0063: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x0064: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x0065: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x0066: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x0067: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x0068: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x0069: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x006a: 0x007c, # VERTICAL LINE ! 0x006b: 0x002c, # COMMA ! 0x006c: 0x0025, # PERCENT SIGN ! 0x006d: 0x005f, # LOW LINE ! 0x006e: 0x003e, # GREATER-THAN SIGN ! 0x006f: 0x003f, # QUESTION MARK ! 0x0070: 0x00a8, # DIAERESIS ! 0x0071: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x0072: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x0073: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x0074: 0x00a0, # NO-BREAK SPACE ! 0x0075: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x0076: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x0077: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x0078: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x0079: 0x0060, # GRAVE ACCENT ! 0x007a: 0x003a, # COLON ! 0x007b: 0x0023, # NUMBER SIGN ! 0x007c: 0x0040, # COMMERCIAL AT ! 0x007d: 0x0027, # APOSTROPHE ! 0x007e: 0x003d, # EQUALS SIGN ! 0x007f: 0x0022, # QUOTATION MARK ! 0x0080: 0x0385, # GREEK DIALYTIKA TONOS ! 0x0081: 0x0061, # LATIN SMALL LETTER A ! 0x0082: 0x0062, # LATIN SMALL LETTER B ! 0x0083: 0x0063, # LATIN SMALL LETTER C ! 0x0084: 0x0064, # LATIN SMALL LETTER D ! 0x0085: 0x0065, # LATIN SMALL LETTER E ! 0x0086: 0x0066, # LATIN SMALL LETTER F ! 0x0087: 0x0067, # LATIN SMALL LETTER G ! 0x0088: 0x0068, # LATIN SMALL LETTER H ! 0x0089: 0x0069, # LATIN SMALL LETTER I ! 0x008a: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x008b: 0x03b2, # GREEK SMALL LETTER BETA ! 0x008c: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x008d: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x008e: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x008f: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x0090: 0x00b0, # DEGREE SIGN ! 0x0091: 0x006a, # LATIN SMALL LETTER J ! 0x0092: 0x006b, # LATIN SMALL LETTER K ! 0x0093: 0x006c, # LATIN SMALL LETTER L ! 0x0094: 0x006d, # LATIN SMALL LETTER M ! 0x0095: 0x006e, # LATIN SMALL LETTER N ! 0x0096: 0x006f, # LATIN SMALL LETTER O ! 0x0097: 0x0070, # LATIN SMALL LETTER P ! 0x0098: 0x0071, # LATIN SMALL LETTER Q ! 0x0099: 0x0072, # LATIN SMALL LETTER R ! 0x009a: 0x03b7, # GREEK SMALL LETTER ETA ! 0x009b: 0x03b8, # GREEK SMALL LETTER THETA ! 0x009c: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x009d: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x009e: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x009f: 0x03bc, # GREEK SMALL LETTER MU ! 0x00a0: 0x00b4, # ACUTE ACCENT ! 0x00a1: 0x007e, # TILDE ! 0x00a2: 0x0073, # LATIN SMALL LETTER S ! 0x00a3: 0x0074, # LATIN SMALL LETTER T ! 0x00a4: 0x0075, # LATIN SMALL LETTER U ! 0x00a5: 0x0076, # LATIN SMALL LETTER V ! 0x00a6: 0x0077, # LATIN SMALL LETTER W ! 0x00a7: 0x0078, # LATIN SMALL LETTER X ! 0x00a8: 0x0079, # LATIN SMALL LETTER Y ! 0x00a9: 0x007a, # LATIN SMALL LETTER Z ! 0x00aa: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ab: 0x03be, # GREEK SMALL LETTER XI ! 0x00ac: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00ad: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ae: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00af: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00b0: 0x00a3, # POUND SIGN ! 0x00b1: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00b2: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00b3: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00b4: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00b5: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00b6: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00b7: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00b8: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00b9: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ba: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00bb: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00bc: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00bd: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00be: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00bf: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00c0: 0x007b, # LEFT CURLY BRACKET ! 0x00c1: 0x0041, # LATIN CAPITAL LETTER A ! 0x00c2: 0x0042, # LATIN CAPITAL LETTER B ! 0x00c3: 0x0043, # LATIN CAPITAL LETTER C ! 0x00c4: 0x0044, # LATIN CAPITAL LETTER D ! 0x00c5: 0x0045, # LATIN CAPITAL LETTER E ! 0x00c6: 0x0046, # LATIN CAPITAL LETTER F ! 0x00c7: 0x0047, # LATIN CAPITAL LETTER G ! 0x00c8: 0x0048, # LATIN CAPITAL LETTER H ! 0x00c9: 0x0049, # LATIN CAPITAL LETTER I ! 0x00ca: 0x00ad, # SOFT HYPHEN ! 0x00cb: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00cc: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00cd: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00ce: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00cf: 0x2015, # HORIZONTAL BAR ! 0x00d0: 0x007d, # RIGHT CURLY BRACKET ! 0x00d1: 0x004a, # LATIN CAPITAL LETTER J ! 0x00d2: 0x004b, # LATIN CAPITAL LETTER K ! 0x00d3: 0x004c, # LATIN CAPITAL LETTER L ! 0x00d4: 0x004d, # LATIN CAPITAL LETTER M ! 0x00d5: 0x004e, # LATIN CAPITAL LETTER N ! 0x00d6: 0x004f, # LATIN CAPITAL LETTER O ! 0x00d7: 0x0050, # LATIN CAPITAL LETTER P ! 0x00d8: 0x0051, # LATIN CAPITAL LETTER Q ! 0x00d9: 0x0052, # LATIN CAPITAL LETTER R ! 0x00da: 0x00b1, # PLUS-MINUS SIGN ! 0x00db: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x00dc: 0x001a, # SUBSTITUTE ! 0x00dd: 0x0387, # GREEK ANO TELEIA ! 0x00de: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00df: 0x00a6, # BROKEN BAR ! 0x00e0: 0x005c, # REVERSE SOLIDUS ! 0x00e1: 0x001a, # SUBSTITUTE ! 0x00e2: 0x0053, # LATIN CAPITAL LETTER S ! 0x00e3: 0x0054, # LATIN CAPITAL LETTER T ! 0x00e4: 0x0055, # LATIN CAPITAL LETTER U ! 0x00e5: 0x0056, # LATIN CAPITAL LETTER V ! 0x00e6: 0x0057, # LATIN CAPITAL LETTER W ! 0x00e7: 0x0058, # LATIN CAPITAL LETTER X ! 0x00e8: 0x0059, # LATIN CAPITAL LETTER Y ! 0x00e9: 0x005a, # LATIN CAPITAL LETTER Z ! 0x00ea: 0x00b2, # SUPERSCRIPT TWO ! 0x00eb: 0x00a7, # SECTION SIGN ! 0x00ec: 0x001a, # SUBSTITUTE ! 0x00ed: 0x001a, # SUBSTITUTE ! 0x00ee: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00ef: 0x00ac, # NOT SIGN ! 0x00f0: 0x0030, # DIGIT ZERO ! 0x00f1: 0x0031, # DIGIT ONE ! 0x00f2: 0x0032, # DIGIT TWO ! 0x00f3: 0x0033, # DIGIT THREE ! 0x00f4: 0x0034, # DIGIT FOUR ! 0x00f5: 0x0035, # DIGIT FIVE ! 0x00f6: 0x0036, # DIGIT SIX ! 0x00f7: 0x0037, # DIGIT SEVEN ! 0x00f8: 0x0038, # DIGIT EIGHT ! 0x00f9: 0x0039, # DIGIT NINE ! 0x00fa: 0x00b3, # SUPERSCRIPT THREE ! 0x00fb: 0x00a9, # COPYRIGHT SIGN ! 0x00fc: 0x001a, # SUBSTITUTE ! 0x00fd: 0x001a, # SUBSTITUTE ! 0x00fe: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00ff: 0x009f, # CONTROL }) Index: hex_codec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/hex_codec.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hex_codec.py 20 Sep 2001 10:33:38 -0000 1.2 --- hex_codec.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 52,56 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 52,56 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: iso8859_1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_1.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_1.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_1.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: iso8859_10.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_10.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_10.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_10.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,87 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a2: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00a3: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00a4: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00a5: 0x0128, # LATIN CAPITAL LETTER I WITH TILDE ! 0x00a6: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00a8: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00a9: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00aa: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00ab: 0x0166, # LATIN CAPITAL LETTER T WITH STROKE ! 0x00ac: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00ae: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00af: 0x014a, # LATIN CAPITAL LETTER ENG ! 0x00b1: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00b2: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00b3: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00b5: 0x0129, # LATIN SMALL LETTER I WITH TILDE ! 0x00b6: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00b8: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00b9: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00ba: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00bb: 0x0167, # LATIN SMALL LETTER T WITH STROKE ! 0x00bc: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bd: 0x2015, # HORIZONTAL BAR ! 0x00be: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00bf: 0x014b, # LATIN SMALL LETTER ENG ! 0x00c0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c7: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00d1: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d7: 0x0168, # LATIN CAPITAL LETTER U WITH TILDE ! 0x00d9: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00e0: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e7: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00f1: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f2: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f7: 0x0169, # LATIN SMALL LETTER U WITH TILDE ! 0x00f9: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00ff: 0x0138, # LATIN SMALL LETTER KRA }) --- 38,87 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a2: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00a3: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00a4: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00a5: 0x0128, # LATIN CAPITAL LETTER I WITH TILDE ! 0x00a6: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00a8: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00a9: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00aa: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00ab: 0x0166, # LATIN CAPITAL LETTER T WITH STROKE ! 0x00ac: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00ae: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00af: 0x014a, # LATIN CAPITAL LETTER ENG ! 0x00b1: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00b2: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00b3: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00b5: 0x0129, # LATIN SMALL LETTER I WITH TILDE ! 0x00b6: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00b8: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00b9: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00ba: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00bb: 0x0167, # LATIN SMALL LETTER T WITH STROKE ! 0x00bc: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bd: 0x2015, # HORIZONTAL BAR ! 0x00be: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00bf: 0x014b, # LATIN SMALL LETTER ENG ! 0x00c0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c7: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00d1: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d7: 0x0168, # LATIN CAPITAL LETTER U WITH TILDE ! 0x00d9: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00e0: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e7: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00f1: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f2: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f7: 0x0169, # LATIN SMALL LETTER U WITH TILDE ! 0x00f9: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00ff: 0x0138, # LATIN SMALL LETTER KRA }) Index: iso8859_13.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_13.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_13.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_13.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,97 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00a5: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00a8: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00aa: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00af: 0x00c6, # LATIN CAPITAL LETTER AE ! 0x00b4: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00b8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00ba: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00bf: 0x00e6, # LATIN SMALL LETTER AE ! 0x00c0: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00c1: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c2: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c3: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c6: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00c7: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x00cb: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00cc: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00cd: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00ce: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00cf: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00d0: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d4: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d8: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00d9: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00da: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00db: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00dd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00de: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00e0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00e1: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e2: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e3: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e6: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00e7: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00eb: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00ec: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00ed: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00ee: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00ef: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00f0: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f4: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f8: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00f9: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00fa: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00fb: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00fe: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00ff: 0x2019, # RIGHT SINGLE QUOTATION MARK }) --- 38,97 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00a5: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00a8: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00aa: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00af: 0x00c6, # LATIN CAPITAL LETTER AE ! 0x00b4: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00b8: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00ba: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00bf: 0x00e6, # LATIN SMALL LETTER AE ! 0x00c0: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00c1: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c2: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c3: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c6: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00c7: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x00cb: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00cc: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00cd: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00ce: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00cf: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00d0: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d4: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d8: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00d9: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00da: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00db: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00dd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00de: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00e0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00e1: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e2: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e3: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e6: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00e7: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00eb: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00ec: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00ed: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00ee: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00ef: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00f0: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f4: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f8: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00f9: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00fa: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00fb: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00fe: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00ff: 0x2019, # RIGHT SINGLE QUOTATION MARK }) Index: iso8859_14.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_14.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_14.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_14.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,72 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x1e02, # LATIN CAPITAL LETTER B WITH DOT ABOVE ! 0x00a2: 0x1e03, # LATIN SMALL LETTER B WITH DOT ABOVE ! 0x00a4: 0x010a, # LATIN CAPITAL LETTER C WITH DOT ABOVE ! 0x00a5: 0x010b, # LATIN SMALL LETTER C WITH DOT ABOVE ! 0x00a6: 0x1e0a, # LATIN CAPITAL LETTER D WITH DOT ABOVE ! 0x00a8: 0x1e80, # LATIN CAPITAL LETTER W WITH GRAVE ! 0x00aa: 0x1e82, # LATIN CAPITAL LETTER W WITH ACUTE ! 0x00ab: 0x1e0b, # LATIN SMALL LETTER D WITH DOT ABOVE ! 0x00ac: 0x1ef2, # LATIN CAPITAL LETTER Y WITH GRAVE ! 0x00af: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00b0: 0x1e1e, # LATIN CAPITAL LETTER F WITH DOT ABOVE ! 0x00b1: 0x1e1f, # LATIN SMALL LETTER F WITH DOT ABOVE ! 0x00b2: 0x0120, # LATIN CAPITAL LETTER G WITH DOT ABOVE ! 0x00b3: 0x0121, # LATIN SMALL LETTER G WITH DOT ABOVE ! 0x00b4: 0x1e40, # LATIN CAPITAL LETTER M WITH DOT ABOVE ! 0x00b5: 0x1e41, # LATIN SMALL LETTER M WITH DOT ABOVE ! 0x00b7: 0x1e56, # LATIN CAPITAL LETTER P WITH DOT ABOVE ! 0x00b8: 0x1e81, # LATIN SMALL LETTER W WITH GRAVE ! 0x00b9: 0x1e57, # LATIN SMALL LETTER P WITH DOT ABOVE ! 0x00ba: 0x1e83, # LATIN SMALL LETTER W WITH ACUTE ! 0x00bb: 0x1e60, # LATIN CAPITAL LETTER S WITH DOT ABOVE ! 0x00bc: 0x1ef3, # LATIN SMALL LETTER Y WITH GRAVE ! 0x00bd: 0x1e84, # LATIN CAPITAL LETTER W WITH DIAERESIS ! 0x00be: 0x1e85, # LATIN SMALL LETTER W WITH DIAERESIS ! 0x00bf: 0x1e61, # LATIN SMALL LETTER S WITH DOT ABOVE ! 0x00d0: 0x0174, # LATIN CAPITAL LETTER W WITH CIRCUMFLEX ! 0x00d7: 0x1e6a, # LATIN CAPITAL LETTER T WITH DOT ABOVE ! 0x00de: 0x0176, # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX ! 0x00f0: 0x0175, # LATIN SMALL LETTER W WITH CIRCUMFLEX ! 0x00f7: 0x1e6b, # LATIN SMALL LETTER T WITH DOT ABOVE ! 0x00fe: 0x0177, # LATIN SMALL LETTER Y WITH CIRCUMFLEX }) --- 38,72 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x1e02, # LATIN CAPITAL LETTER B WITH DOT ABOVE ! 0x00a2: 0x1e03, # LATIN SMALL LETTER B WITH DOT ABOVE ! 0x00a4: 0x010a, # LATIN CAPITAL LETTER C WITH DOT ABOVE ! 0x00a5: 0x010b, # LATIN SMALL LETTER C WITH DOT ABOVE ! 0x00a6: 0x1e0a, # LATIN CAPITAL LETTER D WITH DOT ABOVE ! 0x00a8: 0x1e80, # LATIN CAPITAL LETTER W WITH GRAVE ! 0x00aa: 0x1e82, # LATIN CAPITAL LETTER W WITH ACUTE ! 0x00ab: 0x1e0b, # LATIN SMALL LETTER D WITH DOT ABOVE ! 0x00ac: 0x1ef2, # LATIN CAPITAL LETTER Y WITH GRAVE ! 0x00af: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00b0: 0x1e1e, # LATIN CAPITAL LETTER F WITH DOT ABOVE ! 0x00b1: 0x1e1f, # LATIN SMALL LETTER F WITH DOT ABOVE ! 0x00b2: 0x0120, # LATIN CAPITAL LETTER G WITH DOT ABOVE ! 0x00b3: 0x0121, # LATIN SMALL LETTER G WITH DOT ABOVE ! 0x00b4: 0x1e40, # LATIN CAPITAL LETTER M WITH DOT ABOVE ! 0x00b5: 0x1e41, # LATIN SMALL LETTER M WITH DOT ABOVE ! 0x00b7: 0x1e56, # LATIN CAPITAL LETTER P WITH DOT ABOVE ! 0x00b8: 0x1e81, # LATIN SMALL LETTER W WITH GRAVE ! 0x00b9: 0x1e57, # LATIN SMALL LETTER P WITH DOT ABOVE ! 0x00ba: 0x1e83, # LATIN SMALL LETTER W WITH ACUTE ! 0x00bb: 0x1e60, # LATIN CAPITAL LETTER S WITH DOT ABOVE ! 0x00bc: 0x1ef3, # LATIN SMALL LETTER Y WITH GRAVE ! 0x00bd: 0x1e84, # LATIN CAPITAL LETTER W WITH DIAERESIS ! 0x00be: 0x1e85, # LATIN SMALL LETTER W WITH DIAERESIS ! 0x00bf: 0x1e61, # LATIN SMALL LETTER S WITH DOT ABOVE ! 0x00d0: 0x0174, # LATIN CAPITAL LETTER W WITH CIRCUMFLEX ! 0x00d7: 0x1e6a, # LATIN CAPITAL LETTER T WITH DOT ABOVE ! 0x00de: 0x0176, # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX ! 0x00f0: 0x0175, # LATIN SMALL LETTER W WITH CIRCUMFLEX ! 0x00f7: 0x1e6b, # LATIN SMALL LETTER T WITH DOT ABOVE ! 0x00fe: 0x0177, # LATIN SMALL LETTER Y WITH CIRCUMFLEX }) Index: iso8859_15.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_15.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_15.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_15.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,49 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a4: 0x20ac, # EURO SIGN ! 0x00a6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00a8: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00b4: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00b8: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bc: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00bd: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00be: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS }) --- 38,49 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a4: 0x20ac, # EURO SIGN ! 0x00a6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00a8: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00b4: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00b8: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bc: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00bd: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00be: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS }) Index: iso8859_2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_2.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_2.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_2.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,98 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a2: 0x02d8, # BREVE ! 0x00a3: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00a5: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x00a6: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00a9: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00aa: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00ab: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x00ac: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x00ae: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00af: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00b1: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00b2: 0x02db, # OGONEK ! 0x00b3: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00b5: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x00b6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00b7: 0x02c7, # CARON ! 0x00b9: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00ba: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00bb: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x00bc: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00bd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00be: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bf: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00c0: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00c3: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00c5: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x00c6: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x00cf: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00d5: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x00d8: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00d9: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00db: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00de: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA ! 0x00e0: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00e3: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00e5: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x00e6: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x00ef: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00f5: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x00f8: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00f9: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00fe: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA ! 0x00ff: 0x02d9, # DOT ABOVE }) --- 38,98 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a2: 0x02d8, # BREVE ! 0x00a3: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00a5: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x00a6: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00a9: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00aa: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00ab: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x00ac: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x00ae: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00af: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00b1: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00b2: 0x02db, # OGONEK ! 0x00b3: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00b5: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x00b6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00b7: 0x02c7, # CARON ! 0x00b9: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00ba: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00bb: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x00bc: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x00bd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00be: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bf: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00c0: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00c3: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE ! 0x00c5: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x00c6: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x00cf: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00d2: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00d5: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x00d8: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00d9: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00db: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00de: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA ! 0x00e0: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00e3: 0x0103, # LATIN SMALL LETTER A WITH BREVE ! 0x00e5: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x00e6: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x00ef: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f1: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00f2: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00f5: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x00f8: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00f9: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00fe: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA ! 0x00ff: 0x02d9, # DOT ABOVE }) Index: iso8859_3.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_3.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_3.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_3.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,76 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0126, # LATIN CAPITAL LETTER H WITH STROKE ! 0x00a2: 0x02d8, # BREVE ! 0x00a5: None, ! 0x00a6: 0x0124, # LATIN CAPITAL LETTER H WITH CIRCUMFLEX ! 0x00a9: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00aa: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00ab: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00ac: 0x0134, # LATIN CAPITAL LETTER J WITH CIRCUMFLEX ! 0x00ae: None, ! 0x00af: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00b1: 0x0127, # LATIN SMALL LETTER H WITH STROKE ! 0x00b6: 0x0125, # LATIN SMALL LETTER H WITH CIRCUMFLEX ! 0x00b9: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00ba: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00bb: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00bc: 0x0135, # LATIN SMALL LETTER J WITH CIRCUMFLEX ! 0x00be: None, ! 0x00bf: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00c3: None, ! 0x00c5: 0x010a, # LATIN CAPITAL LETTER C WITH DOT ABOVE ! 0x00c6: 0x0108, # LATIN CAPITAL LETTER C WITH CIRCUMFLEX ! 0x00d0: None, ! 0x00d5: 0x0120, # LATIN CAPITAL LETTER G WITH DOT ABOVE ! 0x00d8: 0x011c, # LATIN CAPITAL LETTER G WITH CIRCUMFLEX ! 0x00dd: 0x016c, # LATIN CAPITAL LETTER U WITH BREVE ! 0x00de: 0x015c, # LATIN CAPITAL LETTER S WITH CIRCUMFLEX ! 0x00e3: None, ! 0x00e5: 0x010b, # LATIN SMALL LETTER C WITH DOT ABOVE ! 0x00e6: 0x0109, # LATIN SMALL LETTER C WITH CIRCUMFLEX ! 0x00f0: None, ! 0x00f5: 0x0121, # LATIN SMALL LETTER G WITH DOT ABOVE ! 0x00f8: 0x011d, # LATIN SMALL LETTER G WITH CIRCUMFLEX ! 0x00fd: 0x016d, # LATIN SMALL LETTER U WITH BREVE ! 0x00fe: 0x015d, # LATIN SMALL LETTER S WITH CIRCUMFLEX ! 0x00ff: 0x02d9, # DOT ABOVE }) --- 38,76 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0126, # LATIN CAPITAL LETTER H WITH STROKE ! 0x00a2: 0x02d8, # BREVE ! 0x00a5: None, ! 0x00a6: 0x0124, # LATIN CAPITAL LETTER H WITH CIRCUMFLEX ! 0x00a9: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00aa: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00ab: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00ac: 0x0134, # LATIN CAPITAL LETTER J WITH CIRCUMFLEX ! 0x00ae: None, ! 0x00af: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00b1: 0x0127, # LATIN SMALL LETTER H WITH STROKE ! 0x00b6: 0x0125, # LATIN SMALL LETTER H WITH CIRCUMFLEX ! 0x00b9: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00ba: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00bb: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00bc: 0x0135, # LATIN SMALL LETTER J WITH CIRCUMFLEX ! 0x00be: None, ! 0x00bf: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00c3: None, ! 0x00c5: 0x010a, # LATIN CAPITAL LETTER C WITH DOT ABOVE ! 0x00c6: 0x0108, # LATIN CAPITAL LETTER C WITH CIRCUMFLEX ! 0x00d0: None, ! 0x00d5: 0x0120, # LATIN CAPITAL LETTER G WITH DOT ABOVE ! 0x00d8: 0x011c, # LATIN CAPITAL LETTER G WITH CIRCUMFLEX ! 0x00dd: 0x016c, # LATIN CAPITAL LETTER U WITH BREVE ! 0x00de: 0x015c, # LATIN CAPITAL LETTER S WITH CIRCUMFLEX ! 0x00e3: None, ! 0x00e5: 0x010b, # LATIN SMALL LETTER C WITH DOT ABOVE ! 0x00e6: 0x0109, # LATIN SMALL LETTER C WITH CIRCUMFLEX ! 0x00f0: None, ! 0x00f5: 0x0121, # LATIN SMALL LETTER G WITH DOT ABOVE ! 0x00f8: 0x011d, # LATIN SMALL LETTER G WITH CIRCUMFLEX ! 0x00fd: 0x016d, # LATIN SMALL LETTER U WITH BREVE ! 0x00fe: 0x015d, # LATIN SMALL LETTER S WITH CIRCUMFLEX ! 0x00ff: 0x02d9, # DOT ABOVE }) Index: iso8859_4.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_4.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_4.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_4.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,91 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a2: 0x0138, # LATIN SMALL LETTER KRA ! 0x00a3: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00a5: 0x0128, # LATIN CAPITAL LETTER I WITH TILDE ! 0x00a6: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00a9: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00aa: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00ab: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00ac: 0x0166, # LATIN CAPITAL LETTER T WITH STROKE ! 0x00ae: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00b1: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00b2: 0x02db, # OGONEK ! 0x00b3: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00b5: 0x0129, # LATIN SMALL LETTER I WITH TILDE ! 0x00b6: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00b7: 0x02c7, # CARON ! 0x00b9: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00ba: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00bb: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00bc: 0x0167, # LATIN SMALL LETTER T WITH STROKE ! 0x00bd: 0x014a, # LATIN CAPITAL LETTER ENG ! 0x00be: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bf: 0x014b, # LATIN SMALL LETTER ENG ! 0x00c0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c7: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00cf: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d1: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d3: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00d9: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00dd: 0x0168, # LATIN CAPITAL LETTER U WITH TILDE ! 0x00de: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00e0: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e7: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00ef: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f1: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f2: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f3: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00f9: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00fd: 0x0169, # LATIN SMALL LETTER U WITH TILDE ! 0x00fe: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00ff: 0x02d9, # DOT ABOVE }) --- 38,91 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x00a2: 0x0138, # LATIN SMALL LETTER KRA ! 0x00a3: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00a5: 0x0128, # LATIN CAPITAL LETTER I WITH TILDE ! 0x00a6: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00a9: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00aa: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x00ab: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00ac: 0x0166, # LATIN CAPITAL LETTER T WITH STROKE ! 0x00ae: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00b1: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x00b2: 0x02db, # OGONEK ! 0x00b3: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00b5: 0x0129, # LATIN SMALL LETTER I WITH TILDE ! 0x00b6: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00b7: 0x02c7, # CARON ! 0x00b9: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00ba: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x00bb: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00bc: 0x0167, # LATIN SMALL LETTER T WITH STROKE ! 0x00bd: 0x014a, # LATIN CAPITAL LETTER ENG ! 0x00be: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00bf: 0x014b, # LATIN SMALL LETTER ENG ! 0x00c0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x00c7: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00c8: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x00ca: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00cc: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x00cf: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00d0: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE ! 0x00d1: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00d2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d3: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00d9: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00dd: 0x0168, # LATIN CAPITAL LETTER U WITH TILDE ! 0x00de: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00e0: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x00e7: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00e8: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x00ea: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ec: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x00ef: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00f0: 0x0111, # LATIN SMALL LETTER D WITH STROKE ! 0x00f1: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00f2: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00f3: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00f9: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00fd: 0x0169, # LATIN SMALL LETTER U WITH TILDE ! 0x00fe: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00ff: 0x02d9, # DOT ABOVE }) Index: iso8859_5.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_5.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_5.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_5.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,135 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00a2: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x00a3: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x00a4: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00a5: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x00a6: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00a7: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00a8: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x00a9: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x00aa: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x00ab: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x00ac: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x00ae: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00af: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x00b0: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00b1: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00b2: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00b3: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00b4: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00b5: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00b6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00b7: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00b8: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00b9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00ba: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00bb: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00bc: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00bd: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00be: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00bf: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00c0: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00c1: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00c2: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00c3: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00c4: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00c5: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00c6: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00c7: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00c8: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00c9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00ca: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x00cb: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00cc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00cd: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00ce: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x00cf: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00d0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00d1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00d2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00d3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00d4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00d5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00d6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00d7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00d8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00d9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00da: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00db: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00dc: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00dd: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00de: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00df: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00f0: 0x2116, # NUMERO SIGN ! 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00f2: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x00f3: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x00f4: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00f5: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x00f6: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00f7: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00f8: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x00f9: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x00fa: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x00fb: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x00fc: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x00fd: 0x00a7, # SECTION SIGN ! 0x00fe: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00ff: 0x045f, # CYRILLIC SMALL LETTER DZHE }) --- 38,135 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00a2: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x00a3: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x00a4: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00a5: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x00a6: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00a7: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00a8: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x00a9: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x00aa: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x00ab: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x00ac: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x00ae: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00af: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x00b0: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00b1: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00b2: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00b3: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00b4: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00b5: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00b6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00b7: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00b8: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00b9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00ba: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00bb: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00bc: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00bd: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00be: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00bf: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00c0: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00c1: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00c2: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00c3: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00c4: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00c5: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00c6: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00c7: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00c8: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00c9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00ca: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x00cb: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00cc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00cd: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00ce: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x00cf: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00d0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00d1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00d2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00d3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00d4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00d5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00d6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00d7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00d8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00d9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00da: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00db: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00dc: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00dd: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00de: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00df: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00f0: 0x2116, # NUMERO SIGN ! 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00f2: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x00f3: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x00f4: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00f5: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x00f6: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00f7: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00f8: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x00f9: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x00fa: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x00fb: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x00fc: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x00fd: 0x00a7, # SECTION SIGN ! 0x00fe: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00ff: 0x045f, # CYRILLIC SMALL LETTER DZHE }) Index: iso8859_6.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_6.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_6.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_6.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,134 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: None, ! 0x00a2: None, ! 0x00a3: None, ! 0x00a5: None, ! 0x00a6: None, ! 0x00a7: None, ! 0x00a8: None, ! 0x00a9: None, ! 0x00aa: None, ! 0x00ab: None, ! 0x00ac: 0x060c, # ARABIC COMMA ! 0x00ae: None, ! 0x00af: None, ! 0x00b0: None, ! 0x00b1: None, ! 0x00b2: None, ! 0x00b3: None, ! 0x00b4: None, ! 0x00b5: None, ! 0x00b6: None, ! 0x00b7: None, ! 0x00b8: None, ! 0x00b9: None, ! 0x00ba: None, ! 0x00bb: 0x061b, # ARABIC SEMICOLON ! 0x00bc: None, ! 0x00bd: None, ! 0x00be: None, ! 0x00bf: 0x061f, # ARABIC QUESTION MARK ! 0x00c0: None, ! 0x00c1: 0x0621, # ARABIC LETTER HAMZA ! 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE ! 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE ! 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE ! 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW ! 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE ! 0x00c7: 0x0627, # ARABIC LETTER ALEF ! 0x00c8: 0x0628, # ARABIC LETTER BEH ! 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA ! 0x00ca: 0x062a, # ARABIC LETTER TEH ! 0x00cb: 0x062b, # ARABIC LETTER THEH ! 0x00cc: 0x062c, # ARABIC LETTER JEEM ! 0x00cd: 0x062d, # ARABIC LETTER HAH ! 0x00ce: 0x062e, # ARABIC LETTER KHAH ! 0x00cf: 0x062f, # ARABIC LETTER DAL ! 0x00d0: 0x0630, # ARABIC LETTER THAL ! 0x00d1: 0x0631, # ARABIC LETTER REH ! 0x00d2: 0x0632, # ARABIC LETTER ZAIN ! 0x00d3: 0x0633, # ARABIC LETTER SEEN ! 0x00d4: 0x0634, # ARABIC LETTER SHEEN ! 0x00d5: 0x0635, # ARABIC LETTER SAD ! 0x00d6: 0x0636, # ARABIC LETTER DAD ! 0x00d7: 0x0637, # ARABIC LETTER TAH ! 0x00d8: 0x0638, # ARABIC LETTER ZAH ! 0x00d9: 0x0639, # ARABIC LETTER AIN ! 0x00da: 0x063a, # ARABIC LETTER GHAIN ! 0x00db: None, ! 0x00dc: None, ! 0x00dd: None, ! 0x00de: None, ! 0x00df: None, ! 0x00e0: 0x0640, # ARABIC TATWEEL ! 0x00e1: 0x0641, # ARABIC LETTER FEH ! 0x00e2: 0x0642, # ARABIC LETTER QAF ! 0x00e3: 0x0643, # ARABIC LETTER KAF ! 0x00e4: 0x0644, # ARABIC LETTER LAM ! 0x00e5: 0x0645, # ARABIC LETTER MEEM ! 0x00e6: 0x0646, # ARABIC LETTER NOON ! 0x00e7: 0x0647, # ARABIC LETTER HEH ! 0x00e8: 0x0648, # ARABIC LETTER WAW ! 0x00e9: 0x0649, # ARABIC LETTER ALEF MAKSURA ! 0x00ea: 0x064a, # ARABIC LETTER YEH ! 0x00eb: 0x064b, # ARABIC FATHATAN ! 0x00ec: 0x064c, # ARABIC DAMMATAN ! 0x00ed: 0x064d, # ARABIC KASRATAN ! 0x00ee: 0x064e, # ARABIC FATHA ! 0x00ef: 0x064f, # ARABIC DAMMA ! 0x00f0: 0x0650, # ARABIC KASRA ! 0x00f1: 0x0651, # ARABIC SHADDA ! 0x00f2: 0x0652, # ARABIC SUKUN ! 0x00f3: None, ! 0x00f4: None, ! 0x00f5: None, ! 0x00f6: None, ! 0x00f7: None, ! 0x00f8: None, ! 0x00f9: None, ! 0x00fa: None, ! 0x00fb: None, ! 0x00fc: None, ! 0x00fd: None, ! 0x00fe: None, ! 0x00ff: None, }) --- 38,134 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: None, ! 0x00a2: None, ! 0x00a3: None, ! 0x00a5: None, ! 0x00a6: None, ! 0x00a7: None, ! 0x00a8: None, ! 0x00a9: None, ! 0x00aa: None, ! 0x00ab: None, ! 0x00ac: 0x060c, # ARABIC COMMA ! 0x00ae: None, ! 0x00af: None, ! 0x00b0: None, ! 0x00b1: None, ! 0x00b2: None, ! 0x00b3: None, ! 0x00b4: None, ! 0x00b5: None, ! 0x00b6: None, ! 0x00b7: None, ! 0x00b8: None, ! 0x00b9: None, ! 0x00ba: None, ! 0x00bb: 0x061b, # ARABIC SEMICOLON ! 0x00bc: None, ! 0x00bd: None, ! 0x00be: None, ! 0x00bf: 0x061f, # ARABIC QUESTION MARK ! 0x00c0: None, ! 0x00c1: 0x0621, # ARABIC LETTER HAMZA ! 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE ! 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE ! 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE ! 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW ! 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE ! 0x00c7: 0x0627, # ARABIC LETTER ALEF ! 0x00c8: 0x0628, # ARABIC LETTER BEH ! 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA ! 0x00ca: 0x062a, # ARABIC LETTER TEH ! 0x00cb: 0x062b, # ARABIC LETTER THEH ! 0x00cc: 0x062c, # ARABIC LETTER JEEM ! 0x00cd: 0x062d, # ARABIC LETTER HAH ! 0x00ce: 0x062e, # ARABIC LETTER KHAH ! 0x00cf: 0x062f, # ARABIC LETTER DAL ! 0x00d0: 0x0630, # ARABIC LETTER THAL ! 0x00d1: 0x0631, # ARABIC LETTER REH ! 0x00d2: 0x0632, # ARABIC LETTER ZAIN ! 0x00d3: 0x0633, # ARABIC LETTER SEEN ! 0x00d4: 0x0634, # ARABIC LETTER SHEEN ! 0x00d5: 0x0635, # ARABIC LETTER SAD ! 0x00d6: 0x0636, # ARABIC LETTER DAD ! 0x00d7: 0x0637, # ARABIC LETTER TAH ! 0x00d8: 0x0638, # ARABIC LETTER ZAH ! 0x00d9: 0x0639, # ARABIC LETTER AIN ! 0x00da: 0x063a, # ARABIC LETTER GHAIN ! 0x00db: None, ! 0x00dc: None, ! 0x00dd: None, ! 0x00de: None, ! 0x00df: None, ! 0x00e0: 0x0640, # ARABIC TATWEEL ! 0x00e1: 0x0641, # ARABIC LETTER FEH ! 0x00e2: 0x0642, # ARABIC LETTER QAF ! 0x00e3: 0x0643, # ARABIC LETTER KAF ! 0x00e4: 0x0644, # ARABIC LETTER LAM ! 0x00e5: 0x0645, # ARABIC LETTER MEEM ! 0x00e6: 0x0646, # ARABIC LETTER NOON ! 0x00e7: 0x0647, # ARABIC LETTER HEH ! 0x00e8: 0x0648, # ARABIC LETTER WAW ! 0x00e9: 0x0649, # ARABIC LETTER ALEF MAKSURA ! 0x00ea: 0x064a, # ARABIC LETTER YEH ! 0x00eb: 0x064b, # ARABIC FATHATAN ! 0x00ec: 0x064c, # ARABIC DAMMATAN ! 0x00ed: 0x064d, # ARABIC KASRATAN ! 0x00ee: 0x064e, # ARABIC FATHA ! 0x00ef: 0x064f, # ARABIC DAMMA ! 0x00f0: 0x0650, # ARABIC KASRA ! 0x00f1: 0x0651, # ARABIC SHADDA ! 0x00f2: 0x0652, # ARABIC SUKUN ! 0x00f3: None, ! 0x00f4: None, ! 0x00f5: None, ! 0x00f6: None, ! 0x00f7: None, ! 0x00f8: None, ! 0x00f9: None, ! 0x00fa: None, ! 0x00fb: None, ! 0x00fc: None, ! 0x00fd: None, ! 0x00fe: None, ! 0x00ff: None, }) Index: iso8859_7.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_7.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_7.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_7.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,121 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00a2: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00a4: None, ! 0x00a5: None, ! 0x00aa: None, ! 0x00ae: None, ! 0x00af: 0x2015, # HORIZONTAL BAR ! 0x00b4: 0x0384, # GREEK TONOS ! 0x00b5: 0x0385, # GREEK DIALYTIKA TONOS ! 0x00b6: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00b8: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00b9: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00ba: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00bc: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00be: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00bf: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00c0: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00c1: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00c2: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00c3: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00c4: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00c5: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00c6: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00c7: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00c8: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00c9: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ca: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00cb: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x00cc: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00cd: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00ce: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00cf: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00d0: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00d1: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00d2: None, ! 0x00d3: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00d4: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00d5: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00d6: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00d7: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00d8: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00d9: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00da: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00db: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00dc: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00dd: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00de: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00df: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00e0: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00e1: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e2: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00e3: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00e4: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00e5: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00e6: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00e7: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e8: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00e9: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00ea: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00eb: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00ec: 0x03bc, # GREEK SMALL LETTER MU ! 0x00ed: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ee: 0x03be, # GREEK SMALL LETTER XI ! 0x00ef: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00f0: 0x03c0, # GREEK SMALL LETTER PI ! 0x00f1: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00f2: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00f3: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00f4: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00f5: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00f6: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00f7: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f8: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00f9: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00fa: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fc: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00fd: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00fe: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ff: None, }) --- 38,121 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00a2: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00a4: None, ! 0x00a5: None, ! 0x00aa: None, ! 0x00ae: None, ! 0x00af: 0x2015, # HORIZONTAL BAR ! 0x00b4: 0x0384, # GREEK TONOS ! 0x00b5: 0x0385, # GREEK DIALYTIKA TONOS ! 0x00b6: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00b8: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00b9: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00ba: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00bc: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00be: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00bf: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00c0: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00c1: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00c2: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00c3: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00c4: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00c5: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00c6: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00c7: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00c8: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00c9: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ca: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00cb: 0x039b, # GREEK CAPITAL LETTER LAMDA ! 0x00cc: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00cd: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00ce: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00cf: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00d0: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00d1: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00d2: None, ! 0x00d3: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00d4: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00d5: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00d6: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00d7: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00d8: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00d9: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00da: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00db: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00dc: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00dd: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00de: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00df: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00e0: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00e1: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e2: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00e3: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00e4: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00e5: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00e6: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00e7: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e8: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00e9: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00ea: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00eb: 0x03bb, # GREEK SMALL LETTER LAMDA ! 0x00ec: 0x03bc, # GREEK SMALL LETTER MU ! 0x00ed: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ee: 0x03be, # GREEK SMALL LETTER XI ! 0x00ef: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00f0: 0x03c0, # GREEK SMALL LETTER PI ! 0x00f1: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00f2: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00f3: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00f4: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00f5: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00f6: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00f7: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f8: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00f9: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00fa: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fc: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00fd: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00fe: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00ff: None, }) Index: iso8859_8.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_8.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_8.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_8.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,109 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: None, ! 0x00aa: 0x00d7, # MULTIPLICATION SIGN ! 0x00ba: 0x00f7, # DIVISION SIGN ! 0x00bf: None, ! 0x00c0: None, ! 0x00c1: None, ! 0x00c2: None, ! 0x00c3: None, ! 0x00c4: None, ! 0x00c5: None, ! 0x00c6: None, ! 0x00c7: None, ! 0x00c8: None, ! 0x00c9: None, ! 0x00ca: None, ! 0x00cb: None, ! 0x00cc: None, ! 0x00cd: None, ! 0x00ce: None, ! 0x00cf: None, ! 0x00d0: None, ! 0x00d1: None, ! 0x00d2: None, ! 0x00d3: None, ! 0x00d4: None, ! 0x00d5: None, ! 0x00d6: None, ! 0x00d7: None, ! 0x00d8: None, ! 0x00d9: None, ! 0x00da: None, ! 0x00db: None, ! 0x00dc: None, ! 0x00dd: None, ! 0x00de: None, ! 0x00df: 0x2017, # DOUBLE LOW LINE ! 0x00e0: 0x05d0, # HEBREW LETTER ALEF ! 0x00e1: 0x05d1, # HEBREW LETTER BET ! 0x00e2: 0x05d2, # HEBREW LETTER GIMEL ! 0x00e3: 0x05d3, # HEBREW LETTER DALET ! 0x00e4: 0x05d4, # HEBREW LETTER HE ! 0x00e5: 0x05d5, # HEBREW LETTER VAV ! 0x00e6: 0x05d6, # HEBREW LETTER ZAYIN ! 0x00e7: 0x05d7, # HEBREW LETTER HET ! 0x00e8: 0x05d8, # HEBREW LETTER TET ! 0x00e9: 0x05d9, # HEBREW LETTER YOD ! 0x00ea: 0x05da, # HEBREW LETTER FINAL KAF ! 0x00eb: 0x05db, # HEBREW LETTER KAF ! 0x00ec: 0x05dc, # HEBREW LETTER LAMED ! 0x00ed: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x00ee: 0x05de, # HEBREW LETTER MEM ! 0x00ef: 0x05df, # HEBREW LETTER FINAL NUN ! 0x00f0: 0x05e0, # HEBREW LETTER NUN ! 0x00f1: 0x05e1, # HEBREW LETTER SAMEKH ! 0x00f2: 0x05e2, # HEBREW LETTER AYIN ! 0x00f3: 0x05e3, # HEBREW LETTER FINAL PE ! 0x00f4: 0x05e4, # HEBREW LETTER PE ! 0x00f5: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x00f6: 0x05e6, # HEBREW LETTER TSADI ! 0x00f7: 0x05e7, # HEBREW LETTER QOF ! 0x00f8: 0x05e8, # HEBREW LETTER RESH ! 0x00f9: 0x05e9, # HEBREW LETTER SHIN ! 0x00fa: 0x05ea, # HEBREW LETTER TAV ! 0x00fb: None, ! 0x00fc: None, ! 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK ! 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK ! 0x00ff: None, }) --- 38,109 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00a1: None, ! 0x00aa: 0x00d7, # MULTIPLICATION SIGN ! 0x00ba: 0x00f7, # DIVISION SIGN ! 0x00bf: None, ! 0x00c0: None, ! 0x00c1: None, ! 0x00c2: None, ! 0x00c3: None, ! 0x00c4: None, ! 0x00c5: None, ! 0x00c6: None, ! 0x00c7: None, ! 0x00c8: None, ! 0x00c9: None, ! 0x00ca: None, ! 0x00cb: None, ! 0x00cc: None, ! 0x00cd: None, ! 0x00ce: None, ! 0x00cf: None, ! 0x00d0: None, ! 0x00d1: None, ! 0x00d2: None, ! 0x00d3: None, ! 0x00d4: None, ! 0x00d5: None, ! 0x00d6: None, ! 0x00d7: None, ! 0x00d8: None, ! 0x00d9: None, ! 0x00da: None, ! 0x00db: None, ! 0x00dc: None, ! 0x00dd: None, ! 0x00de: None, ! 0x00df: 0x2017, # DOUBLE LOW LINE ! 0x00e0: 0x05d0, # HEBREW LETTER ALEF ! 0x00e1: 0x05d1, # HEBREW LETTER BET ! 0x00e2: 0x05d2, # HEBREW LETTER GIMEL ! 0x00e3: 0x05d3, # HEBREW LETTER DALET ! 0x00e4: 0x05d4, # HEBREW LETTER HE ! 0x00e5: 0x05d5, # HEBREW LETTER VAV ! 0x00e6: 0x05d6, # HEBREW LETTER ZAYIN ! 0x00e7: 0x05d7, # HEBREW LETTER HET ! 0x00e8: 0x05d8, # HEBREW LETTER TET ! 0x00e9: 0x05d9, # HEBREW LETTER YOD ! 0x00ea: 0x05da, # HEBREW LETTER FINAL KAF ! 0x00eb: 0x05db, # HEBREW LETTER KAF ! 0x00ec: 0x05dc, # HEBREW LETTER LAMED ! 0x00ed: 0x05dd, # HEBREW LETTER FINAL MEM ! 0x00ee: 0x05de, # HEBREW LETTER MEM ! 0x00ef: 0x05df, # HEBREW LETTER FINAL NUN ! 0x00f0: 0x05e0, # HEBREW LETTER NUN ! 0x00f1: 0x05e1, # HEBREW LETTER SAMEKH ! 0x00f2: 0x05e2, # HEBREW LETTER AYIN ! 0x00f3: 0x05e3, # HEBREW LETTER FINAL PE ! 0x00f4: 0x05e4, # HEBREW LETTER PE ! 0x00f5: 0x05e5, # HEBREW LETTER FINAL TSADI ! 0x00f6: 0x05e6, # HEBREW LETTER TSADI ! 0x00f7: 0x05e7, # HEBREW LETTER QOF ! 0x00f8: 0x05e8, # HEBREW LETTER RESH ! 0x00f9: 0x05e9, # HEBREW LETTER SHIN ! 0x00fa: 0x05ea, # HEBREW LETTER TAV ! 0x00fb: None, ! 0x00fc: None, ! 0x00fd: 0x200e, # LEFT-TO-RIGHT MARK ! 0x00fe: 0x200f, # RIGHT-TO-LEFT MARK ! 0x00ff: None, }) Index: iso8859_9.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_9.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iso8859_9.py 16 May 2001 09:41:45 -0000 1.3 --- iso8859_9.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,47 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00d0: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00dd: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00f0: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00fd: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00fe: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA }) --- 38,47 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x00d0: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00dd: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00f0: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00fd: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00fe: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA }) Index: koi8_r.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/koi8_r.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** koi8_r.py 16 May 2001 09:41:45 -0000 1.3 --- koi8_r.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,169 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x0081: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x0082: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x0083: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x0084: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x0085: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x0086: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x0087: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x0088: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x0089: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x008a: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x008b: 0x2580, # UPPER HALF BLOCK ! 0x008c: 0x2584, # LOWER HALF BLOCK ! 0x008d: 0x2588, # FULL BLOCK ! 0x008e: 0x258c, # LEFT HALF BLOCK ! 0x008f: 0x2590, # RIGHT HALF BLOCK ! 0x0090: 0x2591, # LIGHT SHADE ! 0x0091: 0x2592, # MEDIUM SHADE ! 0x0092: 0x2593, # DARK SHADE ! 0x0093: 0x2320, # TOP HALF INTEGRAL ! 0x0094: 0x25a0, # BLACK SQUARE ! 0x0095: 0x2219, # BULLET OPERATOR ! 0x0096: 0x221a, # SQUARE ROOT ! 0x0097: 0x2248, # ALMOST EQUAL TO ! 0x0098: 0x2264, # LESS-THAN OR EQUAL TO ! 0x0099: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x009a: 0x00a0, # NO-BREAK SPACE ! 0x009b: 0x2321, # BOTTOM HALF INTEGRAL ! 0x009c: 0x00b0, # DEGREE SIGN ! 0x009d: 0x00b2, # SUPERSCRIPT TWO ! 0x009e: 0x00b7, # MIDDLE DOT ! 0x009f: 0x00f7, # DIVISION SIGN ! 0x00a0: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00a1: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00a2: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00a3: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00a4: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00a5: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00a6: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00a7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00a8: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00a9: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00aa: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00ab: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00ac: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00ad: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00ae: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00af: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00b0: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00b1: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00b2: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b3: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00b4: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b5: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00b6: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00b7: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00b8: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00b9: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00ba: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00bb: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00bc: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00bd: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00be: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00bf: 0x00a9, # COPYRIGHT SIGN ! 0x00c0: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00c1: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00c2: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00c3: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00c4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00c5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00c6: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00c7: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00c8: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00c9: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00ca: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00cb: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00cc: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00cd: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ce: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00cf: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00d0: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00d1: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00d2: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00d3: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00d4: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00d5: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00d6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00d7: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00d8: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00d9: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00da: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00db: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00dc: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00dd: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00de: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00df: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00e0: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x00e1: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00e2: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00e3: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00e4: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00e5: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00e6: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00e7: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00e8: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00e9: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00ea: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00eb: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00ec: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00ed: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00ee: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00ef: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00f0: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00f1: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00f2: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00f3: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00f4: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00f5: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00f6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00f7: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00f8: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00f9: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00fa: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00fb: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00fc: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00fd: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00fe: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00ff: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN }) --- 38,169 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL ! 0x0081: 0x2502, # BOX DRAWINGS LIGHT VERTICAL ! 0x0082: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT ! 0x0083: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT ! 0x0084: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT ! 0x0085: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT ! 0x0086: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT ! 0x0087: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT ! 0x0088: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL ! 0x0089: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL ! 0x008a: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL ! 0x008b: 0x2580, # UPPER HALF BLOCK ! 0x008c: 0x2584, # LOWER HALF BLOCK ! 0x008d: 0x2588, # FULL BLOCK ! 0x008e: 0x258c, # LEFT HALF BLOCK ! 0x008f: 0x2590, # RIGHT HALF BLOCK ! 0x0090: 0x2591, # LIGHT SHADE ! 0x0091: 0x2592, # MEDIUM SHADE ! 0x0092: 0x2593, # DARK SHADE ! 0x0093: 0x2320, # TOP HALF INTEGRAL ! 0x0094: 0x25a0, # BLACK SQUARE ! 0x0095: 0x2219, # BULLET OPERATOR ! 0x0096: 0x221a, # SQUARE ROOT ! 0x0097: 0x2248, # ALMOST EQUAL TO ! 0x0098: 0x2264, # LESS-THAN OR EQUAL TO ! 0x0099: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x009a: 0x00a0, # NO-BREAK SPACE ! 0x009b: 0x2321, # BOTTOM HALF INTEGRAL ! 0x009c: 0x00b0, # DEGREE SIGN ! 0x009d: 0x00b2, # SUPERSCRIPT TWO ! 0x009e: 0x00b7, # MIDDLE DOT ! 0x009f: 0x00f7, # DIVISION SIGN ! 0x00a0: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL ! 0x00a1: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL ! 0x00a2: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE ! 0x00a3: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00a4: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE ! 0x00a5: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT ! 0x00a6: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE ! 0x00a7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE ! 0x00a8: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT ! 0x00a9: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE ! 0x00aa: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE ! 0x00ab: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT ! 0x00ac: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE ! 0x00ad: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE ! 0x00ae: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT ! 0x00af: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE ! 0x00b0: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE ! 0x00b1: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT ! 0x00b2: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE ! 0x00b3: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00b4: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE ! 0x00b5: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT ! 0x00b6: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE ! 0x00b7: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE ! 0x00b8: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL ! 0x00b9: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE ! 0x00ba: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE ! 0x00bb: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL ! 0x00bc: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE ! 0x00bd: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE ! 0x00be: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL ! 0x00bf: 0x00a9, # COPYRIGHT SIGN ! 0x00c0: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00c1: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00c2: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00c3: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00c4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00c5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00c6: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00c7: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00c8: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00c9: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00ca: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00cb: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00cc: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00cd: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ce: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00cf: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00d0: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00d1: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00d2: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00d3: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00d4: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00d5: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00d6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00d7: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00d8: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00d9: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00da: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00db: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00dc: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00dd: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00de: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00df: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00e0: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x00e1: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x00e2: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x00e3: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x00e4: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x00e5: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x00e6: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x00e7: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x00e8: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x00e9: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x00ea: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x00eb: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x00ec: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x00ed: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x00ee: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x00ef: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x00f0: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x00f1: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00f2: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x00f3: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x00f4: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x00f5: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x00f6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x00f7: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x00f8: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x00f9: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x00fa: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x00fb: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x00fc: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x00fd: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x00fe: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x00ff: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN }) Index: latin_1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/latin_1.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** latin_1.py 10 Mar 2000 23:17:23 -0000 1.1 --- latin_1.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: mac_cyrillic.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_cyrillic.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mac_cyrillic.py 16 May 2001 09:41:45 -0000 1.3 --- mac_cyrillic.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,164 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x00ac: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x00af: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x00b8: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00b9: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00ba: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00bb: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00bc: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x00bd: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x00be: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x00bf: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x00c0: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x00c1: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x00cc: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x00cd: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x00ce: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x00cf: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00d8: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00d9: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00da: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x00db: 0x045f, # CYRILLIC SMALL LETTER DZHE ! 0x00dc: 0x2116, # NUMERO SIGN ! 0x00dd: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00de: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00df: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ff: 0x00a4, # CURRENCY SIGN }) --- 38,164 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A ! 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE ! 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE ! 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE ! 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE ! 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE ! 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE ! 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE ! 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I ! 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I ! 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA ! 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL ! 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM ! 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN ! 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O ! 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE ! 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER ! 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES ! 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE ! 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U ! 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF ! 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA ! 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE ! 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE ! 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA ! 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA ! 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN ! 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU ! 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN ! 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E ! 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU ! 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x0402, # CYRILLIC CAPITAL LETTER DJE ! 0x00ac: 0x0452, # CYRILLIC SMALL LETTER DJE ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x0403, # CYRILLIC CAPITAL LETTER GJE ! 0x00af: 0x0453, # CYRILLIC SMALL LETTER GJE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x0408, # CYRILLIC CAPITAL LETTER JE ! 0x00b8: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE ! 0x00b9: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE ! 0x00ba: 0x0407, # CYRILLIC CAPITAL LETTER YI ! 0x00bb: 0x0457, # CYRILLIC SMALL LETTER YI ! 0x00bc: 0x0409, # CYRILLIC CAPITAL LETTER LJE ! 0x00bd: 0x0459, # CYRILLIC SMALL LETTER LJE ! 0x00be: 0x040a, # CYRILLIC CAPITAL LETTER NJE ! 0x00bf: 0x045a, # CYRILLIC SMALL LETTER NJE ! 0x00c0: 0x0458, # CYRILLIC SMALL LETTER JE ! 0x00c1: 0x0405, # CYRILLIC CAPITAL LETTER DZE ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x040b, # CYRILLIC CAPITAL LETTER TSHE ! 0x00cc: 0x045b, # CYRILLIC SMALL LETTER TSHE ! 0x00cd: 0x040c, # CYRILLIC CAPITAL LETTER KJE ! 0x00ce: 0x045c, # CYRILLIC SMALL LETTER KJE ! 0x00cf: 0x0455, # CYRILLIC SMALL LETTER DZE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00d8: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U ! 0x00d9: 0x045e, # CYRILLIC SMALL LETTER SHORT U ! 0x00da: 0x040f, # CYRILLIC CAPITAL LETTER DZHE ! 0x00db: 0x045f, # CYRILLIC SMALL LETTER DZHE ! 0x00dc: 0x2116, # NUMERO SIGN ! 0x00dd: 0x0401, # CYRILLIC CAPITAL LETTER IO ! 0x00de: 0x0451, # CYRILLIC SMALL LETTER IO ! 0x00df: 0x044f, # CYRILLIC SMALL LETTER YA ! 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A ! 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE ! 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE ! 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE ! 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE ! 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE ! 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE ! 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE ! 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I ! 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I ! 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA ! 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL ! 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM ! 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN ! 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O ! 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE ! 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER ! 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES ! 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE ! 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U ! 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF ! 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA ! 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE ! 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE ! 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA ! 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA ! 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN ! 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU ! 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN ! 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E ! 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU ! 0x00ff: 0x00a4, # CURRENCY SIGN }) Index: mac_greek.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_greek.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mac_greek.py 16 May 2001 09:41:45 -0000 1.3 --- mac_greek.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,167 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00b9, # SUPERSCRIPT ONE ! 0x0082: 0x00b2, # SUPERSCRIPT TWO ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00b3, # SUPERSCRIPT THREE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x0385, # GREEK DIALYTIKA TONOS ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x0384, # GREEK TONOS ! 0x008c: 0x00a8, # DIAERESIS ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00a3, # POUND SIGN ! 0x0093: 0x2122, # TRADE MARK SIGN ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x2022, # BULLET ! 0x0097: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x0098: 0x2030, # PER MILLE SIGN ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00a6, # BROKEN BAR ! 0x009c: 0x00ad, # SOFT HYPHEN ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00a2: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00a3: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00a4: 0x039b, # GREEK CAPITAL LETTER LAMBDA ! 0x00a5: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00a6: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00ab: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00ac: 0x00a7, # SECTION SIGN ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00b0, # DEGREE SIGN ! 0x00af: 0x0387, # GREEK ANO TELEIA ! 0x00b0: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b5: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00b6: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00b7: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00b8: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00b9: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ba: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00bb: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00bc: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00bd: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00be: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00bf: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00c0: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00c1: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00c4: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00cc: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00cd: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00ce: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2015, # HORIZONTAL BAR ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00d8: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00d9: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00da: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00db: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00dc: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00dd: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00de: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00df: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00e0: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00e1: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e2: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00e3: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00e4: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00e5: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00e6: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00e7: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00e8: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e9: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00ea: 0x03be, # GREEK SMALL LETTER XI ! 0x00eb: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00ec: 0x03bb, # GREEK SMALL LETTER LAMBDA ! 0x00ed: 0x03bc, # GREEK SMALL LETTER MU ! 0x00ee: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ef: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00f0: 0x03c0, # GREEK SMALL LETTER PI ! 0x00f1: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00f2: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00f3: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00f4: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00f5: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00f6: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00f7: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00f8: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f9: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00fa: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00fb: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00fc: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fd: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00fe: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00ff: None, # UNDEFINED }) --- 38,167 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00b9, # SUPERSCRIPT ONE ! 0x0082: 0x00b2, # SUPERSCRIPT TWO ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00b3, # SUPERSCRIPT THREE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x0385, # GREEK DIALYTIKA TONOS ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x0384, # GREEK TONOS ! 0x008c: 0x00a8, # DIAERESIS ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00a3, # POUND SIGN ! 0x0093: 0x2122, # TRADE MARK SIGN ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x2022, # BULLET ! 0x0097: 0x00bd, # VULGAR FRACTION ONE HALF ! 0x0098: 0x2030, # PER MILLE SIGN ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00a6, # BROKEN BAR ! 0x009c: 0x00ad, # SOFT HYPHEN ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x0393, # GREEK CAPITAL LETTER GAMMA ! 0x00a2: 0x0394, # GREEK CAPITAL LETTER DELTA ! 0x00a3: 0x0398, # GREEK CAPITAL LETTER THETA ! 0x00a4: 0x039b, # GREEK CAPITAL LETTER LAMBDA ! 0x00a5: 0x039e, # GREEK CAPITAL LETTER XI ! 0x00a6: 0x03a0, # GREEK CAPITAL LETTER PI ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x03a3, # GREEK CAPITAL LETTER SIGMA ! 0x00ab: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA ! 0x00ac: 0x00a7, # SECTION SIGN ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00b0, # DEGREE SIGN ! 0x00af: 0x0387, # GREEK ANO TELEIA ! 0x00b0: 0x0391, # GREEK CAPITAL LETTER ALPHA ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b5: 0x0392, # GREEK CAPITAL LETTER BETA ! 0x00b6: 0x0395, # GREEK CAPITAL LETTER EPSILON ! 0x00b7: 0x0396, # GREEK CAPITAL LETTER ZETA ! 0x00b8: 0x0397, # GREEK CAPITAL LETTER ETA ! 0x00b9: 0x0399, # GREEK CAPITAL LETTER IOTA ! 0x00ba: 0x039a, # GREEK CAPITAL LETTER KAPPA ! 0x00bb: 0x039c, # GREEK CAPITAL LETTER MU ! 0x00bc: 0x03a6, # GREEK CAPITAL LETTER PHI ! 0x00bd: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA ! 0x00be: 0x03a8, # GREEK CAPITAL LETTER PSI ! 0x00bf: 0x03a9, # GREEK CAPITAL LETTER OMEGA ! 0x00c0: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS ! 0x00c1: 0x039d, # GREEK CAPITAL LETTER NU ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x039f, # GREEK CAPITAL LETTER OMICRON ! 0x00c4: 0x03a1, # GREEK CAPITAL LETTER RHO ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x03a4, # GREEK CAPITAL LETTER TAU ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x03a5, # GREEK CAPITAL LETTER UPSILON ! 0x00cc: 0x03a7, # GREEK CAPITAL LETTER CHI ! 0x00cd: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS ! 0x00ce: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2015, # HORIZONTAL BAR ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS ! 0x00d8: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS ! 0x00d9: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS ! 0x00da: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS ! 0x00db: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS ! 0x00dc: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS ! 0x00dd: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS ! 0x00de: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS ! 0x00df: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS ! 0x00e0: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS ! 0x00e1: 0x03b1, # GREEK SMALL LETTER ALPHA ! 0x00e2: 0x03b2, # GREEK SMALL LETTER BETA ! 0x00e3: 0x03c8, # GREEK SMALL LETTER PSI ! 0x00e4: 0x03b4, # GREEK SMALL LETTER DELTA ! 0x00e5: 0x03b5, # GREEK SMALL LETTER EPSILON ! 0x00e6: 0x03c6, # GREEK SMALL LETTER PHI ! 0x00e7: 0x03b3, # GREEK SMALL LETTER GAMMA ! 0x00e8: 0x03b7, # GREEK SMALL LETTER ETA ! 0x00e9: 0x03b9, # GREEK SMALL LETTER IOTA ! 0x00ea: 0x03be, # GREEK SMALL LETTER XI ! 0x00eb: 0x03ba, # GREEK SMALL LETTER KAPPA ! 0x00ec: 0x03bb, # GREEK SMALL LETTER LAMBDA ! 0x00ed: 0x03bc, # GREEK SMALL LETTER MU ! 0x00ee: 0x03bd, # GREEK SMALL LETTER NU ! 0x00ef: 0x03bf, # GREEK SMALL LETTER OMICRON ! 0x00f0: 0x03c0, # GREEK SMALL LETTER PI ! 0x00f1: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS ! 0x00f2: 0x03c1, # GREEK SMALL LETTER RHO ! 0x00f3: 0x03c3, # GREEK SMALL LETTER SIGMA ! 0x00f4: 0x03c4, # GREEK SMALL LETTER TAU ! 0x00f5: 0x03b8, # GREEK SMALL LETTER THETA ! 0x00f6: 0x03c9, # GREEK SMALL LETTER OMEGA ! 0x00f7: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA ! 0x00f8: 0x03c7, # GREEK SMALL LETTER CHI ! 0x00f9: 0x03c5, # GREEK SMALL LETTER UPSILON ! 0x00fa: 0x03b6, # GREEK SMALL LETTER ZETA ! 0x00fb: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA ! 0x00fc: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA ! 0x00fd: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS ! 0x00fe: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS ! 0x00ff: None, # UNDEFINED }) Index: mac_iceland.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_iceland.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mac_iceland.py 16 May 2001 09:41:45 -0000 1.3 --- mac_iceland.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,163 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x008c: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x00b4, # ACUTE ACCENT ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x00af: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x220f, # N-ARY PRODUCT ! 0x00b9: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ba: 0x222b, # INTEGRAL ! 0x00bb: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00bc: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00bd: 0x2126, # OHM SIGN ! 0x00be: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x00bf: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00c0: 0x00bf, # INVERTED QUESTION MARK ! 0x00c1: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00cc: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00d9: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00da: 0x2044, # FRACTION SLASH ! 0x00db: 0x00a4, # CURRENCY SIGN ! 0x00dc: 0x00d0, # LATIN CAPITAL LETTER ETH ! 0x00dd: 0x00f0, # LATIN SMALL LETTER ETH ! 0x00df: 0x00fe, # LATIN SMALL LETTER THORN ! 0x00e0: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00e1: 0x00b7, # MIDDLE DOT ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x2030, # PER MILLE SIGN ! 0x00e5: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00e6: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00e9: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00ec: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00ed: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: None, # UNDEFINED ! 0x00f1: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00f4: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00f5: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00f6: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x00f7: 0x02dc, # SMALL TILDE ! 0x00f8: 0x00af, # MACRON ! 0x00f9: 0x02d8, # BREVE ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x02da, # RING ABOVE ! 0x00fc: 0x00b8, # CEDILLA ! 0x00fd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00fe: 0x02db, # OGONEK ! 0x00ff: 0x02c7, # CARON }) --- 38,163 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x008c: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x00b4, # ACUTE ACCENT ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x00af: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x220f, # N-ARY PRODUCT ! 0x00b9: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ba: 0x222b, # INTEGRAL ! 0x00bb: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00bc: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00bd: 0x2126, # OHM SIGN ! 0x00be: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x00bf: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00c0: 0x00bf, # INVERTED QUESTION MARK ! 0x00c1: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00cc: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00d9: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00da: 0x2044, # FRACTION SLASH ! 0x00db: 0x00a4, # CURRENCY SIGN ! 0x00dc: 0x00d0, # LATIN CAPITAL LETTER ETH ! 0x00dd: 0x00f0, # LATIN SMALL LETTER ETH ! 0x00df: 0x00fe, # LATIN SMALL LETTER THORN ! 0x00e0: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00e1: 0x00b7, # MIDDLE DOT ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x2030, # PER MILLE SIGN ! 0x00e5: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00e6: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00e9: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00ec: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00ed: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: None, # UNDEFINED ! 0x00f1: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00f4: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00f5: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00f6: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x00f7: 0x02dc, # SMALL TILDE ! 0x00f8: 0x00af, # MACRON ! 0x00f9: 0x02d8, # BREVE ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x02da, # RING ABOVE ! 0x00fc: 0x00b8, # CEDILLA ! 0x00fd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00fe: 0x02db, # OGONEK ! 0x00ff: 0x02c7, # CARON }) Index: mac_latin2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_latin2.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mac_latin2.py 16 May 2001 09:41:45 -0000 1.3 --- mac_latin2.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,167 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x0082: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x0089: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x008c: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x008d: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x0090: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x0091: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x0094: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x0095: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x0096: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x009e: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a2: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00af: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00b0: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00b1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00b5: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00b9: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00ba: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00bb: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x00bc: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x00bd: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x00be: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x00bf: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00c0: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00c1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00c5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00cc: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x00cf: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00d9: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00da: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00db: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x00de: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00df: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00e0: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00e1: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00e5: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00e6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x00e9: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00ec: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00ed: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00f1: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x00f4: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00f5: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00f6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00f7: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00f8: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00f9: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00fa: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00fb: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00fc: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00fe: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00ff: 0x02c7, # CARON }) --- 38,167 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON ! 0x0082: 0x0101, # LATIN SMALL LETTER A WITH MACRON ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x0105, # LATIN SMALL LETTER A WITH OGONEK ! 0x0089: 0x010c, # LATIN CAPITAL LETTER C WITH CARON ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x010d, # LATIN SMALL LETTER C WITH CARON ! 0x008c: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE ! 0x008d: 0x0107, # LATIN SMALL LETTER C WITH ACUTE ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE ! 0x0090: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE ! 0x0091: 0x010e, # LATIN CAPITAL LETTER D WITH CARON ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x010f, # LATIN SMALL LETTER D WITH CARON ! 0x0094: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON ! 0x0095: 0x0113, # LATIN SMALL LETTER E WITH MACRON ! 0x0096: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x011a, # LATIN CAPITAL LETTER E WITH CARON ! 0x009e: 0x011b, # LATIN SMALL LETTER E WITH CARON ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a2: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x0119, # LATIN SMALL LETTER E WITH OGONEK ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA ! 0x00af: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK ! 0x00b0: 0x012f, # LATIN SMALL LETTER I WITH OGONEK ! 0x00b1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON ! 0x00b5: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x0142, # LATIN SMALL LETTER L WITH STROKE ! 0x00b9: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA ! 0x00ba: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA ! 0x00bb: 0x013d, # LATIN CAPITAL LETTER L WITH CARON ! 0x00bc: 0x013e, # LATIN SMALL LETTER L WITH CARON ! 0x00bd: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE ! 0x00be: 0x013a, # LATIN SMALL LETTER L WITH ACUTE ! 0x00bf: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA ! 0x00c0: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA ! 0x00c1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE ! 0x00c5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x0148, # LATIN SMALL LETTER N WITH CARON ! 0x00cc: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE ! 0x00cf: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x014d, # LATIN SMALL LETTER O WITH MACRON ! 0x00d9: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE ! 0x00da: 0x0155, # LATIN SMALL LETTER R WITH ACUTE ! 0x00db: 0x0158, # LATIN CAPITAL LETTER R WITH CARON ! 0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x00de: 0x0159, # LATIN SMALL LETTER R WITH CARON ! 0x00df: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA ! 0x00e0: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA ! 0x00e1: 0x0160, # LATIN CAPITAL LETTER S WITH CARON ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x0161, # LATIN SMALL LETTER S WITH CARON ! 0x00e5: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE ! 0x00e6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x0164, # LATIN CAPITAL LETTER T WITH CARON ! 0x00e9: 0x0165, # LATIN SMALL LETTER T WITH CARON ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON ! 0x00ec: 0x017e, # LATIN SMALL LETTER Z WITH CARON ! 0x00ed: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: 0x016b, # LATIN SMALL LETTER U WITH MACRON ! 0x00f1: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE ! 0x00f4: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE ! 0x00f5: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE ! 0x00f6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK ! 0x00f7: 0x0173, # LATIN SMALL LETTER U WITH OGONEK ! 0x00f8: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE ! 0x00f9: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE ! 0x00fa: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA ! 0x00fb: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE ! 0x00fc: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE ! 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE ! 0x00fe: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA ! 0x00ff: 0x02c7, # CARON }) Index: mac_roman.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_roman.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mac_roman.py 16 May 2001 09:41:45 -0000 1.3 --- mac_roman.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,164 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x008c: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x00b4, # ACUTE ACCENT ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x00af: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x220f, # N-ARY PRODUCT ! 0x00b9: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ba: 0x222b, # INTEGRAL ! 0x00bb: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00bc: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00bd: 0x2126, # OHM SIGN ! 0x00be: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x00bf: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00c0: 0x00bf, # INVERTED QUESTION MARK ! 0x00c1: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00cc: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00d9: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00da: 0x2044, # FRACTION SLASH ! 0x00db: 0x00a4, # CURRENCY SIGN ! 0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x00de: 0xfb01, # LATIN SMALL LIGATURE FI ! 0x00df: 0xfb02, # LATIN SMALL LIGATURE FL ! 0x00e0: 0x2021, # DOUBLE DAGGER ! 0x00e1: 0x00b7, # MIDDLE DOT ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x2030, # PER MILLE SIGN ! 0x00e5: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00e6: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00e9: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00ec: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00ed: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: None, # UNDEFINED ! 0x00f1: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00f4: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00f5: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00f6: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x00f7: 0x02dc, # SMALL TILDE ! 0x00f8: 0x00af, # MACRON ! 0x00f9: 0x02d8, # BREVE ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x02da, # RING ABOVE ! 0x00fc: 0x00b8, # CEDILLA ! 0x00fd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00fe: 0x02db, # OGONEK ! 0x00ff: 0x02c7, # CARON }) --- 38,164 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x008c: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x00b4, # ACUTE ACCENT ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x00af: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x220f, # N-ARY PRODUCT ! 0x00b9: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ba: 0x222b, # INTEGRAL ! 0x00bb: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00bc: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00bd: 0x2126, # OHM SIGN ! 0x00be: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x00bf: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00c0: 0x00bf, # INVERTED QUESTION MARK ! 0x00c1: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00cc: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00d9: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00da: 0x2044, # FRACTION SLASH ! 0x00db: 0x00a4, # CURRENCY SIGN ! 0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK ! 0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ! 0x00de: 0xfb01, # LATIN SMALL LIGATURE FI ! 0x00df: 0xfb02, # LATIN SMALL LIGATURE FL ! 0x00e0: 0x2021, # DOUBLE DAGGER ! 0x00e1: 0x00b7, # MIDDLE DOT ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x2030, # PER MILLE SIGN ! 0x00e5: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00e6: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00e9: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00ec: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00ed: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: None, # UNDEFINED ! 0x00f1: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00f4: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00f5: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00f6: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x00f7: 0x02dc, # SMALL TILDE ! 0x00f8: 0x00af, # MACRON ! 0x00f9: 0x02d8, # BREVE ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x02da, # RING ABOVE ! 0x00fc: 0x00b8, # CEDILLA ! 0x00fd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00fe: 0x02db, # OGONEK ! 0x00ff: 0x02c7, # CARON }) Index: mac_turkish.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_turkish.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mac_turkish.py 16 May 2001 09:41:45 -0000 1.3 --- mac_turkish.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 38,164 **** decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x008c: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x00b4, # ACUTE ACCENT ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x00af: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x220f, # N-ARY PRODUCT ! 0x00b9: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ba: 0x222b, # INTEGRAL ! 0x00bb: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00bc: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00bd: 0x2126, # OHM SIGN ! 0x00be: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x00bf: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00c0: 0x00bf, # INVERTED QUESTION MARK ! 0x00c1: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00cc: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00d9: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00da: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00db: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00dc: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00dd: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00df: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00e0: 0x2021, # DOUBLE DAGGER ! 0x00e1: 0x00b7, # MIDDLE DOT ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x2030, # PER MILLE SIGN ! 0x00e5: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00e6: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00e9: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00ec: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00ed: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: None, # UNDEFINED ! 0x00f1: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00f4: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00f5: None, # UNDEFINED ! 0x00f6: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x00f7: 0x02dc, # SMALL TILDE ! 0x00f8: 0x00af, # MACRON ! 0x00f9: 0x02d8, # BREVE ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x02da, # RING ABOVE ! 0x00fc: 0x00b8, # CEDILLA ! 0x00fd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00fe: 0x02db, # OGONEK ! 0x00ff: 0x02c7, # CARON }) --- 38,164 ---- decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ ! 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS ! 0x0081: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE ! 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA ! 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE ! 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE ! 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS ! 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS ! 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE ! 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE ! 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX ! 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS ! 0x008b: 0x00e3, # LATIN SMALL LETTER A WITH TILDE ! 0x008c: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE ! 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA ! 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE ! 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE ! 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX ! 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS ! 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE ! 0x0093: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE ! 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX ! 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS ! 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE ! 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE ! 0x0098: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE ! 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX ! 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS ! 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE ! 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE ! 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE ! 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX ! 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS ! 0x00a0: 0x2020, # DAGGER ! 0x00a1: 0x00b0, # DEGREE SIGN ! 0x00a4: 0x00a7, # SECTION SIGN ! 0x00a5: 0x2022, # BULLET ! 0x00a6: 0x00b6, # PILCROW SIGN ! 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S ! 0x00a8: 0x00ae, # REGISTERED SIGN ! 0x00aa: 0x2122, # TRADE MARK SIGN ! 0x00ab: 0x00b4, # ACUTE ACCENT ! 0x00ac: 0x00a8, # DIAERESIS ! 0x00ad: 0x2260, # NOT EQUAL TO ! 0x00ae: 0x00c6, # LATIN CAPITAL LIGATURE AE ! 0x00af: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE ! 0x00b0: 0x221e, # INFINITY ! 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO ! 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO ! 0x00b4: 0x00a5, # YEN SIGN ! 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL ! 0x00b7: 0x2211, # N-ARY SUMMATION ! 0x00b8: 0x220f, # N-ARY PRODUCT ! 0x00b9: 0x03c0, # GREEK SMALL LETTER PI ! 0x00ba: 0x222b, # INTEGRAL ! 0x00bb: 0x00aa, # FEMININE ORDINAL INDICATOR ! 0x00bc: 0x00ba, # MASCULINE ORDINAL INDICATOR ! 0x00bd: 0x2126, # OHM SIGN ! 0x00be: 0x00e6, # LATIN SMALL LIGATURE AE ! 0x00bf: 0x00f8, # LATIN SMALL LETTER O WITH STROKE ! 0x00c0: 0x00bf, # INVERTED QUESTION MARK ! 0x00c1: 0x00a1, # INVERTED EXCLAMATION MARK ! 0x00c2: 0x00ac, # NOT SIGN ! 0x00c3: 0x221a, # SQUARE ROOT ! 0x00c4: 0x0192, # LATIN SMALL LETTER F WITH HOOK ! 0x00c5: 0x2248, # ALMOST EQUAL TO ! 0x00c6: 0x2206, # INCREMENT ! 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK ! 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS ! 0x00ca: 0x00a0, # NO-BREAK SPACE ! 0x00cb: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE ! 0x00cc: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE ! 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE ! 0x00ce: 0x0152, # LATIN CAPITAL LIGATURE OE ! 0x00cf: 0x0153, # LATIN SMALL LIGATURE OE ! 0x00d0: 0x2013, # EN DASH ! 0x00d1: 0x2014, # EM DASH ! 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK ! 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK ! 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK ! 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK ! 0x00d6: 0x00f7, # DIVISION SIGN ! 0x00d7: 0x25ca, # LOZENGE ! 0x00d8: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS ! 0x00d9: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS ! 0x00da: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE ! 0x00db: 0x011f, # LATIN SMALL LETTER G WITH BREVE ! 0x00dc: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE ! 0x00dd: 0x0131, # LATIN SMALL LETTER DOTLESS I ! 0x00de: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA ! 0x00df: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA ! 0x00e0: 0x2021, # DOUBLE DAGGER ! 0x00e1: 0x00b7, # MIDDLE DOT ! 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK ! 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK ! 0x00e4: 0x2030, # PER MILLE SIGN ! 0x00e5: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX ! 0x00e6: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX ! 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE ! 0x00e8: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS ! 0x00e9: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE ! 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE ! 0x00eb: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX ! 0x00ec: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS ! 0x00ed: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE ! 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE ! 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX ! 0x00f0: None, # UNDEFINED ! 0x00f1: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE ! 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE ! 0x00f3: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX ! 0x00f4: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE ! 0x00f5: None, # UNDEFINED ! 0x00f6: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT ! 0x00f7: 0x02dc, # SMALL TILDE ! 0x00f8: 0x00af, # MACRON ! 0x00f9: 0x02d8, # BREVE ! 0x00fa: 0x02d9, # DOT ABOVE ! 0x00fb: 0x02da, # RING ABOVE ! 0x00fc: 0x00b8, # CEDILLA ! 0x00fd: 0x02dd, # DOUBLE ACUTE ACCENT ! 0x00fe: 0x02db, # OGONEK ! 0x00ff: 0x02c7, # CARON }) Index: mbcs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mbcs.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mbcs.py 28 Mar 2000 20:29:56 -0000 1.2 --- mbcs.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 21,25 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 21,25 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: palmos.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/palmos.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** palmos.py 12 Jul 2002 14:36:22 -0000 1.1 --- palmos.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 12,16 **** def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_map) --- 12,16 ---- def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_map) *************** *** 18,22 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 18,22 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: raw_unicode_escape.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/raw_unicode_escape.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** raw_unicode_escape.py 10 Mar 2000 23:17:24 -0000 1.1 --- raw_unicode_escape.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: rot_13.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/rot_13.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rot_13.py 16 May 2001 09:41:45 -0000 1.2 --- rot_13.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 17,21 **** return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): --- 17,21 ---- return codecs.charmap_encode(input,errors,encoding_map) ! def decode(self,input,errors='strict'): *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: undefined.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/undefined.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** undefined.py 7 Jun 2000 09:04:05 -0000 1.1 --- undefined.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 24,28 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 24,28 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: unicode_escape.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/unicode_escape.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** unicode_escape.py 10 Mar 2000 23:17:24 -0000 1.1 --- unicode_escape.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: unicode_internal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/unicode_internal.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** unicode_internal.py 10 Mar 2000 23:17:24 -0000 1.1 --- unicode_internal.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: utf_16.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_16.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utf_16.py 5 Apr 2002 12:12:00 -0000 1.3 --- utf_16.py 8 Aug 2002 20:19:19 -0000 1.4 *************** *** 32,36 **** self.encode = codecs.utf_16_be_encode return result ! class StreamReader(Codec,codecs.StreamReader): def __init__(self, stream, errors='strict'): --- 32,36 ---- self.encode = codecs.utf_16_be_encode return result ! class StreamReader(Codec,codecs.StreamReader): def __init__(self, stream, errors='strict'): *************** *** 62,64 **** return (Codec.encode,Codec.decode,StreamReader,StreamWriter) - --- 62,63 ---- Index: utf_16_be.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_16_be.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utf_16_be.py 5 Apr 2002 12:12:00 -0000 1.2 --- utf_16_be.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): *************** *** 31,33 **** return (Codec.encode,Codec.decode,StreamReader,StreamWriter) - --- 31,32 ---- Index: utf_16_le.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_16_le.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utf_16_le.py 5 Apr 2002 12:12:00 -0000 1.2 --- utf_16_le.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): *************** *** 31,33 **** return (Codec.encode,Codec.decode,StreamReader,StreamWriter) - --- 31,32 ---- Index: utf_7.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_7.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utf_7.py 20 Sep 2001 12:56:14 -0000 1.1 --- utf_7.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 16,20 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 16,20 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 25,27 **** return (Codec.encode,Codec.decode,StreamReader,StreamWriter) - --- 25,26 ---- Index: utf_8.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/utf_8.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utf_8.py 10 Mar 2000 23:17:24 -0000 1.1 --- utf_8.py 8 Aug 2002 20:19:19 -0000 1.2 *************** *** 20,24 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 20,24 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass *************** *** 29,31 **** return (Codec.encode,Codec.decode,StreamReader,StreamWriter) - --- 29,30 ---- Index: uu_codec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/uu_codec.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** uu_codec.py 20 Sep 2001 10:33:38 -0000 1.2 --- uu_codec.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 38,42 **** chunk = read(45) write(' \nend\n') ! return (outfile.getvalue(), len(input)) --- 38,42 ---- chunk = read(45) write(' \nend\n') ! return (outfile.getvalue(), len(input)) *************** *** 99,106 **** def decode(self,input,errors='strict'): return uu_decode(input,errors) ! class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 99,106 ---- def decode(self,input,errors='strict'): return uu_decode(input,errors) ! class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass Index: zlib_codec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/zlib_codec.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** zlib_codec.py 20 Sep 2001 10:33:38 -0000 1.2 --- zlib_codec.py 8 Aug 2002 20:19:19 -0000 1.3 *************** *** 53,57 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 53,57 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass From gvanrossum@users.sourceforge.net Thu Aug 8 21:28:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:28:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10494 Modified Files: test_socket.py Log Message: testSendAll(): loop until all data is read; this was necessary at least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but looks like the test *could* fail on any other platform too -- there's no guarantee that recv() reads all data. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** test_socket.py 8 Aug 2002 20:19:19 -0000 1.54 --- test_socket.py 8 Aug 2002 20:28:34 -0000 1.55 *************** *** 379,389 **** def testSendAll(self): # Testing sendall() with a 2048 byte string over TCP while 1: read = self.cli_conn.recv(1024) if not read: break ! self.assert_(len(read) == 1024, "Error performing sendall.") ! read = filter(lambda x: x == 'f', read) ! self.assert_(len(read) == 1024, "Error performing sendall.") def _testSendAll(self): --- 379,389 ---- def testSendAll(self): # Testing sendall() with a 2048 byte string over TCP + msg = '' while 1: read = self.cli_conn.recv(1024) if not read: break ! msg += read ! self.assertEqual(msg, 'f' * 2048) def _testSendAll(self): From gvanrossum@users.sourceforge.net Thu Aug 8 21:37:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:37:10 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.240,1.241 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13210 Modified Files: socketmodule.c Log Message: Clean up some docstrings. Some docstrings didn't show their return value; others were inconsistent in what to name the argument or return value; a few module-global functions had "socket." in front of their name, against convention. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.240 retrieving revision 1.241 diff -C2 -d -r1.240 -r1.241 *** socketmodule.c 6 Aug 2002 22:25:02 -0000 1.240 --- socketmodule.c 8 Aug 2002 20:37:08 -0000 1.241 *************** *** 1111,1115 **** PyDoc_STRVAR(gettimeout_doc, ! "gettimeout()\n\ \n\ Returns the timeout in floating seconds associated with socket \n\ --- 1111,1115 ---- PyDoc_STRVAR(gettimeout_doc, ! "gettimeout() -> timeout\n\ \n\ Returns the timeout in floating seconds associated with socket \n\ *************** *** 1388,1392 **** PyDoc_STRVAR(connect_ex_doc, ! "connect_ex(address)\n\ \n\ This is like connect(address), but returns an error code (the errno value)\n\ --- 1388,1392 ---- PyDoc_STRVAR(connect_ex_doc, ! "connect_ex(address) -> errno\n\ \n\ This is like connect(address), but returns an error code (the errno value)\n\ *************** *** 1788,1792 **** PyDoc_STRVAR(sendto_doc, ! "sendto(data[, flags], address)\n\ \n\ Like send(data, flags) but allows specifying the destination address.\n\ --- 1788,1792 ---- PyDoc_STRVAR(sendto_doc, ! "sendto(data[, flags], address) -> count\n\ \n\ Like send(data, flags) but allows specifying the destination address.\n\ *************** *** 2713,2718 **** PyDoc_STRVAR(getaddrinfo_doc, ! "socket.getaddrinfo(host, port [, family, socktype, proto, flags])\n\ ! --> List of (family, socktype, proto, canonname, sockaddr)\n\ \n\ Resolve host and port into addrinfo struct."); --- 2713,2718 ---- PyDoc_STRVAR(getaddrinfo_doc, ! "getaddrinfo(host, port [, family, socktype, proto, flags])\n\ ! -> list of (family, socktype, proto, canonname, sockaddr)\n\ \n\ Resolve host and port into addrinfo struct."); *************** *** 2791,2795 **** PyDoc_STRVAR(getnameinfo_doc, ! "socket.getnameinfo(sockaddr, flags) --> (host, port)\n\ \n\ Get host and port for a sockaddr."); --- 2791,2795 ---- PyDoc_STRVAR(getnameinfo_doc, ! "getnameinfo(sockaddr, flags) --> (host, port)\n\ \n\ Get host and port for a sockaddr."); *************** *** 2810,2814 **** PyDoc_STRVAR(getdefaulttimeout_doc, ! "socket.getdefaulttimeout() -> None | float\n\ \n\ Returns the default timeout in floating seconds for new socket objects.\n\ --- 2810,2814 ---- PyDoc_STRVAR(getdefaulttimeout_doc, ! "getdefaulttimeout() -> timeout\n\ \n\ Returns the default timeout in floating seconds for new socket objects.\n\ *************** *** 2840,2844 **** PyDoc_STRVAR(setdefaulttimeout_doc, ! "socket.setdefaulttimeout(None | float)\n\ \n\ Set the default timeout in floating seconds for new socket objects.\n\ --- 2840,2844 ---- PyDoc_STRVAR(setdefaulttimeout_doc, ! "setdefaulttimeout(timeout)\n\ \n\ Set the default timeout in floating seconds for new socket objects.\n\ *************** *** 3014,3019 **** PyDoc_STRVAR(socket_doc, ! "Implementation module for socket operations. See the socket module\n\ ! for documentation."); PyMODINIT_FUNC --- 3014,3020 ---- PyDoc_STRVAR(socket_doc, ! "Implementation module for socket operations.\n\ ! \n\ ! See the socket module for documentation."); PyMODINIT_FUNC From gvanrossum@users.sourceforge.net Thu Aug 8 21:39:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:39:34 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.241,1.242 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14007 Modified Files: socketmodule.c Log Message: The other half of the patches added to SF patch 555085 by A I MacIntyre. At least on OS/2, a subsequent connect() on a nonblocking socket returns errno==EISCONN to indicate success. This seems harmless on Unix. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.241 retrieving revision 1.242 diff -C2 -d -r1.241 -r1.242 *** socketmodule.c 8 Aug 2002 20:37:08 -0000 1.241 --- socketmodule.c 8 Aug 2002 20:39:30 -0000 1.242 *************** *** 1328,1331 **** --- 1328,1333 ---- internal_select(s, 1); res = connect(s->sock_fd, addr, addrlen); + if (res < 0 && errno == EISCONN) + res = 0; } } From gvanrossum@users.sourceforge.net Thu Aug 8 21:55:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:55:23 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.167,2.168 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17558/Objects Modified Files: typeobject.c Log Message: A modest speedup of object deallocation. call_finalizer() did rather a lot of work: it had to save and restore the current exception around a call to lookup_maybe(), because that could fail in rare cases, and most objects don't have a __del__ method, so the whole exercise was usually a waste of time. Changed this to cache the __del__ method in the type object just like all other special methods, in a new slot tp_del. So now subtype_dealloc() can test whether tp_del is NULL and skip the whole exercise if it is. The new slot doesn't need a new flag bit: subtype_dealloc() is only called if the type was dynamically allocated by type_new(), so it's guaranteed to have all current slots. Types defined in C cannot fill in tp_del with a function of their own, so there's no corresponding "wrapper". (That functionality is already available through tp_dealloc.) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.167 retrieving revision 2.168 diff -C2 -d -r2.167 -r2.168 *** typeobject.c 7 Aug 2002 20:42:09 -0000 2.167 --- typeobject.c 8 Aug 2002 20:55:20 -0000 2.168 *************** *** 357,422 **** } - static PyObject *lookup_maybe(PyObject *, char *, PyObject **); - - static int - call_finalizer(PyObject *self) - { - static PyObject *del_str = NULL; - PyObject *del, *res; - PyObject *error_type, *error_value, *error_traceback; - - /* Temporarily resurrect the object. */ - assert(self->ob_refcnt == 0); - self->ob_refcnt = 1; - - /* Save the current exception, if any. */ - PyErr_Fetch(&error_type, &error_value, &error_traceback); - - /* Execute __del__ method, if any. */ - del = lookup_maybe(self, "__del__", &del_str); - if (del != NULL) { - res = PyEval_CallObject(del, NULL); - if (res == NULL) - PyErr_WriteUnraisable(del); - else - Py_DECREF(res); - Py_DECREF(del); - } - - /* Restore the saved exception. */ - PyErr_Restore(error_type, error_value, error_traceback); - - /* Undo the temporary resurrection; can't use DECREF here, it would - * cause a recursive call. - */ - assert(self->ob_refcnt > 0); - if (--self->ob_refcnt == 0) - return 0; /* this is the normal path out */ - - /* __del__ resurrected it! Make it look like the original Py_DECREF - * never happened. - */ - { - int refcnt = self->ob_refcnt; - _Py_NewReference(self); - self->ob_refcnt = refcnt; - } - assert(!PyType_IS_GC(self->ob_type) || - _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); - /* If Py_REF_DEBUG, the original decref dropped _Py_RefTotal, but - * _Py_NewReference bumped it again, so that's a wash. - * If Py_TRACE_REFS, _Py_NewReference re-added self to the object - * chain, so no more to do there either. - * If COUNT_ALLOCS, the original decref bumped tp_frees, and - * _Py_NewReference bumped tp_allocs: both of those need to be - * undone. - */ - #ifdef COUNT_ALLOCS - --self->ob_type->tp_frees; - --self->ob_type->tp_allocs; - #endif - return -1; /* __del__ added a reference; don't delete now */ - } - static void subtype_dealloc(PyObject *self) --- 357,360 ---- *************** *** 439,444 **** /* Maybe call finalizer; exit early if resurrected */ ! if (call_finalizer(self) < 0) ! return; /* Find the nearest base with a different tp_dealloc */ --- 377,385 ---- /* Maybe call finalizer; exit early if resurrected */ ! if (type->tp_del) { ! type->tp_del(self); ! if (self->ob_refcnt > 0) ! return; ! } /* Find the nearest base with a different tp_dealloc */ *************** *** 469,474 **** /* Maybe call finalizer; exit early if resurrected */ ! if (call_finalizer(self) < 0) ! goto endlabel; /* Find the nearest base with a different tp_dealloc --- 410,418 ---- /* Maybe call finalizer; exit early if resurrected */ ! if (type->tp_del) { ! type->tp_del(self); ! if (self->ob_refcnt > 0) ! goto endlabel; ! } /* Find the nearest base with a different tp_dealloc *************** *** 3722,3725 **** --- 3666,3728 ---- } + static void + slot_tp_del(PyObject *self) + { + static PyObject *del_str = NULL; + PyObject *del, *res; + PyObject *error_type, *error_value, *error_traceback; + + /* Temporarily resurrect the object. */ + assert(self->ob_refcnt == 0); + self->ob_refcnt = 1; + + /* Save the current exception, if any. */ + PyErr_Fetch(&error_type, &error_value, &error_traceback); + + /* Execute __del__ method, if any. */ + del = lookup_maybe(self, "__del__", &del_str); + if (del != NULL) { + res = PyEval_CallObject(del, NULL); + if (res == NULL) + PyErr_WriteUnraisable(del); + else + Py_DECREF(res); + Py_DECREF(del); + } + + /* Restore the saved exception. */ + PyErr_Restore(error_type, error_value, error_traceback); + + /* Undo the temporary resurrection; can't use DECREF here, it would + * cause a recursive call. + */ + assert(self->ob_refcnt > 0); + if (--self->ob_refcnt == 0) + return; /* this is the normal path out */ + + /* __del__ resurrected it! Make it look like the original Py_DECREF + * never happened. + */ + { + int refcnt = self->ob_refcnt; + _Py_NewReference(self); + self->ob_refcnt = refcnt; + } + assert(!PyType_IS_GC(self->ob_type) || + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + /* If Py_REF_DEBUG, the original decref dropped _Py_RefTotal, but + * _Py_NewReference bumped it again, so that's a wash. + * If Py_TRACE_REFS, _Py_NewReference re-added self to the object + * chain, so no more to do there either. + * If COUNT_ALLOCS, the original decref bumped tp_frees, and + * _Py_NewReference bumped tp_allocs: both of those need to be + * undone. + */ + #ifdef COUNT_ALLOCS + --self->ob_type->tp_frees; + --self->ob_type->tp_allocs; + #endif + } + /* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper *************** *** 3950,3953 **** --- 3953,3957 ---- PyWrapperFlag_KEYWORDS), TPSLOT("__new__", tp_new, slot_tp_new, NULL, ""), + TPSLOT("__del__", tp_del, slot_tp_del, NULL, ""), {NULL} }; From gvanrossum@users.sourceforge.net Thu Aug 8 21:55:22 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 13:55:22 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.110,2.111 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17558/Include Modified Files: object.h Log Message: A modest speedup of object deallocation. call_finalizer() did rather a lot of work: it had to save and restore the current exception around a call to lookup_maybe(), because that could fail in rare cases, and most objects don't have a __del__ method, so the whole exercise was usually a waste of time. Changed this to cache the __del__ method in the type object just like all other special methods, in a new slot tp_del. So now subtype_dealloc() can test whether tp_del is NULL and skip the whole exercise if it is. The new slot doesn't need a new flag bit: subtype_dealloc() is only called if the type was dynamically allocated by type_new(), so it's guaranteed to have all current slots. Types defined in C cannot fill in tp_del with a function of their own, so there's no corresponding "wrapper". (That functionality is already available through tp_dealloc.) Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.110 retrieving revision 2.111 diff -C2 -d -r2.110 -r2.111 *** object.h 7 Aug 2002 20:53:05 -0000 2.110 --- object.h 8 Aug 2002 20:55:20 -0000 2.111 *************** *** 316,319 **** --- 316,320 ---- PyObject *tp_subclasses; PyObject *tp_weaklist; + destructor tp_del; #ifdef COUNT_ALLOCS From jackjansen@users.sourceforge.net Thu Aug 8 22:16:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 08 Aug 2002 14:16:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib MACFS.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26432 Modified Files: MACFS.py Log Message: Use hex escape for non-ascii chars, now that the parser wants that. Good thing, too: some of the characters had been mangled by OS9->CVS->OSX roundtrips. Index: MACFS.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/MACFS.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MACFS.py 17 May 2001 12:38:01 -0000 1.5 --- MACFS.py 8 Aug 2002 21:16:56 -0000 1.6 *************** *** 71,96 **** kChewableItemsFolderType = 'flnt' kApplicationSupportFolderType = 'asup' ! kTextEncodingsFolderType = '€tex' kStationeryFolderType = 'odst' kOpenDocFolderType = 'odod' kOpenDocShellPlugInsFolderType = 'odsp' kEditorsFolderType = 'oded' ! kOpenDocEditorsFolderType = '€odf' kOpenDocLibrariesFolderType = 'odlb' ! kGenEditorsFolderType = '€edi' ! kHelpFolderType = '€hlp' ! kInternetPlugInFolderType = '€net' ! kModemScriptsFolderType = '€mod' kPrinterDescriptionFolderType = 'ppdf' ! kPrinterDriverFolderType = '€prd' ! kScriptingAdditionsFolderType = '€scr' ! kSharedLibrariesFolderType = '€lib' kVoicesFolderType = 'fvoc' kControlStripModulesFolderType = 'sdev' ! kAssistantsFolderType = 'ast€' ! kUtilitiesFolderType = 'uti€' ! kAppleExtrasFolderType = 'aex€' kContextualMenuItemsFolderType = 'cmnu' ! kMacOSReadMesFolderType = 'mor€' kALMModulesFolderType = 'walk' kALMPreferencesFolderType = 'trip' --- 71,96 ---- kChewableItemsFolderType = 'flnt' kApplicationSupportFolderType = 'asup' ! kTextEncodingsFolderType = '\xc4tex' kStationeryFolderType = 'odst' kOpenDocFolderType = 'odod' kOpenDocShellPlugInsFolderType = 'odsp' kEditorsFolderType = 'oded' ! kOpenDocEditorsFolderType = '\xc4odf' kOpenDocLibrariesFolderType = 'odlb' ! kGenEditorsFolderType = '\xc4edi' ! kHelpFolderType = '\xc4hlp' ! kInternetPlugInFolderType = '\xc4net' ! kModemScriptsFolderType = '\xc4mod' kPrinterDescriptionFolderType = 'ppdf' ! kPrinterDriverFolderType = '\xc4prd' ! kScriptingAdditionsFolderType = '\xc4scr' ! kSharedLibrariesFolderType = '\xc4lib' kVoicesFolderType = 'fvoc' kControlStripModulesFolderType = 'sdev' ! kAssistantsFolderType = 'ast\xc4' ! kUtilitiesFolderType = 'uti\xc4' ! kAppleExtrasFolderType = 'aex\xc4' kContextualMenuItemsFolderType = 'cmnu' ! kMacOSReadMesFolderType = 'mor\xc4' kALMModulesFolderType = 'walk' kALMPreferencesFolderType = 'trip' From gvanrossum@users.sourceforge.net Thu Aug 8 22:57:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 14:57:56 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.168,2.169 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6765 Modified Files: typeobject.c Log Message: Significant speedup in new-style object creation: in slot_tp_new(), intern the string "__new__" so we can call PyObject_GetAttr() rather than PyObject_GetAttrString(). (Though it's a mystery why slot_tp_new is being called when a class doesn't define __new__. I'll look into that tomorrow.) 2.2 backport candidate (but I won't do it). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** typeobject.c 8 Aug 2002 20:55:20 -0000 2.168 --- typeobject.c 8 Aug 2002 21:57:53 -0000 2.169 *************** *** 3642,3649 **** slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyObject *func = PyObject_GetAttrString((PyObject *)type, "__new__"); PyObject *newargs, *x; int i, n; if (func == NULL) return NULL; --- 3642,3656 ---- slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! static PyObject *new_str; ! PyObject *func; PyObject *newargs, *x; int i, n; + if (new_str == NULL) { + new_str = PyString_InternFromString("__new__"); + if (new_str == NULL) + return NULL; + } + func = PyObject_GetAttr((PyObject *)type, new_str); if (func == NULL) return NULL; From jackjansen@users.sourceforge.net Fri Aug 9 01:18:23 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 08 Aug 2002 17:18:23 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv13223/Mac/OSX Modified Files: Makefile Log Message: By popular demand the frameworkinstall target now installs everything: the framework, the MacOSX apps and the unix tools. Most of the hard work is done by Mac/OSX/Makefile. Also, it should now be possible to install in a different directory, such as /tmp/dist/Library/Frameworks, for building binary installers. The fink crowd wanted this. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Makefile 2 Aug 2002 21:46:40 -0000 1.19 --- Makefile 9 Aug 2002 00:18:21 -0000 1.20 *************** *** 1,17 **** ! # This file can be invoked from the "python.app" target in the ! # main Makefile. The next two variables are overridden on the # commandline in that case. ! # assume user was invoking from Mac/OSX directory and building in source tree builddir = ../.. srcdir = ../.. ! VERSION=2.3 ! prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) ! PYTHONAPPSDIR=/Applications/Python APPINSTALLDIR=$(prefix)/Resources/Python.app # Variables for installing the "normal" unix binaries - UNIXBINDIR=/usr/local/bin INSTALLED_PYTHON=$(prefix)/bin/python INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python --- 1,19 ---- ! # This file can be invoked from the various frameworkinstall... targets in the ! # main Makefile. The next couple of variables are overridden on the # commandline in that case. ! VERSION=2.3 builddir = ../.. srcdir = ../.. ! LIBDEST=$(prefix)/lib/python$(VERSION) prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) ! dstroot=/. ! ! # These are normally glimpsed from the previous set ! bindir=$(dstroot)/usr/local/bin ! PYTHONAPPSDIR=$(dstroot)/Applications/Python APPINSTALLDIR=$(prefix)/Resources/Python.app # Variables for installing the "normal" unix binaries INSTALLED_PYTHON=$(prefix)/bin/python INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python *************** *** 28,32 **** -fno-common -dynamic INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include ! DEFINES=-DHAVE_CONFIG_H CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) --- 30,34 ---- -fno-common -dynamic INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include ! DEFINES= CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) *************** *** 45,53 **** RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py ! install_all: install_PythonLauncher install_Python install_BuildApplet install_IDE install_PythonLauncher: cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install install_Python: $(PYTHON) --- 47,55 ---- RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py ! installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_PythonLauncher: cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=$(dstroot) install install_Python: $(PYTHON) *************** *** 222,235 **** done ! $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/ # Put symlinks "python" and "pythonw" in the standard place $(INSTALLED_PYTHONW): install_Python # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. ! installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh ! $(INSTALL) -d $(UNIXBINDIR) ! $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python ! $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw # This is for development purposes: create a Mac.pth that refers to the source --- 224,239 ---- done ! $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(LIBDEST)/site-packages/ # Put symlinks "python" and "pythonw" in the standard place $(INSTALLED_PYTHONW): install_Python + # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. + # 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 *************** *** 237,240 **** dontinstallmacsubtree: l=`cd $(srcdir)/Mac/Lib; pwd`; \ ! echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth --- 241,244 ---- dontinstallmacsubtree: l=`cd $(srcdir)/Mac/Lib; pwd`; \ ! echo $$l > $(LIBDEST)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(LIBDEST)/site-packages/Mac.pth From jackjansen@users.sourceforge.net Fri Aug 9 01:18:23 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 08 Aug 2002 17:18:23 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv13223 Modified Files: Makefile.pre.in Log Message: By popular demand the frameworkinstall target now installs everything: the framework, the MacOSX apps and the unix tools. Most of the hard work is done by Mac/OSX/Makefile. Also, it should now be possible to install in a different directory, such as /tmp/dist/Library/Frameworks, for building binary installers. The fink crowd wanted this. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** Makefile.pre.in 6 Aug 2002 13:40:31 -0000 1.95 --- Makefile.pre.in 9 Aug 2002 00:18:21 -0000 1.96 *************** *** 771,774 **** --- 771,782 ---- --install-platlib=$(DESTSHARED) + # Here are a couple of targets for MacOSX again, to install a full + # framework-based Python. frameworkinstall installs everything, the + # subtargets install specific parts. Much of the actual work is offloaded to + # the Makefile in Mac/OSX + # + frameworkinstall: frameworkinstallframework \ + frameworkinstallapps frameworkinstallunixtools + # On install, we re-make the framework # structure in the install location, /Library/Frameworks/ or the argument to *************** *** 777,783 **** # only have to cater for the structural bits of the framework. ! frameworkinstall: frameworkinfrastructureinstall install ! FRAMEWORKFINALDEST=$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION) ! frameworkinfrastructureinstall: $(LDLIBRARY) @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ echo Not configured with --enable-framework; \ --- 785,791 ---- # only have to cater for the structural bits of the framework. ! frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib ! ! frameworkinstallstructure: $(LDLIBRARY) @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ echo Not configured with --enable-framework; \ *************** *** 785,789 **** else true; \ fi ! @for i in $(FRAMEWORKFINALDEST)/Resources/English.lproj $(FRAMEWORKFINALDEST)/lib; do\ if test ! -d $$i; then \ echo "Creating directory $$i"; \ --- 793,797 ---- else true; \ fi ! @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ if test ! -d $$i; then \ echo "Creating directory $$i"; \ *************** *** 792,800 **** fi; \ done ! $(LN) -fsn include/python$(VERSION) $(FRAMEWORKFINALDEST)/Headers ! $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(FRAMEWORKFINALDEST)/Resources/Info.plist ! $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(FRAMEWORKFINALDEST)/Resources/version.plist $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ ! $(FRAMEWORKFINALDEST)/Resources/English.lproj/InfoPlist.strings $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python --- 800,808 ---- fi; \ done ! $(LN) -fsn include/python$(VERSION) $(prefix)/Headers ! $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(prefix)/Resources/Info.plist ! $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(prefix)/Resources/version.plist $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ ! $(prefix)/Resources/English.lproj/InfoPlist.strings $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python *************** *** 803,811 **** $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) ! # Build Python executable that can run GUI code. Another MacOSX pseudo ! # target. ! osxapps: ! $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree install_all \ ! srcdir=$(srcdir) builddir=. # Build the toplevel Makefile --- 811,828 ---- $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) ! # This installs Mac/Lib into the framework ! frameworkinstallmaclib: ! $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \ ! srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) ! ! # This installs the IDE, the Launcher and other apps into /Applications ! frameworkinstallapps: ! $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ ! srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. ! ! # This install the unix python and pythonw tools in /usr/local/bin ! frameworkinstallunixtools: ! $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ ! srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. # Build the toplevel Makefile From rhettinger@users.sourceforge.net Fri Aug 9 01:43:40 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 08 Aug 2002 17:43:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19261 Modified Files: string_tests.py Log Message: Revised the test suite for 'contains' to use the test() function argument rather than vereq(). While it was effectively testing regular strings, it ignored the test() function argument when called by test_userstring.py. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** string_tests.py 8 Aug 2002 20:19:19 -0000 1.21 --- string_tests.py 9 Aug 2002 00:43:38 -0000 1.22 *************** *** 306,316 **** def run_contains_tests(test): ! vereq('' in '', True) ! vereq('' in 'abc', True) ! vereq('\0' in 'abc', False) ! vereq('\0' in '\0abc', True) ! vereq('\0' in 'abc\0', True) ! vereq('a' in '\0abc', True) ! vereq('asdf' in 'asdf', True) ! vereq('asdf' in 'asd', False) ! vereq('asdf' in '', False) --- 306,316 ---- def run_contains_tests(test): ! test('__contains__', '', True, '') # vereq('' in '', True) ! test('__contains__', 'abc', True, '') # vereq('' in 'abc', True) ! test('__contains__', 'abc', False, '\0') # vereq('\0' in 'abc', False) ! test('__contains__', '\0abc', True, '\0') # vereq('\0' in '\0abc', True) ! test('__contains__', 'abc\0', True, '\0') # vereq('\0' in 'abc\0', True) ! test('__contains__', '\0abc', True, 'a') # vereq('a' in '\0abc', True) ! test('__contains__', 'asdf', True, 'asdf') # vereq('asdf' in 'asdf', True) ! test('__contains__', 'asd', False, 'asdf') # vereq('asdf' in 'asd', False) ! test('__contains__', '', False, 'asdf') # vereq('asdf' in '', False) From rhettinger@users.sourceforge.net Fri Aug 9 02:30:21 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 08 Aug 2002 18:30:21 -0700 Subject: [Python-checkins] python/dist/src/Objects iterobject.c,1.11,1.12 tupleobject.c,2.70,2.71 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30405 Modified Files: iterobject.c tupleobject.c Log Message: Moved special case for tuples from iterobject.c to tupleobject.c. Makes the code in iterobject.c cleaner and speeds-up the general case by not checking for tuples everytime. SF Patch #592065. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iterobject.c 16 Jul 2002 20:24:46 -0000 1.11 --- iterobject.c 9 Aug 2002 01:30:17 -0000 1.12 *************** *** 56,59 **** --- 56,60 ---- seqiterobject *it; PyObject *seq; + PyObject *result; assert(PySeqIter_Check(iterator)); *************** *** 63,93 **** return NULL; ! if (PyTuple_CheckExact(seq)) { ! if (it->it_index < PyTuple_GET_SIZE(seq)) { ! PyObject *item; ! item = PyTuple_GET_ITEM(seq, it->it_index); ! it->it_index++; ! Py_INCREF(item); ! return item; ! } Py_DECREF(seq); it->it_seq = NULL; - return NULL; - } - else { - PyObject *result = PySequence_GetItem(seq, it->it_index); - if (result != NULL) { - it->it_index++; - return result; - } - if (PyErr_ExceptionMatches(PyExc_IndexError) || - PyErr_ExceptionMatches(PyExc_StopIteration)) - { - PyErr_Clear(); - Py_DECREF(seq); - it->it_seq = NULL; - } - return NULL; } } --- 64,80 ---- return NULL; ! result = PySequence_GetItem(seq, it->it_index); ! if (result != NULL) { ! it->it_index++; ! return result; ! } ! if (PyErr_ExceptionMatches(PyExc_IndexError) || ! PyErr_ExceptionMatches(PyExc_StopIteration)) ! { ! PyErr_Clear(); Py_DECREF(seq); it->it_seq = NULL; } + return NULL; } Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** tupleobject.c 17 Jul 2002 16:30:38 -0000 2.70 --- tupleobject.c 9 Aug 2002 01:30:17 -0000 2.71 *************** *** 597,600 **** --- 597,602 ---- }; + static PyObject *tuple_iter(PyObject *seq); + PyTypeObject PyTuple_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 625,629 **** tuplerichcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ --- 627,631 ---- tuplerichcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! tuple_iter, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ *************** *** 723,724 **** --- 725,835 ---- #endif } + + /*********************** Tuple Iterator **************************/ + + typedef struct { + PyObject_HEAD + long it_index; + PyTupleObject *it_seq; /* Set to NULL when iterator is exhausted */ + } tupleiterobject; + + PyTypeObject PyTupleIter_Type; + + static PyObject * + tuple_iter(PyObject *seq) + { + tupleiterobject *it; + + if (!PyTuple_Check(seq)) { + PyErr_BadInternalCall(); + return NULL; + } + it = PyObject_GC_New(tupleiterobject, &PyTupleIter_Type); + if (it == NULL) + return NULL; + it->it_index = 0; + Py_INCREF(seq); + it->it_seq = (PyTupleObject *)seq; + _PyObject_GC_TRACK(it); + return (PyObject *)it; + } + + static void + tupleiter_dealloc(tupleiterobject *it) + { + _PyObject_GC_UNTRACK(it); + Py_XDECREF(it->it_seq); + PyObject_GC_Del(it); + } + + static int + tupleiter_traverse(tupleiterobject *it, visitproc visit, void *arg) + { + if (it->it_seq == NULL) + return 0; + return visit((PyObject *)it->it_seq, arg); + } + + + static PyObject * + tupleiter_getiter(PyObject *it) + { + Py_INCREF(it); + return it; + } + + static PyObject * + tupleiter_next(tupleiterobject *it) + { + PyTupleObject *seq; + PyObject *item; + + assert(it != NULL); + seq = it->it_seq; + if (seq == NULL) + return NULL; + assert(PyTuple_Check(seq)); + + if (it->it_index < PyTuple_GET_SIZE(seq)) { + item = PyTuple_GET_ITEM(seq, it->it_index); + ++it->it_index; + Py_INCREF(item); + return item; + } + + Py_DECREF(seq); + it->it_seq = NULL; + return NULL; + } + + PyTypeObject PyTupleIter_Type = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ + "tupleiterator", /* tp_name */ + sizeof(tupleiterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)tupleiter_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ + 0, /* tp_doc */ + (traverseproc)tupleiter_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)tupleiter_getiter, /* tp_iter */ + (iternextfunc)tupleiter_next, /* tp_iternext */ + }; From rhettinger@users.sourceforge.net Fri Aug 9 02:37:08 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 08 Aug 2002 18:37:08 -0700 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31329 Modified Files: UserString.py Log Message: Moved inplace add and multiply methods from UserString to MutableString. Closes SF Bug #592573 where inplace add mutated a UserString. Added unittests to verify the bug is cleared. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** UserString.py 30 Jul 2002 23:26:00 -0000 1.14 --- UserString.py 9 Aug 2002 01:37:06 -0000 1.15 *************** *** 53,70 **** else: return self.__class__(str(other) + self.data) - def __iadd__(self, other): - if isinstance(other, UserString): - self.data += other.data - elif isinstance(other, StringTypes): - self.data += other - else: - self.data += str(other) - return self def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ - def __imul__(self, n): - self.data *= n - return self # the following methods are defined in alphabetical order: --- 53,59 ---- *************** *** 169,172 **** --- 158,172 ---- def immutable(self): return UserString(self.data) + def __iadd__(self, other): + if isinstance(other, UserString): + self.data += other.data + elif isinstance(other, StringTypes): + self.data += other + else: + self.data += str(other) + return self + def __imul__(self, n): + self.data *= n + return self if __name__ == "__main__": From rhettinger@users.sourceforge.net Fri Aug 9 02:37:08 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 08 Aug 2002 18:37:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.22,1.23 test_string.py,1.19,1.20 test_userstring.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31329/test Modified Files: string_tests.py test_string.py test_userstring.py Log Message: Moved inplace add and multiply methods from UserString to MutableString. Closes SF Bug #592573 where inplace add mutated a UserString. Added unittests to verify the bug is cleared. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** string_tests.py 9 Aug 2002 00:43:38 -0000 1.22 --- string_tests.py 9 Aug 2002 01:37:06 -0000 1.23 *************** *** 315,316 **** --- 315,322 ---- test('__contains__', 'asd', False, 'asdf') # vereq('asdf' in 'asd', False) test('__contains__', '', False, 'asdf') # vereq('asdf' in '', False) + + def run_inplace_tests(constructor): + # Verify clearing of SF bug #592573 + s = t = constructor('abc') + s += constructor('def') + verify(s != t, 'in-place concatenate should create a new object') Index: test_string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_string.py 6 Aug 2002 16:58:20 -0000 1.19 --- test_string.py 9 Aug 2002 01:37:06 -0000 1.20 *************** *** 53,56 **** --- 53,57 ---- string_tests.run_method_tests(test) string_tests.run_contains_tests(test) + string_tests.run_inplace_tests(str) string.whitespace Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_userstring.py 6 Aug 2002 16:58:20 -0000 1.8 --- test_userstring.py 9 Aug 2002 01:37:06 -0000 1.9 *************** *** 43,44 **** --- 43,45 ---- string_tests.run_method_tests(test) string_tests.run_contains_tests(test) + string_tests.run_inplace_tests(UserString) From gvanrossum@users.sourceforge.net Fri Aug 9 03:14:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 08 Aug 2002 19:14:37 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7602 Modified Files: typeobject.c Log Message: Major speedup for new-style class creation. Turns out there was some trampolining going on with the tp_new descriptor, where the inherited PyType_GenericNew was overwritten with the much slower slot_tp_new which would end up calling tp_new_wrapper which would eventually call PyType_GenericNew. Add a special case for this to update_one_slot(). XXX Hope there isn't a loophole in this. I'll buy the first person to point out a bug in the reasoning a beer. Backport candidate (but I won't do it). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** typeobject.c 8 Aug 2002 21:57:53 -0000 2.169 --- typeobject.c 9 Aug 2002 02:14:34 -0000 2.170 *************** *** 4082,4085 **** --- 4082,4107 ---- } } + else if (descr->ob_type == &PyCFunction_Type && + PyCFunction_GET_FUNCTION(descr) == + (PyCFunction)tp_new_wrapper && + strcmp(p->name, "__new__") == 0) + { + /* The __new__ wrapper is not a wrapper descriptor, + so must be special-cased differently. + If we don't do this, creating an instance will + always use slot_tp_new which will look up + __new__ in the MRO which will call tp_new_wrapper + which will look through the base classes looking + for a static base and call its tp_new (usually + PyType_GenericNew), after performing various + sanity checks and constructing a new argument + list. Cut all that nonsense short -- this speeds + up instance creation tremendously. */ + specific = type->tp_new; + /* XXX I'm not 100% sure that there isn't a hole + in this reasoning that requires additional + sanity checks. I'll buy the first person to + point out a bug in this reasoning a beer. */ + } else { use_generic = 1; From fdrake@users.sourceforge.net Fri Aug 9 03:39:15 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 08 Aug 2002 19:39:15 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12656/Modules Modified Files: Setup.dist Log Message: Update the text on the Expat module and library. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Setup.dist 5 Aug 2002 18:06:17 -0000 1.29 --- Setup.dist 9 Aug 2002 02:39:13 -0000 1.30 *************** *** 451,473 **** # Interface to the Expat XML parser # ! # Expat is written by James Clark and must be downloaded separately ! # (see below). The pyexpat module was written by Paul Prescod after a ! # prototype by Jack Jansen. ! # ! # The Expat dist includes Windows .lib and .dll files. Home page is at ! # http://www.jclark.com/xml/expat.html, the current production release is ! # always ftp://ftp.jclark.com/pub/xml/expat.zip. ! # ! # EXPAT_DIR, below, should point to the expat/ directory created by ! # unpacking the Expat source distribution. ! # ! # Note: the expat build process doesn't yet build a libexpat.a; you can ! # do this manually while we try convince the author to add it. To do so, ! # cd to EXPAT_DIR, run "make" if you have not done so, then run: # ! # ar cr libexpat.a xmltok/*.o xmlparse/*.o # ! #EXPAT_DIR=/usr/local/src/expat ! #pyexpat pyexpat.c -I$(EXPAT_DIR)/xmlparse -L$(EXPAT_DIR) -lexpat --- 451,465 ---- # Interface to the Expat XML parser # ! # Expat was written by James Clark and is now maintained by a group of ! # developers on SourceForge; see www.libexpat.org for more ! # information. The pyexpat module was written by Paul Prescod after a ! # prototype by Jack Jansen. Source of Expat 1.95.2 is included in ! # Modules/expat/. Usage of a system shared libexpat.so/expat.dll is ! # not advised. # ! # More information on Expat can be found at www.libexpat.org. # ! #EXPAT_DIR=/usr/local/src/expat-1.95.2 ! #pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat From nnorwitz@users.sourceforge.net Fri Aug 9 04:37:44 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 08 Aug 2002 20:37:44 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.242,1.243 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25307/Modules Modified Files: socketmodule.c Log Message: SF bug #592645 fix memory leak in socket.getaddrinfo Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.242 retrieving revision 1.243 diff -C2 -d -r1.242 -r1.243 *** socketmodule.c 8 Aug 2002 20:39:30 -0000 1.242 --- socketmodule.c 9 Aug 2002 03:37:42 -0000 1.243 *************** *** 2705,2708 **** --- 2705,2710 ---- Py_XDECREF(single); } + if (res0) + freeaddrinfo(res0); return all; err: From nnorwitz@users.sourceforge.net Fri Aug 9 04:38:09 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 08 Aug 2002 20:38:09 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.200.6.7,1.200.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25375/Modules Modified Files: Tag: release22-maint socketmodule.c Log Message: SF bug #592645 fix memory leak in socket.getaddrinfo Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.200.6.7 retrieving revision 1.200.6.8 diff -C2 -d -r1.200.6.7 -r1.200.6.8 *** socketmodule.c 28 Jul 2002 16:11:25 -0000 1.200.6.7 --- socketmodule.c 9 Aug 2002 03:38:07 -0000 1.200.6.8 *************** *** 2547,2550 **** --- 2547,2552 ---- Py_XDECREF(single); } + if (res0) + freeaddrinfo(res0); return all; err: From tim_one@users.sourceforge.net Fri Aug 9 06:06:47 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 Aug 2002 22:06:47 -0700 Subject: [Python-checkins] python/dist/src/Objects listsort.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11614/python/Objects Modified Files: listsort.txt Log Message: Repaired a braino in the description of bad minrun values. Index: listsort.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listsort.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** listsort.txt 8 Aug 2002 01:55:16 -0000 1.2 --- listsort.txt 9 Aug 2002 05:06:44 -0000 1.3 *************** *** 276,282 **** q is a power of 2 and r>0 (then the last merge only gets r elements into ! place, and r0 (then the last merge only gets r elements into ! place, and r < minrun is small compared to N), or q a little larger than a ! power of 2 regardless of r (then we've got a case similar to "2112", again ! leaving too little work for the last merge to do). Instead we pick a minrun in range(32, 65) such that N/minrun is exactly a From jackjansen@users.sourceforge.net Fri Aug 9 10:02:03 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 02:02:03 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/macspeech README,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/macspeech In directory usw-pr-cvs1:/tmp/cvs-serv16737/macspeech Removed Files: README Log Message: This file should have gone long ago. --- README DELETED --- From jackjansen@users.sourceforge.net Fri Aug 9 10:02:27 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 02:02:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Unsupported/Classic - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Unsupported/Classic In directory usw-pr-cvs1:/tmp/cvs-serv16989/Unsupported/Classic Log Message: Directory /cvsroot/python/python/dist/src/Mac/Unsupported/Classic added to the repository From jackjansen@users.sourceforge.net Fri Aug 9 10:03:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 02:03:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/Unsupported/Classic Printingmodule.c,NONE,1.1 README,NONE,1.1 macspeechmodule.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Unsupported/Classic In directory usw-pr-cvs1:/tmp/cvs-serv17457/Unsupported/Classic Added Files: Printingmodule.c README macspeechmodule.c Log Message: Depracated some non-carbon modules. --- NEW FILE: Printingmodule.c --- /****************************************************************** Copyright 1998 by Just van Rossum, Den Haag, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Just van Rossum not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. JUST VAN ROSSUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL JUST VAN ROSSUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "Python.h" #include "macglue.h" #include "pymactoolbox.h" #include static PyObject *ErrorObject; /* ----------------------------------------------------- */ static int TPRect_Convert(PyObject *v, TPRect *r) { if (v == Py_None) { *r = NULL; return 1; } return PyArg_Parse(v, "(hhhh)", &(*r)->left, &(*r)->top, &(*r)->right, &(*r)->bottom); } static char Pr_NewTPrintRecord__doc__[] = "creates a new TPrint handle" ; static PyObject * Pr_NewTPrintRecord(self, args) PyObject *self; /* Not used */ PyObject *args; { Handle hPrint; if (!PyArg_ParseTuple(args, "")) return NULL; hPrint = NewHandleClear((long) sizeof(TPrint)); if ( hPrint == NULL ) { PyErr_NoMemory(); return NULL; } return (PyObject *)ResObj_New(hPrint); } static char Pr_PrPurge__doc__[] = "PrPurge() -> None" ; static PyObject * Pr_PrPurge(self, args) PyObject *self; /* Not used */ PyObject *args; { if (!PyArg_ParseTuple(args, "")) return NULL; PrPurge(); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrNoPurge__doc__[] = "PrNoPurge() -> None" ; static PyObject * Pr_PrNoPurge(self, args) PyObject *self; /* Not used */ PyObject *args; { if (!PyArg_ParseTuple(args, "")) return NULL; PrNoPurge(); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrOpen__doc__[] = "PrOpen() -> None" ; static PyObject * Pr_PrOpen(self, args) PyObject *self; /* Not used */ PyObject *args; { if (!PyArg_ParseTuple(args, "")) return NULL; PrOpen(); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrClose__doc__[] = "PrClose() -> None" ; static PyObject * Pr_PrClose(self, args) PyObject *self; /* Not used */ PyObject *args; { if (!PyArg_ParseTuple(args, "")) return NULL; PrClose(); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrintDefault__doc__[] = "PrintDefault(THPrint hPrint) -> None" ; static PyObject * Pr_PrintDefault(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrint; if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) return NULL; PrintDefault(hPrint); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrValidate__doc__[] = "PrValidate(THPrint hPrint) -> None" ; static PyObject * Pr_PrValidate(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrint; if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) return NULL; PrValidate(hPrint); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrStlDialog__doc__[] = "PrStlDialog(THPrint hPrint) -> Boolean" ; static PyObject * Pr_PrStlDialog(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrint; Boolean rv; if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) return NULL; rv = PrStlDialog(hPrint); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } return Py_BuildValue("h", rv); } static char Pr_PrJobDialog__doc__[] = "PrJobDialog(THPrint hPrint) -> Boolean" ; static PyObject * Pr_PrJobDialog(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrint; Boolean rv; if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) return NULL; rv = PrJobDialog(hPrint); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } return Py_BuildValue("h", rv); } static char Pr_PrJobMerge__doc__[] = "PrJobMerge(THPrint hPrintSrc, THPrint hPrintDst) -> none" ; static PyObject * Pr_PrJobMerge(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrintSrc, hPrintDst; if (!PyArg_ParseTuple(args, "O&O&", ResObj_Convert, &hPrintSrc, ResObj_Convert, &hPrintDst)) return NULL; PrJobMerge(hPrintSrc, hPrintDst); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrOpenDoc__doc__[] = "PrOpenDoc(THPrint hPrint) -> TPPrPort aTPPort" ; static PyObject * Pr_PrOpenDoc(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrint; TPPrPort aTPPort; if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) return NULL; aTPPort = PrOpenDoc(hPrint, NULL, NULL); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } return Py_BuildValue("O&", GrafObj_New, aTPPort); } static char Pr_PrCloseDoc__doc__[] = "PrCloseDoc(TPPrPort pPrPort) -> None" ; static PyObject * Pr_PrCloseDoc(self, args) PyObject *self; /* Not used */ PyObject *args; { TPPrPort pPrPort; if (!PyArg_ParseTuple(args, "O&", GrafObj_Convert, &pPrPort)) return NULL; PrCloseDoc(pPrPort); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrOpenPage__doc__[] = "PrOpenPage(TPPrPort pPrPort, TPRect pPageFrame) -> None" ; static PyObject * Pr_PrOpenPage(self, args) PyObject *self; /* Not used */ PyObject *args; { TPPrPort pPrPort; Rect dummyrect = {0, 0, 0, 0}; TPRect pPageFrame = &dummyrect; if (!PyArg_ParseTuple(args, "O&O&", GrafObj_Convert, &pPrPort, TPRect_Convert, &pPageFrame)) return NULL; PrOpenPage(pPrPort, pPageFrame); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrClosePage__doc__[] = "PrClosePage(TPPrPort pPrPort) -> None" ; static PyObject * Pr_PrClosePage(self, args) PyObject *self; /* Not used */ PyObject *args; { TPPrPort pPrPort; if (!PyArg_ParseTuple(args, "O&", GrafObj_Convert, &pPrPort)) return NULL; PrClosePage(pPrPort); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrPicFile__doc__[] = "PrPicFile(THPrint hPrint) -> none" ; static PyObject * Pr_PrPicFile(self, args) PyObject *self; /* Not used */ PyObject *args; { THPrint hPrint; TPrStatus prStatus; if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) return NULL; PrPicFile(hPrint, NULL, NULL, NULL, &prStatus); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrGeneral__doc__[] = "not implemented" ; static PyObject * Pr_PrGeneral(self, args) PyObject *self; /* Not used */ PyObject *args; { if (!PyArg_ParseTuple(args, "")) return NULL; //PrGeneral(); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } Py_INCREF(Py_None); return Py_None; } static char Pr_PrDrvrVers__doc__[] = "PrDrvrVers() -> version" ; static PyObject * Pr_PrDrvrVers(self, args) PyObject *self; /* Not used */ PyObject *args; { short rv; if (!PyArg_ParseTuple(args, "")) return NULL; rv = PrDrvrVers(); { OSErr _err = PrError(); if (_err != noErr) return PyMac_Error(_err); } return Py_BuildValue("h", rv); } /* List of methods defined in the module */ static struct PyMethodDef Pr_methods[] = { {"NewTPrintRecord", (PyCFunction)Pr_NewTPrintRecord, METH_VARARGS, Pr_NewTPrintRecord__doc__}, {"PrPurge", (PyCFunction)Pr_PrPurge, METH_VARARGS, Pr_PrPurge__doc__}, {"PrNoPurge", (PyCFunction)Pr_PrNoPurge, METH_VARARGS, Pr_PrNoPurge__doc__}, {"PrOpen", (PyCFunction)Pr_PrOpen, METH_VARARGS, Pr_PrOpen__doc__}, {"PrClose", (PyCFunction)Pr_PrClose, METH_VARARGS, Pr_PrClose__doc__}, {"PrintDefault",(PyCFunction)Pr_PrintDefault, METH_VARARGS, Pr_PrintDefault__doc__}, {"PrValidate", (PyCFunction)Pr_PrValidate, METH_VARARGS, Pr_PrValidate__doc__}, {"PrStlDialog", (PyCFunction)Pr_PrStlDialog, METH_VARARGS, Pr_PrStlDialog__doc__}, {"PrJobDialog", (PyCFunction)Pr_PrJobDialog, METH_VARARGS, Pr_PrJobDialog__doc__}, {"PrJobMerge", (PyCFunction)Pr_PrJobMerge, METH_VARARGS, Pr_PrJobMerge__doc__}, {"PrOpenDoc", (PyCFunction)Pr_PrOpenDoc, METH_VARARGS, Pr_PrOpenDoc__doc__}, {"PrCloseDoc", (PyCFunction)Pr_PrCloseDoc, METH_VARARGS, Pr_PrCloseDoc__doc__}, {"PrOpenPage", (PyCFunction)Pr_PrOpenPage, METH_VARARGS, Pr_PrOpenPage__doc__}, {"PrClosePage", (PyCFunction)Pr_PrClosePage, METH_VARARGS, Pr_PrClosePage__doc__}, {"PrPicFile", (PyCFunction)Pr_PrPicFile, METH_VARARGS, Pr_PrPicFile__doc__}, // {"PrGeneral", (PyCFunction)Pr_PrGeneral, METH_VARARGS, Pr_PrGeneral__doc__}, {"PrDrvrVers", (PyCFunction)Pr_PrDrvrVers, METH_VARARGS, Pr_PrDrvrVers__doc__}, {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ }; /* Initialization function for the module (*must* be called initPrinting) */ static char Printing_module_documentation[] = "" ; void initPrinting(); void initPrinting() { PyObject *m, *d; /* Create the module and add the functions */ m = Py_InitModule4("Printing", Pr_methods, Printing_module_documentation, (PyObject*)NULL,PYTHON_API_VERSION); /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); ErrorObject = PyString_FromString("Printing.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ } --- NEW FILE: README --- These modules no longer work under Carbon. If you are trying to revive non-carbon builds of MacPython you may want to revive them. --- NEW FILE: macspeechmodule.c --- /*********************************************************** Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "Python.h" #include "macglue.h" #include #include "Speech.h" #ifdef __MWERKS__ #define OLDP2C 1 #include #ifndef c2pstr #define c2pstr C2PStr #endif #ifndef p2cstr #define p2cstr P2CStr #endif #else #include "pascal.h" #endif /* __MWERKS__ */ #include int lib_available; /* Somehow the Apple Fix2X and X2Fix don't do what I expect */ #define fixed2double(x) (((double)(x))/32768.0) #define double2fixed(x) ((Fixed)((x)*32768.0)) char *CurrentSpeech; PyObject *ms_error_object; int speech_available; static init_available() { OSErr err; long result; lib_available = ((ProcPtr)SpeakString != (ProcPtr)0); err = Gestalt(gestaltSpeechAttr, &result); if ( err == noErr && (result & (1<ob_type == &sctype) static scobject * newscobject(arg) VoiceSpec *arg; { scobject *self; OSErr err; self = PyObject_NEW(scobject, &sctype); if (self == NULL) return NULL; if ( (err=NewSpeechChannel(arg, &self->chan)) != 0) { Py_DECREF(self); return (scobject *)PyErr_Mac(ms_error_object, err); } self->curtext = NULL; return self; } /* sc methods */ static void sc_dealloc(self) scobject *self; { DisposeSpeechChannel(self->chan); PyObject_DEL(self); } static PyObject * sc_Stop(self, args) scobject *self; PyObject *args; { OSErr err; if (!PyArg_NoArgs(args)) return NULL; if ((err=StopSpeech(self->chan)) != 0) { PyErr_Mac(ms_error_object, err); return NULL; } if ( self->curtext ) { Py_DECREF(self->curtext); self->curtext = NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * sc_SpeakText(self, args) scobject *self; PyObject *args; { OSErr err; char *str; int len; if (!PyArg_Parse(args, "s#", &str, &len)) return NULL; if ( self->curtext ) { StopSpeech(self->chan); Py_DECREF(self->curtext); self->curtext = NULL; } if ((err=SpeakText(self->chan, (Ptr)str, (long)len)) != 0) { PyErr_Mac(ms_error_object, err); return 0; } (void)PyArg_Parse(args, "O", &self->curtext); /* Or should I check this? */ Py_INCREF(self->curtext); Py_INCREF(Py_None); return Py_None; } static PyObject * sc_GetRate(self, args) scobject *self; PyObject *args; { OSErr err; Fixed farg; if (!PyArg_NoArgs(args)) return NULL; if ((err=GetSpeechRate(self->chan, &farg)) != 0) { PyErr_Mac(ms_error_object, err); return 0; } return PyFloat_FromDouble(fixed2double(farg)); } static PyObject * sc_GetPitch(self, args) scobject *self; PyObject *args; { OSErr err; Fixed farg; if (!PyArg_NoArgs(args)) return NULL; if ((err=GetSpeechPitch(self->chan, &farg)) != 0) { PyErr_Mac(ms_error_object, err); return 0; } return PyFloat_FromDouble(fixed2double(farg)); } static PyObject * sc_SetRate(self, args) scobject *self; PyObject *args; { OSErr err; double darg; if (!PyArg_Parse(args, "d", &darg)) return NULL; if ((err=SetSpeechRate(self->chan, double2fixed(darg))) != 0) { PyErr_Mac(ms_error_object, err); return 0; } Py_INCREF(Py_None); return Py_None; } static PyObject * sc_SetPitch(self, args) scobject *self; PyObject *args; { OSErr err; double darg; if (!PyArg_Parse(args, "d", &darg)) return NULL; if ((err=SetSpeechPitch(self->chan, double2fixed(darg))) != 0) { PyErr_Mac(ms_error_object, err); return NULL; } Py_INCREF(Py_None); return Py_None; } static struct PyMethodDef sc_methods[] = { {"Stop", (PyCFunction)sc_Stop}, {"SetRate", (PyCFunction)sc_SetRate}, {"GetRate", (PyCFunction)sc_GetRate}, {"SetPitch", (PyCFunction)sc_SetPitch}, {"GetPitch", (PyCFunction)sc_GetPitch}, {"SpeakText", (PyCFunction)sc_SpeakText}, {NULL, NULL} /* sentinel */ }; static PyObject * sc_getattr(self, name) scobject *self; char *name; { return Py_FindMethod(sc_methods, (PyObject *)self, name); } static PyTypeObject sctype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ "macspeech.MacSpeechChannel", /*tp_name*/ sizeof(scobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)sc_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)sc_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ }; /* ------------- ** ** Part two - the voice object */ typedef struct { PyObject_HEAD int initialized; VoiceSpec vs; VoiceDescription vd; } mvobject; static PyTypeObject mvtype; #define is_mvobject(v) ((v)->ob_type == &mvtype) static mvobject * newmvobject() { mvobject *self; self = PyObject_NEW(mvobject, &mvtype); if (self == NULL) return NULL; self->initialized = 0; return self; } static int initmvobject(self, ind) mvobject *self; int ind; { OSErr err; if ( (err=GetIndVoice((short)ind, &self->vs)) != 0 ) { PyErr_Mac(ms_error_object, err); return 0; } if ( (err=GetVoiceDescription(&self->vs, &self->vd, sizeof self->vd)) != 0) { PyErr_Mac(ms_error_object, err); return 0; } self->initialized = 1; return 1; } /* mv methods */ static void mv_dealloc(self) mvobject *self; { PyObject_DEL(self); } static PyObject * mv_getgender(self, args) mvobject *self; PyObject *args; { PyObject *rv; if (!PyArg_NoArgs(args)) return NULL; if (!self->initialized) { PyErr_SetString(ms_error_object, "Uninitialized voice"); return NULL; } rv = PyInt_FromLong(self->vd.gender); return rv; } static PyObject * mv_newchannel(self, args) mvobject *self; PyObject *args; { if (!PyArg_NoArgs(args)) return NULL; if (!self->initialized) { PyErr_SetString(ms_error_object, "Uninitialized voice"); return NULL; } return (PyObject *)newscobject(&self->vs); } static struct PyMethodDef mv_methods[] = { {"GetGender", (PyCFunction)mv_getgender}, {"NewChannel", (PyCFunction)mv_newchannel}, {NULL, NULL} /* sentinel */ }; static PyObject * mv_getattr(self, name) mvobject *self; char *name; { return Py_FindMethod(mv_methods, (PyObject *)self, name); } static PyTypeObject mvtype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ "macspeech.MacVoice", /*tp_name*/ sizeof(mvobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)mv_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)mv_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ }; /* ------------- ** ** Part three - The module interface */ /* See if Speech manager available */ static PyObject * ms_Available(self, args) PyObject *self; /* Not used */ PyObject *args; { if (!PyArg_NoArgs(args)) return NULL; return PyInt_FromLong(speech_available); } /* Count number of busy speeches */ static PyObject * ms_Busy(self, args) PyObject *self; /* Not used */ PyObject *args; { short result; if (!PyArg_NoArgs(args)) return NULL; if ( !check_available() ) return NULL; result = SpeechBusy(); return PyInt_FromLong(result); } /* Say something */ static PyObject * ms_SpeakString(self, args) PyObject *self; /* Not used */ PyObject *args; { OSErr err; char *str; int len; if (!PyArg_Parse(args, "s", &str)) return NULL; if ( !check_available()) return NULL; if (CurrentSpeech) { /* Free the old speech, after killing it off ** (note that speach is async and c2pstr works inplace) */ SpeakString("\p"); free(CurrentSpeech); } len = strlen(str); CurrentSpeech = malloc(len+1); strcpy(CurrentSpeech, str); err = SpeakString(c2pstr(CurrentSpeech)); if ( err ) { PyErr_Mac(ms_error_object, err); return NULL; } Py_INCREF(Py_None); return Py_None; } /* Count number of available voices */ static PyObject * ms_CountVoices(self, args) PyObject *self; /* Not used */ PyObject *args; { short result; if (!PyArg_NoArgs(args)) return NULL; if ( !check_available()) return NULL; CountVoices(&result); return PyInt_FromLong(result); } static PyObject * ms_GetIndVoice(self, args) PyObject *self; /* Not used */ PyObject *args; { mvobject *rv; long ind; if( !PyArg_Parse(args, "i", &ind)) return NULL; if ( !check_available() ) return NULL; rv = newmvobject(); if ( !initmvobject(rv, ind) ) { Py_DECREF(rv); return NULL; } return (PyObject *)rv; } static PyObject * ms_Version(self, args) PyObject *self; /* Not used */ PyObject *args; { NumVersion v; if (!PyArg_NoArgs(args)) return NULL; if ( !check_available()) return NULL; v = SpeechManagerVersion(); return PyInt_FromLong(*(int *)&v); } /* List of functions defined in the module */ static struct PyMethodDef ms_methods[] = { {"Available", ms_Available}, {"CountVoices", ms_CountVoices}, {"Busy", ms_Busy}, {"SpeakString", ms_SpeakString}, {"GetIndVoice", ms_GetIndVoice}, {"Version", ms_Version}, {NULL, NULL} /* sentinel */ }; /* Initialization function for the module (*must* be called initmacspeech) */ void initmacspeech() { PyObject *m, *d; speech_available = init_available(); /* Create the module and add the functions */ m = Py_InitModule("macspeech", ms_methods); /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); ms_error_object = PyErr_NewException("macspeech.error", NULL, NULL); PyDict_SetItemString(d, "error", ms_error_object); } From purcell@users.sourceforge.net Fri Aug 9 10:46:25 2002 From: purcell@users.sourceforge.net (purcell@users.sourceforge.net) Date: Fri, 09 Aug 2002 02:46:25 -0700 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32682/Lib Modified Files: unittest.py Log Message: Fix to ensure consistent 'repr' and 'str' results between Python versions, since 'repr(new_style_class) != repr(classic_class)'. Suggested by Jeremy Hylton. Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** unittest.py 8 Aug 2002 13:38:02 -0000 1.17 --- unittest.py 9 Aug 2002 09:46:23 -0000 1.18 *************** *** 47,51 **** __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" ! __version__ = "#Revision: 1.45 $"[11:-2] import time --- 47,51 ---- __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" ! __version__ = "#Revision: 1.46 $"[11:-2] import time *************** *** 63,66 **** --- 63,69 ---- __metaclass__ = type + def _strclass(cls): + return "%s.%s" % (cls.__module__, cls.__name__) + class TestResult: """Holder for test result information. *************** *** 117,121 **** def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ ! (self.__class__, self.testsRun, len(self.errors), len(self.failures)) --- 120,124 ---- def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ ! (_strclass(self.__class__), self.testsRun, len(self.errors), len(self.failures)) *************** *** 187,191 **** def id(self): ! return "%s.%s" % (self.__class__, self.__testMethodName) def __str__(self): --- 190,194 ---- def id(self): ! return "%s.%s" % (_strclass(self.__class__), self.__testMethodName) def __str__(self): *************** *** 194,198 **** def __repr__(self): return "<%s testMethod=%s>" % \ ! (self.__class__, self.__testMethodName) def run(self, result=None): --- 197,201 ---- def __repr__(self): return "<%s testMethod=%s>" % \ ! (_strclass(self.__class__), self.__testMethodName) def run(self, result=None): *************** *** 322,326 **** def __repr__(self): ! return "<%s tests=%s>" % (self.__class__, self._tests) __str__ = __repr__ --- 325,329 ---- def __repr__(self): ! return "<%s tests=%s>" % (_strclass(self.__class__), self._tests) __str__ = __repr__ *************** *** 386,393 **** def __str__(self): ! return "%s (%s)" % (self.__class__, self.__testFunc.__name__) def __repr__(self): ! return "<%s testFunc=%s>" % (self.__class__, self.__testFunc) def shortDescription(self): --- 389,396 ---- def __str__(self): ! return "%s (%s)" % (_strclass(self.__class__), self.__testFunc.__name__) def __repr__(self): ! return "<%s testFunc=%s>" % (_strclass(self.__class__), self.__testFunc) def shortDescription(self): From jackjansen@users.sourceforge.net Fri Aug 9 11:17:30 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 03:17:30 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts zappycfiles.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv16401 Modified Files: zappycfiles.py Log Message: Patch by Russel Owen: if we have command line arguments zap pyc files in the directories given. Index: zappycfiles.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/zappycfiles.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** zappycfiles.py 23 Jan 2001 22:45:52 -0000 1.1 --- zappycfiles.py 9 Aug 2002 10:17:28 -0000 1.2 *************** *** 1,22 **** ! # Zap .pyc files import os import sys doit = 1 def main(): ! if os.name == 'mac': ! import macfs ! fss, ok = macfs.GetDirectory('Directory to zap pyc files in') ! if not ok: ! sys.exit(0) ! dir = fss.as_pathname() ! zappyc(dir) ! else: ! if not sys.argv[1:]: print 'Usage: zappyc dir ...' sys.exit(1) ! for dir in sys.argv[1:]: ! zappyc(dir) def zappyc(dir): --- 1,25 ---- ! #!/usr/local/bin/python ! """Recursively zap all .pyc files""" import os import sys + # set doit true to actually delete files + # set doit false to just print what would be deleted doit = 1 def main(): ! if not sys.argv[1:]: ! if os.name == 'mac': ! import macfs ! fss, ok = macfs.GetDirectory('Directory to zap pyc files in') ! if not ok: ! sys.exit(0) ! dir = fss.as_pathname() ! zappyc(dir) ! else: print 'Usage: zappyc dir ...' sys.exit(1) ! for dir in sys.argv[1:]: ! zappyc(dir) def zappyc(dir): From jackjansen@users.sourceforge.net Fri Aug 9 11:22:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 03:22:14 -0700 Subject: [Python-checkins] python/dist/src/Mac/Contrib/strptime strptime.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/strptime In directory usw-pr-cvs1:/tmp/cvs-serv18591/strptime Removed Files: strptime.py Log Message: Obsolete now that there's a python implementation of strptime in the standard lib. --- strptime.py DELETED --- From sjoerd@users.sourceforge.net Fri Aug 9 14:35:21 2002 From: sjoerd@users.sourceforge.net (sjoerd@users.sourceforge.net) Date: Fri, 09 Aug 2002 06:35:21 -0700 Subject: [Python-checkins] python/dist/src/Modules main.c,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23408 Modified Files: main.c Log Message: On Cygwin, put stdin, stderr, and stdout in binary mode when the -u flag is given (to mimic native Windows). Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** main.c 2 Aug 2002 14:11:23 -0000 1.68 --- main.c 9 Aug 2002 13:35:18 -0000 1.69 *************** *** 5,9 **** #include "compile.h" /* For CO_FUTURE_DIVISION */ ! #ifdef MS_WINDOWS #include #endif --- 5,9 ---- #include "compile.h" /* For CO_FUTURE_DIVISION */ ! #if defined(MS_WINDOWS) || defined(__CYGWIN__) #include #endif *************** *** 305,309 **** if (unbuffered) { ! #ifdef MS_WINDOWS _setmode(fileno(stdin), O_BINARY); _setmode(fileno(stdout), O_BINARY); --- 305,309 ---- if (unbuffered) { ! #if defined(MS_WINDOWS) || defined(__CYGWIN__) _setmode(fileno(stdin), O_BINARY); _setmode(fileno(stdout), O_BINARY); From sjoerd@users.sourceforge.net Fri Aug 9 14:37:35 2002 From: sjoerd@users.sourceforge.net (sjoerd@users.sourceforge.net) Date: Fri, 09 Aug 2002 06:37:35 -0700 Subject: [Python-checkins] python/dist/src/Misc python.man,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24479 Modified Files: python.man Log Message: Document that -u puts stdin, stdout, and stderr in binary mode. Index: python.man =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python.man,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** python.man 28 Jul 2002 10:34:08 -0000 1.25 --- python.man 9 Aug 2002 13:37:31 -0000 1.26 *************** *** 139,147 **** .TP .B \-u ! Force stdin, stdout and stderr to be totally unbuffered. Note that ! there is internal buffering in xreadlines(), readlines() and file-object ! iterators ("for line in sys.stdin") which is not influenced by this ! option. To work around this, you will want to use "sys.stdin.readline()" ! inside a "while 1:" loop. .TP .B \-v --- 139,148 ---- .TP .B \-u ! Force stdin, stdout and stderr to be totally unbuffered. On systems ! where it matters, also put stdin, stdout and stderr in binary mode. ! Note that there is internal buffering in xreadlines(), readlines() and ! file-object iterators ("for line in sys.stdin") which is not ! influenced by this option. To work around this, you will want to use ! "sys.stdin.readline()" inside a "while 1:" loop. .TP .B \-v From jackjansen@users.sourceforge.net Fri Aug 9 14:42:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 06:42:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts cachersrc.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv26371 Added Files: cachersrc.py Log Message: Tool to pre-created cached .rsrc.df.rsrc files in the Lib directories, similar to compileall.py. --- NEW FILE: cachersrc.py --- # Scan the tree passed as argv[0] for .rsrc files, skipping .rsrc.df.rsrc # files, and open these. The effect of this is to create the .rsrc.df.rsrc # cache files if needed. # These are needed on OSX: the .rsrc files are in reality AppleSingle-encoded # files. We decode the resources into a datafork-based resource file. import macresource import os import sys import getopt class NoArgsError(Exception): pass def handler((verbose, force), dirname, fnames): for fn in fnames: if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc': if force: try: os.unlink(os.path.join(dirname, fn + '.df.rsrc')) except IOError: pass macresource.open_pathname(os.path.join(dirname, fn), verbose=verbose) def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'vf') if not args: raise NoArgsError except (getopt.GetoptError, NoArgsError): sys.stderr.write('Usage: cachersrc.py dirname ...\n') sys.exit(1) verbose = 0 force = 0 for o, v in opts: if o == '-v': verbose = 1 if o == '-f': force = 1 for dir in sys.argv[1:]: os.path.walk(dir, handler, (verbose, force)) if __name__ == '__main__': main() From jackjansen@users.sourceforge.net Fri Aug 9 14:44:09 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 06:44:09 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib macresource.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26877 Modified Files: macresource.py Log Message: - Check not only that cache file exists, but also that it is newer than the applesingle file. - Added optional verbose option for cachersrc tool. Index: macresource.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macresource.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** macresource.py 29 Mar 2002 21:17:57 -0000 1.7 --- macresource.py 9 Aug 2002 13:44:03 -0000 1.8 *************** *** 71,75 **** return refno ! def open_pathname(pathname): """Open a resource file given by pathname, possibly decoding an AppleSingle file""" --- 71,75 ---- return refno ! def open_pathname(pathname, verbose=0): """Open a resource file given by pathname, possibly decoding an AppleSingle file""" *************** *** 90,94 **** return refno # Finally try decoding an AppleSingle file ! pathname = _decode(pathname) refno = Res.FSOpenResourceFile(pathname, u'', 1) else: --- 90,94 ---- return refno # Finally try decoding an AppleSingle file ! pathname = _decode(pathname, verbose=verbose) refno = Res.FSOpenResourceFile(pathname, u'', 1) else: *************** *** 96,104 **** return refno ! def _decode(pathname): # Decode an AppleSingle resource file, return the new pathname. newpathname = pathname + '.df.rsrc' ! if os.path.exists(newpathname): return newpathname import applesingle applesingle.decode(pathname, newpathname, resonly=1) --- 96,107 ---- return refno ! def _decode(pathname, verbose=0): # Decode an AppleSingle resource file, return the new pathname. newpathname = pathname + '.df.rsrc' ! if os.path.exists(newpathname) and \ ! os.stat(newpathname).st_mtime >= os.stat(pathname).st_mtime: return newpathname + if verbose: + print 'Decoding', pathname import applesingle applesingle.decode(pathname, newpathname, resonly=1) From jackjansen@users.sourceforge.net Fri Aug 9 15:15:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 07:15:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv8664 Modified Files: Makefile Log Message: - Precompile py files in Mac subtree after installing - Pre-cache .rsrc files in Mac subtree after installing - Fixed nameclash in Make variables Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Makefile 9 Aug 2002 00:18:21 -0000 1.20 --- Makefile 9 Aug 2002 14:15:46 -0000 1.21 *************** *** 46,49 **** --- 46,50 ---- RESOURCEFILE=python.rsrc RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py + CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE *************** *** 115,121 **** $(srcdir)/Mac/scripts/BuildApplet.py ! LIBDEST=$(prefix)/Mac/Lib ! LIBSRC=$(srcdir)/Mac/Lib ! LIBSUBDIRS= \ Carbon \ lib-scriptpackages \ --- 116,122 ---- $(srcdir)/Mac/scripts/BuildApplet.py ! MACLIBDEST=$(prefix)/Mac/Lib ! MACLIBSRC=$(srcdir)/Mac/Lib ! MACLIBSUBDIRS= \ Carbon \ lib-scriptpackages \ *************** *** 131,139 **** mkcwproject/template-carbon \ mkcwproject/template-ppc ! TOOLSDEST=$(prefix)/Mac/Tools ! TOOLSSRC=$(srcdir)/Mac/Tools ! TOOLSSUBDIRS=IDE ! installmacsubtree: ! @for i in $(LIBDEST) $(TOOLSDEST); \ do \ if test ! -d $$i; then \ --- 132,140 ---- mkcwproject/template-carbon \ mkcwproject/template-ppc ! MACTOOLSDEST=$(prefix)/Mac/Tools ! MACTOOLSSRC=$(srcdir)/Mac/Tools ! MACTOOLSSUBDIRS=IDE ! installmacsubtree: $(INSTALLED_PYTHON) ! @for i in $(MACLIBDEST) $(MACTOOLSDEST); \ do \ if test ! -d $$i; then \ *************** *** 143,151 **** fi; \ done ! @for d in $(LIBSUBDIRS); \ do \ ! a=$(LIBSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(LIBDEST)/$$d; \ if test ! -d $$b; then \ echo "Creating directory $$b"; \ --- 144,152 ---- fi; \ done ! @for d in $(MACLIBSUBDIRS); \ do \ ! a=$(MACLIBSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(MACLIBDEST)/$$d; \ if test ! -d $$b; then \ echo "Creating directory $$b"; \ *************** *** 154,172 **** fi; \ done ! @for i in $(LIBSRC)/*.py $(LIBSRC)/*.rsrc; \ do \ if test -x $$i; then \ ! $(INSTALL_SCRIPT) $$i $(LIBDEST); \ ! echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ else \ ! $(INSTALL_DATA) $$i $(LIBDEST); \ ! echo $(INSTALL_DATA) $$i $(LIBDEST); \ fi; \ done ! @for d in $(LIBSUBDIRS); \ do \ ! a=$(LIBSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(LIBDEST)/$$d; \ for i in $$a/*; \ do \ --- 155,173 ---- fi; \ done ! @for i in $(MACLIBSRC)/*.py $(MACLIBSRC)/*.rsrc; \ do \ if test -x $$i; then \ ! $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \ ! echo $(INSTALL_SCRIPT) $$i $(MACLIBDEST); \ else \ ! $(INSTALL_DATA) $$i $(MACLIBDEST); \ ! echo $(INSTALL_DATA) $$i $(MACLIBDEST); \ fi; \ done ! @for d in $(MACLIBSUBDIRS); \ do \ ! a=$(MACLIBSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(MACLIBDEST)/$$d; \ for i in $$a/*; \ do \ *************** *** 188,196 **** done; \ done ! @for d in $(TOOLSSUBDIRS); \ do \ ! a=$(TOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(TOOLSDEST)/$$d; \ if test ! -d $$b; then \ echo "Creating directory $$b"; \ --- 189,197 ---- done; \ done ! @for d in $(MACTOOLSSUBDIRS); \ do \ ! a=$(MACTOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(MACTOOLSDEST)/$$d; \ if test ! -d $$b; then \ echo "Creating directory $$b"; \ *************** *** 199,207 **** fi; \ done ! @for d in $(TOOLSSUBDIRS); \ do \ ! a=$(TOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(TOOLSDEST)/$$d; \ for i in $$a/*; \ do \ --- 200,208 ---- fi; \ done ! @for d in $(MACTOOLSSUBDIRS); \ do \ ! a=$(MACTOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(MACTOOLSDEST)/$$d; \ for i in $$a/*; \ do \ *************** *** 223,228 **** done; \ done ! $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(LIBDEST)/site-packages/ # Put symlinks "python" and "pythonw" in the standard place --- 224,234 ---- done; \ done ! $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(LIBDEST)/site-packages/ + + $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) + $(INSTALLED_PYTHON) $(srcdir)/Lib/compileall.py $(MACLIBDEST) $(MACTOOLSDEST) + $(INSTALLED_PYTHON) -O $(srcdir)/Lib/compileall.py $(MACLIBDEST) $(MACTOOLSDEST) + # Put symlinks "python" and "pythonw" in the standard place *************** *** 241,244 **** dontinstallmacsubtree: l=`cd $(srcdir)/Mac/Lib; pwd`; \ ! echo $$l > $(LIBDEST)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(LIBDEST)/site-packages/Mac.pth --- 247,250 ---- dontinstallmacsubtree: l=`cd $(srcdir)/Mac/Lib; pwd`; \ ! echo $$l > $(MACLIBDEST)/site-packages/Mac.pth ; \ ! echo $$l/lib-scriptpackages >> $(MACLIBDEST)/site-packages/Mac.pth From jackjansen@users.sourceforge.net Fri Aug 9 15:43:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 Aug 2002 07:43:00 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.96,1.97 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv24667 Modified Files: Makefile.pre.in Log Message: When installing the "python" link in bindir also test for a pre-existing symlink and remove it. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** Makefile.pre.in 9 Aug 2002 00:18:21 -0000 1.96 --- Makefile.pre.in 9 Aug 2002 14:42:57 -0000 1.97 *************** *** 561,565 **** # Install the interpreter (by creating a hard link to python$(VERSION)) bininstall: altbininstall ! -if test -f $(BINDIR)/$(PYTHON); \ then rm -f $(BINDIR)/$(PYTHON); \ else true; \ --- 561,565 ---- # Install the interpreter (by creating a hard link to python$(VERSION)) bininstall: altbininstall ! -if test -f $(BINDIR)/$(PYTHON) -o -L $(BINDIR)/$(PYTHON); \ then rm -f $(BINDIR)/$(PYTHON); \ else true; \ From fdrake@users.sourceforge.net Fri Aug 9 15:57:57 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 07:57:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/dom __init__.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv1549 Modified Files: __init__.py Log Message: New entries to track the DOM API growth. These match names exposed in PyXML 0.8. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** __init__.py 30 Nov 2001 15:37:33 -0000 1.10 --- __init__.py 9 Aug 2002 14:57:55 -0000 1.11 *************** *** 56,59 **** --- 56,60 ---- NAMESPACE_ERR = 14 INVALID_ACCESS_ERR = 15 + VALIDATION_ERR = 16 *************** *** 117,120 **** --- 118,124 ---- code = INVALID_ACCESS_ERR + class ValidationErr(DOMException): + code = VALIDATION_ERR + XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace" *************** *** 122,125 **** --- 126,130 ---- XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" EMPTY_NAMESPACE = None + EMPTY_PREFIX = None from domreg import getDOMImplementation,registerDOMImplementation From gvanrossum@users.sourceforge.net Fri Aug 9 16:18:03 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:18:03 -0700 Subject: [Python-checkins] python/nondist/sandbox/help inspect.py,1.4,NONE pydoc.py,1.7,NONE test_inspect.py,1.3,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/help In directory usw-pr-cvs1:/tmp/cvs-serv13549 Removed Files: inspect.py pydoc.py test_inspect.py Log Message: The help sandbox is no longer needed -- pydoc is integrated in the std lib. --- inspect.py DELETED --- --- pydoc.py DELETED --- --- test_inspect.py DELETED --- From nascheme@users.sourceforge.net Fri Aug 9 16:20:51 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:20:51 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.85,2.86 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15244/Objects Modified Files: intobject.c Log Message: Only call sq_repeat if the object does not have a nb_multiply slot. One example of where this changes behavior is when a new-style instance defines '__mul__' and '__rmul__' and is multiplied by an int. Before the change the '__rmul__' method is never called, even if the int is the left operand. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -d -r2.85 -r2.86 *** intobject.c 17 Jul 2002 16:30:38 -0000 2.85 --- intobject.c 9 Aug 2002 15:20:48 -0000 2.86 *************** *** 342,345 **** --- 342,351 ---- */ + /* Return true if the sq_repeat method should be used */ + #define USE_SQ_REPEAT(o) (!PyInt_Check(o) && \ + o->ob_type->tp_as_sequence && \ + o->ob_type->tp_as_sequence->sq_repeat && \ + (!o->ob_type->tp_as_number || \ + !o->ob_type->tp_as_number->nb_multiply)) static PyObject * int_mul(PyObject *v, PyObject *w) *************** *** 350,363 **** double doubleprod; /* (double)a * (double)b */ ! if (!PyInt_Check(v) && ! v->ob_type->tp_as_sequence && ! v->ob_type->tp_as_sequence->sq_repeat) { /* sequence * int */ a = PyInt_AsLong(w); return (*v->ob_type->tp_as_sequence->sq_repeat)(v, a); } ! if (!PyInt_Check(w) && ! w->ob_type->tp_as_sequence && ! w->ob_type->tp_as_sequence->sq_repeat) { /* int * sequence */ a = PyInt_AsLong(v); --- 356,365 ---- double doubleprod; /* (double)a * (double)b */ ! 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); From gvanrossum@users.sourceforge.net Fri Aug 9 16:36:50 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:36:50 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.159,2.160 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24403/Objects Modified Files: unicodeobject.c Log Message: Unicode replace() method with empty pattern argument should fail, like it does for 8-bit strings. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.159 retrieving revision 2.160 diff -C2 -d -r2.159 -r2.160 *** unicodeobject.c 6 Aug 2002 19:03:17 -0000 2.159 --- unicodeobject.c 9 Aug 2002 15:36:48 -0000 2.160 *************** *** 3456,3459 **** --- 3456,3464 ---- PyUnicodeObject *u; + if (str1->length == 0) { + PyErr_SetString(PyExc_ValueError, "empty pattern string"); + return NULL; + } + if (maxcount < 0) maxcount = INT_MAX; From gvanrossum@users.sourceforge.net Fri Aug 9 16:36:50 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:36:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24403/Lib/test Modified Files: test_unicode.py Log Message: Unicode replace() method with empty pattern argument should fail, like it does for 8-bit strings. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** test_unicode.py 6 Aug 2002 23:08:51 -0000 1.63 --- test_unicode.py 9 Aug 2002 15:36:48 -0000 1.64 *************** *** 207,210 **** --- 207,216 ---- 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) + try: + u"abc".replace(u"", u"x") + except ValueError: + pass + else: + raise TestFailed, "u.replace('', ...) should raise ValueError" test('startswith', u'hello', True, u'he') From nascheme@users.sourceforge.net Fri Aug 9 16:46:52 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:46:52 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.79.6.2,2.79.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31698/Objects Modified Files: Tag: release22-maint intobject.c Log Message: Only call sq_repeat if the object does not have a nb_multiply slot. One example of where this changes behavior is when a new-style instance defines '__mul__' and '__rmul__' and is multiplied by an int. Before the change the '__rmul__' method is never called, even if the int is the left operand. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.79.6.2 retrieving revision 2.79.6.3 diff -C2 -d -r2.79.6.2 -r2.79.6.3 *** intobject.c 26 Apr 2002 06:31:22 -0000 2.79.6.2 --- intobject.c 9 Aug 2002 15:46:50 -0000 2.79.6.3 *************** *** 345,348 **** --- 345,354 ---- */ + /* Return true if the sq_repeat method should be used */ + #define USE_SQ_REPEAT(o) (!PyInt_Check(o) && \ + o->ob_type->tp_as_sequence && \ + o->ob_type->tp_as_sequence->sq_repeat && \ + (!o->ob_type->tp_as_number || \ + !o->ob_type->tp_as_number->nb_multiply)) static PyObject * int_mul(PyObject *v, PyObject *w) *************** *** 353,366 **** double doubleprod; /* (double)a * (double)b */ ! if (!PyInt_Check(v) && ! v->ob_type->tp_as_sequence && ! v->ob_type->tp_as_sequence->sq_repeat) { /* sequence * int */ a = PyInt_AsLong(w); return (*v->ob_type->tp_as_sequence->sq_repeat)(v, a); } ! if (!PyInt_Check(w) && ! w->ob_type->tp_as_sequence && ! w->ob_type->tp_as_sequence->sq_repeat) { /* int * sequence */ a = PyInt_AsLong(v); --- 359,368 ---- double doubleprod; /* (double)a * (double)b */ ! 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); From gvanrossum@users.sourceforge.net Fri Aug 9 16:57:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:57:36 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.456,1.457 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5240 Modified Files: NEWS Log Message: News about Neil's fix to correctly invoke __rmul__. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.456 retrieving revision 1.457 diff -C2 -d -r1.456 -r1.457 *** NEWS 6 Aug 2002 17:01:51 -0000 1.456 --- NEWS 9 Aug 2002 15:57:34 -0000 1.457 *************** *** 7,10 **** --- 7,15 ---- Core and builtins + - When x is an object whose class implements __mul__ and __rmul__, + 1.0*x would correctly invoke __rmul__, but 1*x would erroneously + invoke __mul__. This was due to the sequence-repeat code in the int + type. This has been fixed now. + - Previously, "str1 in str2" required str1 to be a string of length 1. This restriction has been relaxed to allow str1 to be a string of From gvanrossum@users.sourceforge.net Fri Aug 9 16:57:54 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 08:57:54 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.31,1.337.2.4.2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5336 Modified Files: Tag: release22-maint NEWS Log Message: News about Neil's fix to correctly invoke __rmul__. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.31 retrieving revision 1.337.2.4.2.32 diff -C2 -d -r1.337.2.4.2.31 -r1.337.2.4.2.32 *** NEWS 11 Jul 2002 07:06:43 -0000 1.337.2.4.2.31 --- NEWS 9 Aug 2002 15:57:52 -0000 1.337.2.4.2.32 *************** *** 5,8 **** --- 5,13 ---- Core and builtins + - When x is an object whose class implements __mul__ and __rmul__, + 1.0*x would correctly invoke __rmul__, but 1*x would erroneously + invoke __mul__. This was due to the sequence-repeat code in the int + type. This has been fixed now. + - If a dying instance of a new-style class got resurrected by its class's __del__ method, Python aborted with a fatal error. From gvanrossum@users.sourceforge.net Fri Aug 9 17:11:40 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:11:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.151,1.152 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11793 Modified Files: test_descr.py Log Message: Test for Neil's fix to correctly invoke __rmul__. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** test_descr.py 6 Aug 2002 21:28:28 -0000 1.151 --- test_descr.py 9 Aug 2002 16:11:37 -0000 1.152 *************** *** 3233,3236 **** --- 3233,3251 ---- del o + def testrmul(): + # SF patch 592646 + if verbose: + print "Testing correct invocation of __rmul__..." + class C(object): + def __mul__(self, other): + return "mul" + def __rmul__(self, other): + return "rmul" + a = C() + vereq(a*2, "mul") + vereq(a*2.2, "mul") + vereq(2*a, "rmul") + vereq(2.2*a, "rmul") + def do_this_first(): if verbose: *************** *** 3325,3328 **** --- 3340,3344 ---- subtype_resurrection() slottrash() + testrmul() if verbose: print "All OK" From gvanrossum@users.sourceforge.net Fri Aug 9 17:14:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:14:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12270/test Modified Files: test_tempfile.py Log Message: Check-in of the most essential parts of SF 589982 (tempfile.py rewrite, by Zack Weinberg). This replaces most code in tempfile.py (please review!!!) and adds extensive unit tests for it. This will cause some warnings in the test suite; I'll check those in soon, and also the docs. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_tempfile.py 29 Oct 2001 21:46:08 -0000 1.1 --- test_tempfile.py 9 Aug 2002 16:14:33 -0000 1.2 *************** *** 1,10 **** ! # SF bug #476138: tempfile behavior across platforms ! # Ensure that a temp file can be closed any number of times without error. import tempfile ! f = tempfile.TemporaryFile("w+b") ! f.write('abc\n') ! f.close() ! f.close() ! f.close() --- 1,707 ---- ! # tempfile.py unit tests. import tempfile + import os + import sys + import re + import errno + import warnings ! import unittest ! from test import test_support ! ! if hasattr(os, 'stat'): ! import stat ! has_stat = 1 ! else: ! has_stat = 0 ! ! has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) ! ! # This is organized as one test for each chunk of code in tempfile.py, ! # in order of their appearance in the file. Testing which requires ! # threads is not done here. ! ! # Common functionality. ! class TC(unittest.TestCase): ! ! str_check = re.compile(r"[a-zA-Z0-9_-]{6}$") ! ! def failOnException(self, what, ei=None): ! if ei is None: ! ei = sys.exc_info() ! self.fail("%s raised %s: %s" % (what, ei[0], ei[1])) ! ! def nameCheck(self, name, dir, pre, suf): ! (ndir, nbase) = os.path.split(name) ! npre = nbase[:len(pre)] ! nsuf = nbase[len(nbase)-len(suf):] ! ! self.assertEqual(ndir, dir, ! "file '%s' not in directory '%s'" % (name, dir)) ! self.assertEqual(npre, pre, ! "file '%s' does not begin with '%s'" % (nbase, pre)) ! self.assertEqual(nsuf, suf, ! "file '%s' does not end with '%s'" % (nbase, suf)) ! ! nbase = nbase[len(pre):len(nbase)-len(suf)] ! self.assert_(self.str_check.match(nbase), ! "random string '%s' does not match /^[a-zA-Z0-9_-]{6}$/" ! % nbase) ! ! test_classes = [] ! ! class test_exports(TC): ! def test_exports(self): ! """There are no surprising symbols in the tempfile module""" ! dict = tempfile.__dict__ ! ! expected = { ! "NamedTemporaryFile" : 1, ! "TemporaryFile" : 1, ! "mkstemp" : 1, ! "mkdtemp" : 1, ! "mktemp" : 1, ! "TMP_MAX" : 1, ! "gettempprefix" : 1, ! "gettempdir" : 1, ! "tempdir" : 1, ! "template" : 1 ! } ! ! unexp = [] ! for key in dict: ! if key[0] != '_' and key not in expected: ! unexp.append(key) ! self.failUnless(len(unexp) == 0, ! "unexpected keys: %s" % unexp) ! ! test_classes.append(test_exports) ! ! ! class test__once(TC): ! """Test the internal function _once.""" ! ! def setUp(self): ! tempfile.once_var = None ! self.already_called = 0 ! ! def tearDown(self): ! del tempfile.once_var ! ! def callMeOnce(self): ! self.failIf(self.already_called, "callMeOnce called twice") ! self.already_called = 1 ! return 24 ! ! def do_once(self): ! tempfile._once('once_var', self.callMeOnce) ! ! def test_once_initializes(self): ! """_once initializes its argument""" ! ! self.do_once() ! ! self.assertEqual(tempfile.once_var, 24, ! "once_var=%d, not 24" % tempfile.once_var) ! self.assertEqual(self.already_called, 1, ! "already_called=%d, not 1" % self.already_called) ! ! def test_once_means_once(self): ! """_once calls the callback just once""" ! ! self.do_once() ! self.do_once() ! self.do_once() ! self.do_once() ! ! def test_once_namespace_safe(self): ! """_once does not modify anything but its argument""" ! ! env_copy = tempfile.__dict__.copy() ! ! self.do_once() ! ! env = tempfile.__dict__ ! ! a = env.keys() ! a.sort() ! b = env_copy.keys() ! b.sort() ! ! self.failIf(len(a) != len(b)) ! for i in xrange(len(a)): ! self.failIf(a[i] != b[i]) ! ! key = a[i] ! if key != 'once_var': ! self.failIf(env[key] != env_copy[key]) ! ! test_classes.append(test__once) ! ! ! class test__RandomNameSequence(TC): ! """Test the internal iterator object _RandomNameSequence.""" ! ! def setUp(self): ! self.r = tempfile._RandomNameSequence() ! ! def test_get_six_char_str(self): ! """_RandomNameSequence returns a six-character string""" ! s = self.r.next() ! self.nameCheck(s, '', '', '') ! ! def test_many(self): ! """_RandomNameSequence returns no duplicate strings (stochastic)""" ! ! dict = {} ! r = self.r ! for i in xrange(1000): ! s = r.next() ! self.nameCheck(s, '', '', '') ! self.failIf(s in dict) ! dict[s] = 1 ! ! def test_supports_iter(self): ! """_RandomNameSequence supports the iterator protocol""" ! ! i = 0 ! r = self.r ! try: ! for s in r: ! i += 1 ! if i == 20: ! break ! except: ! failOnException("iteration") ! ! test_classes.append(test__RandomNameSequence) ! ! ! class test__candidate_tempdir_list(TC): ! """Test the internal function _candidate_tempdir_list.""" ! ! def test_nonempty_list(self): ! """_candidate_tempdir_list returns a nonempty list of strings""" ! ! cand = tempfile._candidate_tempdir_list() ! ! self.failIf(len(cand) == 0) ! for c in cand: ! self.assert_(isinstance(c, basestring), ! "%s is not a string" % c) ! ! def test_wanted_dirs(self): ! """_candidate_tempdir_list contains the expected directories""" ! ! # Make sure the interesting environment variables are all set. ! added = [] ! try: ! for envname in 'TMPDIR', 'TEMP', 'TMP': ! dirname = os.getenv(envname) ! if not dirname: ! os.environ[envname] = os.path.abspath(envname) ! added.append(envname) ! ! cand = tempfile._candidate_tempdir_list() ! ! for envname in 'TMPDIR', 'TEMP', 'TMP': ! dirname = os.getenv(envname) ! if not dirname: raise ValueError ! self.assert_(dirname in cand) ! ! try: ! dirname = os.getcwd() ! except (AttributeError, os.error): ! dirname = os.curdir ! ! self.assert_(dirname in cand) ! ! # Not practical to try to verify the presence of OS-specific ! # paths in this list. ! finally: ! for p in added: ! del os.environ[p] ! ! test_classes.append(test__candidate_tempdir_list) ! ! ! # We test _get_default_tempdir by testing gettempdir. ! ! ! class test__get_candidate_names(TC): ! """Test the internal function _get_candidate_names.""" ! ! def test_retval(self): ! """_get_candidate_names returns a _RandomNameSequence object""" ! obj = tempfile._get_candidate_names() ! self.assert_(isinstance(obj, tempfile._RandomNameSequence)) ! ! def test_same_thing(self): ! """_get_candidate_names always returns the same object""" ! a = tempfile._get_candidate_names() ! b = tempfile._get_candidate_names() ! ! self.assert_(a is b) ! ! test_classes.append(test__get_candidate_names) ! ! ! class test__mkstemp_inner(TC): ! """Test the internal function _mkstemp_inner.""" ! ! class mkstemped: ! _bflags = tempfile._bin_openflags ! _tflags = tempfile._text_openflags ! _close = os.close ! _unlink = os.unlink ! ! def __init__(self, dir, pre, suf, bin): ! if bin: flags = self._bflags ! else: flags = self._tflags ! ! (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags) ! ! def write(self, str): ! os.write(self.fd, str) ! ! def __del__(self): ! self._close(self.fd) ! self._unlink(self.name) ! ! def do_create(self, dir=None, pre="", suf="", bin=1): ! if dir is None: ! dir = tempfile.gettempdir() ! try: ! file = self.mkstemped(dir, pre, suf, bin) ! except: ! self.failOnException("_mkstemp_inner") ! ! self.nameCheck(file.name, dir, pre, suf) ! return file ! ! def test_basic(self): ! """_mkstemp_inner can create files""" ! self.do_create().write("blat") ! self.do_create(pre="a").write("blat") ! self.do_create(suf="b").write("blat") ! self.do_create(pre="a", suf="b").write("blat") ! self.do_create(pre="aa", suf=".txt").write("blat") ! ! def test_basic_many(self): ! """_mkstemp_inner can create many files (stochastic)""" ! extant = range(1000) ! for i in extant: ! extant[i] = self.do_create(pre="aa") ! ! def test_choose_directory(self): ! """_mkstemp_inner can create files in a user-selected directory""" ! dir = tempfile.mkdtemp() ! try: ! self.do_create(dir=dir).write("blat") ! finally: ! os.rmdir(dir) ! ! def test_file_mode(self): ! """_mkstemp_inner creates files with the proper mode""" ! if not has_stat: ! return # ugh, can't use TestSkipped. ! ! file = self.do_create() ! mode = stat.S_IMODE(os.stat(file.name).st_mode) ! self.assertEqual(mode, 0600) ! ! def test_noinherit(self): ! """_mkstemp_inner file handles are not inherited by child processes""" ! # FIXME: Find a way to test this on Windows. ! if os.name != 'posix': ! return # ugh, can't use TestSkipped. ! ! file = self.do_create() ! ! # We have to exec something, so that FD_CLOEXEC will take ! # effect. The sanest thing to try is /bin/sh; we can easily ! # instruct it to attempt to write to the fd and report success ! # or failure. Unfortunately, sh syntax does not permit use of ! # fds numerically larger than 9; abandon this test if so. ! if file.fd > 9: ! raise test_support.TestSkipped, 'cannot test with fd %d' % file.fd ! ! pid = os.fork() ! if pid: ! status = os.wait()[1] ! self.failUnless(os.WIFEXITED(status), ! "child process did not exit (status %d)" % status) ! ! # We want the child to have exited _un_successfully, indicating ! # failure to write to the closed fd. ! self.failUnless(os.WEXITSTATUS(status) != 0, ! "child process exited successfully") ! ! else: ! try: ! # Throw away stderr. ! nul = os.open('/dev/null', os.O_RDWR) ! os.dup2(nul, 2) ! os.execv('/bin/sh', ['sh', '-c', 'echo blat >&%d' % file.fd]) ! except: ! os._exit(0) ! ! def test_textmode(self): ! """_mkstemp_inner can create files in text mode""" ! if not has_textmode: ! return # ugh, can't use TestSkipped. ! ! self.do_create(bin=0).write("blat\n") ! # XXX should test that the file really is a text file ! ! test_classes.append(test__mkstemp_inner) ! ! ! class test_gettempprefix(TC): ! """Test gettempprefix().""" ! ! def test_sane_template(self): ! """gettempprefix returns a nonempty prefix string""" ! p = tempfile.gettempprefix() ! ! self.assert_(isinstance(p, basestring)) ! self.assert_(len(p) > 0) ! ! def test_usable_template(self): ! """gettempprefix returns a usable prefix string""" ! ! # Create a temp directory, avoiding use of the prefix. ! # Then attempt to create a file whose name is ! # prefix + 'xxxxxx.xxx' in that directory. ! p = tempfile.gettempprefix() + "xxxxxx.xxx" ! d = tempfile.mkdtemp(prefix="") ! try: ! p = os.path.join(d, p) ! try: ! fd = os.open(p, os.O_RDWR | os.O_CREAT) ! except: ! self.failOnException("os.open") ! os.close(fd) ! os.unlink(p) ! finally: ! os.rmdir(d) ! ! test_classes.append(test_gettempprefix) ! ! ! class test_gettempdir(TC): ! """Test gettempdir().""" ! ! def test_directory_exists(self): ! """gettempdir returns a directory which exists""" ! ! dir = tempfile.gettempdir() ! self.assert_(os.path.isabs(dir) or dir == os.curdir, ! "%s is not an absolute path" % dir) ! self.assert_(os.path.isdir(dir), ! "%s is not a directory" % dir) ! ! def test_directory_writable(self): ! """gettempdir returns a directory writable by the user""" ! ! # sneaky: just instantiate a NamedTemporaryFile, which ! # defaults to writing into the directory returned by ! # gettempdir. ! try: ! file = tempfile.NamedTemporaryFile() ! file.write("blat") ! file.close() ! except: ! self.failOnException("create file in %s" % tempfile.gettempdir()) ! ! def test_same_thing(self): ! """gettempdir always returns the same object""" ! a = tempfile.gettempdir() ! b = tempfile.gettempdir() ! ! self.assert_(a is b) ! ! test_classes.append(test_gettempdir) ! ! ! class test_mkstemp(TC): ! """Test mkstemp().""" ! def do_create(self, dir=None, pre="", suf="", ): ! if dir is None: ! dir = tempfile.gettempdir() ! try: ! (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf) ! except: ! self.failOnException("mkstemp") ! ! try: ! self.nameCheck(name, dir, pre, suf) ! finally: ! os.close(fd) ! os.unlink(name) ! ! def test_basic(self): ! """mkstemp can create files""" ! self.do_create() ! self.do_create(pre="a") ! self.do_create(suf="b") ! self.do_create(pre="a", suf="b") ! self.do_create(pre="aa", suf=".txt") ! ! def test_choose_directory(self): ! """mkstemp can create directories in a user-selected directory""" ! dir = tempfile.mkdtemp() ! try: ! self.do_create(dir=dir) ! finally: ! os.rmdir(dir) ! ! test_classes.append(test_mkstemp) ! ! ! class test_mkdtemp(TC): ! """Test mkdtemp().""" ! ! def do_create(self, dir=None, pre="", suf=""): ! if dir is None: ! dir = tempfile.gettempdir() ! try: ! name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf) ! except: ! self.failOnException("mkdtemp") ! ! try: ! self.nameCheck(name, dir, pre, suf) ! return name ! except: ! os.rmdir(name) ! raise ! ! def test_basic(self): ! """mkdtemp can create directories""" ! os.rmdir(self.do_create()) ! os.rmdir(self.do_create(pre="a")) ! os.rmdir(self.do_create(suf="b")) ! os.rmdir(self.do_create(pre="a", suf="b")) ! os.rmdir(self.do_create(pre="aa", suf=".txt")) ! ! def test_basic_many(self): ! """mkdtemp can create many directories (stochastic)""" ! extant = range(1000) ! try: ! for i in extant: ! extant[i] = self.do_create(pre="aa") ! finally: ! for i in extant: ! if(isinstance(i, basestring)): ! os.rmdir(i) ! ! def test_choose_directory(self): ! """mkdtemp can create directories in a user-selected directory""" ! dir = tempfile.mkdtemp() ! try: ! os.rmdir(self.do_create(dir=dir)) ! finally: ! os.rmdir(dir) ! ! def test_mode(self): ! """mkdtemp creates directories with the proper mode""" ! if not has_stat: ! return # ugh, can't use TestSkipped. ! ! dir = self.do_create() ! try: ! mode = stat.S_IMODE(os.stat(dir).st_mode) ! self.assertEqual(mode, 0700) ! finally: ! os.rmdir(dir) ! ! test_classes.append(test_mkdtemp) ! ! ! class test_mktemp(TC): ! """Test mktemp().""" ! ! # For safety, all use of mktemp must occur in a private directory. ! # We must also suppress the RuntimeWarning it generates. ! def setUp(self): ! self.dir = tempfile.mkdtemp() ! warnings.filterwarnings("ignore", ! category=RuntimeWarning, ! message="mktemp") ! ! def tearDown(self): ! if self.dir: ! os.rmdir(self.dir) ! self.dir = None ! # XXX This clobbers any -W options. ! warnings.resetwarnings() ! ! class mktemped: ! _unlink = os.unlink ! _bflags = tempfile._bin_openflags ! ! def __init__(self, dir, pre, suf): ! self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf) ! # Create the file. This will raise an exception if it's ! # mysteriously appeared in the meanwhile. ! os.close(os.open(self.name, self._bflags, 0600)) ! ! def __del__(self): ! self._unlink(self.name) ! ! def do_create(self, pre="", suf=""): ! try: ! file = self.mktemped(self.dir, pre, suf) ! except: ! self.failOnException("mktemp") ! ! self.nameCheck(file.name, self.dir, pre, suf) ! return file ! ! def test_basic(self): ! """mktemp can choose usable file names""" ! self.do_create() ! self.do_create(pre="a") ! self.do_create(suf="b") ! self.do_create(pre="a", suf="b") ! self.do_create(pre="aa", suf=".txt") ! ! def test_many(self): ! """mktemp can choose many usable file names (stochastic)""" ! extant = range(1000) ! for i in extant: ! extant[i] = self.do_create(pre="aa") ! ! def test_warning(self): ! """mktemp issues a warning when used""" ! warnings.filterwarnings("error", ! category=RuntimeWarning, ! message="mktemp") ! self.assertRaises(RuntimeWarning, ! tempfile.mktemp, (), { 'dir': self.dir }) ! ! test_classes.append(test_mktemp) ! ! ! # We test _TemporaryFileWrapper by testing NamedTemporaryFile. ! ! ! class test_NamedTemporaryFile(TC): ! """Test NamedTemporaryFile().""" ! ! def do_create(self, dir=None, pre="", suf=""): ! if dir is None: ! dir = tempfile.gettempdir() ! try: ! file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf) ! except: ! self.failOnException("NamedTemporaryFile") ! ! self.nameCheck(file.name, dir, pre, suf) ! return file ! ! ! def test_basic(self): ! """NamedTemporaryFile can create files""" ! self.do_create() ! self.do_create(pre="a") ! self.do_create(suf="b") ! self.do_create(pre="a", suf="b") ! self.do_create(pre="aa", suf=".txt") ! ! def test_creates_named(self): ! """NamedTemporaryFile creates files with names""" ! f = tempfile.NamedTemporaryFile() ! self.failUnless(os.path.exists(f.name), ! "NamedTemporaryFile %s does not exist" % f.name) ! ! def test_del_on_close(self): ! """A NamedTemporaryFile is deleted when closed""" ! dir = tempfile.mkdtemp() ! try: ! f = tempfile.NamedTemporaryFile(dir=dir) ! f.write('blat') ! f.close() ! self.failIf(os.path.exists(f.name), ! "NamedTemporaryFile %s exists after close" % f.name) ! finally: ! os.rmdir(dir) ! ! def test_multiple_close(self): ! """A NamedTemporaryFile can be closed many times without error""" ! ! f = tempfile.NamedTemporaryFile() ! f.write('abc\n') ! f.close() ! try: ! f.close() ! f.close() ! except: ! self.failOnException("close") ! ! # How to test the mode and bufsize parameters? ! ! test_classes.append(test_NamedTemporaryFile) ! ! ! class test_TemporaryFile(TC): ! """Test TemporaryFile().""" ! ! def test_basic(self): ! """TemporaryFile can create files""" ! # No point in testing the name params - the file has no name. ! try: ! tempfile.TemporaryFile() ! except: ! self.failOnException("TemporaryFile") ! ! def test_has_no_name(self): ! """TemporaryFile creates files with no names (on this system)""" ! dir = tempfile.mkdtemp() ! f = tempfile.TemporaryFile(dir=dir) ! f.write('blat') ! ! # Sneaky: because this file has no name, it should not prevent ! # us from removing the directory it was created in. ! try: ! os.rmdir(dir) ! except: ! ei = sys.exc_info() ! # cleanup ! f.close() ! os.rmdir(dir) ! self.failOnException("rmdir", ei) ! ! def test_multiple_close(self): ! """A TemporaryFile can be closed many times without error""" ! f = tempfile.TemporaryFile() ! f.write('abc\n') ! f.close() ! try: ! f.close() ! f.close() ! except: ! self.failOnException("close") ! ! # How to test the mode and bufsize parameters? ! ! class dummy_test_TemporaryFile(TC): ! def test_dummy(self): ! """TemporaryFile and NamedTemporaryFile are the same (on this system)""" ! pass ! ! if tempfile.NamedTemporaryFile is tempfile.TemporaryFile: ! test_classes.append(dummy_test_TemporaryFile) ! else: ! test_classes.append(test_TemporaryFile) ! ! def test_main(): ! suite = unittest.TestSuite() ! for c in test_classes: ! suite.addTest(unittest.makeSuite(c)) ! test_support.run_suite(suite) ! ! if __name__ == "__main__": ! test_main() From gvanrossum@users.sourceforge.net Fri Aug 9 17:14:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:14:35 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12270 Modified Files: tempfile.py Log Message: Check-in of the most essential parts of SF 589982 (tempfile.py rewrite, by Zack Weinberg). This replaces most code in tempfile.py (please review!!!) and adds extensive unit tests for it. This will cause some warnings in the test suite; I'll check those in soon, and also the docs. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tempfile.py 1 Jun 2002 14:18:46 -0000 1.39 --- tempfile.py 9 Aug 2002 16:14:32 -0000 1.40 *************** *** 1,176 **** ! """Temporary files and filenames.""" ! # XXX This tries to be not UNIX specific, but I don't know beans about ! # how to choose a temp directory or filename on MS-DOS or other ! # systems so it may have to be changed... ! import os ! __all__ = ["mktemp", "TemporaryFile", "tempdir", "gettempprefix"] - # Parameters that the caller may set to override the defaults tempdir = None - template = None ! def gettempdir(): ! """Function to calculate the directory to use.""" ! global tempdir ! if tempdir is not None: ! return tempdir ! # _gettempdir_inner deduces whether a candidate temp dir is usable by ! # trying to create a file in it, and write to it. If that succeeds, ! # great, it closes the file and unlinks it. There's a race, though: ! # the *name* of the test file it tries is the same across all threads ! # under most OSes (Linux is an exception), and letting multiple threads ! # all try to open, write to, close, and unlink a single file can cause ! # a variety of bogus errors (e.g., you cannot unlink a file under ! # Windows if anyone has it open, and two threads cannot create the ! # same file in O_EXCL mode under Unix). The simplest cure is to serialize ! # calls to _gettempdir_inner. This isn't a real expense, because the ! # first thread to succeed sets the global tempdir, and all subsequent ! # calls to gettempdir() reuse that without trying _gettempdir_inner. ! _tempdir_lock.acquire() try: ! return _gettempdir_inner() finally: ! _tempdir_lock.release() - def _gettempdir_inner(): - """Function to calculate the directory to use.""" - global tempdir - if tempdir is not None: - return tempdir - try: - pwd = os.getcwd() - except (AttributeError, os.error): - pwd = os.curdir - attempdirs = ['/tmp', '/var/tmp', '/usr/tmp', pwd] - if os.name == 'nt': - attempdirs.insert(0, 'C:\\TEMP') - attempdirs.insert(0, '\\TEMP') - elif os.name == 'mac': - import macfs, MACFS try: ! refnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, ! MACFS.kTemporaryFolderType, 1) ! dirname = macfs.FSSpec((refnum, dirid, '')).as_pathname() ! attempdirs.insert(0, dirname) ! except macfs.error: ! pass ! elif os.name == 'riscos': ! scrapdir = os.getenv('Wimp$ScrapDir') ! if scrapdir: ! attempdirs.insert(0, scrapdir) for envname in 'TMPDIR', 'TEMP', 'TMP': ! if envname in os.environ: ! attempdirs.insert(0, os.environ[envname]) ! testfile = gettempprefix() + 'test' ! for dir in attempdirs: try: ! filename = os.path.join(dir, testfile) ! if os.name == 'posix': ! try: ! fd = os.open(filename, ! os.O_RDWR | os.O_CREAT | os.O_EXCL, 0700) ! except OSError: ! pass ! else: ! fp = os.fdopen(fd, 'w') ! fp.write('blat') ! fp.close() ! os.unlink(filename) ! del fp, fd ! tempdir = dir ! break ! else: ! fp = open(filename, 'w') fp.write('blat') fp.close() ! os.unlink(filename) ! tempdir = dir ! break ! except IOError: ! pass ! if tempdir is None: ! msg = "Can't find a usable temporary directory amongst " + `attempdirs` ! raise IOError, msg ! return tempdir ! # template caches the result of gettempprefix, for speed, when possible. ! # XXX unclear why this isn't "_template"; left it "template" for backward ! # compatibility. ! if os.name == "posix": ! # We don't try to cache the template on posix: the pid may change on us ! # between calls due to a fork, and on Linux the pid changes even for ! # another thread in the same process. Since any attempt to keep the ! # cache in synch would have to call os.getpid() anyway in order to make ! # sure the pid hasn't changed between calls, a cache wouldn't save any ! # time. In addition, a cache is difficult to keep correct with the pid ! # changing willy-nilly, and earlier attempts proved buggy (races). ! template = None ! # Else the pid never changes, so gettempprefix always returns the same ! # string. ! elif os.name == "nt": ! template = '~' + `os.getpid()` + '-' ! elif os.name in ('mac', 'riscos'): ! template = 'Python-Tmp-' ! else: ! template = 'tmp' # XXX might choose a better one def gettempprefix(): ! """Function to calculate a prefix of the filename to use. ! This incorporates the current process id on systems that support such a ! notion, so that concurrent processes don't generate the same prefix. """ ! global template ! if template is None: ! return '@' + `os.getpid()` + '.' else: ! return template ! def mktemp(suffix=""): ! """User-callable function to return a unique temporary file name.""" ! dir = gettempdir() ! pre = gettempprefix() ! while 1: ! i = _counter.get_next() ! file = os.path.join(dir, pre + str(i) + suffix) ! if not os.path.exists(file): return file ! class TemporaryFileWrapper: ! """Temporary file wrapper ! This class provides a wrapper around files opened for temporary use. ! In particular, it seeks to automatically remove the file when it is ! no longer needed. """ ! # Cache the unlinker so we don't get spurious errors at shutdown ! # when the module-level "os" is None'd out. Note that this must ! # be referenced as self.unlink, because the name TemporaryFileWrapper ! # may also get None'd out before __del__ is called. ! unlink = os.unlink ! def __init__(self, file, path): ! self.file = file ! self.path = path ! self.close_called = 0 ! def close(self): ! if not self.close_called: ! self.close_called = 1 ! self.file.close() ! self.unlink(self.path) ! def __del__(self): ! self.close() def __getattr__(self, name): --- 1,359 ---- ! """Temporary files. ! This module provides generic, low- and high-level interfaces for ! creating temporary files and directories. The interfaces listed ! as "safe" just below can be used without fear of race conditions. ! Those listed as "unsafe" cannot, and are provided for backward ! compatibility only. ! This module also provides some data items to the user: ! TMP_MAX - maximum number of names that will be tried before ! giving up. ! template - the default prefix for all temporary names. ! You may change this to control the default prefix. ! tempdir - If this is set to a string before the first use of ! any routine from this module, it will be considered as ! another candidate location to store temporary files. ! """ ! ! __all__ = [ ! "NamedTemporaryFile", "TemporaryFile", # high level safe interfaces ! "mkstemp", "mkdtemp", # low level safe interfaces ! "mktemp", # deprecated unsafe interface ! "TMP_MAX", "gettempprefix", # constants ! "tempdir", "gettempdir" ! ] ! ! ! # Imports. ! ! import os as _os ! import errno as _errno ! from random import Random as _Random ! ! if _os.name == 'mac': ! import macfs as _macfs ! import MACFS as _MACFS ! ! try: ! import fcntl as _fcntl ! def _set_cloexec(fd): ! flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) ! if flags >= 0: ! # flags read successfully, modify ! flags |= _fcntl.FD_CLOEXEC ! _fcntl.fcntl(fd, _fcntl.F_SETFD, flags) ! except (ImportError, AttributeError): ! def _set_cloexec(fd): ! pass ! ! try: ! import thread as _thread ! _allocate_lock = _thread.allocate_lock ! except (ImportError, AttributeError): ! class _allocate_lock: ! def acquire(self): ! pass ! release = acquire ! ! _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL ! if hasattr(_os, 'O_NOINHERIT'): _text_openflags |= _os.O_NOINHERIT ! if hasattr(_os, 'O_NOFOLLOW'): _text_openflags |= _os.O_NOFOLLOW ! ! _bin_openflags = _text_openflags ! if hasattr(_os, 'O_BINARY'): _bin_openflags |= _os.O_BINARY ! ! if hasattr(_os, 'TMP_MAX'): ! TMP_MAX = _os.TMP_MAX ! else: ! TMP_MAX = 10000 ! ! if _os.name == 'nt': ! template = '~t' # cater to eight-letter limit ! else: ! template = "tmp" tempdir = None ! # Internal routines. ! _once_lock = _allocate_lock() ! ! def _once(var, initializer): ! """Wrapper to execute an initialization operation just once, ! even if multiple threads reach the same point at the same time. ! ! var is the name (as a string) of the variable to be entered into ! the current global namespace. ! ! initializer is a callable which will return the appropriate initial ! value for variable. It will be called only if variable is not ! present in the global namespace, or its current value is None. ! ! Do not call _once from inside an initializer routine, it will deadlock. ! """ ! ! vars = globals() ! lock = _once_lock ! ! # Check first outside the lock. ! if var in vars and vars[var] is not None: ! return try: ! lock.acquire() ! # Check again inside the lock. ! if var in vars and vars[var] is not None: ! return ! vars[var] = initializer() finally: ! lock.release() ! ! class _RandomNameSequence: ! """An instance of _RandomNameSequence generates an endless ! sequence of unpredictable strings which can safely be incorporated ! into file names. Each string is six characters long. Multiple ! threads can safely use the same instance at the same time. ! ! _RandomNameSequence is an iterator.""" ! ! characters = ( "abcdefghijklmnopqrstuvwxyz" ! + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ! + "0123456789-_") ! ! def __init__(self): ! self.mutex = _allocate_lock() ! self.rng = _Random() ! self.normcase = _os.path.normcase ! def __iter__(self): ! return self ! ! def next(self): ! m = self.mutex ! c = self.characters ! r = self.rng try: ! m.acquire() ! letters = ''.join([r.choice(c), r.choice(c), r.choice(c), ! r.choice(c), r.choice(c), r.choice(c)]) ! finally: ! m.release() ! ! return self.normcase(letters) ! ! def _candidate_tempdir_list(): ! """Generate a list of candidate temporary directories which ! _get_default_tempdir will try.""" ! ! dirlist = [] ! ! # First, try the environment. for envname in 'TMPDIR', 'TEMP', 'TMP': ! dirname = _os.getenv(envname) ! if dirname: dirlist.append(dirname) ! ! # Failing that, try OS-specific locations. ! if _os.name == 'mac': try: ! refnum, dirid = _macfs.FindFolder(_MACFS.kOnSystemDisk, ! _MACFS.kTemporaryFolderType, 1) ! dirname = _macfs.FSSpec((refnum, dirid, '')).as_pathname() ! dirlist.append(dirname) ! except _macfs.error: ! pass ! elif _os.name == 'riscos': ! dirname = _os.getenv('Wimp$ScrapDir') ! if dirname: dirlist.append(dirname) ! elif _os.name == 'nt': ! dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ]) ! else: ! dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ]) ! ! # As a last resort, the current directory. ! try: ! dirlist.append(_os.getcwd()) ! except (AttributeError, _os.error): ! dirlist.append(_os.curdir) ! ! return dirlist ! ! def _get_default_tempdir(): ! """Calculate the default directory to use for temporary files. ! This routine should be called through '_once' (see above) as we ! do not want multiple threads attempting this calculation simultaneously. ! ! We determine whether or not a candidate temp dir is usable by ! trying to create and write to a file in that directory. If this ! is successful, the test file is deleted. To prevent denial of ! service, the name of the test file must be randomized.""" ! ! namer = _RandomNameSequence() ! dirlist = _candidate_tempdir_list() ! flags = _text_openflags ! ! for dir in dirlist: ! if dir != _os.curdir: ! dir = _os.path.normcase(_os.path.abspath(dir)) ! # Try only a few names per directory. ! for seq in xrange(100): ! name = namer.next() ! filename = _os.path.join(dir, name) ! try: ! fd = _os.open(filename, flags, 0600) ! fp = _os.fdopen(fd, 'w') fp.write('blat') fp.close() ! _os.unlink(filename) ! del fp, fd ! return dir ! except (OSError, IOError), e: ! if e[0] != _errno.EEXIST: ! break # no point trying more names in this directory ! pass ! raise IOError, (_errno.ENOENT, ! ("No usable temporary directory found in %s" % dirlist)) + def _get_candidate_names(): + """Common setup sequence for all user-callable interfaces.""" ! _once('_name_sequence', _RandomNameSequence) ! return _name_sequence ! ! def _mkstemp_inner(dir, pre, suf, flags): ! """Code common to mkstemp, TemporaryFile, and NamedTemporaryFile.""" ! ! names = _get_candidate_names() ! ! for seq in xrange(TMP_MAX): ! name = names.next() ! file = _os.path.join(dir, pre + name + suf) ! try: ! fd = _os.open(file, flags, 0600) ! _set_cloexec(fd) ! return (fd, file) ! except OSError, e: ! if e.errno == _errno.EEXIST: ! continue # try again ! raise ! ! raise IOError, (_errno.EEXIST, "No usable temporary file name found") ! ! ! # User visible interfaces. def gettempprefix(): ! """Accessor for tempdir.template.""" ! return template ! def gettempdir(): ! """Accessor for tempdir.tempdir.""" ! _once('tempdir', _get_default_tempdir) ! return tempdir ! ! def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=1): ! """mkstemp([suffix, [prefix, [dir, [binary]]]]) ! User-callable function to create and return a unique temporary ! file. The return value is a pair (fd, name) where fd is the ! file descriptor returned by os.open, and name is the filename. ! ! If 'suffix' is specified, the file name will end with that suffix, ! otherwise there will be no suffix. ! ! If 'prefix' is specified, the file name will begin with that prefix, ! otherwise a default prefix is used. ! ! If 'dir' is specified, the file will be created in that directory, ! otherwise a default directory is used. ! ! If 'binary' is specified and false, the file is opened in binary ! mode. Otherwise, the file is opened in text mode. On some ! operating systems, this makes no difference. ! ! The file is readable and writable only by the creating user ID. ! If the operating system uses permission bits to indicate whether a ! file is executable, the file is executable by no one. The file ! descriptor is not inherited by children of this process. ! ! Caller is responsible for deleting the file when done with it. """ ! if binary: ! flags = _bin_openflags else: ! flags = _text_openflags + return _mkstemp_inner(dir, prefix, suffix, flags) ! ! def mkdtemp(suffix="", prefix=template, dir=gettempdir()): ! """mkdtemp([suffix, [prefix, [dir]]]) ! User-callable function to create and return a unique temporary ! directory. The return value is the pathname of the directory. ! ! Arguments are as for mkstemp, except that the 'binary' argument is ! not accepted. ! ! The directory is readable, writable, and searchable only by the ! creating user. ! ! Caller is responsible for deleting the directory when done with it. ! """ ! ! names = _get_candidate_names() ! ! for seq in xrange(TMP_MAX): ! name = names.next() ! file = _os.path.join(dir, prefix + name + suffix) ! try: ! _os.mkdir(file, 0700) return file + except OSError, e: + if e.errno == _errno.EEXIST: + continue # try again + raise + raise IOError, (_errno.EEXIST, "No usable temporary directory name found") ! def mktemp(suffix="", prefix=template, dir=gettempdir()): ! """mktemp([suffix, [prefix, [dir]]]) ! User-callable function to return a unique temporary file name. The ! file is not created. ! Arguments are as for mkstemp, except that the 'binary' argument is ! not accepted. ! ! This function is unsafe and should not be used. The file name ! refers to a file that did not exist at some point, but by the time ! you get around to creating it, someone else may have beaten you to ! the punch. """ ! from warnings import warn as _warn ! _warn("mktemp is a potential security risk to your program", ! RuntimeWarning, stacklevel=2) ! names = _get_candidate_names() ! for seq in xrange(TMP_MAX): ! name = names.next() ! file = _os.path.join(dir, prefix + name + suffix) ! if not _os.path.exists(file): ! return file ! raise IOError, (_errno.EEXIST, "No usable temporary filename found") ! class _TemporaryFileWrapper: ! """Temporary file wrapper ! ! This class provides a wrapper around files opened for ! temporary use. In particular, it seeks to automatically ! remove the file when it is no longer needed. ! """ ! ! def __init__(self, file, name): ! self.file = file ! self.name = name ! self.close_called = 0 def __getattr__(self, name): *************** *** 181,272 **** return a ! try: ! import fcntl as _fcntl ! def _set_cloexec(fd, flag=_fcntl.FD_CLOEXEC): ! flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) ! if flags >= 0: ! # flags read successfully, modify ! flags |= flag ! _fcntl.fcntl(fd, _fcntl.F_SETFD, flags) ! except (ImportError, AttributeError): ! def _set_cloexec(fd): ! pass ! def TemporaryFile(mode='w+b', bufsize=-1, suffix=""): ! """Create and return a temporary file (opened read-write by default).""" ! name = mktemp(suffix) ! if os.name == 'posix': ! # Unix -- be very careful ! fd = os.open(name, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700) ! _set_cloexec(fd) ! try: ! os.unlink(name) ! return os.fdopen(fd, mode, bufsize) ! except: ! os.close(fd) ! raise ! elif os.name == 'nt': ! # Windows -- can't unlink an open file, but O_TEMPORARY creates a ! # file that "deletes itself" when the last handle is closed. ! # O_NOINHERIT ensures processes created via spawn() don't get a ! # handle to this too. That would be a security hole, and, on my ! # Win98SE box, when an O_TEMPORARY file is inherited by a spawned ! # process, the fd in the spawned process seems to lack the ! # O_TEMPORARY flag, so the file doesn't go away by magic then if the ! # spawning process closes it first. ! flags = (os.O_RDWR | os.O_CREAT | os.O_EXCL | ! os.O_TEMPORARY | os.O_NOINHERIT) ! if 'b' in mode: ! flags |= os.O_BINARY ! fd = os.open(name, flags, 0700) ! return os.fdopen(fd, mode, bufsize) ! else: ! # Assume we can't unlink a file that's still open, or arrange for ! # an automagically self-deleting file -- use wrapper. ! file = open(name, mode, bufsize) ! return TemporaryFileWrapper(file, name) ! # In order to generate unique names, mktemp() uses _counter.get_next(). ! # This returns a unique integer on each call, in a threadsafe way (i.e., ! # multiple threads will never see the same integer). The integer will ! # usually be a Python int, but if _counter.get_next() is called often ! # enough, it will become a Python long. ! # Note that the only names that survive this next block of code ! # are "_counter" and "_tempdir_lock". ! class _ThreadSafeCounter: ! def __init__(self, mutex, initialvalue=0): ! self.mutex = mutex ! self.i = initialvalue ! def get_next(self): ! self.mutex.acquire() ! result = self.i ! try: ! newi = result + 1 ! except OverflowError: ! newi = long(result) + 1 ! self.i = newi ! self.mutex.release() ! return result ! try: ! import thread ! except ImportError: ! class _DummyMutex: ! def acquire(self): ! pass ! release = acquire ! _counter = _ThreadSafeCounter(_DummyMutex()) ! _tempdir_lock = _DummyMutex() ! del _DummyMutex else: ! _counter = _ThreadSafeCounter(thread.allocate_lock()) ! _tempdir_lock = thread.allocate_lock() ! del thread ! del _ThreadSafeCounter --- 364,443 ---- return a ! # NT provides delete-on-close as a primitive, so we don't need ! # the wrapper to do anything special. We still use it so that ! # file.name is useful (i.e. not "(fdopen)") with NamedTemporaryFile. ! if _os.name != 'nt': ! # Cache the unlinker so we don't get spurious errors at ! # shutdown when the module-level "os" is None'd out. Note ! # that this must be referenced as self.unlink, because the ! # name TemporaryFileWrapper may also get None'd out before ! # __del__ is called. ! unlink = _os.unlink ! def close(self): ! if not self.close_called: ! self.close_called = 1 ! self.file.close() ! self.unlink(self.name) ! def __del__(self): ! self.close() ! def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", ! prefix=template, dir=gettempdir()): ! """Create and return a temporary file. ! Arguments: ! 'prefix', 'suffix', 'dir' -- as for mkstemp. ! 'mode' -- the mode argument to os.fdopen (default "w+b"). ! 'bufsize' -- the buffer size argument to os.fdopen (default -1). ! The file is created as mkstemp() would do it. ! Returns a file object; the name of the file is accessible as ! file.name. The file will be automatically deleted when it is ! closed. ! """ ! bin = 'b' in mode ! if bin: flags = _bin_openflags ! else: flags = _text_openflags ! # Setting O_TEMPORARY in the flags causes the OS to delete ! # the file when it is closed. This is only supported by Windows. ! if _os.name == 'nt': ! flags |= _os.O_TEMPORARY ! (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) ! file = _os.fdopen(fd, mode, bufsize) ! return _TemporaryFileWrapper(file, name) ! ! if _os.name != 'posix': ! # On non-POSIX systems, assume that we cannot unlink a file while ! # it is open. ! TemporaryFile = NamedTemporaryFile else: ! def TemporaryFile(mode='w+b', bufsize=-1, suffix="", ! prefix=template, dir=gettempdir()): ! """Create and return a temporary file. ! Arguments: ! 'prefix', 'suffix', 'directory' -- as for mkstemp. ! 'mode' -- the mode argument to os.fdopen (default "w+b"). ! 'bufsize' -- the buffer size argument to os.fdopen (default -1). ! The file is created as mkstemp() would do it. ! Returns a file object. The file has no name, and will cease to ! exist when it is closed. ! """ ! ! bin = 'b' in mode ! if bin: flags = _bin_openflags ! else: flags = _text_openflags ! ! (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) ! try: ! _os.unlink(name) ! return _os.fdopen(fd, mode, bufsize) ! except: ! _os.close(fd) ! raise From gvanrossum@users.sourceforge.net Fri Aug 9 17:16:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:16:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtempfile.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13633 Modified Files: libtempfile.tex Log Message: Doc portion of SF 589982 (tempfile.py rewrite, by Zack Weinberg). Fred, please review! Index: libtempfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtempfile.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libtempfile.tex 28 Nov 2001 07:26:15 -0000 1.17 --- libtempfile.tex 9 Aug 2002 16:16:30 -0000 1.18 *************** *** 1,37 **** \section{\module{tempfile} --- ! Generate temporary file names} \declaremodule{standard}{tempfile} ! \modulesynopsis{Generate temporary file names.} \indexii{temporary}{file name} \indexii{temporary}{file} ! This module generates temporary file names. It is not \UNIX{} specific, ! but it may require some help on non-\UNIX{} systems. ! The module defines the following user-callable functions: ! \begin{funcdesc}{mktemp}{\optional{suffix}} ! Return a unique temporary filename. This is an absolute pathname of a ! file that does not exist at the time the call is made. No two calls ! will return the same filename. \var{suffix}, if provided, is used as ! the last part of the generated file name. This can be used to provide ! a filename extension or other identifying information that may be ! useful on some platforms. ! \end{funcdesc} ! \begin{funcdesc}{TemporaryFile}{\optional{mode\optional{, ! bufsize\optional{, suffix}}}} Return a file (or file-like) object that can be used as a temporary ! storage area. The file is created in the most secure manner available ! in the appropriate temporary directory for the host platform. Under ! \UNIX, the directory entry to the file is removed so that it is secure ! against attacks which involve creating symbolic links to the file or ! replacing the file with a symbolic link to some other file. For other ! platforms, which don't allow removing the directory entry while the ! file is in use, the file is automatically deleted as soon as it is ! closed (including an implicit close when it is garbage-collected). The \var{mode} parameter defaults to \code{'w+b'} so that the file --- 1,45 ---- \section{\module{tempfile} --- ! Generate temporary files and directories} ! \sectionauthor{Zack Weinberg}{zack@codesourcery.com} \declaremodule{standard}{tempfile} ! \modulesynopsis{Generate temporary files and directories.} \indexii{temporary}{file name} \indexii{temporary}{file} + This module generates temporary files and directories. It works on + all supported platforms. ! In version 2.3 of Python, this module was overhauled for enhanced ! security. It now provides three new functions, ! \function{NamedTemporaryFile}, \function{mkstemp}, and ! \function{mkdtemp}, which should eliminate all remaining need to use ! the insecure \function{mktemp} function. Temporary file names created ! by this module no longer contain the process ID; instead a string of ! six random characters is used. ! Also, all the user-callable functions now take additional arguments ! which allow direct control over the location and name of temporary ! files. It is no longer necessary to use the global \var{tempdir} and ! \var{template} variables. To maintain backward compatibility, the ! argument order is somewhat odd; it is recommended to use keyword ! arguments for clarity. ! The module defines the following user-callable functions: ! \begin{funcdesc}{TemporaryFile}{\optional{mode='w+b'} ! \optional{, bufsize=-1} ! \optional{, suffix} ! \optional{, prefix} ! \optional{, dir}} Return a file (or file-like) object that can be used as a temporary ! storage area. The file is created using \function{mkstemp}. It will ! be destroyed as soon as it is closed (including an implicit close when ! the object is garbage collected). Under \UNIX, the directory entry ! for the file is removed immediately after the file is created. Other ! platforms do not support this; your code should not rely on a ! \class{TemporaryFile} having or not having a visible name in the file ! system. The \var{mode} parameter defaults to \code{'w+b'} so that the file *************** *** 39,64 **** used so that it behaves consistently on all platforms without regard for the data that is stored. \var{bufsize} defaults to \code{-1}, ! meaning that the operating system default is used. \var{suffix} is ! passed to \function{mktemp()}. \end{funcdesc} The module uses two global variables that tell it how to construct a ! temporary name. The caller may assign values to them; by default they ! are initialized at the first call to \function{mktemp()}. \begin{datadesc}{tempdir} When set to a value other than \code{None}, this variable defines the ! directory in which filenames returned by \function{mktemp()} reside. ! The default is taken from the environment variable \envvar{TMPDIR}; if ! this is not set, either \file{/usr/tmp} is used (on \UNIX), or the ! current working directory (all other systems). No check is made to ! see whether its value is valid. \end{datadesc} ! \begin{funcdesc}{gettempprefix}{} ! Return the filename prefix used to create temporary files. This does ! not contain the directory component. Using this function is preferred ! over using the \code{template} variable directly. ! \versionadded{1.5.2} \end{funcdesc} --- 47,176 ---- used so that it behaves consistently on all platforms without regard for the data that is stored. \var{bufsize} defaults to \code{-1}, ! meaning that the operating system default is used. ! ! The \var{dir}, \var{prefix} and \var{suffix} parameters are passed to ! \function{mkstemp}. ! \end{funcdesc} ! ! \begin{funcdesc}{NamedTemporaryFile}{\optional{mode='w+b'} ! \optional{, bufsize=-1} ! \optional{, suffix} ! \optional{, prefix} ! \optional{, dir}} ! This function operates exactly as \function{TemporaryFile} does, ! except that the file is guaranteed to have a visible name in the file ! system. That name can be retrieved from the \member{name} member of ! the file object. ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{mkstemp}{\optional{suffix} ! \optional{, prefix} ! \optional{, dir} ! \optional{, binary=1}} ! Creates a temporary file in the most secure manner possible. There ! are no race conditions in the file's creation, assuming that the ! platform properly implements the \constant{O_EXCL} flag for ! \function{os.open}. The file is readable and writable only by the ! creating user ID. If the platform uses permission bits to indicate ! whether a file is executable, the file is executable by no one. The ! file descriptor is not inherited by child processes. ! ! Unlike \function{TemporaryFile}, the user of \function{mkstemp} is ! responsible for deleting the temporary file when done with it. ! ! If \var{suffix} is specified, the file name will end with that suffix, ! otherwise there will be no suffix. \function{mkstemp} does not put a ! dot between the file name and the suffix; if you need one, put it at ! the beginning of \var{suffix}. ! ! If \var{prefix} is specified, the file name will begin with that ! prefix; otherwise, a default prefix is used. ! ! If \var{dir} is specified, the file will be created in that directory; ! otherwise, a default directory is used. ! ! If \var{binary} is specified, it indicates whether to open the file in ! binary mode (the default) or text mode. On some platforms, this makes ! no difference. ! ! \function{mkstemp} returns a tuple containing an OS-level handle to ! an open file (as would be returned by \function{os.open}) and the ! absolute pathname of that file, in that order. ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{mkdtemp}{\optional{suffix} ! \optional{, prefix} ! \optional{, dir}} ! Creates a temporary directory in the most secure manner possible. ! There are no race conditions in the directory's creation. The ! directory is readable, writable, and searchable only by the ! creating user ID. ! ! The user of \function{mkdtemp} is responsible for deleting the ! temporary directory and its contents when done with it. ! ! The \var{prefix}, \var{suffix}, and \var{dir} arguments are the same ! as for \function{mkstemp}. ! ! \function{mkdtemp} returns the absolute pathname of the new directory. ! \versionadded{2.3} ! \end{funcdesc} ! ! \begin{funcdesc}{mktemp}{\optional{suffix} ! \optional{, prefix} ! \optional{, dir}} ! \deprecated{2.3}{Use \function{mkstemp()} instead.} ! Return an absolute pathname of a file that did not exist at the time ! the call is made. The \var{prefix}, \var{suffix}, and \var{dir} ! arguments are the same as for \function{mkstemp}. ! ! \warning{Use of this function may introduce a security hole in your ! program. By the time you get around to doing anything with the file ! name it returns, someone else may have beaten you to the punch.} \end{funcdesc} The module uses two global variables that tell it how to construct a ! temporary name. They are initialized at the first call to any of the ! functions above. The caller may change them, but this is discouraged; ! use the appropriate function arguments, instead. \begin{datadesc}{tempdir} When set to a value other than \code{None}, this variable defines the ! default value for the \var{dir} argument to all the functions defined ! in this module. ! ! If \var{tempdir} is unset or \code{None} at any call to any of the ! above functions, Python searches a standard list of directories and ! sets \var{tempdir} to the first one which the calling user can create ! files in. The list is: ! ! \begin{enumerate} ! \item The directory named by the \envvar{TMPDIR} environment variable. ! \item The directory named by the \envvar{TEMP} environment variable. ! \item The directory named by the \envvar{TMP} environment variable. ! \item A platform-specific location: ! \begin{itemize} ! \item On Macintosh, the \file{Temporary Items} folder. ! \item On RiscOS, the directory named by the ! \envvar{Wimp\$ScrapDir} environment variable. ! \item On Windows, the directories ! \file{C:$\backslash$TEMP}, ! \file{C:$\backslash$TMP}, ! \file{$\backslash$TEMP}, and ! \file{$\backslash$TMP}, in that order. ! \item On all other platforms, the directories ! \file{/tmp}, \file{/var/tmp}, and \file{/usr/tmp}, in that order. ! \end{itemize} ! \item As a last resort, the current working directory. ! \end{enumerate} \end{datadesc} ! \begin{funcdesc}{gettempdir}{} ! Return the directory currently selected to create temporary files in. ! If \var{tempdir} is not None, this simply returns its contents; ! otherwise, the search described above is performed, and the result ! returned. \end{funcdesc} *************** *** 67,75 **** When set to a value other than \code{None}, this variable defines the prefix of the final component of the filenames returned by ! \function{mktemp()}. A string of decimal digits is added to generate ! unique filenames. The default is either \file{@\var{pid}.} where ! \var{pid} is the current process ID (on \UNIX), ! \file{\textasciitilde\var{pid}-} on Windows NT, \file{Python-Tmp-} on ! MacOS, or \file{tmp} (all other systems). Older versions of this module used to require that \code{template} be --- 179,186 ---- When set to a value other than \code{None}, this variable defines the prefix of the final component of the filenames returned by ! \function{mktemp()}. A string of six random letters and digits is ! appended to the prefix to make the filename unique. On Windows, ! the default prefix is \file{\textasciitilde{}T}; on all other systems ! it is \file{tmp}. Older versions of this module used to require that \code{template} be *************** *** 77,78 **** --- 188,196 ---- been necessary since version 1.5.2. \end{datadesc} + + \begin{funcdesc}{gettempprefix}{} + Return the filename prefix used to create temporary files. This does + not contain the directory component. Using this function is preferred + over reading the \var{template} variable directly. + \versionadded{1.5.2} + \end{funcdesc} From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_wininst.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib/distutils/command Modified Files: bdist_wininst.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** bdist_wininst.py 29 Jul 2002 12:11:18 -0000 1.34 --- bdist_wininst.py 9 Aug 2002 16:37:34 -0000 1.35 *************** *** 131,136 **** # And make an archive relative to the root of the # pseudo-installation tree. ! from tempfile import mktemp ! archive_basename = mktemp() fullname = self.distribution.get_fullname() arcname = self.make_archive(archive_basename, "zip", --- 131,137 ---- # And make an archive relative to the root of the # pseudo-installation tree. ! from tempfile import NamedTemporaryFile ! arc = NamedTemporaryFile(".zip") ! archive_basename = arc.name[:-4] fullname = self.distribution.get_fullname() arcname = self.make_archive(archive_basename, "zip", *************** *** 140,144 **** # remove the zip-file again log.debug("removing temporary file '%s'", arcname) ! os.remove(arcname) if not self.keep_temp: --- 141,145 ---- # remove the zip-file again log.debug("removing temporary file '%s'", arcname) ! arc.close() if not self.keep_temp: From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/hotshot stones.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/hotshot In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib/hotshot Modified Files: stones.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: stones.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/hotshot/stones.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stones.py 18 Jul 2002 19:47:05 -0000 1.1 --- stones.py 9 Aug 2002 16:37:34 -0000 1.2 *************** *** 9,18 **** if sys.argv[1:]: logfile = sys.argv[1] - cleanup = 0 else: import tempfile ! logfile = tempfile.mktemp() ! cleanup = 1 ! p = hotshot.Profile(logfile) --- 9,16 ---- if sys.argv[1:]: logfile = sys.argv[1] else: import tempfile ! logf = tempfile.NamedTemporaryFile() ! logfile = logf.name p = hotshot.Profile(logfile) *************** *** 25,30 **** stats = hotshot.stats.load(logfile) - if cleanup: - os.unlink(logfile) stats.strip_dirs() stats.sort_stats('time', 'calls') --- 23,26 ---- From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-irix5 torgb.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix5 In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib/plat-irix5 Modified Files: torgb.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: torgb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix5/torgb.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** torgb.py 12 Dec 2000 23:11:42 -0000 1.6 --- torgb.py 9 Aug 2002 16:37:35 -0000 1.7 *************** *** 71,75 **** def _torgb(filename, temps): if filename[-2:] == '.Z': ! fname = tempfile.mktemp() temps.append(fname) sts = uncompress.copy(filename, fname) --- 71,76 ---- def _torgb(filename, temps): if filename[-2:] == '.Z': ! (fd, fname) = tempfile.mkstemp() ! os.close(fd) temps.append(fname) sts = uncompress.copy(filename, fname) *************** *** 92,96 **** raise error, \ filename + ': unsupported image file type ' + `ftype` ! temp = tempfile.mktemp() sts = table[ftype].copy(fname, temp) if sts: --- 93,98 ---- raise error, \ filename + ': unsupported image file type ' + `ftype` ! (fd, temp) = tempfile.mktemp() ! os.close(fd) sts = table[ftype].copy(fname, temp) if sts: From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-irix6 torgb.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix6 In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib/plat-irix6 Modified Files: torgb.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: torgb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/torgb.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** torgb.py 12 Dec 2000 23:11:42 -0000 1.3 --- torgb.py 9 Aug 2002 16:37:35 -0000 1.4 *************** *** 71,75 **** def _torgb(filename, temps): if filename[-2:] == '.Z': ! fname = tempfile.mktemp() temps.append(fname) sts = uncompress.copy(filename, fname) --- 71,76 ---- def _torgb(filename, temps): if filename[-2:] == '.Z': ! (fd, fname) = tempfile.mkstemp() ! os.close(fd) temps.append(fname) sts = uncompress.copy(filename, fname) *************** *** 92,96 **** raise error, \ filename + ': unsupported image file type ' + `ftype` ! temp = tempfile.mktemp() sts = table[ftype].copy(fname, temp) if sts: --- 93,98 ---- raise error, \ filename + ': unsupported image file type ' + `ftype` ! (fd, temp) = tempfile.mktemp() ! os.close(fd) sts = table[ftype].copy(fname, temp) if sts: From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:38 -0700 Subject: [Python-checkins] python/dist/src/Tools/faqwiz faqwiz.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/faqwiz In directory usw-pr-cvs1:/tmp/cvs-serv22967/Tools/faqwiz Modified Files: faqwiz.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: faqwiz.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/faqwiz/faqwiz.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** faqwiz.py 31 Mar 2000 00:58:00 -0000 1.26 --- faqwiz.py 9 Aug 2002 16:37:36 -0000 1.27 *************** *** 808,817 **** import tempfile ! tfn = tempfile.mktemp() ! f = open(tfn, 'w') ! emit(LOGHEADER, self.ui, os.environ, date=date, _file=f) ! f.close() ! command = interpolate(SH_CHECKIN, file=file, tfn=tfn) log("\n\n" + command) p = os.popen(command) --- 808,817 ---- import tempfile ! tf = tempfile.NamedTemporaryFile() ! emit(LOGHEADER, self.ui, os.environ, date=date, _file=tfn) ! tf.flush() ! tf.seek(0) ! command = interpolate(SH_CHECKIN, file=file, tfn=tf.name) log("\n\n" + command) p = os.popen(command) *************** *** 820,824 **** log("output: " + output) log("done: " + str(sts)) ! log("TempFile:\n" + open(tfn).read() + "end") if not sts: --- 820,824 ---- log("output: " + output) log("done: " + str(sts)) ! log("TempFile:\n" + tf.read() + "end") if not sts: From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:38 -0700 Subject: [Python-checkins] python/dist/src/Tools/compiler regrtest.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/compiler In directory usw-pr-cvs1:/tmp/cvs-serv22967/Tools/compiler Modified Files: regrtest.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/compiler/regrtest.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** regrtest.py 17 Sep 2001 21:31:35 -0000 1.3 --- regrtest.py 9 Aug 2002 16:37:36 -0000 1.4 *************** *** 16,21 **** def copy_test_suite(): ! dest = tempfile.mktemp() ! os.mkdir(dest) os.system("cp -r %s/* %s" % (test.__path__[0], dest)) print "Creating copy of test suite in", dest --- 16,20 ---- def copy_test_suite(): ! dest = tempfile.mkdtemp() os.system("cp -r %s/* %s" % (test.__path__[0], dest)) print "Creating copy of test suite in", dest *************** *** 23,28 **** def copy_library(): ! dest = tempfile.mktemp() ! os.mkdir(dest) libdir = os.path.split(test.__path__[0])[0] print "Found standard library in", libdir --- 22,26 ---- def copy_library(): ! dest = tempfile.mkdtemp() libdir = os.path.split(test.__path__[0])[0] print "Found standard library in", libdir From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:38 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle IOBinding.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv22967/Tools/idle Modified Files: IOBinding.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IOBinding.py 5 Aug 2002 14:55:20 -0000 1.8 --- IOBinding.py 9 Aug 2002 16:37:36 -0000 1.9 *************** *** 281,287 **** filename = self.filename else: ! filename = tempfilename = tempfile.mktemp() if not self.writefile(filename): ! os.unlink(tempfilename) return "break" edconf = idleconf.getsection('EditorWindow') --- 281,289 ---- filename = self.filename else: ! (tfd, tfn) = tempfile.mkstemp() ! os.close(tfd) ! filename = tfn if not self.writefile(filename): ! os.unlink(tfn) return "break" edconf = idleconf.getsection('EditorWindow') From gvanrossum@users.sourceforge.net Fri Aug 9 17:37:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:37:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.16,1.17 test_anydbm.py,1.2,1.3 test_binhex.py,1.13,1.14 test_bsddb.py,1.11,1.12 test_commands.py,1.6,1.7 test_dumbdbm.py,1.7,1.8 test_gzip.py,1.10,1.11 test_netrc.py,1.3,1.4 test_pkg.py,1.15,1.16 test_pkgimport.py,1.6,1.7 test_uu.py,1.4,1.5 test_wave.py,1.3,1.4 test_whichdb.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib/test Modified Files: pickletester.py test_anydbm.py test_binhex.py test_bsddb.py test_commands.py test_dumbdbm.py test_gzip.py test_netrc.py test_pkg.py test_pkgimport.py test_uu.py test_wave.py test_whichdb.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pickletester.py 30 Jul 2002 23:26:00 -0000 1.16 --- pickletester.py 9 Aug 2002 16:37:35 -0000 1.17 *************** *** 1,4 **** import unittest ! from test.test_support import TestFailed, have_unicode class C: --- 1,4 ---- import unittest ! from test.test_support import TestFailed, have_unicode, TESTFN class C: *************** *** 270,285 **** def test_dump_closed_file(self): ! import tempfile, os ! fn = tempfile.mktemp() ! f = open(fn, "w") ! f.close() ! self.assertRaises(ValueError, self.module.dump, 123, f) ! os.remove(fn) def test_load_closed_file(self): ! import tempfile, os ! fn = tempfile.mktemp() ! f = open(fn, "w") ! f.close() ! self.assertRaises(ValueError, self.module.dump, 123, f) ! os.remove(fn) --- 270,287 ---- def test_dump_closed_file(self): ! import os ! f = open(TESTFN, "w") ! try: ! f.close() ! self.assertRaises(ValueError, self.module.dump, 123, f) ! finally: ! os.remove(TESTFN) def test_load_closed_file(self): ! import os ! f = open(TESTFN, "w") ! try: ! f.close() ! self.assertRaises(ValueError, self.module.dump, 123, f) ! finally: ! os.remove(TESTFN) Index: test_anydbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_anydbm.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_anydbm.py 23 Jul 2002 19:03:43 -0000 1.2 --- test_anydbm.py 9 Aug 2002 16:37:35 -0000 1.3 *************** *** 7,15 **** import unittest import anydbm - import tempfile import glob from test import test_support ! _fname = tempfile.mktemp() def _delete_files(): --- 7,14 ---- import unittest import anydbm import glob from test import test_support ! _fname = test_support.TESTFN def _delete_files(): Index: test_binhex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binhex.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_binhex.py 23 Jul 2002 19:03:45 -0000 1.13 --- test_binhex.py 9 Aug 2002 16:37:35 -0000 1.14 *************** *** 7,11 **** import binhex import os - import tempfile import unittest from test import test_support --- 7,10 ---- *************** *** 15,20 **** def setUp(self): ! self.fname1 = tempfile.mktemp() ! self.fname2 = tempfile.mktemp() def tearDown(self): --- 14,19 ---- def setUp(self): ! self.fname1 = test_support.TESTFN + "1" ! self.fname2 = test_support.TESTFN + "2" def tearDown(self): Index: test_bsddb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_bsddb.py 23 Jul 2002 19:23:22 -0000 1.11 --- test_bsddb.py 9 Aug 2002 16:37:35 -0000 1.12 *************** *** 6,11 **** import bsddb import dbhash # Just so we know it's imported ! import tempfile ! from test.test_support import verbose, verify def test(openmethod, what, ondisk=1): --- 6,10 ---- import bsddb import dbhash # Just so we know it's imported ! from test.test_support import verbose, verify, TESTFN def test(openmethod, what, ondisk=1): *************** *** 15,19 **** if ondisk: ! fname = tempfile.mktemp() else: fname = None --- 14,18 ---- if ondisk: ! fname = TESTFN else: fname = None Index: test_commands.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_commands.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_commands.py 23 Jul 2002 19:03:46 -0000 1.6 --- test_commands.py 9 Aug 2002 16:37:35 -0000 1.7 *************** *** 25,32 **** self.assertEquals(getstatusoutput('echo xyzzy'), (0, 'xyzzy')) ! # we use mktemp in the next line to get a filename which we ! # _know_ won't exist. This is guaranteed to fail. ! status, output = getstatusoutput('cat ' + tempfile.mktemp()) ! self.assertNotEquals(status, 0) def test_getstatus(self): --- 25,39 ---- self.assertEquals(getstatusoutput('echo xyzzy'), (0, 'xyzzy')) ! # we use mkdtemp in the next line to create an empty directory ! # under our exclusive control; from that, we can invent a pathname ! # that we _know_ won't exist. This is guaranteed to fail. ! try: ! dir = tempfile.mkdtemp() ! name = os.path.join(dir, "foo") ! ! status, output = getstatusoutput('cat ' + name) ! self.assertNotEquals(status, 0) ! finally: ! os.rmdir(dir) def test_getstatus(self): Index: test_dumbdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dumbdbm.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_dumbdbm.py 23 Jul 2002 19:03:50 -0000 1.7 --- test_dumbdbm.py 9 Aug 2002 16:37:35 -0000 1.8 *************** *** 7,14 **** import unittest import dumbdbm - import tempfile from test import test_support ! _fname = tempfile.mktemp() def _delete_files(): --- 7,13 ---- import unittest import dumbdbm from test import test_support ! _fname = test_support.TESTFN def _delete_files(): Index: test_gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gzip.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_gzip.py 30 Jul 2002 23:26:01 -0000 1.10 --- test_gzip.py 9 Aug 2002 16:37:35 -0000 1.11 *************** *** 1,7 **** ! from test.test_support import verify import sys, os ! import gzip, tempfile ! filename = tempfile.mktemp() data1 = """ int length=DEFAULTALLOC, err = Z_OK; --- 1,7 ---- ! from test.test_support import verify, TESTFN import sys, os ! import gzip ! filename = TESTFN data1 = """ int length=DEFAULTALLOC, err = Z_OK; Index: test_netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_netrc.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_netrc.py 23 Jul 2002 19:03:57 -0000 1.3 --- test_netrc.py 9 Aug 2002 16:37:35 -0000 1.4 *************** *** 1,4 **** ! import netrc, os, tempfile, unittest from test import test_support --- 1,4 ---- ! import netrc, os, unittest from test import test_support *************** *** 18,22 **** """ ! temp_filename = tempfile.mktemp() class NetrcTestCase(unittest.TestCase): --- 18,22 ---- """ ! temp_filename = test_support.TESTFN class NetrcTestCase(unittest.TestCase): Index: test_pkg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkg.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_pkg.py 23 Jul 2002 19:03:58 -0000 1.15 --- test_pkg.py 9 Aug 2002 16:37:35 -0000 1.16 *************** *** 9,13 **** def mkhier(root, descr): ! mkdir(root) for name, contents in descr: comps = name.split() --- 9,14 ---- def mkhier(root, descr): ! if not os.path.isdir(root): ! mkdir(root) for name, contents in descr: comps = name.split() *************** *** 53,68 **** def runtest(hier, code): ! root = tempfile.mktemp() mkhier(root, hier) savepath = sys.path[:] ! codefile = tempfile.mktemp() ! f = open(codefile, "w") ! f.write(code) ! f.close() try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: ! execfile(codefile, globals(), {}) except: traceback.print_exc(file=sys.stdout) --- 54,68 ---- def runtest(hier, code): ! root = tempfile.mkdtemp() mkhier(root, hier) savepath = sys.path[:] ! codefile = tempfile.NamedTemporaryFile() ! codefile.write(code) ! codefile.flush() try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: ! execfile(codefile.name, globals(), {}) except: traceback.print_exc(file=sys.stdout) *************** *** 73,77 **** except (os.error, IOError): pass - os.remove(codefile) # Test descriptions --- 73,76 ---- Index: test_pkgimport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkgimport.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_pkgimport.py 23 Jul 2002 19:03:58 -0000 1.6 --- test_pkgimport.py 9 Aug 2002 16:37:36 -0000 1.7 *************** *** 18,23 **** def setUp(self): ! self.test_dir = tempfile.mktemp() ! os.mkdir(self.test_dir) sys.path.append(self.test_dir) self.package_dir = os.path.join(self.test_dir, --- 18,22 ---- def setUp(self): ! self.test_dir = tempfile.mkdtemp() sys.path.append(self.test_dir) self.package_dir = os.path.join(self.test_dir, Index: test_uu.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_uu.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_uu.py 23 Jul 2002 19:04:09 -0000 1.4 --- test_uu.py 9 Aug 2002 16:37:36 -0000 1.5 *************** *** 125,130 **** # Test to verify that decode() will refuse to overwrite an existing file ! import tempfile ! outfile = tempfile.mktemp() inp = StringIO('Here is a message to be uuencoded') out = StringIO() --- 125,129 ---- # Test to verify that decode() will refuse to overwrite an existing file ! outfile = TESTFN + "out" inp = StringIO('Here is a message to be uuencoded') out = StringIO() Index: test_wave.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_wave.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_wave.py 23 Jul 2002 19:04:09 -0000 1.3 --- test_wave.py 9 Aug 2002 16:37:36 -0000 1.4 *************** *** 1,4 **** ! from test.test_support import TestFailed ! import os, tempfile import wave --- 1,4 ---- ! from test.test_support import TestFailed, TESTFN ! import os import wave *************** *** 12,18 **** nframes = 100 ! testfile = tempfile.mktemp() ! ! f = wave.open(testfile, 'wb') f.setnchannels(nchannels) f.setsampwidth(sampwidth) --- 12,16 ---- nframes = 100 ! f = wave.open(TESTFN, 'wb') f.setnchannels(nchannels) f.setsampwidth(sampwidth) *************** *** 23,27 **** f.close() ! f = wave.open(testfile, 'rb') check(nchannels == f.getnchannels(), "nchannels") check(sampwidth == f.getsampwidth(), "sampwidth") --- 21,25 ---- f.close() ! f = wave.open(TESTFN, 'rb') check(nchannels == f.getnchannels(), "nchannels") check(sampwidth == f.getsampwidth(), "sampwidth") *************** *** 32,34 **** f.close() ! os.remove(testfile) --- 30,32 ---- f.close() ! os.remove(TESTFN) Index: test_whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_whichdb.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_whichdb.py 8 Aug 2002 20:19:19 -0000 1.2 --- test_whichdb.py 9 Aug 2002 16:37:36 -0000 1.3 *************** *** 12,16 **** import glob ! _fname = tempfile.mktemp() def _delete_files(): --- 12,16 ---- import glob ! _fname = test.test_support.TESTFN def _delete_files(): From gvanrossum@users.sourceforge.net Fri Aug 9 17:38:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:38:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils util.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib/distutils Modified Files: util.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** util.py 4 Jun 2002 20:14:42 -0000 1.68 --- util.py 9 Aug 2002 16:37:34 -0000 1.69 *************** *** 360,368 **** # run it with the appropriate flags. if not direct: ! from tempfile import mktemp ! script_name = mktemp(".py") log.info("writing byte-compilation script '%s'", script_name) if not dry_run: ! script = open(script_name, "w") script.write("""\ --- 360,368 ---- # run it with the appropriate flags. if not direct: ! from tempfile import mkstemp ! (script_fd, script_name) = mkstemp(".py") log.info("writing byte-compilation script '%s'", script_name) if not dry_run: ! script = os.fdopen(script_fd, "w") script.write("""\ From gvanrossum@users.sourceforge.net Fri Aug 9 17:38:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:38:06 -0700 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.5,1.6 mimetools.py,1.26,1.27 pipes.py,1.11,1.12 pydoc.py,1.66,1.67 toaiff.py,1.12,1.13 urllib.py,1.148,1.149 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22967/Lib Modified Files: cgitb.py mimetools.py pipes.py pydoc.py toaiff.py urllib.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cgitb.py 26 Jun 2002 07:10:56 -0000 1.5 --- cgitb.py 9 Aug 2002 16:37:33 -0000 1.6 *************** *** 194,201 **** if self.logdir is not None: import os, tempfile ! name = tempfile.mktemp(['.html', '.txt'][text]) ! path = os.path.join(self.logdir, os.path.basename(name)) try: ! file = open(path, 'w') file.write(doc) file.close() --- 194,201 ---- if self.logdir is not None: import os, tempfile ! (fd, name) = tempfile.mkstemp(suffix=['.html', '.txt'][text], ! dir=self.logdir) try: ! file = os.fdopen(fd, 'w') file.write(doc) file.close() Index: mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetools.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mimetools.py 1 Jun 2002 14:18:46 -0000 1.26 --- mimetools.py 9 Aug 2002 16:37:33 -0000 1.27 *************** *** 203,208 **** def pipethrough(input, command, output): ! tempname = tempfile.mktemp() ! temp = open(tempname, 'w') copyliteral(input, temp) temp.close() --- 203,208 ---- def pipethrough(input, command, output): ! (fd, tempname) = tempfile.mkstemp() ! temp = os.fdopen(fd, 'w') copyliteral(input, temp) temp.close() Index: pipes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pipes.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pipes.py 2 Aug 2001 07:15:29 -0000 1.11 --- pipes.py 9 Aug 2002 16:37:33 -0000 1.12 *************** *** 226,230 **** rkind = list[i][2] if lkind[1] == 'f' or rkind[0] == 'f': ! temp = tempfile.mktemp() garbage.append(temp) list[i-1][-1] = list[i][0] = temp --- 226,231 ---- rkind = list[i][2] if lkind[1] == 'f' or rkind[0] == 'f': ! (fd, temp) = tempfile.mkstemp() ! os.close(fd) garbage.append(temp) list[i-1][-1] = list[i][0] = temp Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** pydoc.py 6 Aug 2002 17:29:38 -0000 1.66 --- pydoc.py 9 Aug 2002 16:37:33 -0000 1.67 *************** *** 1204,1209 **** import tempfile ! filename = tempfile.mktemp() ! open(filename, 'w').close() try: if hasattr(os, 'system') and os.system('more %s' % filename) == 0: --- 1204,1209 ---- import tempfile ! (fd, filename) = tempfile.mkstemp() ! os.close(fd) try: if hasattr(os, 'system') and os.system('more %s' % filename) == 0: *************** *** 1230,1235 **** """Page through text by invoking a program on a temporary file.""" import tempfile ! filename = tempfile.mktemp() ! file = open(filename, 'w') file.write(text) file.close() --- 1230,1235 ---- """Page through text by invoking a program on a temporary file.""" import tempfile ! (fd, filename) = tempfile.mkstemp() ! file = os.fdopen(fd, 'w') file.write(text) file.close() Index: toaiff.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/toaiff.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** toaiff.py 1 Jun 2002 14:18:47 -0000 1.12 --- toaiff.py 9 Aug 2002 16:37:33 -0000 1.13 *************** *** 76,80 **** def _toaiff(filename, temps): if filename[-2:] == '.Z': ! fname = tempfile.mktemp() temps.append(fname) sts = uncompress.copy(filename, fname) --- 76,81 ---- def _toaiff(filename, temps): if filename[-2:] == '.Z': ! (fd, fname) = tempfile.mkstemp() ! os.close(fd) temps.append(fname) sts = uncompress.copy(filename, fname) *************** *** 99,103 **** raise error, \ filename + ': unsupported audio file type ' + `ftype` ! temp = tempfile.mktemp() temps.append(temp) sts = table[ftype].copy(fname, temp) --- 100,105 ---- raise error, \ filename + ': unsupported audio file type ' + `ftype` ! (fd, temp) = tempfile.mktemp() ! os.close(fd) temps.append(temp) sts = table[ftype].copy(fname, temp) Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** urllib.py 11 Jun 2002 13:38:51 -0000 1.148 --- urllib.py 9 Aug 2002 16:37:33 -0000 1.149 *************** *** 213,217 **** fp = self.open(url, data) headers = fp.info() ! if not filename: import tempfile garbage, path = splittype(url) --- 213,219 ---- fp = self.open(url, data) headers = fp.info() ! if filename: ! tfp = open(filename, 'wb') ! else: import tempfile garbage, path = splittype(url) *************** *** 220,229 **** path, garbage = splitattr(path or "") suffix = os.path.splitext(path)[1] ! filename = tempfile.mktemp(suffix) self.__tempfiles.append(filename) result = filename, headers if self.tempcache is not None: self.tempcache[url] = result - tfp = open(filename, 'wb') bs = 1024*8 size = -1 --- 222,231 ---- path, garbage = splitattr(path or "") suffix = os.path.splitext(path)[1] ! (fd, filename) = tempfile.mkstemp(suffix) self.__tempfiles.append(filename) + tfp = os.open(fd, 'wb') result = filename, headers if self.tempcache is not None: self.tempcache[url] = result bs = 1024*8 size = -1 From gvanrossum@users.sourceforge.net Fri Aug 9 17:38:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:38:34 -0700 Subject: [Python-checkins] python/dist/src/Demo/pdist rcslib.py,1.8,1.9 rcvs.py,1.21,1.22 rrcs.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/pdist In directory usw-pr-cvs1:/tmp/cvs-serv23808/pdist Modified Files: rcslib.py rcvs.py rrcs.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: rcslib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rcslib.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rcslib.py 20 Jul 2001 19:00:52 -0000 1.8 --- rcslib.py 9 Aug 2002 16:38:32 -0000 1.9 *************** *** 144,163 **** message = message + '\n' lockflag = "-u" ! textfile = None ! try: ! if new: ! textfile = tempfile.mktemp() ! f = open(textfile, 'w') ! f.write(message) ! f.close() ! cmd = 'ci %s%s -t%s %s %s' % \ ! (lockflag, rev, textfile, otherflags, name) ! else: ! message = regsub.gsub('\([\\"$`]\)', '\\\\\\1', message) ! cmd = 'ci %s%s -m"%s" %s %s' % \ ! (lockflag, rev, message, otherflags, name) ! return self._system(cmd) ! finally: ! if textfile: self._remove(textfile) # --- Exported support methods --- --- 144,158 ---- message = message + '\n' lockflag = "-u" ! if new: ! f = tempfile.NamedTemporaryFile() ! f.write(message) ! f.flush() ! cmd = 'ci %s%s -t%s %s %s' % \ ! (lockflag, rev, f.name, otherflags, name) ! else: ! message = regsub.gsub('\([\\"$`]\)', '\\\\\\1', message) ! cmd = 'ci %s%s -m"%s" %s %s' % \ ! (lockflag, rev, message, otherflags, name) ! return self._system(cmd) # --- Exported support methods --- Index: rcvs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rcvs.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** rcvs.py 27 Nov 1996 19:49:24 -0000 1.21 --- rcvs.py 9 Aug 2002 16:38:32 -0000 1.22 *************** *** 173,187 **** return import tempfile ! tfn = tempfile.mktemp() ! try: ! tf = open(tfn, 'w') ! tf.write(data) ! tf.close() ! print 'diff %s -r%s %s' % (flags, rev, fn) ! sts = os.system('diff %s %s %s' % (flags, tfn, fn)) ! if sts: ! print '='*70 ! finally: ! remove(tfn) def commitcheck(self): --- 173,183 ---- return import tempfile ! tf = tempfile.NamedTemporaryFile() ! tf.write(data) ! tf.flush() ! print 'diff %s -r%s %s' % (flags, rev, fn) ! sts = os.system('diff %s %s %s' % (flags, tf.name, fn)) ! if sts: ! print '='*70 def commitcheck(self): Index: rrcs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/pdist/rrcs.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** rrcs.py 27 Nov 1996 19:49:26 -0000 1.6 --- rrcs.py 9 Aug 2002 16:38:32 -0000 1.7 *************** *** 103,117 **** flags = flags[1:] data = x.get(fn) ! tfn = tempfile.mktemp() ! try: ! tf = open(tfn, 'w') ! tf.write(data) ! tf.close() ! print 'diff %s -r%s %s' % (flags, x.head(fn), fn) ! sts = os.system('diff %s %s %s' % (flags, tfn, fn)) ! if sts: ! print '='*70 ! finally: ! remove(tfn) def same(x, copts, fn, data = None): --- 103,113 ---- flags = flags[1:] data = x.get(fn) ! tf = tempfile.NamedTemporaryFile() ! tf.write(data) ! tf.flush() ! print 'diff %s -r%s %s' % (flags, x.head(fn), fn) ! sts = os.system('diff %s %s %s' % (flags, tf.name, fn)) ! if sts: ! print '='*70 def same(x, copts, fn, data = None): From gvanrossum@users.sourceforge.net Fri Aug 9 17:38:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 09:38:34 -0700 Subject: [Python-checkins] python/dist/src/Demo/scripts pp.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/scripts In directory usw-pr-cvs1:/tmp/cvs-serv23808/scripts Modified Files: pp.py Log Message: Massive changes from SF 589982 (tempfile.py rewrite, by Zack Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones. Index: pp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/pp.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pp.py 27 Nov 1996 19:47:06 -0000 1.4 --- pp.py 9 Aug 2002 16:38:32 -0000 1.5 *************** *** 121,138 **** import tempfile ! tfn = tempfile.mktemp() ! try: ! fp = open(tfn, 'w') ! fp.write(program) ! fp.close() ! if DFLAG: ! import pdb ! pdb.run('execfile(' + `tfn` + ')') ! else: ! execfile(tfn) ! finally: ! import os ! try: ! os.unlink(tfn) ! except: ! pass --- 121,130 ---- import tempfile ! fp = tempfile.NamedTemporaryFile() ! fp.write(program) ! fp.flush() ! if DFLAG: ! import pdb ! pdb.run('execfile(' + `tfn` + ')') ! else: ! execfile(tfn) From gvanrossum@users.sourceforge.net Fri Aug 9 18:16:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 10:16:32 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.457,1.458 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13198 Modified Files: NEWS Log Message: News about the tempfile rewrite. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.457 retrieving revision 1.458 diff -C2 -d -r1.457 -r1.458 *** NEWS 9 Aug 2002 15:57:34 -0000 1.457 --- NEWS 9 Aug 2002 17:16:30 -0000 1.458 *************** *** 7,10 **** --- 7,20 ---- Core and builtins + - The tempfile module has been overhauled for enhanced security. The + mktemp() function is now deprecated; new, safe replacements are + mkstemp() (for files) and mkdtemp() (for directories), and the + higher-level functions NamedTemporaryFile() and TemporaryFile(). + Use of some global variables in this module is also deprecated; the + new functions have keyword arguments to provide the same + functionality. All Lib, Tools and Demo modules that used the unsafe + interfaces have been updated to use the safe replacements. Thanks + to Zack Weinberg! + - When x is an object whose class implements __mul__ and __rmul__, 1.0*x would correctly invoke __rmul__, but 1*x would erroneously From gvanrossum@users.sourceforge.net Fri Aug 9 18:17:09 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 10:17:09 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.458,1.459 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13545 Modified Files: NEWS Log Message: Credit to Oren for the file-iterator patch. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.458 retrieving revision 1.459 diff -C2 -d -r1.458 -r1.459 *** NEWS 9 Aug 2002 17:16:30 -0000 1.458 --- NEWS 9 Aug 2002 17:17:07 -0000 1.459 *************** *** 34,38 **** don't. It so happens that this gives a nice additional speed boost to "for line in file:"; the xreadlines method and corresponding ! module are now obsolete. - Encoding declarations (PEP 263, phase 1) have been implemented. A --- 34,38 ---- don't. It so happens that this gives a nice additional speed boost to "for line in file:"; the xreadlines method and corresponding ! module are now obsolete. Thanks to Oren Tirosh! - Encoding declarations (PEP 263, phase 1) have been implemented. A From gvanrossum@users.sourceforge.net Fri Aug 9 18:38:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 10:38:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24847 Modified Files: test_gc.py Log Message: Test finalizers and GC from inside __del__ for new classes. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_gc.py 23 Jul 2002 19:03:53 -0000 1.18 --- test_gc.py 9 Aug 2002 17:38:16 -0000 1.19 *************** *** 125,128 **** --- 125,152 ---- gc.garbage.remove(obj) + def test_finalizer_newclass(): + # A() is uncollectable if it is part of a cycle, make sure it shows up + # in gc.garbage. + class A(object): + def __del__(self): pass + class B(object): + pass + a = A() + a.a = a + id_a = id(a) + b = B() + b.b = b + gc.collect() + del a + del b + expect_nonzero(gc.collect(), "finalizer") + for obj in gc.garbage: + if id(obj) == id_a: + del obj.a + break + else: + raise TestFailed, "didn't find obj in garbage (finalizer)" + gc.garbage.remove(obj) + def test_function(): # Tricky: f -> d -> f, code should call d.clear() after the exec to *************** *** 178,181 **** --- 202,220 ---- apply(gc.set_threshold, thresholds) + def test_del_newclass(): + # __del__ methods can trigger collection, make this to happen + thresholds = gc.get_threshold() + gc.enable() + gc.set_threshold(1) + + class A(object): + def __del__(self): + dir(self) + a = A() + del a + + gc.disable() + apply(gc.set_threshold, thresholds) + class Ouch: n = 0 *************** *** 226,230 **** --- 265,271 ---- run_test("frames", test_frame) run_test("finalizers", test_finalizer) + run_test("finalizers (new class)", test_finalizer_newclass) run_test("__del__", test_del) + run_test("__del__ (new class)", test_del_newclass) run_test("saveall", test_saveall) run_test("trashcan", test_trashcan) From gvanrossum@users.sourceforge.net Fri Aug 9 18:39:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 10:39:17 -0700 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25289 Modified Files: gcmodule.c Log Message: For new-style classes, we can now test for tp_del instead of asking for a __del__ attribute, to see if there's a finalizer. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -d -r2.54 -r2.55 *** gcmodule.c 7 Jul 2002 05:13:56 -0000 2.54 --- gcmodule.c 9 Aug 2002 17:39:14 -0000 2.55 *************** *** 347,353 **** Py_FatalError("PyGC: can't initialize __del__ string"); } ! return (PyInstance_Check(op) || ! PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) ! && PyObject_HasAttr(op, delstr); } --- 347,353 ---- Py_FatalError("PyGC: can't initialize __del__ string"); } ! return PyInstance_Check(op) ? PyObject_HasAttr(op, delstr) : ! PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE) ? ! op->ob_type->tp_del != NULL : 0; } From tim_one@users.sourceforge.net Fri Aug 9 19:00:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 09 Aug 2002 11:00:29 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2327/python/Lib Modified Files: tempfile.py Log Message: Whitespace normalization. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tempfile.py 9 Aug 2002 16:14:32 -0000 1.40 --- tempfile.py 9 Aug 2002 18:00:27 -0000 1.41 *************** *** 59,67 **** _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL ! if hasattr(_os, 'O_NOINHERIT'): _text_openflags |= _os.O_NOINHERIT ! if hasattr(_os, 'O_NOFOLLOW'): _text_openflags |= _os.O_NOFOLLOW _bin_openflags = _text_openflags ! if hasattr(_os, 'O_BINARY'): _bin_openflags |= _os.O_BINARY if hasattr(_os, 'TMP_MAX'): --- 59,70 ---- _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL ! if hasattr(_os, 'O_NOINHERIT'): ! _text_openflags |= _os.O_NOINHERIT ! if hasattr(_os, 'O_NOFOLLOW'): ! _text_openflags |= _os.O_NOFOLLOW _bin_openflags = _text_openflags ! if hasattr(_os, 'O_BINARY'): ! _bin_openflags |= _os.O_BINARY if hasattr(_os, 'TMP_MAX'): *************** *** 178,182 **** return dirlist ! def _get_default_tempdir(): """Calculate the default directory to use for temporary files. --- 181,185 ---- return dirlist ! def _get_default_tempdir(): """Calculate the default directory to use for temporary files. *************** *** 240,244 **** raise IOError, (_errno.EEXIST, "No usable temporary file name found") ! # User visible interfaces. --- 243,247 ---- raise IOError, (_errno.EEXIST, "No usable temporary file name found") ! # User visible interfaces. *************** *** 303,307 **** names = _get_candidate_names() ! for seq in xrange(TMP_MAX): name = names.next() --- 306,310 ---- names = _get_candidate_names() ! for seq in xrange(TMP_MAX): name = names.next() From tim_one@users.sourceforge.net Fri Aug 9 19:01:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 09 Aug 2002 11:01:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2651/python/Lib/test Modified Files: test_tempfile.py Log Message: Whitespace normalization. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_tempfile.py 9 Aug 2002 16:14:33 -0000 1.2 --- test_tempfile.py 9 Aug 2002 18:01:01 -0000 1.3 *************** *** 269,273 **** self._close(self.fd) self._unlink(self.name) ! def do_create(self, dir=None, pre="", suf="", bin=1): if dir is None: --- 269,273 ---- self._close(self.fd) self._unlink(self.name) ! def do_create(self, dir=None, pre="", suf="", bin=1): if dir is None: *************** *** 486,490 **** os.rmdir(self.do_create(pre="a", suf="b")) os.rmdir(self.do_create(pre="aa", suf=".txt")) ! def test_basic_many(self): """mkdtemp can create many directories (stochastic)""" --- 486,490 ---- os.rmdir(self.do_create(pre="a", suf="b")) os.rmdir(self.do_create(pre="aa", suf=".txt")) ! def test_basic_many(self): """mkdtemp can create many directories (stochastic)""" From tim_one@users.sourceforge.net Fri Aug 9 19:13:53 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 09 Aug 2002 11:13:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7525/python/Lib/test Modified Files: test_tempfile.py Log Message: There's no distinction among 'user', 'group' and 'world' permissions on Win32, so tests that assume there are such distinctions can't pass. Fiddled them to work. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_tempfile.py 9 Aug 2002 18:01:01 -0000 1.3 --- test_tempfile.py 9 Aug 2002 18:13:51 -0000 1.4 *************** *** 310,314 **** file = self.do_create() mode = stat.S_IMODE(os.stat(file.name).st_mode) ! self.assertEqual(mode, 0600) def test_noinherit(self): --- 310,320 ---- file = self.do_create() mode = stat.S_IMODE(os.stat(file.name).st_mode) ! expected = 0600 ! if sys.platform in ('win32',): ! # There's no distinction among 'user', 'group' and 'world'; ! # replicate the 'user' bits. ! user = expected >> 6 ! expected = user * (1 + 8 + 64) ! self.assertEqual(mode, expected) def test_noinherit(self): *************** *** 514,518 **** try: mode = stat.S_IMODE(os.stat(dir).st_mode) ! self.assertEqual(mode, 0700) finally: os.rmdir(dir) --- 520,530 ---- try: mode = stat.S_IMODE(os.stat(dir).st_mode) ! expected = 0700 ! if sys.platform in ('win32',): ! # There's no distinction among 'user', 'group' and 'world'; ! # replicate the 'user' bits. ! user = expected >> 6 ! expected = user * (1 + 8 + 64) ! self.assertEqual(mode, expected) finally: os.rmdir(dir) From fdrake@users.sourceforge.net Fri Aug 9 19:34:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 11:34:19 -0700 Subject: [Python-checkins] python/dist/src/Objects weakrefobject.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17670 Modified Files: weakrefobject.c Log Message: Add support for the iterator protocol to weakref proxy objects. Part of fixing SF bug #591704. Index: weakrefobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/weakrefobject.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** weakrefobject.c 27 Mar 2002 15:18:21 -0000 1.9 --- weakrefobject.c 9 Aug 2002 18:34:16 -0000 1.10 *************** *** 384,387 **** --- 384,405 ---- } + /* iterator slots */ + + static PyObject * + proxy_iter(PyWeakReference *proxy) + { + if (!proxy_checkref(proxy)) + return NULL; + return PyObject_GetIter(PyWeakref_GET_OBJECT(proxy)); + } + + static PyObject * + proxy_iternext(PyWeakReference *proxy) + { + if (!proxy_checkref(proxy)) + return NULL; + return PyIter_Next(PyWeakref_GET_OBJECT(proxy)); + } + static PyNumberMethods proxy_as_number = { *************** *** 448,471 **** 0, /* methods */ ! (destructor)weakref_dealloc,/*tp_dealloc*/ ! (printfunc)proxy_print, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! proxy_compare, /*tp_compare*/ ! (unaryfunc)proxy_repr, /*tp_repr*/ ! &proxy_as_number, /*tp_as_number*/ ! &proxy_as_sequence, /*tp_as_sequence*/ ! &proxy_as_mapping, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! (ternaryfunc)0, /*tp_call*/ ! (unaryfunc)proxy_str, /*tp_str*/ ! (getattrofunc)proxy_getattr,/*tp_getattro*/ ! (setattrofunc)proxy_setattr,/*tp_setattro*/ ! 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ! |Py_TPFLAGS_CHECKTYPES, /*tp_flags*/ ! 0, /*tp_doc*/ ! (traverseproc)gc_traverse, /*tp_traverse*/ ! (inquiry)gc_clear, /*tp_clear*/ }; --- 466,493 ---- 0, /* methods */ ! (destructor)weakref_dealloc, /* tp_dealloc */ ! (printfunc)proxy_print, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! proxy_compare, /* tp_compare */ ! (unaryfunc)proxy_repr, /* tp_repr */ ! &proxy_as_number, /* tp_as_number */ ! &proxy_as_sequence, /* tp_as_sequence */ ! &proxy_as_mapping, /* tp_as_mapping */ ! 0, /* tp_hash */ ! (ternaryfunc)0, /* tp_call */ ! (unaryfunc)proxy_str, /* tp_str */ ! (getattrofunc)proxy_getattr, /* tp_getattro */ ! (setattrofunc)proxy_setattr, /* tp_setattro */ ! 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ! | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)gc_traverse, /* tp_traverse */ ! (inquiry)gc_clear, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)proxy_iter, /* tp_iter */ ! (iternextfunc)proxy_iternext, /* tp_iternext */ }; *************** *** 479,502 **** 0, /* methods */ ! (destructor)weakref_dealloc,/*tp_dealloc*/ ! (printfunc)proxy_print, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! proxy_compare, /*tp_compare*/ ! (unaryfunc)proxy_repr, /*tp_repr*/ ! &proxy_as_number, /*tp_as_number*/ ! &proxy_as_sequence, /*tp_as_sequence*/ ! &proxy_as_mapping, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! (ternaryfunc)proxy_call, /*tp_call*/ ! (unaryfunc)proxy_str, /*tp_str*/ ! (getattrofunc)proxy_getattr,/*tp_getattro*/ ! (setattrofunc)proxy_setattr,/*tp_setattro*/ ! 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ! |Py_TPFLAGS_CHECKTYPES, /*tp_flags*/ ! 0, /*tp_doc*/ ! (traverseproc)gc_traverse, /*tp_traverse*/ ! (inquiry)gc_clear, /*tp_clear*/ }; --- 501,528 ---- 0, /* methods */ ! (destructor)weakref_dealloc, /* tp_dealloc */ ! (printfunc)proxy_print, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! proxy_compare, /* tp_compare */ ! (unaryfunc)proxy_repr, /* tp_repr */ ! &proxy_as_number, /* tp_as_number */ ! &proxy_as_sequence, /* tp_as_sequence */ ! &proxy_as_mapping, /* tp_as_mapping */ ! 0, /* tp_hash */ ! (ternaryfunc)proxy_call, /* tp_call */ ! (unaryfunc)proxy_str, /* tp_str */ ! (getattrofunc)proxy_getattr, /* tp_getattro */ ! (setattrofunc)proxy_setattr, /* tp_setattro */ ! 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ! | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)gc_traverse, /* tp_traverse */ ! (inquiry)gc_clear, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)proxy_iter, /* tp_iter */ ! (iternextfunc)proxy_iternext, /* tp_iternext */ }; From fdrake@users.sourceforge.net Fri Aug 9 19:35:54 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 11:35:54 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.322,2.323 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv18447 Modified Files: ceval.c Log Message: Add weakref support generator-iterators. Part of fixing SF bug #591704. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.322 retrieving revision 2.323 diff -C2 -d -r2.322 -r2.323 *** ceval.c 6 Aug 2002 17:47:40 -0000 2.322 --- ceval.c 9 Aug 2002 18:35:52 -0000 2.323 *************** *** 95,98 **** --- 95,101 ---- /* True if generator is being executed. */ int gi_running; + + /* List of weak reference. */ + PyObject *gi_weakreflist; } genobject; *************** *** 107,110 **** --- 110,114 ---- gen->gi_frame = f; gen->gi_running = 0; + gen->gi_weakreflist = NULL; _PyObject_GC_TRACK(gen); return (PyObject *)gen; *************** *** 121,124 **** --- 125,130 ---- { _PyObject_GC_UNTRACK(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) gen); Py_DECREF(gen->gi_frame); PyObject_GC_Del(gen); *************** *** 206,210 **** 0, /* tp_clear */ 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ --- 212,216 ---- 0, /* tp_clear */ 0, /* tp_richcompare */ ! offsetof(genobject, gi_weakreflist), /* tp_weaklistoffset */ (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ From fdrake@users.sourceforge.net Fri Aug 9 19:37:12 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 11:37:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_generators.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19070 Modified Files: test_generators.py Log Message: Add tests for weakref support for generator-iterators. Part of fixing SF bug #591704. Index: test_generators.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_generators.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_generators.py 23 Jul 2002 19:03:54 -0000 1.36 --- test_generators.py 9 Aug 2002 18:37:10 -0000 1.37 *************** *** 1360,1363 **** --- 1360,1387 ---- """ + weakref_tests = """\ + Generators are weakly referencable: + + >>> import weakref + >>> def gen(): + ... yield 'foo!' + ... + >>> wr = weakref.ref(gen) + >>> wr() is gen + True + >>> p = weakref.proxy(gen) + + Generator-iterators are weakly referencable as well: + + >>> gi = gen() + >>> wr = weakref.ref(gi) + >>> wr() is gi + True + >>> p = weakref.proxy(gi) + >>> list(p) + ['foo!'] + + """ + __test__ = {"tut": tutorial_tests, "pep": pep_tests, *************** *** 1365,1369 **** "fun": fun_tests, "syntax": syntax_tests, ! "conjoin": conjoin_tests} # Magic test name that regrtest.py invokes *after* importing this module. --- 1389,1395 ---- "fun": fun_tests, "syntax": syntax_tests, ! "conjoin": conjoin_tests, ! "weakref": weakref_tests, ! } # Magic test name that regrtest.py invokes *after* importing this module. From gvanrossum@users.sourceforge.net Fri Aug 9 20:18:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 12:18:27 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.97,1.98 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5114 Modified Files: Makefile.pre.in Log Message: Whitespace normalization. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** Makefile.pre.in 9 Aug 2002 14:42:57 -0000 1.97 --- Makefile.pre.in 9 Aug 2002 19:18:25 -0000 1.98 *************** *** 517,521 **** QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \ test_unicodedata test_re test_sre test_select test_poll \ ! test_linuxaudiodev test_struct test_sunaudiodev test_zlib quicktest: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f --- 517,521 ---- QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \ test_unicodedata test_re test_sre test_select test_poll \ ! test_linuxaudiodev test_struct test_sunaudiodev test_zlib quicktest: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f *************** *** 778,782 **** frameworkinstall: frameworkinstallframework \ frameworkinstallapps frameworkinstallunixtools ! # On install, we re-make the framework # structure in the install location, /Library/Frameworks/ or the argument to --- 778,782 ---- frameworkinstall: frameworkinstallframework \ frameworkinstallapps frameworkinstallunixtools ! # On install, we re-make the framework # structure in the install location, /Library/Frameworks/ or the argument to From gvanrossum@users.sourceforge.net Fri Aug 9 21:07:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 13:07:36 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts gprof2html.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv27868 Added Files: gprof2html.py Log Message: A tool to transform gprof(1) output into HTML, so you can click on a function name and go to the corresponding entry. --- NEW FILE: gprof2html.py --- #! /usr/bin/env python2.3 """Transform gprof(1) output into useful HTML.""" import re, os, sys, cgi, webbrowser header = """\ gprof output (%s)

"""

trailer = """\
""" def add_escapes(input): for line in input: yield cgi.escape(line) def main(): filename = "gprof.out" if sys.argv[1:]: filename = sys.argv[1] outputfilename = filename + ".html" input = add_escapes(file(filename)) output = file(outputfilename, "w") output.write(header % filename) for line in input: output.write(line) if line.startswith(" time"): break labels = {} for line in input: m = re.match(r"(.* )(\w+)\n", line) if not m: output.write(line) break stuff, fname = m.group(1, 2) labels[fname] = fname output.write('%s%s\n' % (stuff, fname, fname, fname)) for line in input: output.write(line) if line.startswith("index % time"): break for line in input: m = re.match(r"(.* )(\w+)(( <cycle.*>)? \[\d+\])\n", line) if not m: output.write(line) if line.startswith("Index by function name"): break continue prefix, fname, suffix = m.group(1, 2, 3) if fname not in labels: output.write(line) continue if line.startswith("["): output.write('%s%s%s\n' % (prefix, fname, fname, fname, suffix)) else: output.write('%s%s%s\n' % (prefix, fname, fname, suffix)) for line in input: for part in re.findall(r"(\w+(?:\.c)?|\W+)", line): if part in labels: part = '%s' % (part, part) output.write(part) output.write(trailer) output.close() webbrowser.open("file:" + os.path.abspath(outputfilename)) main() From fdrake@users.sourceforge.net Fri Aug 9 21:20:52 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 13:20:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools mksourcepkg,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv1153/tools Modified Files: mksourcepkg Log Message: Lots of changes to the packaging of the documentation, all to keep directories clean where the packages are unpacked. Each package now contains a single directory, Python-Docs-/, which contains the files for that version of the documentation. Closes SF feature request #567576. Index: mksourcepkg =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mksourcepkg,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mksourcepkg 2 Feb 2001 15:48:00 -0000 1.5 --- mksourcepkg 9 Aug 2002 20:20:50 -0000 1.6 *************** *** 74,78 **** tempdir = tempfile.mktemp() os.mkdir(tempdir) ! pkgdir = os.path.join(tempdir, "Python-" + release) os.mkdir(pkgdir) pwd = os.getcwd() --- 74,78 ---- tempdir = tempfile.mktemp() os.mkdir(tempdir) ! pkgdir = os.path.join(tempdir, "Python-Docs-" + release) os.mkdir(pkgdir) pwd = os.getcwd() *************** *** 91,102 **** # might not have done a "cvs login" to the anonymous server. # That avoids a lot of painful gunk here. ! os.chdir(pkgdir) if not quiet: print "--- current directory is:", pkgdir if cvstag: ! run("cvs -d%s export -r %s -d Doc python/dist/src/Doc" ! % (cvsroot, cvstag)) else: ! run("cvs -Q -d%s checkout -d Doc python/dist/src/Doc" % cvsroot) # remove CVS directories for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'): --- 91,103 ---- # might not have done a "cvs login" to the anonymous server. # That avoids a lot of painful gunk here. ! os.chdir(tempdir) if not quiet: print "--- current directory is:", pkgdir if cvstag: ! run("cvs -d%s export -r %s -d Python-Docs-%s python/dist/src/Doc" ! % (cvsroot, cvstag, release)) else: ! run("cvs -Q -d%s checkout -d Python-Docs-%s python/dist/src/Doc" ! % (cvsroot, release)) # remove CVS directories for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'): *************** *** 106,110 **** LICENSE = os.path.normpath( os.path.join(mydir, os.pardir, os.pardir, "LICENSE")) ! shutil.copyfile(LICENSE, "Doc/LICENSE") if tools: archive = "doctools-" + release --- 107,111 ---- LICENSE = os.path.normpath( os.path.join(mydir, os.pardir, os.pardir, "LICENSE")) ! shutil.copyfile(LICENSE, "LICENSE") if tools: archive = "doctools-" + release *************** *** 112,116 **** for d in ("api", "dist", "doc", "ext", "inst", "lib", "mac", "ref", "tut"): ! shutil.rmtree(os.path.join(os.path.join(pkgdir, "Doc"), d)) else: archive = "latex-" + release --- 113,117 ---- for d in ("api", "dist", "doc", "ext", "inst", "lib", "mac", "ref", "tut"): ! shutil.rmtree(os.path.join(pkgdir, d)) else: archive = "latex-" + release *************** *** 122,134 **** for format in formats: if format == "bzip2": ! run("tar cf - Python-%s | bzip2 -9 >%s.tar.bz2" % (release, archive)) elif format == "gzip": ! run("tar cf - Python-%s | gzip -9 >%s.tgz" % (release, archive)) elif format == "zip": if os.path.exists(archive + ".zip"): os.unlink(archive + ".zip") ! run("zip -q -r9 %s.zip Python-%s" % (archive, release)) --- 123,135 ---- for format in formats: if format == "bzip2": ! run("tar cf - Python-Docs-%s | bzip2 -9 >%s.tar.bz2" % (release, archive)) elif format == "gzip": ! run("tar cf - Python-Docs-%s | gzip -9 >%s.tgz" % (release, archive)) elif format == "zip": if os.path.exists(archive + ".zip"): os.unlink(archive + ".zip") ! run("zip -q -r9 %s.zip Python-Docs-%s" % (archive, release)) From fdrake@users.sourceforge.net Fri Aug 9 21:20:52 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 13:20:52 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.244,1.245 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv1153 Modified Files: Makefile Log Message: Lots of changes to the packaging of the documentation, all to keep directories clean where the packages are unpacked. Each package now contains a single directory, Python-Docs-/, which contains the files for that version of the documentation. Closes SF feature request #567576. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.244 retrieving revision 1.245 diff -C2 -d -r1.244 -r1.245 *** Makefile 25 May 2002 20:28:46 -0000 1.244 --- Makefile 9 Aug 2002 20:20:50 -0000 1.245 *************** *** 397,448 **** $(ISILOINDEXFILES): $(COMMONPERL) html/about.dat perl/isilo.perl ! isilo: isilo/python-api-$(RELEASE).pdb \ ! isilo/python-doc-$(RELEASE).pdb \ ! isilo/python-ext-$(RELEASE).pdb \ ! isilo/python-lib-$(RELEASE).pdb \ ! isilo/python-mac-$(RELEASE).pdb \ ! isilo/python-ref-$(RELEASE).pdb \ ! isilo/python-tut-$(RELEASE).pdb \ ! isilo/python-dist-$(RELEASE).pdb \ ! isilo/python-inst-$(RELEASE).pdb \ ! isilo/python-whatsnew-$(RELEASE).pdb ! isilo/python-api-$(RELEASE).pdb: isilo/api/api.html isilo/api/api.css $(MKISILO) "-iPython/C API Reference Manual" \ isilo/api/api.html $@ ! isilo/python-doc-$(RELEASE).pdb: isilo/doc/doc.html isilo/doc/doc.css $(MKISILO) "-iDocumenting Python" \ isilo/doc/doc.html $@ ! isilo/python-ext-$(RELEASE).pdb: isilo/ext/ext.html isilo/ext/ext.css $(MKISILO) "-iExtending & Embedding Python" \ isilo/ext/ext.html $@ ! isilo/python-lib-$(RELEASE).pdb: isilo/lib/lib.html isilo/lib/lib.css $(MKISILO) "-iPython Library Reference" \ isilo/lib/lib.html $@ ! isilo/python-mac-$(RELEASE).pdb: isilo/mac/mac.html isilo/mac/mac.css $(MKISILO) "-iPython/C API Reference Manual" \ isilo/mac/mac.html $@ ! isilo/python-ref-$(RELEASE).pdb: isilo/ref/ref.html isilo/ref/ref.css $(MKISILO) "-iPython Reference Manual" \ isilo/ref/ref.html $@ ! isilo/python-tut-$(RELEASE).pdb: isilo/tut/tut.html isilo/tut/tut.css $(MKISILO) "-iPython Tutorial" \ isilo/tut/tut.html $@ ! isilo/python-dist-$(RELEASE).pdb: isilo/dist/dist.html isilo/dist/dist.css $(MKISILO) "-iDistributing Python Modules" \ isilo/dist/dist.html $@ ! isilo/python-inst-$(RELEASE).pdb: isilo/inst/inst.html isilo/inst/inst.css $(MKISILO) "-iInstalling Python Modules" \ isilo/inst/inst.html $@ ! isilo/python-whatsnew-$(RELEASE).pdb: isilo/whatsnew/$(WHATSNEW).html isilo/whatsnew/$(WHATSNEW).css $(MKISILO) "-iWhat's New in Python X.Y" \ isilo/whatsnew/$(WHATSNEW).html $@ --- 397,448 ---- $(ISILOINDEXFILES): $(COMMONPERL) html/about.dat perl/isilo.perl ! isilo: isilo/python-api.pdb \ ! isilo/python-doc.pdb \ ! isilo/python-ext.pdb \ ! isilo/python-lib.pdb \ ! isilo/python-mac.pdb \ ! isilo/python-ref.pdb \ ! isilo/python-tut.pdb \ ! isilo/python-dist.pdb \ ! isilo/python-inst.pdb \ ! isilo/python-whatsnew.pdb ! isilo/python-api.pdb: isilo/api/api.html isilo/api/api.css $(MKISILO) "-iPython/C API Reference Manual" \ isilo/api/api.html $@ ! isilo/python-doc.pdb: isilo/doc/doc.html isilo/doc/doc.css $(MKISILO) "-iDocumenting Python" \ isilo/doc/doc.html $@ ! isilo/python-ext.pdb: isilo/ext/ext.html isilo/ext/ext.css $(MKISILO) "-iExtending & Embedding Python" \ isilo/ext/ext.html $@ ! isilo/python-lib.pdb: isilo/lib/lib.html isilo/lib/lib.css $(MKISILO) "-iPython Library Reference" \ isilo/lib/lib.html $@ ! isilo/python-mac.pdb: isilo/mac/mac.html isilo/mac/mac.css $(MKISILO) "-iPython/C API Reference Manual" \ isilo/mac/mac.html $@ ! isilo/python-ref.pdb: isilo/ref/ref.html isilo/ref/ref.css $(MKISILO) "-iPython Reference Manual" \ isilo/ref/ref.html $@ ! isilo/python-tut.pdb: isilo/tut/tut.html isilo/tut/tut.css $(MKISILO) "-iPython Tutorial" \ isilo/tut/tut.html $@ ! isilo/python-dist.pdb: isilo/dist/dist.html isilo/dist/dist.css $(MKISILO) "-iDistributing Python Modules" \ isilo/dist/dist.html $@ ! isilo/python-inst.pdb: isilo/inst/inst.html isilo/inst/inst.css $(MKISILO) "-iInstalling Python Modules" \ isilo/inst/inst.html $@ ! isilo/python-whatsnew.pdb: isilo/whatsnew/$(WHATSNEW).html isilo/whatsnew/$(WHATSNEW).css $(MKISILO) "-iWhat's New in Python X.Y" \ isilo/whatsnew/$(WHATSNEW).html $@ *************** *** 542,546 **** pdf-$(PAPER)-$(RELEASE).tar: $(PDFFILES) ! cd paper-$(PAPER) && tar cf ../$@ *.pdf pdf-$(PAPER)-$(RELEASE).tgz: pdf-$(PAPER)-$(RELEASE).tar --- 542,550 ---- pdf-$(PAPER)-$(RELEASE).tar: $(PDFFILES) ! rm -f $@ ! mkdir Python-Docs-$(RELEASE) ! cp paper-$(PAPER)/*.pdf Python-Docs-$(RELEASE) ! tar cf $@ Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) pdf-$(PAPER)-$(RELEASE).tgz: pdf-$(PAPER)-$(RELEASE).tar *************** *** 552,559 **** pdf-$(PAPER)-$(RELEASE).zip: pdf rm -f $@ ! cd paper-$(PAPER) && zip -q -9 ../$@ *.pdf postscript-$(PAPER)-$(RELEASE).tar: $(PSFILES) paper-$(PAPER)/README ! cd paper-$(PAPER) && tar cf ../$@ *.ps README postscript-$(PAPER)-$(RELEASE).tar.bz2: postscript-$(PAPER)-$(RELEASE).tar --- 556,571 ---- pdf-$(PAPER)-$(RELEASE).zip: pdf rm -f $@ ! mkdir Python-Docs-$(RELEASE) ! cp paper-$(PAPER)/*.pdf Python-Docs-$(RELEASE) ! zip -q -r -9 $@ Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) postscript-$(PAPER)-$(RELEASE).tar: $(PSFILES) paper-$(PAPER)/README ! rm -f $@ ! mkdir Python-Docs-$(RELEASE) ! cp paper-$(PAPER)/*.ps Python-Docs-$(RELEASE) ! cp paper-$(PAPER)/README Python-Docs-$(RELEASE) ! tar cf $@ Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) postscript-$(PAPER)-$(RELEASE).tar.bz2: postscript-$(PAPER)-$(RELEASE).tar *************** *** 565,574 **** postscript-$(PAPER)-$(RELEASE).zip: $(PSFILES) paper-$(PAPER)/README rm -f $@ ! cd paper-$(PAPER) && zip -q -9 ../$@ *.ps README html-$(RELEASE).tar: $(ALLHTMLFILES) $(HTMLCSSFILES) ! cd html && \ ! tar cf ../html-$(RELEASE).tar *.html */*.css */*.html \ ! */*.gif */*.txt html-$(RELEASE).tgz: html-$(RELEASE).tar --- 577,595 ---- postscript-$(PAPER)-$(RELEASE).zip: $(PSFILES) paper-$(PAPER)/README rm -f $@ ! mkdir Python-Docs-$(RELEASE) ! cp paper-$(PAPER)/*.ps Python-Docs-$(RELEASE) ! cp paper-$(PAPER)/README Python-Docs-$(RELEASE) ! zip -q -r -9 $@ Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) ! ! HTMLPKGFILES=*.html */*.css */*.html */*.gif */*.txt html-$(RELEASE).tar: $(ALLHTMLFILES) $(HTMLCSSFILES) ! mkdir Python-Docs-$(RELEASE) ! cd html && tar cf ../temp.tar $(HTMLPKGFILES) ! cd Python-Docs-$(RELEASE) && tar xf ../temp.tar ! rm temp.tar ! tar cf html-$(RELEASE).tar Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) html-$(RELEASE).tgz: html-$(RELEASE).tar *************** *** 580,588 **** html-$(RELEASE).zip: $(ALLHTMLFILES) $(HTMLCSSFILES) rm -f $@ ! cd html && \ ! zip -q -9 ../$@ *.html */*.css */*.html */*.gif */*.txt isilo-$(RELEASE).zip: isilo ! cd isilo && zip -q -9 ../$@ python-*-$(RELEASE).pdb --- 601,617 ---- html-$(RELEASE).zip: $(ALLHTMLFILES) $(HTMLCSSFILES) rm -f $@ ! mkdir Python-Docs-$(RELEASE) ! cd html && tar cf ../temp.tar $(HTMLPKGFILES) ! cd Python-Docs-$(RELEASE) && tar xf ../temp.tar ! rm temp.tar ! zip -q -r -9 $@ Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) isilo-$(RELEASE).zip: isilo ! rm -f $@ ! mkdir Python-Docs-$(RELEASE) ! cp isilo/python-*.pdb Python-Docs-$(RELEASE) ! zip -q -r -9 $@ Python-Docs-$(RELEASE) ! rm -r Python-Docs-$(RELEASE) *************** *** 653,657 **** rm -rf isilo/ref/ isilo/tut/ isilo/inst/ isilo/dist/ rm -rf isilo/whatsnew/ ! rm -f isilo/python-*-$(RELEASE).pdb isilo-$(RELEASE).zip realclean distclean: clobber --- 682,686 ---- rm -rf isilo/ref/ isilo/tut/ isilo/inst/ isilo/dist/ rm -rf isilo/whatsnew/ ! rm -f isilo/python-*.pdb isilo-$(RELEASE).zip realclean distclean: clobber From fdrake@users.sourceforge.net Fri Aug 9 21:41:22 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 13:41:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.34.6.3,1.34.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv11954 Modified Files: Tag: release22-maint ref2.tex Log Message: Correct and update markup to match what we're doing on the trunk. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.34.6.3 retrieving revision 1.34.6.4 diff -C2 -d -r1.34.6.3 -r1.34.6.4 *** ref2.tex 6 Aug 2002 22:39:30 -0000 1.34.6.3 --- ref2.tex 9 Aug 2002 20:41:19 -0000 1.34.6.4 *************** *** 354,375 **** otherwise have a special meaning, such as newline, backslash itself, or the quote character. String literals may optionally be prefixed ! with a letter `r' or `R'; such strings are called \dfn{raw ! strings}\index{raw string} and use different rules for interpreting ! backslash escape sequences. A prefix of 'u' or 'U' makes the string ! a Unicode string. Unicode strings use the Unicode character set as ! defined by the Unicode Consortium and ISO~10646. Some additional ! escape sequences, described below, are available in Unicode strings. ! The two prefix characters may be combined; in this case, `u' must ! appear before `r'. ! In triple-quoted strings, ! unescaped newlines and quotes are allowed (and are retained), except ! that three unescaped quotes in a row terminate the string. (A ! ``quote'' is the character used to open the string, i.e. either ! \code{'} or \code{"}.) ! Unless an `r' or `R' prefix is present, escape sequences in strings ! are interpreted according to rules similar ! to those used by Standard C. The recognized escape sequences are: \index{physical line} \index{escape sequence} --- 354,375 ---- otherwise have a special meaning, such as newline, backslash itself, or the quote character. String literals may optionally be prefixed ! with a letter \character{r} or \character{R}; such strings are called ! \dfn{raw strings}\index{raw string} and use different rules for ! interpreting backslash escape sequences. A prefix of \character{u} or ! \character{U} makes the string a Unicode string. Unicode strings use ! the Unicode character set as defined by the Unicode Consortium and ! ISO~10646. Some additional escape sequences, described below, are ! available in Unicode strings. The two prefix characters may be ! combined; in this case, \character{u} must appear before ! \character{r}. ! In triple-quoted strings, unescaped newlines and quotes are allowed ! (and are retained), except that three unescaped quotes in a row ! terminate the string. (A ``quote'' is the character used to open the ! string, i.e. either \code{'} or \code{"}.) ! Unless an \character{r} or \character{R} prefix is present, escape ! sequences in strings are interpreted according to rules similar to ! those used by Standard C. The recognized escape sequences are: \index{physical line} \index{escape sequence} *************** *** 410,435 **** escapes for non-Unicode string literals. ! When an `r' or `R' prefix is present, a character following a ! backslash is included in the string without change, and \emph{all ! backslashes are left in the string}. For example, the string literal ! \code{r"\e n"} consists of two characters: a backslash and a lowercase ! `n'. String quotes can be escaped with a backslash, but the backslash ! remains in the string; for example, \code{r"\e""} is a valid string ! literal consisting of two characters: a backslash and a double quote; ! \code{r"\e"} is not a valid string literal (even a raw string cannot ! end in an odd number of backslashes). Specifically, \emph{a raw ! string cannot end in a single backslash} (since the backslash would ! escape the following quote character). Note also that a single ! backslash followed by a newline is interpreted as those two characters ! as part of the string, \emph{not} as a line continuation. ! When an `r' or `R' prefix is used in conjunction with a `u' or `U' ! prefix, then the \uXXXX escape sequence is processed while \emph{all other ! backslashes are left in the string}. For example, the string literal ! \code{ur"\u0062\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, \uXXXX escape sequences are ! only recognized when there are an odd number of backslashes. \subsection{String literal concatenation\label{string-catenation}} --- 410,436 ---- escapes for non-Unicode string literals. ! When an \character{r} or \character{R} prefix is present, a character ! following a backslash is included in the string without change, and ! \emph{all backslashes are left in the string}. For example, the ! string literal \code{r"\e n"} consists of two characters: a backslash ! and a lowercase `n'. String quotes can be escaped with a backslash, ! but the backslash remains in the string; for example, \code{r"\e""} is ! a valid string literal consisting of two characters: a backslash and a ! double quote; \code{r"\e"} is not a valid string literal (even a raw ! string cannot end in an odd number of backslashes). Specifically, ! \emph{a raw string cannot end in a single backslash} (since the ! backslash would escape the following quote character). Note also that ! a single backslash followed by a newline is interpreted as those two ! characters as part of the string, \emph{not} as a line continuation. ! When an \character{r} or \character{R} prefix is used in conjunction ! 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 Fri Aug 9 23:56:48 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 Aug 2002 15:56:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools update-docs.sh,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv16429 Modified Files: update-docs.sh Log Message: Accomodate the packaging changes when we unpack into the dev/doc/ area on python.org. Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** update-docs.sh 1 Apr 2002 20:15:05 -0000 1.9 --- update-docs.sh 9 Aug 2002 22:56:46 -0000 1.10 *************** *** 26,30 **** mv $DOCTYPE $DOCTYPE-temp fi ! mv $TMPDIR $DOCTYPE rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? --- 26,31 ---- mv $DOCTYPE $DOCTYPE-temp fi ! mv $TMPDIR/Python-Docs-* $DOCTYPE ! rmdir $TMPDIR rm -rf $DOCTYPE-temp || exit $? rm "$UPDATES" || exit $? From gvanrossum@users.sourceforge.net Sat Aug 10 01:15:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 17:15:38 -0700 Subject: [Python-checkins] python/dist/src/Lib toaiff.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17452 Modified Files: toaiff.py Log Message: Fix a typo in the mktemp -> mkstemp patch. Index: toaiff.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/toaiff.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** toaiff.py 9 Aug 2002 16:37:33 -0000 1.13 --- toaiff.py 10 Aug 2002 00:15:36 -0000 1.14 *************** *** 100,104 **** raise error, \ filename + ': unsupported audio file type ' + `ftype` ! (fd, temp) = tempfile.mktemp() os.close(fd) temps.append(temp) --- 100,104 ---- raise error, \ filename + ': unsupported audio file type ' + `ftype` ! (fd, temp) = tempfile.mkstemp() os.close(fd) temps.append(temp) From gvanrossum@users.sourceforge.net Sat Aug 10 01:18:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 17:18:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-irix5 torgb.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix5 In directory usw-pr-cvs1:/tmp/cvs-serv18550/plat-irix5 Modified Files: torgb.py Log Message: Fix a typo in the mktemp -> mkstemp patch. Index: torgb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix5/torgb.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** torgb.py 9 Aug 2002 16:37:35 -0000 1.7 --- torgb.py 10 Aug 2002 00:17:59 -0000 1.8 *************** *** 93,97 **** raise error, \ filename + ': unsupported image file type ' + `ftype` ! (fd, temp) = tempfile.mktemp() os.close(fd) sts = table[ftype].copy(fname, temp) --- 93,97 ---- raise error, \ filename + ': unsupported image file type ' + `ftype` ! (fd, temp) = tempfile.mkstemp() os.close(fd) sts = table[ftype].copy(fname, temp) From gvanrossum@users.sourceforge.net Sat Aug 10 01:18:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 17:18:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-irix6 torgb.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix6 In directory usw-pr-cvs1:/tmp/cvs-serv18550/plat-irix6 Modified Files: torgb.py Log Message: Fix a typo in the mktemp -> mkstemp patch. Index: torgb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-irix6/torgb.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** torgb.py 9 Aug 2002 16:37:35 -0000 1.4 --- torgb.py 10 Aug 2002 00:17:59 -0000 1.5 *************** *** 93,97 **** raise error, \ filename + ': unsupported image file type ' + `ftype` ! (fd, temp) = tempfile.mktemp() os.close(fd) sts = table[ftype].copy(fname, temp) --- 93,97 ---- raise error, \ filename + ': unsupported image file type ' + `ftype` ! (fd, temp) = tempfile.mkstemp() os.close(fd) sts = table[ftype].copy(fname, temp) From tim_one@users.sourceforge.net Sat Aug 10 04:04:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 09 Aug 2002 20:04:36 -0700 Subject: [Python-checkins] python/dist/src/Objects listsort.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6094/python/Objects Modified Files: listsort.txt Log Message: The samplesort-vs-mergesort #-of-comparisons comparisons were captured before %sort was introduced. Redid them (the numbers change, but the conclusions don't). Also did the samplesort counts with the released 2.2.1, as they're slightly different under the last CVS 2.3 samplesort (some higher, some lower -- CVS had been changed to stop doing the special-case business on recursive samplesort calls). Index: listsort.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listsort.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** listsort.txt 9 Aug 2002 05:06:44 -0000 1.3 --- listsort.txt 10 Aug 2002 03:04:33 -0000 1.4 *************** *** 96,124 **** structure in the data. ! n lg(n!) *sort 3sort +sort ~sort !sort ! ------- ------- ------ -------- ------- ------- -------- ! 32768 444255 453084 453604 32908 130484 469132 samplesort ! 449235 33019 33016 188720 65534 timsort ! 0.86% 1273.77% -0.33% -30.86% 615.86% %ch from timsort ! 65536 954037 973111 970464 65686 260019 1004597 ! 963924 65767 65802 377634 131070 ! 0.95% 1375.61% -0.18% -31.15% 666.46% ! 131072 2039137 2100019 2102708 131232 555035 2161268 ! 2058863 131422 131363 755476 262142 ! 2.00% 1499.97% -0.10% -26.53% 724.46% ! 262144 4340409 4461471 4442796 262314 1107826 4584316 ! 4380148 262446 262466 1511174 524286 ! 1.86% 1592.84% -0.06% -26.69% 774.39% ! 524288 9205096 9448146 9368681 524468 2218562 9691553 ! 9285454 524576 524626 3022584 1048574 ! 1.75% 1685.95% -0.03% -26.60% 824.26% ! 1048576 19458756 19950541 20307955 1048766 4430616 20433371 ! 19621100 1048854 1048933 6045418 2097150 ! 1.68% 1836.20% -0.02% -26.71% 874.34% Discussion of cases: --- 96,124 ---- structure in the data. ! n lg(n!) *sort 3sort +sort %sort ~sort !sort ! ------- ------- ------ -------- ------- ------ ------- -------- ! 32768 444255 453096 453614 32908 452871 130491 469141 old ! 449235 33019 33016 51328 188720 65534 new ! 0.86% 1273.80% -0.33% 782.31% -30.85% 615.87% %ch from new ! 65536 954037 972699 981940 65686 973104 260029 1004607 ! 963714 65824 65809 103409 377634 131070 ! 0.93% 1391.77% -0.19% 841.02% -31.14% 666.47% ! 131072 2039137 2101881 2091491 131232 2092894 554790 2161379 ! 2059092 131413 131362 209130 755476 262142 ! 2.08% 1491.54% -0.10% 900.76% -26.56% 724.51% ! 262144 4340409 4464460 4403233 262314 4445884 1107842 4584560 ! 4380687 262440 262460 421998 1511174 524286 ! 1.91% 1577.81% -0.06% 953.53% -26.69% 774.44% ! 524288 9205096 9453356 9408463 524468 9441930 2218577 9692015 ! 9285709 524581 524634 848590 3022584 1048574 ! 1.81% 1693.52% -0.03% 1012.66% -26.60% 824.30% ! 1048576 19458756 19950272 19838588 1048766 19912134 4430649 20434212 ! 19621118 1048960 1048942 1715806 6045418 2097150 ! 1.68% 1791.26% -0.02% 1060.51% -26.71% 874.38% Discussion of cases: *************** *** 133,140 **** variant about 19% more. ! 3sort and !sort: No contest; there's structure in this data, but not of ! the specific kinds samplesort special-cases. Note that structure in !sort ! wasn't put there on purpose -- it was crafted as a worst case for a ! previous quicksort implementation. That timsort nails it came as a surprise to me (although it's obvious in retrospect). --- 133,140 ---- variant about 19% more. ! 3sort, %sort, and !sort: No contest; there's structure in this data, but ! not of the specific kinds samplesort special-cases. Note that structure ! in !sort wasn't put there on purpose -- it was crafted as a worst case for ! a previous quicksort implementation. That timsort nails it came as a surprise to me (although it's obvious in retrospect). From gvanrossum@users.sourceforge.net Sat Aug 10 06:14:15 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 22:14:15 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10789 Modified Files: pep-0283.txt Log Message: Status update. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0283.txt 13 Jul 2002 14:00:04 -0000 1.13 --- pep-0283.txt 10 Aug 2002 05:14:13 -0000 1.14 *************** *** 16,23 **** Bugs may be fixed until the final release. ! There is currently no defined schedule. We hope to release at ! least the first alpha before OSCON 2002, and the final release ! before the end of 2002, but if important projects below are ! delayed, the release may be delayed. There will be at least two alpha releases, two beta releases, and --- 16,22 ---- Bugs may be fixed until the final release. ! There is currently no defined schedule. We hope to do the final ! release before the end of 2002, but if important projects below ! are delayed, even that may be delayed. There will be at least two alpha releases, two beta releases, and *************** *** 66,87 **** - PEP 273 Import Modules from Zip Archives Ahlstrom ! I think this is close -- maybe it's already checked in and I ! don't know about it! - PEP 282 A Logging System Mick ! Vinay Sajip has been making steady progress on an ! implementation, and despite a recent near-flamewar (which I ! haven't followed) I expect that his code will be incorporated in ! the near future. - PEP 263 Defining Python Source Code Encodings ! I'm all for this plan. I haven't reviewed the implementation. - PEP 218 Adding a Built-In Set Object Type I think it would be good to revive this in some form, using a ! module rather than a built-in type. - A new command line option parser. Greg Ward's Optik --- 65,87 ---- - PEP 273 Import Modules from Zip Archives Ahlstrom ! This project has been dormant too long. Somebody wake it up! ! http://www.python.org/sf/492105 - PEP 282 A Logging System Mick ! Vinay Sajip's implementation is close to completion IMO. I ! expect that his code will be incorporated in the near future. ! http://www.python.org/sf/578494 - PEP 263 Defining Python Source Code Encodings ! Implemented (at least phase 1, which is all that's planned for ! 2.3). - PEP 218 Adding a Built-In Set Object Type I think it would be good to revive this in some form, using a ! module rather than a built-in type. Alex Martelli has ! contributed a new version: http://www.python.org/sf/580995 - A new command line option parser. Greg Ward's Optik *************** *** 93,101 **** Skip Montanaro has posted a proto-PEP for this idea: http://mail.python.org/pipermail/python-dev/2002-May/024346.html ! - Extended slice notation for all built-in sequences. A patch by ! Michael Hudson has solved this, mostly; there's an open issue ! about slice assignments where the source has a different length ! than the destination, as in L[:5:] = range(10). - An iterator tools module featuring goodies from SML and Haskell? --- 93,100 ---- Skip Montanaro has posted a proto-PEP for this idea: http://mail.python.org/pipermail/python-dev/2002-May/024346.html + Unfortunately there hasn't been much progress on this. ! - Extended slice notation for all built-in sequences. Completed: ! patch by Michael Hudson is now all checked in. - An iterator tools module featuring goodies from SML and Haskell? *************** *** 103,120 **** - Speed up list iterations by filling tp_iter and other tweaks? ! http://www.python.org/sf/560736 (This is done; also for xrange.) - Deprecate the buffer object. http://mail.python.org/pipermail/python-dev/2002-July/026388.html http://mail.python.org/pipermail/python-dev/2002-July/026408.html - Lazily tracking tuples? http://mail.python.org/pipermail/python-dev/2002-May/023926.html http://www.python.org/sf/558745 ! - Timeoutsocket. Work in progress. ! http://mail.python.org/pipermail/python-dev/2002-May/024077.html ! http://www.python.org/sf/555085 (Most of this is done, but we ! still need to add a global timeout option.) - Making None a keyword. Can't be done right away, but a warning --- 102,122 ---- - Speed up list iterations by filling tp_iter and other tweaks? ! http://www.python.org/sf/560736 (This is done; also for xrange ! and tuple objects.) - Deprecate the buffer object. http://mail.python.org/pipermail/python-dev/2002-July/026388.html http://mail.python.org/pipermail/python-dev/2002-July/026408.html + No progress; the last time this was brought up only Marc-Andre + Lemburg said he had a use for it. I need to find out exactly + what that need is and how much of the buffer object we can retire. - Lazily tracking tuples? http://mail.python.org/pipermail/python-dev/2002-May/023926.html http://www.python.org/sf/558745 + Not much enthusiasm I believe. ! - Timeout sockets. Completed. ! http://www.python.org/sf/555085 - Making None a keyword. Can't be done right away, but a warning *************** *** 134,138 **** - Nuke SET_LINENO from all code objects (providing a different way to set debugger breakpoints). This can boost pystone by >5%. ! (Tim Peters.) - Write a pymemcompat.h that people can bundle with their --- 136,140 ---- - Nuke SET_LINENO from all code objects (providing a different way to set debugger breakpoints). This can boost pystone by >5%. ! http://www.python.org/sf/587993 awaiting review. - Write a pymemcompat.h that people can bundle with their From tim_one@users.sourceforge.net Sat Aug 10 06:21:17 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 09 Aug 2002 22:21:17 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.133,2.134 listsort.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12101/python/Objects Modified Files: listobject.c listsort.txt Log Message: 1. Combined the base and length arrays into a single array of structs. This is friendlier for caches. 2. Cut MIN_GALLOP to 7, but added a per-sort min_gallop vrbl that adapts the "get into galloping mode" threshold higher when galloping isn't paying, and lower when it is. There's no known case where this hurts. It's (of course) neutral for /sort, \sort and =sort. It also happens to be neutral for !sort. It cuts a tiny # of compares in 3sort and +sort. For *sort, it reduces the # of compares to better than what this used to do when MIN_GALLOP was hardcoded to 10 (it did about 0.1% more *sort compares before, but given how close we are to the limit, this is "a lot"!). %sort used to do about 1.5% more compares, and ~sort about 3.6% more. Here are exact counts: i *sort 3sort +sort %sort ~sort !sort 15 449235 33019 33016 51328 188720 65534 before 448885 33016 33007 50426 182083 65534 after 0.08% 0.01% 0.03% 1.79% 3.65% 0.00% %ch from after 16 963714 65824 65809 103409 377634 131070 962991 65821 65808 101667 364341 131070 0.08% 0.00% 0.00% 1.71% 3.65% 0.00% 17 2059092 131413 131362 209130 755476 262142 2057533 131410 131361 206193 728871 262142 0.08% 0.00% 0.00% 1.42% 3.65% 0.00% 18 4380687 262440 262460 421998 1511174 524286 4377402 262437 262459 416347 1457945 524286 0.08% 0.00% 0.00% 1.36% 3.65% 0.00% 19 9285709 524581 524634 848590 3022584 1048574 9278734 524580 524633 837947 2916107 1048574 0.08% 0.00% 0.00% 1.27% 3.65% 0.00% 20 19621118 1048960 1048942 1715806 6045418 2097150 19606028 1048958 1048941 1694896 5832445 2097150 0.08% 0.00% 0.00% 1.23% 3.65% 0.00% 3. Added some key asserts I overlooked before. 4. Updated the doc file. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.133 retrieving revision 2.134 diff -C2 -d -r2.133 -r2.134 *** listobject.c 8 Aug 2002 01:06:39 -0000 2.133 --- listobject.c 10 Aug 2002 05:21:15 -0000 2.134 *************** *** 1123,1131 **** #define MAX_MERGE_PENDING 85 ! /* If a run wins MIN_GALLOP times in a row, we switch to galloping mode, ! * and stay there until both runs win less often than MIN_GALLOP ! * consecutive times. See listsort.txt for more info. */ ! #define MIN_GALLOP 8 /* Avoid malloc for small temp arrays. */ --- 1123,1130 ---- #define MAX_MERGE_PENDING 85 ! /* When we get into galloping mode, we stay there until both runs win less ! * often than MIN_GALLOP consecutive times. See listsort.txt for more info. */ ! #define MIN_GALLOP 7 /* Avoid malloc for small temp arrays. */ *************** *** 1135,1142 **** --- 1134,1152 ---- * a convenient way to pass state around among the helper functions. */ + struct s_slice { + PyObject **base; + int len; + }; + typedef struct s_MergeState { /* The user-supplied comparison function. or NULL if none given. */ PyObject *compare; + /* This controls when we get *into* galloping mode. It's initialized + * to MIN_GALLOP. merge_lo and merge_hi tend to nudge it higher for + * random data, and lower for highly structured data. + */ + int min_gallop; + /* 'a' is temp storage to help with merges. It contains room for * alloced entries. *************** *** 1149,1153 **** * true (so long as the indices are in bounds) that * ! * base[i] + len[i] == base[i+1] * * so we could cut the storage for this, but it's a minor amount, --- 1159,1163 ---- * true (so long as the indices are in bounds) that * ! * pending[i].base + pending[i].len == pending[i+1].base * * so we could cut the storage for this, but it's a minor amount, *************** *** 1155,1160 **** */ int n; ! PyObject **base[MAX_MERGE_PENDING]; ! int len[MAX_MERGE_PENDING]; /* 'a' points to this when possible, rather than muck with malloc. */ --- 1165,1169 ---- */ int n; ! struct s_slice pending[MAX_MERGE_PENDING]; /* 'a' points to this when possible, rather than muck with malloc. */ *************** *** 1171,1174 **** --- 1180,1184 ---- ms->alloced = MERGESTATE_TEMP_SIZE; ms->n = 0; + ms->min_gallop = MIN_GALLOP; } *************** *** 1225,1228 **** --- 1235,1239 ---- PyObject **dest; int result = -1; /* guilty until proved innocent */ + int min_gallop = ms->min_gallop; assert(ms && pa && pb && na > 0 && nb > 0 && pa + na == pb); *************** *** 1249,1252 **** --- 1260,1264 ---- */ for (;;) { + assert(na > 1 && nb > 0); k = ISLT(*pb, *pa, compare); if (k) { *************** *** 1259,1263 **** if (nb == 0) goto Succeed; ! if (bcount >= MIN_GALLOP) break; } --- 1271,1275 ---- if (nb == 0) goto Succeed; ! if (bcount >= min_gallop) break; } *************** *** 1269,1273 **** if (na == 1) goto CopyB; ! if (acount >= MIN_GALLOP) break; } --- 1281,1285 ---- if (na == 1) goto CopyB; ! if (acount >= min_gallop) break; } *************** *** 1279,1283 **** --- 1291,1299 ---- * anymore. */ + ++min_gallop; do { + assert(na > 1 && nb > 0); + min_gallop -= min_gallop > 1; + ms->min_gallop = min_gallop; k = gallop_right(*pb, pa, na, 0, compare); acount = k; *************** *** 1320,1323 **** --- 1336,1341 ---- goto CopyB; } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); + ++min_gallop; /* penalize it for leaving galloping mode */ + ms->min_gallop = min_gallop; } Succeed: *************** *** 1350,1353 **** --- 1368,1372 ---- PyObject **basea; PyObject **baseb; + int min_gallop = ms->min_gallop; assert(ms && pa && pb && na > 0 && nb > 0 && pa + na == pb); *************** *** 1377,1380 **** --- 1396,1400 ---- */ for (;;) { + assert(na > 0 && nb > 1); k = ISLT(*pb, *pa, compare); if (k) { *************** *** 1387,1391 **** if (na == 0) goto Succeed; ! if (acount >= MIN_GALLOP) break; } --- 1407,1411 ---- if (na == 0) goto Succeed; ! if (acount >= min_gallop) break; } *************** *** 1397,1401 **** if (nb == 1) goto CopyA; ! if (bcount >= MIN_GALLOP) break; } --- 1417,1421 ---- if (nb == 1) goto CopyA; ! if (bcount >= min_gallop) break; } *************** *** 1407,1411 **** --- 1427,1435 ---- * anymore. */ + ++min_gallop; do { + assert(na > 0 && nb > 1); + min_gallop -= min_gallop > 1; + ms->min_gallop = min_gallop; k = gallop_right(*pb, basea, na, na-1, compare); if (k < 0) *************** *** 1450,1453 **** --- 1474,1479 ---- goto Succeed; } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); + ++min_gallop; /* penalize it for leaving galloping mode */ + ms->min_gallop = min_gallop; } Succeed: *************** *** 1483,1490 **** assert(i == ms->n - 2 || i == ms->n - 3); ! pa = ms->base[i]; ! pb = ms->base[i+1]; ! na = ms->len[i]; ! nb = ms->len[i+1]; assert(na > 0 && nb > 0); assert(pa + na == pb); --- 1509,1516 ---- assert(i == ms->n - 2 || i == ms->n - 3); ! pa = ms->pending[i].base; ! na = ms->pending[i].len; ! pb = ms->pending[i+1].base; ! nb = ms->pending[i+1].len; assert(na > 0 && nb > 0); assert(pa + na == pb); *************** *** 1494,1502 **** * in this merge). The current run i+1 goes away in any case. */ ! if (i == ms->n - 3) { ! ms->len[i+1] = ms->len[i+2]; ! ms->base[i+1] = ms->base[i+2]; ! } ! ms->len[i] = na + nb; --ms->n; --- 1520,1526 ---- * in this merge). The current run i+1 goes away in any case. */ ! ms->pending[i].len = na + nb; ! if (i == ms->n - 3) ! ms->pending[i+1] = ms->pending[i+2]; --ms->n; *************** *** 1542,1557 **** merge_collapse(MergeState *ms) { ! int *len = ms->len; assert(ms); while (ms->n > 1) { int n = ms->n - 2; ! if (n > 0 && len[n-1] <= len[n] + len[n+1]) { ! if (len[n-1] < len[n+1]) --n; if (merge_at(ms, n) < 0) return -1; } ! else if (len[n] <= len[n+1]) { if (merge_at(ms, n) < 0) return -1; --- 1566,1581 ---- merge_collapse(MergeState *ms) { ! struct s_slice *p = ms->pending; assert(ms); while (ms->n > 1) { int n = ms->n - 2; ! if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) { ! if (p[n-1].len < p[n+1].len) --n; if (merge_at(ms, n) < 0) return -1; } ! else if (p[n].len <= p[n+1].len) { if (merge_at(ms, n) < 0) return -1; *************** *** 1571,1580 **** merge_force_collapse(MergeState *ms) { ! int *len = ms->len; assert(ms); while (ms->n > 1) { int n = ms->n - 2; ! if (n > 0 && len[n-1] < len[n+1]) --n; if (merge_at(ms, n) < 0) --- 1595,1604 ---- merge_force_collapse(MergeState *ms) { ! struct s_slice *p = ms->pending; assert(ms); while (ms->n > 1) { int n = ms->n - 2; ! if (n > 0 && p[n-1].len < p[n+1].len) --n; if (merge_at(ms, n) < 0) *************** *** 1665,1670 **** /* Push run onto pending-runs stack, and maybe merge. */ assert(ms.n < MAX_MERGE_PENDING); ! ms.base[ms.n] = lo; ! ms.len[ms.n] = n; ++ms.n; if (merge_collapse(&ms) < 0) --- 1689,1694 ---- /* Push run onto pending-runs stack, and maybe merge. */ assert(ms.n < MAX_MERGE_PENDING); ! ms.pending[ms.n].base = lo; ! ms.pending[ms.n].len = n; ++ms.n; if (merge_collapse(&ms) < 0) *************** *** 1679,1684 **** goto fail; assert(ms.n == 1); ! assert(ms.base[0] == self->ob_item); ! assert(ms.len[0] == self->ob_size); succeed: --- 1703,1708 ---- goto fail; assert(ms.n == 1); ! assert(ms.pending[0].base == self->ob_item); ! assert(ms.pending[0].len == self->ob_size); succeed: Index: listsort.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listsort.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** listsort.txt 10 Aug 2002 03:04:33 -0000 1.4 --- listsort.txt 10 Aug 2002 05:21:15 -0000 1.5 *************** *** 96,124 **** structure in the data. ! n lg(n!) *sort 3sort +sort %sort ~sort !sort ! ------- ------- ------ -------- ------- ------ ------- -------- ! 32768 444255 453096 453614 32908 452871 130491 469141 old ! 449235 33019 33016 51328 188720 65534 new ! 0.86% 1273.80% -0.33% 782.31% -30.85% 615.87% %ch from new 65536 954037 972699 981940 65686 973104 260029 1004607 ! 963714 65824 65809 103409 377634 131070 ! 0.93% 1391.77% -0.19% 841.02% -31.14% 666.47% 131072 2039137 2101881 2091491 131232 2092894 554790 2161379 ! 2059092 131413 131362 209130 755476 262142 ! 2.08% 1491.54% -0.10% 900.76% -26.56% 724.51% 262144 4340409 4464460 4403233 262314 4445884 1107842 4584560 ! 4380687 262440 262460 421998 1511174 524286 ! 1.91% 1577.81% -0.06% 953.53% -26.69% 774.44% 524288 9205096 9453356 9408463 524468 9441930 2218577 9692015 ! 9285709 524581 524634 848590 3022584 1048574 ! 1.81% 1693.52% -0.03% 1012.66% -26.60% 824.30% 1048576 19458756 19950272 19838588 1048766 19912134 4430649 20434212 ! 19621118 1048960 1048942 1715806 6045418 2097150 ! 1.68% 1791.26% -0.02% 1060.51% -26.71% 874.38% Discussion of cases: --- 96,124 ---- structure in the data. ! n lg(n!) *sort 3sort +sort %sort ~sort !sort ! ------- ------- ------ ------- ------- ------ ------- -------- ! 32768 444255 453096 453614 32908 452871 130491 469141 old ! 448885 33016 33007 50426 182083 65534 new ! 0.94% 1273.92% -0.30% 798.09% -28.33% 615.87% %ch from new 65536 954037 972699 981940 65686 973104 260029 1004607 ! 962991 65821 65808 101667 364341 131070 ! 1.01% 1391.83% -0.19% 857.15% -28.63% 666.47% 131072 2039137 2101881 2091491 131232 2092894 554790 2161379 ! 2057533 131410 131361 206193 728871 262142 ! 2.16% 1491.58% -0.10% 915.02% -23.88% 724.51% 262144 4340409 4464460 4403233 262314 4445884 1107842 4584560 ! 4377402 262437 262459 416347 1457945 524286 ! 1.99% 1577.82% -0.06% 967.83% -24.01% 774.44% 524288 9205096 9453356 9408463 524468 9441930 2218577 9692015 ! 9278734 524580 524633 837947 2916107 1048574 ! 1.88% 1693.52% -0.03% 1026.79% -23.92% 824.30% 1048576 19458756 19950272 19838588 1048766 19912134 4430649 20434212 ! 19606028 1048958 1048941 1694896 5832445 2097150 ! 1.76% 1791.27% -0.02% 1074.83% -24.03% 874.38% Discussion of cases: *************** *** 172,176 **** "15 20 1": - 2**i *sort \sort /sort 3sort +sort %sort ~sort =sort !sort 32768 16384 0 0 6256 0 10821 12288 0 16383 --- 172,175 ---- *************** *** 431,434 **** --- 430,438 ---- at-a-time mode. + A refinement: The MergeState struct contains the value of min_gallop that + controls when we enter galloping mode, initialized to MIN_GALLOP. + merge_lo() and merge_hi() adjust this higher when gallooping isn't paying + off, and lower when it is. + Galloping *************** *** 537,547 **** We can't guess in advance when it's going to win, though, so we do one pair at a time until the evidence seems strong that galloping may pay. MIN_GALLOP ! is 8 as I type this, and that's pretty strong evidence. However, if the data ! is random, it simply will trigger galloping mode purely by luck every now ! and again, and it's quite likely to hit one of the losing cases next. 8 ! favors protecting against a slowdown on random data at the expense of giving ! up small wins on lightly clustered data, and tiny marginal wins on highly ! clustered data (they win huge anyway, and if you're getting a factor of ! 10 speedup, another percent just isn't worth fighting for). --- 541,559 ---- We can't guess in advance when it's going to win, though, so we do one pair at a time until the evidence seems strong that galloping may pay. MIN_GALLOP ! is 7, and that's pretty strong evidence. However, if the data is random, it ! simply will trigger galloping mode purely by luck every now and again, and ! it's quite likely to hit one of the losing cases next. On the other hand, ! in cases like ~sort, galloping always pays, and MIN_GALLOP is larger than it ! "should be" then. So the MergeState struct keeps a min_gallop variable ! that merge_lo and merge_hi adjust: the longer we stay in galloping mode, ! the smaller min_gallop gets, making it easier to transition back to ! galloping mode (if we ever leave it in the current merge, and at the ! start of the next merge). But whenever the gallop loop doesn't pay, ! min_gallop is increased by one, making it harder to transition to back ! to galloping mode (and again both within a merge and across merges). For ! random data, this all but eliminates the gallop penalty: min_gallop grows ! large enough that we almost never get into galloping mode. And for cases ! like ~sort, min_gallop can fall to as low as 1. This seems to work well, ! but in all it's a minor improvement over using a fixed MIN_GALLOP value. *************** *** 568,571 **** --- 580,586 ---- Comparing Average # of Compares on Random Arrays ------------------------------------------------ + [NOTE: This was done when the new algorithm used about 0.1% more compares + on random data than does its current incarnation.] + Here list.sort() is samplesort, and list.msort() this sort: From gvanrossum@users.sourceforge.net Sat Aug 10 06:41:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 22:41:32 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.170,2.171 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19677 Modified Files: typeobject.c Log Message: Disallow class assignment completely unless both old and new are heap types. This prevents nonsense like 2.__class__ = bool or True.__class__ = int. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.170 retrieving revision 2.171 diff -C2 -d -r2.170 -r2.171 *** typeobject.c 9 Aug 2002 02:14:34 -0000 2.170 --- typeobject.c 10 Aug 2002 05:41:29 -0000 2.171 *************** *** 1746,1749 **** --- 1746,1756 ---- } new = (PyTypeObject *)value; + if (!(new->tp_flags & Py_TPFLAGS_HEAPTYPE) || + !(old->tp_flags & Py_TPFLAGS_HEAPTYPE)) + { + PyErr_Format(PyExc_TypeError, + "__class__ assignment: only for heap types"); + return -1; + } if (new->tp_dealloc != old->tp_dealloc || new->tp_free != old->tp_free) *************** *** 1772,1782 **** return -1; } ! if (new->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! Py_INCREF(new); ! } self->ob_type = new; ! if (old->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! Py_DECREF(old); ! } return 0; } --- 1779,1785 ---- return -1; } ! Py_INCREF(new); self->ob_type = new; ! Py_DECREF(old); return 0; } From gvanrossum@users.sourceforge.net Sat Aug 10 06:42:09 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 09 Aug 2002 22:42:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.152,1.153 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19902 Modified Files: test_descr.py Log Message: Disallow class assignment completely unless both old and new are heap types. This prevents nonsense like 2.__class__ = bool or True.__class__ = int. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** test_descr.py 9 Aug 2002 16:11:37 -0000 1.152 --- test_descr.py 10 Aug 2002 05:42:07 -0000 1.153 *************** *** 2479,2482 **** --- 2479,2487 ---- cant(object(), list) cant(list(), object) + class Int(int): __slots__ = [] + cant(2, Int) + cant(Int(), int) + cant(True, int) + cant(2, bool) def setdict(): From mhammond@users.sourceforge.net Sat Aug 10 07:26:34 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Fri, 09 Aug 2002 23:26:34 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.459,1.460 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2146 Modified Files: NEWS Log Message: Clarify that the interruptable popen fixes aren't used under Win9x. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.459 retrieving revision 1.460 diff -C2 -d -r1.459 -r1.460 *** NEWS 9 Aug 2002 17:17:07 -0000 1.459 --- NEWS 10 Aug 2002 06:26:31 -0000 1.460 *************** *** 64,70 **** and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will ! interrupt time.sleep() in the main thread, and any child processes ! created via the popen family are also interrupted (as generally ! happens on for Linux/Unix). [SF bugs 231273, 439992 and 581232] - Slices and repetitions of buffer objects now consistently return --- 64,71 ---- and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will ! interrupt time.sleep() in the main thread, and any child processes ! created via the popen family (on win2k; we can't make win9x work ! reliably) are also interrupted (as generally happens on for Linux/Unix.) ! [SF bugs 231273, 439992 and 581232] - Slices and repetitions of buffer objects now consistently return From tim_one@users.sourceforge.net Sat Aug 10 08:04:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 10 Aug 2002 00:04:05 -0700 Subject: [Python-checkins] python/dist/src/Objects listsort.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12588/python/Objects Modified Files: listsort.txt Log Message: Fixed new typos, added a little info about ~sort versus "hint"s. Index: listsort.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listsort.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** listsort.txt 10 Aug 2002 05:21:15 -0000 1.5 --- listsort.txt 10 Aug 2002 07:04:01 -0000 1.6 *************** *** 114,119 **** 1.99% 1577.82% -0.06% 967.83% -24.01% 774.44% ! 524288 9205096 9453356 9408463 524468 9441930 2218577 9692015 ! 9278734 524580 524633 837947 2916107 1048574 1.88% 1693.52% -0.03% 1026.79% -23.92% 824.30% --- 114,119 ---- 1.99% 1577.82% -0.06% 967.83% -24.01% 774.44% ! 524288 9205096 9453356 9408463 524468 9441930 2218577 9692015 ! 9278734 524580 524633 837947 2916107 1048574 1.88% 1693.52% -0.03% 1026.79% -23.92% 824.30% *************** *** 432,436 **** A refinement: The MergeState struct contains the value of min_gallop that controls when we enter galloping mode, initialized to MIN_GALLOP. ! merge_lo() and merge_hi() adjust this higher when gallooping isn't paying off, and lower when it is. --- 432,436 ---- A refinement: The MergeState struct contains the value of min_gallop that controls when we enter galloping mode, initialized to MIN_GALLOP. ! merge_lo() and merge_hi() adjust this higher when galloping isn't paying off, and lower when it is. *************** *** 550,554 **** galloping mode (if we ever leave it in the current merge, and at the start of the next merge). But whenever the gallop loop doesn't pay, ! min_gallop is increased by one, making it harder to transition to back to galloping mode (and again both within a merge and across merges). For random data, this all but eliminates the gallop penalty: min_gallop grows --- 550,554 ---- galloping mode (if we ever leave it in the current merge, and at the start of the next merge). But whenever the gallop loop doesn't pay, ! min_gallop is increased by one, making it harder to transition back to galloping mode (and again both within a merge and across merges). For random data, this all but eliminates the gallop penalty: min_gallop grows *************** *** 576,579 **** --- 576,585 ---- it's unclear how to generalize that intuition usefully, and merging of wildly unbalanced runs already enjoys excellent performance. + + ~sort is a good example of when balanced runs could benefit from a better + hint value: to the extent possible, this would like to use a starting + offset equal to the previous value of acount/bcount. Doing so saves about + 10% of the compares in ~sort. However, doing so is also a mixed bag, + hurting other cases. From loewis@users.sourceforge.net Sat Aug 10 13:22:16 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 Aug 2002 05:22:16 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle OutputWindow.py,1.6,1.7 PyShell.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv10082 Modified Files: OutputWindow.py PyShell.py Log Message: 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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** OutputWindow.py 23 Feb 2002 22:39:37 -0000 1.6 --- OutputWindow.py 10 Aug 2002 12:22:12 -0000 1.7 *************** *** 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) Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** PyShell.py 5 Aug 2002 14:55:21 -0000 1.38 --- PyShell.py 10 Aug 2002 12:22:12 -0000 1.39 *************** *** 192,196 **** if isinstance(source, types.UnicodeType): import IOBinding ! source = source.encode(IOBinding.encoding) try: return InteractiveInterpreter.runsource(self, source, filename) --- 192,201 ---- if isinstance(source, types.UnicodeType): import IOBinding ! try: ! source = source.encode(IOBinding.encoding) ! except UnicodeError: ! self.tkconsole.resetoutput() ! self.write("Unsupported characters in input") ! return try: return InteractiveInterpreter.runsource(self, source, filename) From tim_one@users.sourceforge.net Sat Aug 10 22:20:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 10 Aug 2002 14:20:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7300/python/Lib/test Modified Files: test_gc.py Log Message: If any trash happened to be sitting around waiting to get collected at the time it's called, test_saveall() made it look a leak, triggering bogus warnings from regrtest's -l (findleaks) mode. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_gc.py 9 Aug 2002 17:38:16 -0000 1.19 --- test_gc.py 10 Aug 2002 21:20:54 -0000 1.20 *************** *** 1,3 **** ! from test.test_support import verify, verbose, TestFailed import sys import gc --- 1,3 ---- ! from test.test_support import verify, verbose, TestFailed, vereq import sys import gc *************** *** 169,172 **** --- 169,178 ---- # Verify that cyclic garbage like lists show up in gc.garbage if the # SAVEALL option is enabled. + + # First make sure we don't save away other stuff that just happens to + # be waiting for collection. + gc.collect() + vereq(gc.garbage, []) # if this fails, someone else created immortal trash + debug = gc.get_debug() gc.set_debug(debug | gc.DEBUG_SAVEALL) *************** *** 176,179 **** --- 182,186 ---- del l gc.collect() + vereq(len(gc.garbage), 1) try: for obj in gc.garbage: From tim_one@users.sourceforge.net Sat Aug 10 22:29:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 10 Aug 2002 14:29:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9928/python/Lib/test Modified Files: test_gc.py Log Message: test_saveall(): Simplified a little, given that we only expect one item in gc.garbage (so no need to loop looking for it -- it's there or it's not). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_gc.py 10 Aug 2002 21:20:54 -0000 1.20 --- test_gc.py 10 Aug 2002 21:29:56 -0000 1.21 *************** *** 181,194 **** id_l = id(l) del l gc.collect() - vereq(len(gc.garbage), 1) try: ! for obj in gc.garbage: ! if id(obj) == id_l: ! del obj[:] ! break else: raise TestFailed, "didn't find obj in garbage (saveall)" - gc.garbage.remove(obj) finally: gc.set_debug(debug) --- 181,192 ---- id_l = id(l) del l + gc.collect() try: ! vereq(len(gc.garbage), 1) ! if id(gc.garbage[0]) == id_l: ! del gc.garbage[0] else: raise TestFailed, "didn't find obj in garbage (saveall)" finally: gc.set_debug(debug) From tim_one@users.sourceforge.net Sat Aug 10 22:32:19 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 10 Aug 2002 14:32:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10743/python/Lib/test Modified Files: test_gc.py Log Message: And one more simplification to test_saveall(). Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_gc.py 10 Aug 2002 21:29:56 -0000 1.21 --- test_gc.py 10 Aug 2002 21:32:16 -0000 1.22 *************** *** 175,194 **** vereq(gc.garbage, []) # if this fails, someone else created immortal trash - debug = gc.get_debug() - gc.set_debug(debug | gc.DEBUG_SAVEALL) l = [] l.append(l) id_l = id(l) - del l gc.collect() ! try: ! vereq(len(gc.garbage), 1) ! if id(gc.garbage[0]) == id_l: ! del gc.garbage[0] ! else: ! raise TestFailed, "didn't find obj in garbage (saveall)" ! finally: ! gc.set_debug(debug) def test_del(): --- 175,193 ---- vereq(gc.garbage, []) # if this fails, someone else created immortal trash l = [] l.append(l) id_l = id(l) + debug = gc.get_debug() + gc.set_debug(debug | gc.DEBUG_SAVEALL) + del l gc.collect() ! gc.set_debug(debug) ! ! vereq(len(gc.garbage), 1) ! if id(gc.garbage[0]) == id_l: ! del gc.garbage[0] ! else: ! raise TestFailed, "didn't find obj in garbage (saveall)" def test_del(): From gvanrossum@users.sourceforge.net Sun Aug 11 05:05:15 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 10 Aug 2002 21:05:15 -0700 Subject: [Python-checkins] python/nondist/peps pep-0237.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13895 Modified Files: pep-0237.txt Log Message: Remove author's email addresses. Mention %X (same treatment as %x). Insert new stage B0, which gives warnings about e.g. 0xffffffff without semantic changes. Move the proposed deployment of subsequent stages up by one minor revision. Index: pep-0237.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0237.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0237.txt 30 Oct 2001 21:12:14 -0000 1.13 --- pep-0237.txt 11 Aug 2002 04:05:13 -0000 1.14 *************** *** 2,6 **** Title: Unifying Long Integers and Integers Version: $Revision$ ! Author: pep@zadka.site.co.il (Moshe Zadka), guido@python.org (Guido van Rossum) Status: Draft Type: Standards Track --- 2,6 ---- Title: Unifying Long Integers and Integers Version: $Revision$ ! Author: Moshe Zadka, Guido van Rossum Status: Draft Type: Standards Track *************** *** 105,117 **** machine. This will be changed to equal 0xffffffffL (2**32-1). ! - Currently, the '%u', '%x' and '%o' string formatting operators ! and the hex() and oct() built-in functions behave differently ! for negative numbers: negative short ints are formatted as ! unsigned C long, while negative long ints are formatted with a ! minus sign. This will be changed to use the long int semantics ! in all cases (but without the trailing 'L' that currently ! distinguishes the output of hex() and oct() for long ints). ! Note that this means that '%u' becomes an alias for '%d'. It ! will eventually be removed. - Currently, repr() of a long int returns a string ending in 'L' --- 105,117 ---- machine. This will be changed to equal 0xffffffffL (2**32-1). ! - Currently, the '%u', '%x', '%X' and '%o' string formatting ! operators and the hex() and oct() built-in functions behave ! differently for negative numbers: negative short ints are ! formatted as unsigned C long, while negative long ints are ! formatted with a minus sign. This will be changed to use the ! long int semantics in all cases (but without the trailing 'L' ! that currently distinguishes the output of hex() and oct() for ! long ints). Note that this means that '%u' becomes an alias for ! '%d'. It will eventually be removed. - Currently, repr() of a long int returns a string ending in 'L' *************** *** 200,203 **** --- 200,209 ---- stages of phase B: + B0. Warnings are enabled about operations that will change their + numeric outcome in stage B1, in particular hex() and oct(), + '%u', '%x', '%X' and '%o', hex and oct literals in the + (inclusive) range [sys.maxint+1, sys.maxint*2+1], and left + shifts losing bits; but not repr() of a long. + B1. The remaining semantic differences are addressed. Operations that give different results than before will issue a warning *************** *** 216,222 **** We propose the following timeline: ! B1. Python 2.3. ! B2. Python 2.4. B3. The rest of the Python 2.x line. --- 222,230 ---- We propose the following timeline: ! B0. Python 2.3. ! B1. Python 2.4. ! ! B2. Python 2.5. B3. The rest of the Python 2.x line. From tim_one@users.sourceforge.net Sun Aug 11 05:15:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 10 Aug 2002 21:15:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gc.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15229/python/Lib/test Modified Files: test_gc.py Log Message: test_saveall(): Another small simplification; plus s/l/L/g. test_del(), test_del_newclass(): No need to use apply() in these. Index: test_gc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_gc.py 10 Aug 2002 21:32:16 -0000 1.22 --- test_gc.py 11 Aug 2002 04:15:09 -0000 1.23 *************** *** 175,193 **** vereq(gc.garbage, []) # if this fails, someone else created immortal trash ! l = [] ! l.append(l) ! id_l = id(l) debug = gc.get_debug() gc.set_debug(debug | gc.DEBUG_SAVEALL) ! del l gc.collect() gc.set_debug(debug) vereq(len(gc.garbage), 1) ! if id(gc.garbage[0]) == id_l: ! del gc.garbage[0] ! else: ! raise TestFailed, "didn't find obj in garbage (saveall)" def test_del(): --- 175,191 ---- vereq(gc.garbage, []) # if this fails, someone else created immortal trash ! L = [] ! L.append(L) ! id_L = id(L) debug = gc.get_debug() gc.set_debug(debug | gc.DEBUG_SAVEALL) ! del L gc.collect() gc.set_debug(debug) vereq(len(gc.garbage), 1) ! obj = gc.garbage.pop() ! vereq(id(obj), id_L) def test_del(): *************** *** 204,208 **** gc.disable() ! apply(gc.set_threshold, thresholds) def test_del_newclass(): --- 202,206 ---- gc.disable() ! gc.set_threshold(*thresholds) def test_del_newclass(): *************** *** 219,223 **** gc.disable() ! apply(gc.set_threshold, thresholds) class Ouch: --- 217,221 ---- gc.disable() ! gc.set_threshold(*thresholds) class Ouch: From gvanrossum@users.sourceforge.net Sun Aug 11 05:24:14 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 10 Aug 2002 21:24:14 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.86,2.87 stringobject.c,2.175,2.176 unicodeobject.c,2.160,2.161 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15811/Objects Modified Files: intobject.c stringobject.c unicodeobject.c Log Message: Implement stage B0 of PEP 237: add warnings for operations that currently return inconsistent results for ints and longs; in particular: hex/oct/%u/%o/%x/%X of negative short ints, and x<= LONG_BIT) { return PyInt_FromLong(0L); } ! a = (long)((unsigned long)a << b); ! return PyInt_FromLong(a); } --- 670,687 ---- return int_pos(v); if (b >= LONG_BIT) { + if (PyErr_Warn(PyExc_DeprecationWarning, + "x<> b) != a || (c < 0 && a > 0)) { ! if (PyErr_Warn(PyExc_DeprecationWarning, ! "x< ob_ival; + if (x < 0) { + if (PyErr_Warn(PyExc_DeprecationWarning, + "hex()/oct() of negative int will return " + "a signed string in Python 2.4 and up") < 0) + return NULL; + } if (x == 0) strcpy(buf, "0"); *************** *** 774,777 **** --- 790,799 ---- char buf[100]; long x = v -> ob_ival; + if (x < 0) { + if (PyErr_Warn(PyExc_DeprecationWarning, + "hex()/oct() of negative int will return " + "a signed string in Python 2.4 and up") < 0) + return NULL; + } PyOS_snprintf(buf, sizeof(buf), "0x%lx", x); return PyString_FromString(buf); Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.175 retrieving revision 2.176 diff -C2 -d -r2.175 -r2.176 *** stringobject.c 6 Aug 2002 16:58:21 -0000 2.175 --- stringobject.c 11 Aug 2002 04:24:11 -0000 2.176 *************** *** 3312,3315 **** --- 3312,3321 ---- return -1; } + if (x < 0 && type != 'd' && type != 'i') { + if (PyErr_Warn(PyExc_DeprecationWarning, + "%u/%o/%x/%X of negative int will return " + "a signed string in Python 2.4 and up") < 0) + return -1; + } if (prec < 0) prec = 1; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.160 retrieving revision 2.161 diff -C2 -d -r2.160 -r2.161 *** unicodeobject.c 9 Aug 2002 15:36:48 -0000 2.160 --- unicodeobject.c 11 Aug 2002 04:24:11 -0000 2.161 *************** *** 5220,5223 **** --- 5220,5227 ---- } + /* XXX To save some code duplication, formatfloat/long/int could have been + shared with stringobject.c, converting from 8-bit to Unicode after the + formatting is done. */ + static int formatfloat(Py_UNICODE *buf, *************** *** 5295,5298 **** --- 5299,5308 ---- if (x == -1 && PyErr_Occurred()) return -1; + if (x < 0 && type != 'd' && type != 'i') { + if (PyErr_Warn(PyExc_DeprecationWarning, + "%u/%o/%x/%X of negative int will return " + "a signed string in Python 2.4 and up") < 0) + return -1; + } if (prec < 0) prec = 1; From gvanrossum@users.sourceforge.net Sun Aug 11 05:24:14 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 10 Aug 2002 21:24:14 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.252,2.253 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15811/Python Modified Files: compile.c Log Message: Implement stage B0 of PEP 237: add warnings for operations that currently return inconsistent results for ints and longs; in particular: hex/oct/%u/%o/%x/%X of negative short ints, and x< sys.maxint " + "will return positive values " + "in Python 2.4 and up") < 0) + return NULL; + } + } else x = PyOS_strtol(s, &end, 0); From lemburg@users.sourceforge.net Sun Aug 11 13:23:05 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Sun, 11 Aug 2002 05:23:05 -0700 Subject: [Python-checkins] python/dist/src/Include unicodeobject.h,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv573/Include Modified Files: unicodeobject.h Log Message: Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level. u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** unicodeobject.h 29 May 2002 11:33:13 -0000 2.38 --- unicodeobject.h 11 Aug 2002 12:23:03 -0000 2.39 *************** *** 518,521 **** --- 518,533 ---- #endif + /* --- Unicode ordinals --------------------------------------------------- */ + + /* Create a Unicode Object from the given Unicode code point ordinal. + + The ordinal must be in range(0x10000) on narrow Python builds + (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is + raised in case it is not. + + */ + + extern DL_IMPORT(PyObject*) PyUnicode_FromOrdinal(int ordinal); + /* === Builtin Codecs ===================================================== From lemburg@users.sourceforge.net Sun Aug 11 13:23:06 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Sun, 11 Aug 2002 05:23:06 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.460,1.461 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv573/Misc Modified Files: NEWS Log Message: Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level. u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.460 retrieving revision 1.461 diff -C2 -d -r1.460 -r1.461 *** NEWS 10 Aug 2002 06:26:31 -0000 1.460 --- NEWS 11 Aug 2002 12:23:03 -0000 1.461 *************** *** 7,10 **** --- 7,13 ---- Core and builtins + - u'%c' will now raise a ValueError in case the argument is an + integer outside the valid range of Unicode code point ordinals. + - The tempfile module has been overhauled for enhanced security. The mktemp() function is now deprecated; new, safe replacements are *************** *** 437,440 **** --- 440,446 ---- C API + + - New C API PyUnicode_FromOrdinal() which exposes unichr() at C + level. - New functions PyErr_SetExcFromWindowsErr() and From lemburg@users.sourceforge.net Sun Aug 11 13:23:05 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Sun, 11 Aug 2002 05:23:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv573/Lib/test Modified Files: test_unicode.py Log Message: Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level. u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** test_unicode.py 9 Aug 2002 15:36:48 -0000 1.64 --- test_unicode.py 11 Aug 2002 12:23:03 -0000 1.65 *************** *** 454,457 **** --- 454,465 ---- verify(value == u'abc, def') + for ordinal in (-100, 0x20000): + try: + u"%c" % ordinal + except ValueError: + pass + else: + print '*** formatting u"%%c" % %i should give a ValueError' % ordinal + # formatting jobs delegated from the string implementation: verify('...%(foo)s...' % {'foo':u"abc"} == u'...abc...') From lemburg@users.sourceforge.net Sun Aug 11 13:23:06 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Sun, 11 Aug 2002 05:23:06 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.261,2.262 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv573/Python Modified Files: bltinmodule.c Log Message: Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level. u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.261 retrieving revision 2.262 diff -C2 -d -r2.261 -r2.262 *** bltinmodule.c 30 Jun 2002 15:26:10 -0000 2.261 --- bltinmodule.c 11 Aug 2002 12:23:04 -0000 2.262 *************** *** 261,302 **** { long x; - Py_UNICODE s[2]; if (!PyArg_ParseTuple(args, "l:unichr", &x)) return NULL; ! #ifdef Py_UNICODE_WIDE ! if (x < 0 || x > 0x10ffff) { ! PyErr_SetString(PyExc_ValueError, ! "unichr() arg not in range(0x110000) " ! "(wide Python build)"); ! return NULL; ! } ! #else ! if (x < 0 || x > 0xffff) { ! PyErr_SetString(PyExc_ValueError, ! "unichr() arg not in range(0x10000) " ! "(narrow Python build)"); ! return NULL; ! } ! #endif ! ! if (x <= 0xffff) { ! /* UCS-2 character */ ! s[0] = (Py_UNICODE) x; ! return PyUnicode_FromUnicode(s, 1); ! } ! else { ! #ifndef Py_UNICODE_WIDE ! /* UCS-4 character. store as two surrogate characters */ ! x -= 0x10000L; ! s[0] = 0xD800 + (Py_UNICODE) (x >> 10); ! s[1] = 0xDC00 + (Py_UNICODE) (x & 0x03FF); ! return PyUnicode_FromUnicode(s, 2); ! #else ! s[0] = (Py_UNICODE)x; ! return PyUnicode_FromUnicode(s, 1); ! #endif ! } } --- 261,269 ---- { long x; if (!PyArg_ParseTuple(args, "l:unichr", &x)) return NULL; ! return PyUnicode_FromOrdinal(x); } From lemburg@users.sourceforge.net Sun Aug 11 13:23:06 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Sun, 11 Aug 2002 05:23:06 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.161,2.162 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv573/Objects Modified Files: unicodeobject.c Log Message: Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level. u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.161 retrieving revision 2.162 diff -C2 -d -r2.161 -r2.162 *** unicodeobject.c 11 Aug 2002 04:24:11 -0000 2.161 --- unicodeobject.c 11 Aug 2002 12:23:04 -0000 2.162 *************** *** 391,394 **** --- 391,433 ---- #endif + PyObject *PyUnicode_FromOrdinal(int ordinal) + { + Py_UNICODE s[2]; + + #ifdef Py_UNICODE_WIDE + if (ordinal < 0 || ordinal > 0x10ffff) { + PyErr_SetString(PyExc_ValueError, + "unichr() arg not in range(0x110000) " + "(wide Python build)"); + return NULL; + } + #else + if (ordinal < 0 || ordinal > 0xffff) { + PyErr_SetString(PyExc_ValueError, + "unichr() arg not in range(0x10000) " + "(narrow Python build)"); + return NULL; + } + #endif + + if (ordinal <= 0xffff) { + /* UCS-2 character */ + s[0] = (Py_UNICODE) ordinal; + return PyUnicode_FromUnicode(s, 1); + } + else { + #ifndef Py_UNICODE_WIDE + /* UCS-4 character. store as two surrogate characters */ + ordinal -= 0x10000L; + s[0] = 0xD800 + (Py_UNICODE) (ordinal >> 10); + s[1] = 0xDC00 + (Py_UNICODE) (ordinal & 0x03FF); + return PyUnicode_FromUnicode(s, 2); + #else + s[0] = (Py_UNICODE)ordinal; + return PyUnicode_FromUnicode(s, 1); + #endif + } + } + PyObject *PyUnicode_FromObject(register PyObject *obj) { *************** *** 5374,5378 **** if (x == -1 && PyErr_Occurred()) goto onError; ! buf[0] = (char) x; } buf[1] = '\0'; --- 5413,5432 ---- if (x == -1 && PyErr_Occurred()) goto onError; ! #ifdef Py_UNICODE_WIDE ! if (x < 0 || x > 0x10ffff) { ! PyErr_SetString(PyExc_ValueError, ! "%c arg not in range(0x110000) " ! "(wide Python build)"); ! return -1; ! } ! #else ! if (x < 0 || x > 0xffff) { ! PyErr_SetString(PyExc_ValueError, ! "%c arg not in range(0x10000) " ! "(narrow Python build)"); ! return -1; ! } ! #endif ! buf[0] = (Py_UNICODE) x; } buf[1] = '\0'; From gvanrossum@users.sourceforge.net Sun Aug 11 15:04:15 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 11 Aug 2002 07:04:15 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.87,2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28673 Modified Files: intobject.c Log Message: Use a better check for overflow from a<> b) != a || (c < 0 && a > 0)) { if (PyErr_Warn(PyExc_DeprecationWarning, "x<>= LONG_BIT - 1 - b; ! if (c) { if (PyErr_Warn(PyExc_DeprecationWarning, "x< Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv29264 Modified Files: compile.c Log Message: Reset errno to zero after calling PyErr_Warn(). It can potentially do a lot of work, including I/O (e.g. to import warnings.py), which might affect errno. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.253 retrieving revision 2.254 diff -C2 -d -r2.253 -r2.254 *** compile.c 11 Aug 2002 04:24:12 -0000 2.253 --- compile.c 11 Aug 2002 14:06:15 -0000 2.254 *************** *** 1163,1166 **** --- 1163,1167 ---- "in Python 2.4 and up") < 0) return NULL; + errno = 0; /* Might be changed by PyErr_Warn() */ } } From ping@users.sourceforge.net Sun Aug 11 16:11:36 2002 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Sun, 11 Aug 2002 08:11:36 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16670 Modified Files: pydoc.py Log Message: Extend stripid() to handle strings ending in more than one '>'. Add resolve() to handle looking up objects and names (fix SF bug 586931). Add a nicer error message when given a filename that doesn't exist. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** pydoc.py 9 Aug 2002 16:37:33 -0000 1.67 --- pydoc.py 11 Aug 2002 15:11:33 -0000 1.68 *************** *** 108,114 **** """Remove the hexadecimal id from a Python object representation.""" # The behaviour of %p is implementation-dependent; we check two cases. ! for pattern in [' at 0x[0-9a-f]{6,}>$', ' at [0-9A-F]{8,}>$']: if re.search(pattern, repr(Exception)): ! return re.sub(pattern, '>', text) return text --- 108,114 ---- """Remove the hexadecimal id from a Python object representation.""" # The behaviour of %p is implementation-dependent; we check two cases. ! for pattern in [' at 0x[0-9a-f]{6,}(>+)$', ' at [0-9A-F]{8,}(>+)$']: if re.search(pattern, repr(Exception)): ! return re.sub(pattern, '\\1', text) return text *************** *** 1326,1368 **** html = HTMLDoc() ! def doc(thing, title='Python Library Documentation: %s', forceload=0): ! """Display text documentation, given an object or a path to an object.""" ! suffix, name = '', None ! if type(thing) is type(''): ! try: ! object = locate(thing, forceload) ! except ErrorDuringImport, value: ! print value ! return if not object: ! print 'no Python documentation found for %s' % repr(thing) ! return ! parts = split(thing, '.') ! if len(parts) > 1: suffix = ' in ' + join(parts[:-1], '.') ! name = parts[-1] ! thing = object ! desc = describe(thing) ! module = inspect.getmodule(thing) ! if not suffix and module and module is not thing: ! suffix = ' in module ' + module.__name__ ! pager(title % (desc + suffix) + '\n\n' + text.document(thing, name)) ! def writedoc(key, forceload=0): """Write HTML documentation to a file in the current directory.""" try: ! object = locate(key, forceload) ! except ErrorDuringImport, value: print value - else: - if object: - page = html.page(describe(object), - html.document(object, object.__name__)) - file = open(key + '.html', 'w') - file.write(page) - file.close() - print 'wrote', key + '.html' - else: - print 'no Python documentation found for %s' % repr(key) def writedocs(dir, pkgpath='', done=None): --- 1326,1364 ---- html = HTMLDoc() ! def resolve(thing, forceload=0): ! """Given an object or a path to an object, get the object and its name.""" ! if isinstance(thing, str): ! object = locate(thing, forceload) if not object: ! raise ImportError, 'no Python documentation found for %r' % thing ! return object, thing ! else: ! return thing, getattr(thing, '__name__', None) ! def doc(thing, title='Python Library Documentation: %s', forceload=0): ! """Display text documentation, given an object or a path to an object.""" ! try: ! object, name = resolve(thing, forceload) ! desc = describe(object) ! module = inspect.getmodule(object) ! if name and '.' in name: ! desc += ' in ' + name[:name.rfind('.')] ! elif module and module is not object: ! desc += ' in module ' + module.__name__ ! pager(title % desc + '\n\n' + text.document(object, name)) ! except (ImportError, ErrorDuringImport), value: ! print value ! def writedoc(thing, forceload=0): """Write HTML documentation to a file in the current directory.""" try: ! object, name = resolve(thing, forceload) ! page = html.page(describe(object), html.document(object, name)) ! file = open(name + '.html', 'w') ! file.write(page) ! file.close() ! print 'wrote', name + '.html' ! except (ImportError, ErrorDuringImport), value: print value def writedocs(dir, pkgpath='', done=None): *************** *** 2035,2039 **** def ispath(x): ! return type(x) is types.StringType and find(x, os.sep) >= 0 def cli(): --- 2031,2035 ---- def ispath(x): ! return isinstance(x, str) and find(x, os.sep) >= 0 def cli(): *************** *** 2075,2078 **** --- 2071,2077 ---- if not args: raise BadUsage for arg in args: + if ispath(arg) and not os.path.exists(arg): + print 'file %r does not exist' % arg + break try: if ispath(arg) and os.path.isfile(arg): From nnorwitz@users.sourceforge.net Sun Aug 11 16:40:38 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 11 Aug 2002 08:40:38 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.234.4.3,2.234.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22935/Python Modified Files: Tag: release22-maint compile.c Log Message: SF bug # 557028, illegal use of malloc/free This only applies to 2.2. Use PyMem_Malloc/Free instead of malloc/free. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.234.4.3 retrieving revision 2.234.4.4 diff -C2 -d -r2.234.4.3 -r2.234.4.4 *** compile.c 3 Mar 2002 21:32:00 -0000 2.234.4.3 --- compile.c 11 Aug 2002 15:40:35 -0000 2.234.4.4 *************** *** 1959,1963 **** } if (childtype == MINUS) { ! char *s = malloc(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); --- 1959,1963 ---- } if (childtype == MINUS) { ! char *s = PyMem_Malloc(strlen(STR(pnum)) + 2); if (s == NULL) { com_error(c, PyExc_MemoryError, ""); *************** *** 1967,1971 **** s[0] = '-'; strcpy(s + 1, STR(pnum)); ! free(STR(pnum)); STR(pnum) = s; } --- 1967,1971 ---- s[0] = '-'; strcpy(s + 1, STR(pnum)); ! PyMem_Free(STR(pnum)); STR(pnum) = s; } From tim_one@users.sourceforge.net Sun Aug 11 18:54:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 11 Aug 2002 10:54:44 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.88,2.89 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30127/python/Objects Modified Files: intobject.c Log Message: int_lshift(): Simplified/sped overflow-checking. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -d -r2.88 -r2.89 *** intobject.c 11 Aug 2002 14:04:13 -0000 2.88 --- intobject.c 11 Aug 2002 17:54:42 -0000 2.89 *************** *** 676,682 **** return PyInt_FromLong(0L); } ! c = a < 0 ? ~a : a; ! c >>= LONG_BIT - 1 - b; ! if (c) { if (PyErr_Warn(PyExc_DeprecationWarning, "x< Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9390/python/Lib Modified Files: heapq.py Log Message: Fixed misspelling in comment. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** heapq.py 8 Aug 2002 20:19:18 -0000 1.14 --- heapq.py 11 Aug 2002 18:28:09 -0000 1.15 *************** *** 219,223 **** # The total compares needed by list.sort() on the same lists were 8627, # 8627, and 8632 (this should be compared to the sum of heapify() and ! # heappop() compares): list.sort() is (unsurprisingly!) more efficent # for sorting. --- 219,223 ---- # The total compares needed by list.sort() on the same lists were 8627, # 8627, and 8632 (this should be compared to the sum of heapify() and ! # heappop() compares): list.sort() is (unsurprisingly!) more efficient # for sorting. From nnorwitz@users.sourceforge.net Sun Aug 11 21:07:40 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 11 Aug 2002 13:07:40 -0700 Subject: [Python-checkins] python/dist/src/Lib telnetlib.py,1.16.10.1,1.16.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6478/Lib Modified Files: Tag: release22-maint telnetlib.py Log Message: Fix SF bug #593696 telnetlib raises UnboundLocalError Backported from: revision 1.18 SF 554073. Fix typo in error reporting of unrecognized character following IAC. Bugfix candidate if anyone cares. Index: telnetlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v retrieving revision 1.16.10.1 retrieving revision 1.16.10.2 diff -C2 -d -r1.16.10.1 -r1.16.10.2 *** telnetlib.py 16 Feb 2002 23:08:25 -0000 1.16.10.1 --- telnetlib.py 11 Aug 2002 20:07:38 -0000 1.16.10.2 *************** *** 422,426 **** self.sock.sendall(IAC + DONT + opt) else: ! self.msg('IAC %d not recognized' % ord(opt)) except EOFError: # raised by self.rawq_getchar() pass --- 422,426 ---- self.sock.sendall(IAC + DONT + opt) else: ! self.msg('IAC %d not recognized' % ord(c)) except EOFError: # raised by self.rawq_getchar() pass From gvanrossum@users.sourceforge.net Mon Aug 12 01:55:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 11 Aug 2002 17:55:46 -0700 Subject: [Python-checkins] python/nondist/peps pep-0237.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv17011 Modified Files: pep-0237.txt Log Message: Add a note explaining that changing sign is a special case of losing bits for the << operator. Index: pep-0237.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0237.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pep-0237.txt 11 Aug 2002 04:05:13 -0000 1.14 --- pep-0237.txt 12 Aug 2002 00:55:43 -0000 1.15 *************** *** 99,103 **** - Currently, x< Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv7520/python/Misc Modified Files: ACKS NEWS Log Message: Cautious introduction of a patch that started from SF 560379: Karatsuba multiplication. Lots of things were changed from that. This needs a lot more testing, for correctness and speed, the latter especially when bit lengths are unbalanced. For now, the Karatsuba code gets invoked if and only if envar KARAT exists. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.192 retrieving revision 1.193 diff -C2 -d -r1.192 -r1.193 *** ACKS 5 Aug 2002 16:14:46 -0000 1.192 --- ACKS 12 Aug 2002 02:31:18 -0000 1.193 *************** *** 107,110 **** --- 107,111 ---- Alex Coventry Matthew Dixon Cowles + Christopher A. Craig Drew Csillag Tom Culliton Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.461 retrieving revision 1.462 diff -C2 -d -r1.461 -r1.462 *** NEWS 11 Aug 2002 12:23:03 -0000 1.461 --- NEWS 12 Aug 2002 02:31:19 -0000 1.462 *************** *** 7,10 **** --- 7,14 ---- Core and builtins + - XXX Karatsuba multiplication. This is currently used if and only + if envar KARAT exists. It needs more correctness and speed testing, + the latter especially with unbalanced bit lengths. + - u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. *************** *** 67,72 **** and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will ! interrupt time.sleep() in the main thread, and any child processes ! created via the popen family (on win2k; we can't make win9x work reliably) are also interrupted (as generally happens on for Linux/Unix.) [SF bugs 231273, 439992 and 581232] --- 71,76 ---- and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will ! interrupt time.sleep() in the main thread, and any child processes ! created via the popen family (on win2k; we can't make win9x work reliably) are also interrupted (as generally happens on for Linux/Unix.) [SF bugs 231273, 439992 and 581232] *************** *** 84,88 **** - The built-ins slice() and buffer() are now callable types. The ! types classobj (formerly class), code, function, instance, and instancemethod (formerly instance-method), which have no built-in names but are accessible through the types module, are now also --- 88,92 ---- - The built-ins slice() and buffer() are now callable types. The ! 0 types classobj (formerly class), code, function, instance, and instancemethod (formerly instance-method), which have no built-in names but are accessible through the types module, are now also From tim_one@users.sourceforge.net Mon Aug 12 03:31:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 11 Aug 2002 19:31:21 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7520/python/Objects Modified Files: longobject.c Log Message: Cautious introduction of a patch that started from SF 560379: Karatsuba multiplication. Lots of things were changed from that. This needs a lot more testing, for correctness and speed, the latter especially when bit lengths are unbalanced. For now, the Karatsuba code gets invoked if and only if envar KARAT exists. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** longobject.c 17 Jul 2002 16:30:38 -0000 1.120 --- longobject.c 12 Aug 2002 02:31:19 -0000 1.121 *************** *** 9,14 **** --- 9,25 ---- #include + /* For long multiplication, use the O(N**2) school algorithm unless + * both operands contain more than KARATSUBA_CUTOFF digits (this + * being an internal Python long digit, in base BASE). + */ + #define KARATSUBA_CUTOFF 35 + #define ABS(x) ((x) < 0 ? -(x) : (x)) + #undef MIN + #undef MAX + #define MAX(x, y) ((x) < (y) ? (y) : (x)) + #define MIN(x, y) ((x) > (y) ? (y) : (x)) + /* Forward */ static PyLongObject *long_normalize(PyLongObject *); *************** *** 35,39 **** int j = ABS(v->ob_size); register int i = j; ! while (i > 0 && v->ob_digit[i-1] == 0) --i; --- 46,50 ---- int j = ABS(v->ob_size); register int i = j; ! while (i > 0 && v->ob_digit[i-1] == 0) --i; *************** *** 227,231 **** unsigned long x, prev; int i; ! if (vv == NULL || !PyLong_Check(vv)) { PyErr_BadInternalCall(); --- 238,242 ---- unsigned long x, prev; int i; ! if (vv == NULL || !PyLong_Check(vv)) { PyErr_BadInternalCall(); *************** *** 493,497 **** PyErr_SetString(PyExc_OverflowError, "long too big to convert"); return -1; ! } --- 504,508 ---- PyErr_SetString(PyExc_OverflowError, "long too big to convert"); return -1; ! } *************** *** 735,739 **** static int convert_binop(PyObject *v, PyObject *w, PyLongObject **a, PyLongObject **b) { ! if (PyLong_Check(v)) { *a = (PyLongObject *) v; Py_INCREF(v); --- 746,750 ---- static int convert_binop(PyObject *v, PyObject *w, PyLongObject **a, PyLongObject **b) { ! if (PyLong_Check(v)) { *a = (PyLongObject *) v; Py_INCREF(v); *************** *** 745,749 **** return 0; } ! if (PyLong_Check(w)) { *b = (PyLongObject *) w; Py_INCREF(w); --- 756,760 ---- return 0; } ! if (PyLong_Check(w)) { *b = (PyLongObject *) w; Py_INCREF(w); *************** *** 783,787 **** twodigits carry = extra; int i; ! if (z == NULL) return NULL; --- 794,798 ---- twodigits carry = extra; int i; ! if (z == NULL) return NULL; *************** *** 827,831 **** const int size = ABS(a->ob_size); PyLongObject *z; ! assert(n > 0 && n <= MASK); z = _PyLong_New(size); --- 838,842 ---- const int size = ABS(a->ob_size); PyLongObject *z; ! assert(n > 0 && n <= MASK); z = _PyLong_New(size); *************** *** 856,860 **** } assert(base >= 2 && base <= 36); ! /* Compute a rough upper bound for the length of the string */ i = base; --- 867,871 ---- } assert(base >= 2 && base <= 36); ! /* Compute a rough upper bound for the length of the string */ i = base; *************** *** 874,878 **** if (a->ob_size < 0) sign = '-'; ! if (a->ob_size == 0) { *--p = '0'; --- 885,889 ---- if (a->ob_size < 0) sign = '-'; ! if (a->ob_size == 0) { *--p = '0'; *************** *** 993,997 **** char *start, *orig_str = str; PyLongObject *z; ! if ((base != 0 && base < 2) || base > 36) { PyErr_SetString(PyExc_ValueError, --- 1004,1008 ---- char *start, *orig_str = str; PyLongObject *z; ! if ((base != 0 && base < 2) || base > 36) { PyErr_SetString(PyExc_ValueError, *************** *** 1024,1028 **** int k = -1; PyLongObject *temp; ! if (*str <= '9') k = *str - '0'; --- 1035,1039 ---- int k = -1; PyLongObject *temp; ! if (*str <= '9') k = *str - '0'; *************** *** 1054,1058 **** onError: ! PyErr_Format(PyExc_ValueError, "invalid literal for long(): %.200s", orig_str); Py_XDECREF(z); --- 1065,1069 ---- onError: ! PyErr_Format(PyExc_ValueError, "invalid literal for long(): %.200s", orig_str); Py_XDECREF(z); *************** *** 1093,1097 **** int size_a = ABS(a->ob_size), size_b = ABS(b->ob_size); PyLongObject *z; ! if (size_b == 0) { PyErr_SetString(PyExc_ZeroDivisionError, --- 1104,1108 ---- int size_a = ABS(a->ob_size), size_b = ABS(b->ob_size); PyLongObject *z; ! if (size_b == 0) { PyErr_SetString(PyExc_ZeroDivisionError, *************** *** 1143,1147 **** PyLongObject *a; int j, k; ! if (v == NULL || w == NULL) { Py_XDECREF(v); --- 1154,1158 ---- PyLongObject *a; int j, k; ! if (v == NULL || w == NULL) { Py_XDECREF(v); *************** *** 1149,1160 **** return NULL; } ! assert(size_v >= size_w && size_w > 1); /* Assert checks by div() */ assert(v->ob_refcnt == 1); /* Since v will be used as accumulator! */ assert(size_w == ABS(w->ob_size)); /* That's how d was calculated */ ! size_v = ABS(v->ob_size); a = _PyLong_New(size_v - size_w + 1); ! for (j = size_v, k = a->ob_size-1; a != NULL && k >= 0; --j, --k) { digit vj = (j >= size_v) ? 0 : v->ob_digit[j]; --- 1160,1171 ---- return NULL; } ! assert(size_v >= size_w && size_w > 1); /* Assert checks by div() */ assert(v->ob_refcnt == 1); /* Since v will be used as accumulator! */ assert(size_w == ABS(w->ob_size)); /* That's how d was calculated */ ! size_v = ABS(v->ob_size); a = _PyLong_New(size_v - size_w + 1); ! for (j = size_v, k = a->ob_size-1; a != NULL && k >= 0; --j, --k) { digit vj = (j >= size_v) ? 0 : v->ob_digit[j]; *************** *** 1162,1166 **** stwodigits carry = 0; int i; ! SIGCHECK({ Py_DECREF(a); --- 1173,1177 ---- stwodigits carry = 0; int i; ! SIGCHECK({ Py_DECREF(a); *************** *** 1173,1177 **** q = (((twodigits)vj << SHIFT) + v->ob_digit[j-1]) / w->ob_digit[size_w-1]; ! while (w->ob_digit[size_w-2]*q > (( --- 1184,1188 ---- q = (((twodigits)vj << SHIFT) + v->ob_digit[j-1]) / w->ob_digit[size_w-1]; ! while (w->ob_digit[size_w-2]*q > (( *************** *** 1182,1186 **** + v->ob_digit[j-2]) --q; ! for (i = 0; i < size_w && i+k < size_v; ++i) { twodigits z = w->ob_digit[i] * q; --- 1193,1197 ---- + v->ob_digit[j-2]) --q; ! for (i = 0; i < size_w && i+k < size_v; ++i) { twodigits z = w->ob_digit[i] * q; *************** *** 1193,1202 **** carry -= zz; } ! if (i+k < size_v) { carry += v->ob_digit[i+k]; v->ob_digit[i+k] = 0; } ! if (carry == 0) a->ob_digit[k] = (digit) q; --- 1204,1213 ---- carry -= zz; } ! if (i+k < size_v) { carry += v->ob_digit[i+k]; v->ob_digit[i+k] = 0; } ! if (carry == 0) a->ob_digit[k] = (digit) q; *************** *** 1214,1218 **** } } /* for j, k */ ! if (a == NULL) *prem = NULL; --- 1225,1229 ---- } } /* for j, k */ ! if (a == NULL) *prem = NULL; *************** *** 1255,1259 **** { int sign; ! if (a->ob_size != b->ob_size) { if (ABS(a->ob_size) == 0 && ABS(b->ob_size) == 0) --- 1266,1270 ---- { int sign; ! if (a->ob_size != b->ob_size) { if (ABS(a->ob_size) == 0 && ABS(b->ob_size) == 0) *************** *** 1425,1429 **** { PyLongObject *a, *b, *z; ! CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); --- 1436,1440 ---- { PyLongObject *a, *b, *z; ! CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); *************** *** 1458,1509 **** } ! static PyObject * ! long_mul(PyLongObject *v, PyLongObject *w) { ! PyLongObject *a, *b, *z; ! int size_a; ! int size_b; int i; ! if (!convert_binop((PyObject *)v, (PyObject *)w, &a, &b)) { ! if (!PyLong_Check(v) && ! v->ob_type->tp_as_sequence && ! v->ob_type->tp_as_sequence->sq_repeat) ! return long_repeat((PyObject *)v, w); ! if (!PyLong_Check(w) && ! w->ob_type->tp_as_sequence && ! w->ob_type->tp_as_sequence->sq_repeat) ! return long_repeat((PyObject *)w, v); ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! ! size_a = ABS(a->ob_size); ! size_b = ABS(b->ob_size); ! if (size_a > size_b) { ! /* we are faster with the small object on the left */ ! int hold_sa = size_a; ! PyLongObject *hold_a = a; ! size_a = size_b; ! size_b = hold_sa; ! a = b; ! b = hold_a; ! } ! z = _PyLong_New(size_a + size_b); ! if (z == NULL) { ! Py_DECREF(a); ! Py_DECREF(b); return NULL; ! } ! for (i = 0; i < z->ob_size; ++i) ! z->ob_digit[i] = 0; for (i = 0; i < size_a; ++i) { twodigits carry = 0; twodigits f = a->ob_digit[i]; int j; ! SIGCHECK({ - Py_DECREF(a); - Py_DECREF(b); Py_DECREF(z); return NULL; --- 1469,1494 ---- } ! /* Grade school multiplication, ignoring the signs. ! * Returns the absolute value of the product, or NULL if error. ! */ ! static PyLongObject * ! x_mul(PyLongObject *a, PyLongObject *b) { ! PyLongObject *z; ! int size_a = ABS(a->ob_size); ! int size_b = ABS(b->ob_size); int i; ! z = _PyLong_New(size_a + size_b); ! if (z == NULL) return NULL; ! ! memset(z->ob_digit, 0, z->ob_size * sizeof(digit)); for (i = 0; i < size_a; ++i) { twodigits carry = 0; twodigits f = a->ob_digit[i]; int j; ! SIGCHECK({ Py_DECREF(z); return NULL; *************** *** 1521,1524 **** --- 1506,1708 ---- } } + return z; + } + + /* A helper for Karatsuba multiplication (k_mul). + Takes a long "n" and an integer "size" representing the place to + split, and sets low and high such that abs(n) == (high << size) + low, + viewing the shift as being by digits. The sign bit is ignored, and + the return values are >= 0. + Returns 0 on success, -1 on failure. + */ + static int + kmul_split(PyLongObject *n, int size, PyLongObject **high, PyLongObject **low) + { + PyLongObject *hi, *lo; + int size_lo, size_hi; + const int size_n = ABS(n->ob_size); + + size_lo = MIN(size_n, size); + size_hi = size_n - size_lo; + + if ((hi = _PyLong_New(size_hi)) == NULL) + return -1; + if ((lo = _PyLong_New(size_lo)) == NULL) { + Py_DECREF(hi); + return -1; + } + + memcpy(lo->ob_digit, n->ob_digit, size_lo * sizeof(digit)); + memcpy(hi->ob_digit, n->ob_digit + size_lo, size_hi * sizeof(digit)); + + *high = long_normalize(hi); + *low = long_normalize(lo); + return 0; + } + + /* Karatsuba multiplication. Ignores the input signs, and returns the + * absolute value of the product (or NULL if error). + * See Knuth Vol. 2 Chapter 4.3.3 (Pp. 294-295). + */ + static PyLongObject * + k_mul(PyLongObject *a, PyLongObject *b) + { + PyLongObject *ah = NULL; + PyLongObject *al = NULL; + PyLongObject *bh = NULL; + PyLongObject *bl = NULL; + PyLongObject *albl = NULL; + PyLongObject *ahbh = NULL; + PyLongObject *k = NULL; + PyLongObject *ret = NULL; + PyLongObject *t1, *t2; + int shift; /* the number of digits we split off */ + int i; + + /* (ah*X+al)(bh*X+bl) = ah*bh*X*X + (ah*bl + al*bh)*X + al*bl + * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl + * Then the original product is + * ah*bh*X*X + (k - ah*bh - ah*bl)*X + al*bl + * By picking X to be a power of 2, "*X" is just shifting, and it's + * been reduced to 3 multiplies on numbers half the size. + */ + + /* We want to split based on the larger number; fiddle so that a + * is largest. + */ + if (ABS(a->ob_size) > ABS(b->ob_size)) { + t1 = a; + a = b; + b = t1; + } + + /* Use gradeschool math when either number is too small. */ + if (ABS(a->ob_size) <= KARATSUBA_CUTOFF) + return x_mul(a, b); + + shift = ABS(b->ob_size) >> 1; + if (kmul_split(a, shift, &ah, &al) < 0) goto fail; + if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; + + if ((ahbh = k_mul(ah, bh)) == NULL) goto fail; + assert(ahbh->ob_size >= 0); + + /* Allocate result space, and copy ahbh into the high digits. */ + ret = _PyLong_New(ahbh->ob_size + 2*shift + 1); + if (ret == NULL) goto fail; + #ifdef Py_DEBUG + /* Fill with trash, to catch reference to uninitialized digits. */ + memset(ret->ob_digit, 0xDF, ret->ob_size * sizeof(digit)); + #endif + memcpy(ret->ob_digit + 2*shift, ahbh->ob_digit, + ahbh->ob_size * sizeof(digit)); + /* That didn't copy into the most-significant (overflow) digit. */ + ret->ob_digit[ret->ob_size - 1] = 0; + + /* Compute al*bl, and copy into the low digits. */ + if ((albl = k_mul(al, bl)) == NULL) goto fail; + assert(albl->ob_size >= 0); + assert(albl->ob_size <= 2*shift); /* no overlap with high digits */ + memcpy(ret->ob_digit, albl->ob_digit, albl->ob_size * sizeof(digit)); + + /* Zero out remaining digits. */ + i = 2*shift - albl->ob_size; /* number of uninitialized digits */ + if (i) + memset(ret->ob_digit + albl->ob_size, 0, i * sizeof(digit)); + + /* k = (ah+al)(bh+bl) */ + if ((t1 = x_add(ah, al)) == NULL) goto fail; + Py_DECREF(ah); + Py_DECREF(al); + ah = al = NULL; + + if ((t2 = x_add(bh, bl)) == NULL) { + Py_DECREF(t1); + goto fail; + } + Py_DECREF(bh); + Py_DECREF(bl); + bh = bl = NULL; + + k = k_mul(t1, t2); + Py_DECREF(t1); + Py_DECREF(t2); + if (k == NULL) goto fail; + + /* Subtract ahbh and albl from k. Note that this can't become + * negative, since k = ahbh + albl + other stuff. + */ + if ((t1 = x_sub(k, ahbh)) == NULL) goto fail; + Py_DECREF(k); + k = t1; + Py_DECREF(ahbh); + ahbh = NULL; + + if ((t1 = x_sub(k, albl)) == NULL) goto fail; + Py_DECREF(k); + k = t1; + Py_DECREF(albl); + albl = NULL; + + /* Add k into the result, at the shift-th least-significant digit. */ + { + int j; /* index into k */ + digit carry = 0; + + for (i = shift, j = 0; j < k->ob_size; ++i, ++j) { + carry += ret->ob_digit[i] + k->ob_digit[j]; + ret->ob_digit[i] = carry & MASK; + carry >>= SHIFT; + } + for (; carry && i < ret->ob_size; ++i) { + carry += ret->ob_digit[i]; + ret->ob_digit[i] = carry & MASK; + carry >>= SHIFT; + } + assert(carry == 0); + } + Py_DECREF(k); + return long_normalize(ret); + + fail: + Py_XDECREF(ret); + Py_XDECREF(ah); + Py_XDECREF(al); + Py_XDECREF(bh); + Py_XDECREF(bl); + Py_XDECREF(ahbh); + Py_XDECREF(albl); + Py_XDECREF(k); + return NULL; + } + + + static PyObject * + long_mul(PyLongObject *v, PyLongObject *w) + { + PyLongObject *a, *b, *z; + + if (!convert_binop((PyObject *)v, (PyObject *)w, &a, &b)) { + if (!PyLong_Check(v) && + v->ob_type->tp_as_sequence && + v->ob_type->tp_as_sequence->sq_repeat) + return long_repeat((PyObject *)v, w); + if (!PyLong_Check(w) && + w->ob_type->tp_as_sequence && + w->ob_type->tp_as_sequence->sq_repeat) + return long_repeat((PyObject *)w, v); + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + + if (Py_GETENV("KARAT") != NULL) + z = k_mul(a, b); + else + z = x_mul(a, b); + if(z == NULL) { + Py_DECREF(a); + Py_DECREF(b); + return NULL; + } if (a->ob_size < 0) z->ob_size = -(z->ob_size); *************** *** 1546,1554 **** static int ! l_divmod(PyLongObject *v, PyLongObject *w, PyLongObject **pdiv, PyLongObject **pmod) { PyLongObject *div, *mod; ! if (long_divrem(v, w, &div, &mod) < 0) return -1; --- 1730,1738 ---- static int ! l_divmod(PyLongObject *v, PyLongObject *w, PyLongObject **pdiv, PyLongObject **pmod) { PyLongObject *div, *mod; ! if (long_divrem(v, w, &div, &mod) < 0) return -1; *************** *** 1658,1662 **** "long/long too large for a float"); return NULL; ! } --- 1842,1846 ---- "long/long too large for a float"); return NULL; ! } *************** *** 1715,1719 **** CONVERT_BINOP(v, w, &a, &b); ! if (PyLong_Check(x) || Py_None == x) { c = x; Py_INCREF(x); --- 1899,1903 ---- CONVERT_BINOP(v, w, &a, &b); ! if (PyLong_Check(x) || Py_None == x) { c = x; Py_INCREF(x); *************** *** 1755,1762 **** digit bi = b->ob_digit[i]; int j; ! for (j = 0; j < SHIFT; ++j) { PyLongObject *temp; ! if (bi & 1) { temp = (PyLongObject *)long_mul(z, a); --- 1939,1946 ---- digit bi = b->ob_digit[i]; int j; ! for (j = 0; j < SHIFT; ++j) { PyLongObject *temp; ! if (bi & 1) { temp = (PyLongObject *)long_mul(z, a); *************** *** 1887,1891 **** int newsize, wordshift, loshift, hishift, i, j; digit lomask, himask; ! CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); --- 2071,2075 ---- int newsize, wordshift, loshift, hishift, i, j; digit lomask, himask; ! CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); *************** *** 1904,1908 **** } else { ! shiftby = PyLong_AsLong((PyObject *)b); if (shiftby == -1L && PyErr_Occurred()) --- 2088,2092 ---- } else { ! shiftby = PyLong_AsLong((PyObject *)b); if (shiftby == -1L && PyErr_Occurred()) *************** *** 1954,1958 **** int oldsize, newsize, wordshift, remshift, i, j; twodigits accum; ! CONVERT_BINOP(v, w, &a, &b); --- 2138,2142 ---- int oldsize, newsize, wordshift, remshift, i, j; twodigits accum; ! CONVERT_BINOP(v, w, &a, &b); *************** *** 1984,1988 **** for (i = 0; i < wordshift; i++) z->ob_digit[i] = 0; ! accum = 0; for (i = wordshift, j = 0; j < oldsize; i++, j++) { accum |= a->ob_digit[j] << remshift; --- 2168,2172 ---- for (i = 0; i < wordshift; i++) z->ob_digit[i] = 0; ! accum = 0; for (i = wordshift, j = 0; j < oldsize; i++, j++) { accum |= a->ob_digit[j] << remshift; *************** *** 1992,1996 **** if (remshift) z->ob_digit[newsize-1] = (digit)accum; ! else assert(!accum); z = long_normalize(z); --- 2176,2180 ---- if (remshift) z->ob_digit[newsize-1] = (digit)accum; ! else assert(!accum); z = long_normalize(z); *************** *** 2004,2012 **** /* Bitwise and/xor/or operations */ - #undef MIN - #undef MAX - #define MAX(x, y) ((x) < (y) ? (y) : (x)) - #define MIN(x, y) ((x) > (y) ? (y) : (x)) - static PyObject * long_bitwise(PyLongObject *a, --- 2188,2191 ---- *************** *** 2021,2025 **** digit diga, digb; PyObject *v; ! if (a->ob_size < 0) { a = (PyLongObject *) long_invert(a); --- 2200,2204 ---- digit diga, digb; PyObject *v; ! if (a->ob_size < 0) { a = (PyLongObject *) long_invert(a); *************** *** 2038,2042 **** maskb = 0; } ! negz = 0; switch (op) { --- 2217,2221 ---- maskb = 0; } ! negz = 0; switch (op) { *************** *** 2064,2068 **** break; } ! /* JRH: The original logic here was to allocate the result value (z) as the longer of the two operands. However, there are some cases --- 2243,2247 ---- break; } ! /* JRH: The original logic here was to allocate the result value (z) as the longer of the two operands. However, there are some cases *************** *** 2089,2093 **** return NULL; } ! for (i = 0; i < size_z; ++i) { diga = (i < size_a ? a->ob_digit[i] : 0) ^ maska; --- 2268,2272 ---- return NULL; } ! for (i = 0; i < size_z; ++i) { diga = (i < size_a ? a->ob_digit[i] : 0) ^ maska; *************** *** 2099,2103 **** } } ! Py_DECREF(a); Py_DECREF(b); --- 2278,2282 ---- } } ! Py_DECREF(a); Py_DECREF(b); From tim_one@users.sourceforge.net Mon Aug 12 03:44:01 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 11 Aug 2002 19:44:01 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9768/python/Objects Modified Files: longobject.c Log Message: k_mul(): Repaired typo in comment. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** longobject.c 12 Aug 2002 02:31:19 -0000 1.121 --- longobject.c 12 Aug 2002 02:43:58 -0000 1.122 *************** *** 1563,1567 **** * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl * Then the original product is ! * ah*bh*X*X + (k - ah*bh - ah*bl)*X + al*bl * By picking X to be a power of 2, "*X" is just shifting, and it's * been reduced to 3 multiplies on numbers half the size. --- 1563,1567 ---- * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl * Then the original product is ! * ah*bh*X*X + (k - ah*bh - al*bl)*X + al*bl * By picking X to be a power of 2, "*X" is just shifting, and it's * been reduced to 3 multiplies on numbers half the size. From tim_one@users.sourceforge.net Mon Aug 12 03:54:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 11 Aug 2002 19:54:12 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.122,1.123 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11469/python/Objects Modified Files: longobject.c Log Message: k_mul(): Repaired another typo in another comment. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** longobject.c 12 Aug 2002 02:43:58 -0000 1.122 --- longobject.c 12 Aug 2002 02:54:10 -0000 1.123 *************** *** 1568,1572 **** */ ! /* We want to split based on the larger number; fiddle so that a * is largest. */ --- 1568,1572 ---- */ ! /* We want to split based on the larger number; fiddle so that b * is largest. */ From nnorwitz@users.sourceforge.net Mon Aug 12 04:33:34 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 11 Aug 2002 20:33:34 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.462,1.463 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19454/Misc Modified Files: NEWS Log Message: Revert what looks like a typo from the last checkin Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.462 retrieving revision 1.463 diff -C2 -d -r1.462 -r1.463 *** NEWS 12 Aug 2002 02:31:19 -0000 1.462 --- NEWS 12 Aug 2002 03:33:32 -0000 1.463 *************** *** 88,92 **** - The built-ins slice() and buffer() are now callable types. The ! 0 types classobj (formerly class), code, function, instance, and instancemethod (formerly instance-method), which have no built-in names but are accessible through the types module, are now also --- 88,92 ---- - The built-ins slice() and buffer() are now callable types. The ! types classobj (formerly class), code, function, instance, and instancemethod (formerly instance-method), which have no built-in names but are accessible through the types module, are now also From gvanrossum@users.sourceforge.net Mon Aug 12 04:42:06 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 11 Aug 2002 20:42:06 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.463,1.464 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21212 Modified Files: NEWS Log Message: New news about __class__ assignment restrictions and speed-up of new-style object creation/deallocation. Moved all news about type/class unification and new-stype classes to a separate section at the top. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.463 retrieving revision 1.464 diff -C2 -d -r1.463 -r1.464 *** NEWS 12 Aug 2002 03:33:32 -0000 1.463 --- NEWS 12 Aug 2002 03:42:03 -0000 1.464 *************** *** 5,8 **** --- 5,59 ---- Type/class unification and new-style classes + - Assignment to __class__ is disallowed if either the old and the new + class is a statically allocated type object (such as defined by an + extenson module). This prevents anomalies like 2.__class__ = bool. + + - New-style object creation and deallocation have been sped up + significantly; they are now faster than classic instance creation + and deallocation. + + - The __slots__ variable can now mention "private" names, and the + right thing will happen (e.g. __slots__ = ["__foo"]). + + - The built-ins slice() and buffer() are now callable types. The + types classobj (formerly class), code, function, instance, and + instancemethod (formerly instance-method), which have no built-in + names but are accessible through the types module, are now also + callable. The type dict-proxy is renamed to dictproxy. + + - Cycles going through the __class__ link of a new-style instance are + now detected by the garbage collector. + + - Classes using __slots__ are now properly garbage collected. + [SF bug 519621] + + - Tightened the __slots__ rules: a slot name must be a valid Python + identifier. + + - The constructor for the module type now requires a name argument and + takes an optional docstring argument. Previously, this constructor + ignored its arguments. As a consequence, deriving a class from a + module (not from the module type) is now illegal; previously this + created an unnamed module, just like invoking the module type did. + [SF bug 563060] + + - A new type object, 'basestring', is added. This is a common base type + for 'str' and 'unicode', and can be used instead of + types.StringTypes, e.g. to test whether something is "a string": + isinstance(x, basestring) is True for Unicode and 8-bit strings. This + is an abstract base class and cannot be instantiated directly. + + - Changed new-style class instantiation so that when C's __new__ + method returns something that's not a C instance, its __init__ is + not called. [SF bug #537450] + + - Fixed super() to work correctly with class methods. [SF bug #535444] + + - If you try to pickle an instance of a class that has __slots__ but + doesn't define or override __getstate__, a TypeError is now raised. + This is done by adding a bozo __getstate__ to the class that always + raises TypeError. (Before, this would appear to be pickled, but the + state of the slots would be lost.) + Core and builtins *************** *** 81,96 **** was one or when the slice range was all inclusive. - - The __slots__ variable can now mention "private" names, and the - right thing will happen (e.g. __slots__ = ["__foo"]). - - Unicode objects in sys.path are no longer ignored but treated as directory names. - - The built-ins slice() and buffer() are now callable types. The - types classobj (formerly class), code, function, instance, and - instancemethod (formerly instance-method), which have no built-in - names but are accessible through the types module, are now also - callable. The type dict-proxy is renamed to dictproxy. - - Fixed string.startswith and string.endswith builtin methods so they accept negative indices. [SF bug 493951] --- 132,138 ---- *************** *** 103,122 **** gives "dlrow olleh". - - Cycles going through the __class__ link of a new-style instance are - now detected by the garbage collector. - - - Classes using __slots__ are now properly garbage collected. - [SF bug 519621] - - - Tightened the __slots__ rules: a slot name must be a valid Python - identifier. - - - The constructor for the module type now requires a name argument and - takes an optional docstring argument. Previously, this constructor - ignored its arguments. As a consequence, deriving a class from a - module (not from the module type) is now illegal; previously this - created an unnamed module, just like invoking the module type did. - [SF bug 563060] - - A new warning PendingDeprecationWarning was added to provide direction on features which are in the process of being deprecated. --- 145,148 ---- *************** *** 125,134 **** as a command line option or warnings.filterwarnings() in code. - - A new type object, 'basestring', is added. This is a common base type - for 'str' and 'unicode', and can be used instead of - types.StringTypes, e.g. to test whether something is "a string": - isinstance(x, basestring) is True for Unicode and 8-bit strings. This - is an abstract base class and cannot be instantiated directly. - - Deprecated features of xrange objects have been removed as promised. The start, stop, and step attributes and the tolist() --- 151,154 ---- *************** *** 159,168 **** value corresponding to key. [SF patch #539949] - - Changed new-style class instantiation so that when C's __new__ - method returns something that's not a C instance, its __init__ is - not called. [SF bug #537450] - - - Fixed super() to work correctly with class methods. [SF bug #535444] - - A new built-in type, bool, has been added, as well as built-in names for its two values, True and False. Comparisons and sundry --- 179,182 ---- *************** *** 183,192 **** and lets them use the same API with Python versions from 1.5.2 onwards. - - - If you try to pickle an instance of a class that has __slots__ but - doesn't define or override __getstate__, a TypeError is now raised. - This is done by adding a bozo __getstate__ to the class that always - raises TypeError. (Before, this would appear to be pickled, but the - state of the slots would be lost.) - PyErr_Display will provide file and line information for all exceptions --- 197,200 ---- From neal@metaslash.com Mon Aug 12 04:49:42 2002 From: neal@metaslash.com (Neal Norwitz) Date: Sun, 11 Aug 2002 23:49:42 -0400 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.120,1.121 References: Message-ID: <3D573056.2A1C067D@metaslash.com> tim_one@users.sourceforge.net wrote: > Lots of things were changed from that. This needs a lot more testing, > for correctness and speed, the latter especially when bit lengths are > + static PyObject * > + long_mul(PyLongObject *v, PyLongObject *w) > + { /* snip */ > + if (Py_GETENV("KARAT") != NULL) > + z = k_mul(a, b); > + else > + z = x_mul(a, b); Py_GETENV could be a speed problem. getenv() can be very slow on some boxes (linear lookup in the env't). It would probably be best to cache the env value of KARAT or store the function. Something like: typedef PyLongObject*(mul_func_t)(PyLongObject *a, PyLongObject *b); static mul_func_t mul_func; if (mul_func == NULL) { if (Py_GETENV("KARAT") != NULL) mul_func = k_mul; else mul_func = x_mul; } Of course, this means, KARAT must be set prior to the first call to long_mul and cannot be changed thereafter. I'll try to make some tests and use valgrind. Neal From tim@zope.com Mon Aug 12 05:21:09 2002 From: tim@zope.com (Tim Peters) Date: Mon, 12 Aug 2002 00:21:09 -0400 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.120,1.121 In-Reply-To: <3D573056.2A1C067D@metaslash.com> Message-ID: [Neal Norwitz] > Py_GETENV could be a speed problem. ... Yes. It's a temporary measure to ease testing. In the meantime, few people multiply long ints (this has no effect on any other kind of multiply, including "regular old int" multiply). From tim_one@users.sourceforge.net Mon Aug 12 06:09:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 11 Aug 2002 22:09:39 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3694/python/Objects Modified Files: longobject.c Log Message: Introduced helper functions v_iadd and v_isub, for in-place digit-vector addition and subtraction. Reworked the tail end of k_mul() to use them. This saves oodles of one-shot longobject allocations (this is a triply- recursive routine, so saving one allocation in the body saves 3**n allocations at depth n; we actually save 2 allocations in the body). Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** longobject.c 12 Aug 2002 02:54:10 -0000 1.123 --- longobject.c 12 Aug 2002 05:09:36 -0000 1.124 *************** *** 776,779 **** --- 776,830 ---- } + /* x[0:m] and y[0:n] are digit vectors, LSD first, m >= n required. x[0:n] + * is modified in place, by adding y to it. Carries are propagated as far as + * x[m-1], and the remaining carry (0 or 1) is returned. + */ + static digit + v_iadd(digit *x, int m, digit *y, int n) + { + int i; + digit carry = 0; + + assert(m >= n); + for (i = 0; i < n; ++i) { + carry += x[i] + y[i]; + x[i] = carry & MASK; + carry >>= SHIFT; + assert((carry & 1) == carry); + } + for (; carry && i < m; ++i) { + carry += x[i]; + x[i] = carry & MASK; + carry >>= SHIFT; + assert((carry & 1) == carry); + } + return carry; + } + + /* x[0:m] and y[0:n] are digit vectors, LSD first, m >= n required. x[0:n] + * is modified in place, by subtracting y from it. Borrows are propagated as + * far as x[m-1], and the remaining borrow (0 or 1) is returned. + */ + static digit + v_isub(digit *x, int m, digit *y, int n) + { + int i; + digit borrow = 0; + + assert(m >= n); + for (i = 0; i < n; ++i) { + borrow = x[i] - y[i] - borrow; + x[i] = borrow & MASK; + borrow >>= SHIFT; + borrow &= 1; /* keep only 1 sign bit */ + } + for (; borrow && i < m; ++i) { + borrow = x[i] - borrow; + x[i] = borrow & MASK; + borrow >>= SHIFT; + borrow &= 1; + } + return borrow; + } /* Multiply by a single digit, ignoring the sign. */ *************** *** 1559,1563 **** int shift; /* the number of digits we split off */ int i; ! /* (ah*X+al)(bh*X+bl) = ah*bh*X*X + (ah*bl + al*bh)*X + al*bl * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl --- 1610,1616 ---- int shift; /* the number of digits we split off */ int i; ! #ifdef Py_DEBUG ! digit d; ! #endif /* (ah*X+al)(bh*X+bl) = ah*bh*X*X + (ah*bl + al*bh)*X + al*bl * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl *************** *** 1630,1666 **** if (k == NULL) goto fail; ! /* Subtract ahbh and albl from k. Note that this can't become ! * negative, since k = ahbh + albl + other stuff. ! */ ! if ((t1 = x_sub(k, ahbh)) == NULL) goto fail; Py_DECREF(k); ! k = t1; Py_DECREF(ahbh); - ahbh = NULL; ! if ((t1 = x_sub(k, albl)) == NULL) goto fail; ! Py_DECREF(k); ! k = t1; Py_DECREF(albl); - albl = NULL; - - /* Add k into the result, at the shift-th least-significant digit. */ - { - int j; /* index into k */ - digit carry = 0; - for (i = shift, j = 0; j < k->ob_size; ++i, ++j) { - carry += ret->ob_digit[i] + k->ob_digit[j]; - ret->ob_digit[i] = carry & MASK; - carry >>= SHIFT; - } - for (; carry && i < ret->ob_size; ++i) { - carry += ret->ob_digit[i]; - ret->ob_digit[i] = carry & MASK; - carry >>= SHIFT; - } - assert(carry == 0); - } - Py_DECREF(k); return long_normalize(ret); --- 1683,1712 ---- if (k == NULL) goto fail; ! /* Add k into the result, starting at the shift'th LSD. */ ! i = ret->ob_size - shift; /* # digits after shift */ ! #ifdef Py_DEBUG ! d = ! #endif ! v_iadd(ret->ob_digit + shift, i, k->ob_digit, k->ob_size); ! assert(d == 0); Py_DECREF(k); ! ! /* Subtract ahbh and albl from the result. Note that this can't ! * become negative, since k = ahbh + albl + other stuff. ! */ ! #ifdef Py_DEBUG ! d = ! #endif ! v_isub(ret->ob_digit + shift, i, ahbh->ob_digit, ahbh->ob_size); ! assert(d == 0); Py_DECREF(ahbh); ! #ifdef Py_DEBUG ! d = ! #endif ! v_isub(ret->ob_digit + shift, i, albl->ob_digit, albl->ob_size); ! assert(d == 0); Py_DECREF(albl); return long_normalize(ret); From tim_one@users.sourceforge.net Mon Aug 12 07:18:01 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 11 Aug 2002 23:18:01 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.124,1.125 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16200/python/Objects Modified Files: longobject.c Log Message: x_mul(): This failed to normalize its result. k_mul(): This didn't allocate enough result space when one input had more than twice as many bits as the other. This was partly hidden by that x_mul() didn't normalize its result. The Karatsuba recurrence is pretty much hosed if the inputs aren't roughly the same size. If one has at least twice as many bits as the other, we get a degenerate case where the "high half" of the smaller input is 0. Added a special case for that, for speed, but despite that it helped, this can still be much slower than the "grade school" method. It seems to take a really wild imbalance to trigger that; e.g., a 2**22-bit input times a 1000-bit input on my box runs about twice as slow under k_mul than under x_mul. This still needs to be addressed. I'm also not sure that allocating a->ob_size + b->ob_size digits is enough, given that this is computing k = (ah+al)*(bh+bl) instead of k = (ah-al)*(bl-bh); i.e., it's certainly enough for the final result, but it's vaguely possible that adding in the "artificially" large k may overflow that temporarily. If so, an assert will trigger in the debug build, but we'll probably compute the right result anyway(!). Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** longobject.c 12 Aug 2002 05:09:36 -0000 1.124 --- longobject.c 12 Aug 2002 06:17:58 -0000 1.125 *************** *** 1557,1561 **** } } ! return z; } --- 1557,1561 ---- } } ! return long_normalize(z); } *************** *** 1631,1636 **** /* Use gradeschool math when either number is too small. */ ! if (ABS(a->ob_size) <= KARATSUBA_CUTOFF) ! return x_mul(a, b); shift = ABS(b->ob_size) >> 1; --- 1631,1643 ---- /* Use gradeschool math when either number is too small. */ ! if (ABS(a->ob_size) <= KARATSUBA_CUTOFF) { ! /* 0 is inevitable if one kmul arg has more than twice ! * the digits of another, so it's worth special-casing. ! */ ! if (a->ob_size == 0) ! return _PyLong_New(0); ! else ! return x_mul(a, b); ! } shift = ABS(b->ob_size) >> 1; *************** *** 1642,1646 **** /* Allocate result space, and copy ahbh into the high digits. */ ! ret = _PyLong_New(ahbh->ob_size + 2*shift + 1); if (ret == NULL) goto fail; #ifdef Py_DEBUG --- 1649,1653 ---- /* Allocate result space, and copy ahbh into the high digits. */ ! ret = _PyLong_New(ABS(a->ob_size) + ABS(b->ob_size)); if (ret == NULL) goto fail; #ifdef Py_DEBUG *************** *** 1648,1655 **** memset(ret->ob_digit, 0xDF, ret->ob_size * sizeof(digit)); #endif memcpy(ret->ob_digit + 2*shift, ahbh->ob_digit, ahbh->ob_size * sizeof(digit)); ! /* That didn't copy into the most-significant (overflow) digit. */ ! ret->ob_digit[ret->ob_size - 1] = 0; /* Compute al*bl, and copy into the low digits. */ --- 1655,1667 ---- memset(ret->ob_digit, 0xDF, ret->ob_size * sizeof(digit)); #endif + assert(2*shift + ahbh->ob_size <= ret->ob_size); memcpy(ret->ob_digit + 2*shift, ahbh->ob_digit, ahbh->ob_size * sizeof(digit)); ! ! /* Zero-out the digits higher than the ahbh copy. */ ! i = ret->ob_size - 2*shift - ahbh->ob_size; ! if (i) ! memset(ret->ob_digit + 2*shift + ahbh->ob_size, 0, ! i * sizeof(digit)); /* Compute al*bl, and copy into the low digits. */ From mhammond@users.sourceforge.net Mon Aug 12 08:22:00 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 12 Aug 2002 00:22:00 -0700 Subject: [Python-checkins] python/dist/src/Include Python.h,2.56,2.57 abstract.h,2.44,2.45 boolobject.h,1.3,1.4 bufferobject.h,2.6,2.7 cellobject.h,2.2,2.3 ceval.h,2.44,2.45 classobject.h,2.40,2.41 cobject.h,2.10,2.11 codecs.h,2.3,2.4 compile.h,2.37,2.38 complexobject.h,2.9,2.10 descrobject.h,2.9,2.10 dictobject.h,2.24,2.25 enumobject.h,2.1,2.2 eval.h,2.15,2.16 fileobject.h,2.30,2.31 floatobject.h,2.20,2.21 frameobject.h,2.35,2.36 funcobject.h,2.24,2.25 intobject.h,2.25,2.26 intrcheck.h,2.9,2.10 iterobject.h,1.4,1.5 listobject.h,2.23,2.24 longintrepr.h,2.13,2.14 longobject.h,2.25,2.26 marshal.h,2.11,2.12 methodobject.h,2.24,2.25 modsupport.h,2.38,2.39 moduleobject.h,2.19,2.20 node.h,2.19,2.20 objimpl.h,2.56,2.57 parsetok.h,2.18,2.19 pgenheaders.h,2.28,2.29 pyerrors.h,2.55,2.56 pygetopt.h,2.1,2.2 pymem.h,2.15,2.16 pystate.h,2.18,2.19 pythonrun.h,2.52,2.53 pythread.h,2.19,2.20 rangeobject.h,2.18,2.19 sliceobject.h,2.6,2.7 stringobject.h,2.34,2.35 structmember.h,2.19,2.20 structseq.h,1.1,1.2 symtable.h,2.9,2.10 sysmodule.h,2.24,2.25 token.h,2.19,2.20 traceback.h,2.19,2.20 tupleobject.h,2.27,2.28 unicodeobject.h,2.39,2.40 weakrefobject.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv3457 Modified Files: Python.h abstract.h boolobject.h bufferobject.h cellobject.h ceval.h classobject.h cobject.h codecs.h compile.h complexobject.h descrobject.h dictobject.h enumobject.h eval.h fileobject.h floatobject.h frameobject.h funcobject.h intobject.h intrcheck.h iterobject.h listobject.h longintrepr.h longobject.h marshal.h methodobject.h modsupport.h moduleobject.h node.h objimpl.h parsetok.h pgenheaders.h pyerrors.h pygetopt.h pymem.h pystate.h pythonrun.h pythread.h rangeobject.h sliceobject.h stringobject.h structmember.h structseq.h symtable.h sysmodule.h token.h traceback.h tupleobject.h unicodeobject.h weakrefobject.h Log Message: Excise DL_EXPORT from Include. Thanks to Skip Montanaro and Kalle Svensson for the patches. Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** Python.h 20 Jul 2002 08:51:52 -0000 2.56 --- Python.h 12 Aug 2002 07:21:56 -0000 2.57 *************** *** 115,119 **** /* _Py_Mangle is defined in compile.c */ ! extern DL_IMPORT(int) _Py_Mangle(char *p, char *name, \ char *buffer, size_t maxlen); --- 115,119 ---- /* _Py_Mangle is defined in compile.c */ ! PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \ char *buffer, size_t maxlen); Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** abstract.h 8 May 2002 08:44:21 -0000 2.44 --- abstract.h 12 Aug 2002 07:21:56 -0000 2.45 *************** *** 224,228 **** #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) ! DL_IMPORT(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); /* --- 224,228 ---- #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) ! PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); [...1069 lines suppressed...] *************** *** 1210,1217 **** ! DL_IMPORT(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); /* isinstance(object, typeorclass) */ ! DL_IMPORT(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); /* issubclass(object, typeorclass) */ --- 1210,1217 ---- ! PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); /* isinstance(object, typeorclass) */ ! PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); /* issubclass(object, typeorclass) */ Index: boolobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/boolobject.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** boolobject.h 2 May 2002 20:23:27 -0000 1.3 --- boolobject.h 12 Aug 2002 07:21:56 -0000 1.4 *************** *** 10,14 **** typedef PyIntObject PyBoolObject; ! extern DL_IMPORT(PyTypeObject) PyBool_Type; #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type) --- 10,14 ---- typedef PyIntObject PyBoolObject; ! PyAPI_DATA(PyTypeObject) PyBool_Type; #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type) *************** *** 18,22 **** /* Don't use these directly */ ! extern DL_IMPORT(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; /* Use these macros */ --- 18,22 ---- /* Don't use these directly */ ! PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; /* Use these macros */ *************** *** 25,29 **** /* Function to return a bool from a C long */ ! extern DL_IMPORT(PyObject *) PyBool_FromLong(long); #ifdef __cplusplus --- 25,29 ---- /* Function to return a bool from a C long */ ! PyAPI_FUNC(PyObject *) PyBool_FromLong(long); #ifdef __cplusplus Index: bufferobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/bufferobject.h,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -d -r2.6 -r2.7 *** bufferobject.h 1 Sep 2000 23:29:26 -0000 2.6 --- bufferobject.h 12 Aug 2002 07:21:56 -0000 2.7 *************** *** 11,15 **** ! extern DL_IMPORT(PyTypeObject) PyBuffer_Type; #define PyBuffer_Check(op) ((op)->ob_type == &PyBuffer_Type) --- 11,15 ---- ! PyAPI_DATA(PyTypeObject) PyBuffer_Type; #define PyBuffer_Check(op) ((op)->ob_type == &PyBuffer_Type) *************** *** 17,30 **** #define Py_END_OF_BUFFER (-1) ! extern DL_IMPORT(PyObject *) PyBuffer_FromObject(PyObject *base, int offset, int size); ! extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, int offset, int size); ! extern DL_IMPORT(PyObject *) PyBuffer_FromMemory(void *ptr, int size); ! extern DL_IMPORT(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, int size); ! extern DL_IMPORT(PyObject *) PyBuffer_New(int size); #ifdef __cplusplus --- 17,30 ---- #define Py_END_OF_BUFFER (-1) ! PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base, int offset, int size); ! PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, int offset, int size); ! PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, int size); ! PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, int size); ! PyAPI_FUNC(PyObject *) PyBuffer_New(int size); #ifdef __cplusplus Index: cellobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/cellobject.h,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -d -r2.2 -r2.3 *** cellobject.h 28 Feb 2002 23:46:34 -0000 2.2 --- cellobject.h 12 Aug 2002 07:21:56 -0000 2.3 *************** *** 12,22 **** } PyCellObject; ! extern DL_IMPORT(PyTypeObject) PyCell_Type; #define PyCell_Check(op) ((op)->ob_type == &PyCell_Type) ! extern DL_IMPORT(PyObject *) PyCell_New(PyObject *); ! extern DL_IMPORT(PyObject *) PyCell_Get(PyObject *); ! extern DL_IMPORT(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) --- 12,22 ---- } PyCellObject; ! PyAPI_DATA(PyTypeObject) PyCell_Type; #define PyCell_Check(op) ((op)->ob_type == &PyCell_Type) ! PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); ! PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); ! PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) Index: ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** ceval.h 2 Aug 2001 04:15:00 -0000 2.44 --- ceval.h 12 Aug 2002 07:21:56 -0000 2.45 *************** *** 8,17 **** /* Interface to random parts in ceval.c */ ! DL_IMPORT(PyObject *) PyEval_CallObjectWithKeywords ! (PyObject *, PyObject *, PyObject *); /* DLL-level Backwards compatibility: */ #undef PyEval_CallObject ! DL_IMPORT(PyObject *) PyEval_CallObject(PyObject *, PyObject *); /* Inline this */ --- 8,17 ---- /* Interface to random parts in ceval.c */ ! PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( ! PyObject *, PyObject *, PyObject *); /* DLL-level Backwards compatibility: */ #undef PyEval_CallObject ! PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *); /* Inline this */ *************** *** 19,51 **** PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) ! DL_IMPORT(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...); ! DL_IMPORT(PyObject *) PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...); ! DL_IMPORT(void) PyEval_SetProfile(Py_tracefunc, PyObject *); ! DL_IMPORT(void) PyEval_SetTrace(Py_tracefunc, PyObject *); ! DL_IMPORT(PyObject *) PyEval_GetBuiltins(void); ! DL_IMPORT(PyObject *) PyEval_GetGlobals(void); ! DL_IMPORT(PyObject *) PyEval_GetLocals(void); ! DL_IMPORT(PyObject *) PyEval_GetOwner(void); ! DL_IMPORT(PyObject *) PyEval_GetFrame(void); ! DL_IMPORT(int) PyEval_GetRestricted(void); /* Look at the current frame's (if any) code's co_flags, and turn on the corresponding compiler flags in cf->cf_flags. Return 1 if any flag was set, else return 0. */ ! DL_IMPORT(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); ! DL_IMPORT(int) Py_FlushLine(void); ! DL_IMPORT(int) Py_AddPendingCall(int (*func)(void *), void *arg); ! DL_IMPORT(int) Py_MakePendingCalls(void); ! DL_IMPORT(void) Py_SetRecursionLimit(int); ! DL_IMPORT(int) Py_GetRecursionLimit(void); ! DL_IMPORT(char *) PyEval_GetFuncName(PyObject *); ! DL_IMPORT(char *) PyEval_GetFuncDesc(PyObject *); /* Interface for threads. --- 19,51 ---- PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) ! PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, char *format, ...); ! PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...); ! PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); ! PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); ! PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); ! PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); ! PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); ! PyAPI_FUNC(PyObject *) PyEval_GetOwner(void); ! PyAPI_FUNC(PyObject *) PyEval_GetFrame(void); ! PyAPI_FUNC(int) PyEval_GetRestricted(void); /* Look at the current frame's (if any) code's co_flags, and turn on the corresponding compiler flags in cf->cf_flags. Return 1 if any flag was set, else return 0. */ ! PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); ! PyAPI_FUNC(int) Py_FlushLine(void); ! PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); ! PyAPI_FUNC(int) Py_MakePendingCalls(void); ! PyAPI_FUNC(void) Py_SetRecursionLimit(int); ! PyAPI_FUNC(int) Py_GetRecursionLimit(void); ! PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *); ! PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *); /* Interface for threads. *************** *** 94,108 **** */ ! extern DL_IMPORT(PyThreadState *) PyEval_SaveThread(void); ! extern DL_IMPORT(void) PyEval_RestoreThread(PyThreadState *); #ifdef WITH_THREAD ! extern DL_IMPORT(void) PyEval_InitThreads(void); ! extern DL_IMPORT(void) PyEval_AcquireLock(void); ! extern DL_IMPORT(void) PyEval_ReleaseLock(void); ! extern DL_IMPORT(void) PyEval_AcquireThread(PyThreadState *tstate); ! extern DL_IMPORT(void) PyEval_ReleaseThread(PyThreadState *tstate); ! extern DL_IMPORT(void) PyEval_ReInitThreads(void); #define Py_BEGIN_ALLOW_THREADS { \ --- 94,108 ---- */ ! PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); ! PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); #ifdef WITH_THREAD ! PyAPI_FUNC(void) PyEval_InitThreads(void); ! PyAPI_FUNC(void) PyEval_AcquireLock(void); ! PyAPI_FUNC(void) PyEval_ReleaseLock(void); ! PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); ! PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); ! PyAPI_FUNC(void) PyEval_ReInitThreads(void); #define Py_BEGIN_ALLOW_THREADS { \ *************** *** 123,127 **** #endif /* !WITH_THREAD */ ! extern DL_IMPORT(int) _PyEval_SliceIndex(PyObject *, int *); --- 123,127 ---- #endif /* !WITH_THREAD */ ! PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, int *); Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** classobject.h 7 Dec 2001 21:54:33 -0000 2.40 --- classobject.h 12 Aug 2002 07:21:56 -0000 2.41 *************** *** 36,40 **** } PyMethodObject; ! extern DL_IMPORT(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) --- 36,40 ---- } PyMethodObject; ! PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) *************** *** 42,54 **** #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) ! extern DL_IMPORT(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyInstance_New(PyObject *, PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyMethod_Function(PyObject *); ! extern DL_IMPORT(PyObject *) PyMethod_Self(PyObject *); ! extern DL_IMPORT(PyObject *) PyMethod_Class(PyObject *); /* Macros for direct access to these values. Type checks are *not* --- 42,54 ---- #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) ! PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); ! PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); ! PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); /* Macros for direct access to these values. Type checks are *not* *************** *** 61,65 **** (((PyMethodObject *)meth) -> im_class) ! extern DL_IMPORT(int) PyClass_IsSubclass(PyObject *, PyObject *); --- 61,65 ---- (((PyMethodObject *)meth) -> im_class) ! PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); Index: cobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/cobject.h,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** cobject.h 1 Sep 2000 23:29:26 -0000 2.10 --- cobject.h 12 Aug 2002 07:21:56 -0000 2.11 *************** *** 15,19 **** #endif ! extern DL_IMPORT(PyTypeObject) PyCObject_Type; #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type) --- 15,19 ---- #endif ! PyAPI_DATA(PyTypeObject) PyCObject_Type; #define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type) *************** *** 25,30 **** */ ! extern DL_IMPORT(PyObject *) ! PyCObject_FromVoidPtr(void *cobj, void (*destruct)(void*)); --- 25,30 ---- */ ! PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr( ! void *cobj, void (*destruct)(void*)); *************** *** 34,52 **** the PyCObject is destroyed. */ ! extern DL_IMPORT(PyObject *) ! PyCObject_FromVoidPtrAndDesc(void *cobj, void *desc, ! void (*destruct)(void*,void*)); /* Retrieve a pointer to a C object from a PyCObject. */ ! extern DL_IMPORT(void *) ! PyCObject_AsVoidPtr(PyObject *); /* Retrieve a pointer to a description object from a PyCObject. */ ! extern DL_IMPORT(void *) ! PyCObject_GetDesc(PyObject *); /* Import a pointer to a C object from a module using a PyCObject. */ ! extern DL_IMPORT(void *) ! PyCObject_Import(char *module_name, char *cobject_name); #ifdef __cplusplus --- 34,48 ---- the PyCObject is destroyed. */ ! PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc( ! void *cobj, void *desc, void (*destruct)(void*,void*)); /* Retrieve a pointer to a C object from a PyCObject. */ ! PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *); /* Retrieve a pointer to a description object from a PyCObject. */ ! PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *); /* Import a pointer to a C object from a module using a PyCObject. */ ! PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name); #ifdef __cplusplus Index: codecs.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/codecs.h,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -d -r2.3 -r2.4 *** codecs.h 3 Aug 2000 16:24:24 -0000 2.3 --- codecs.h 12 Aug 2002 07:21:56 -0000 2.4 *************** *** 24,28 **** The search_function's refcount is incremented by this function. */ ! extern DL_IMPORT(int) PyCodec_Register( PyObject *search_function ); --- 24,28 ---- The search_function's refcount is incremented by this function. */ ! PyAPI_FUNC(int) PyCodec_Register( PyObject *search_function ); *************** *** 46,50 **** */ ! extern DL_IMPORT(PyObject *) _PyCodec_Lookup( const char *encoding ); --- 46,50 ---- */ ! PyAPI_FUNC(PyObject *) _PyCodec_Lookup( const char *encoding ); *************** *** 60,64 **** */ ! extern DL_IMPORT(PyObject *) PyCodec_Encode( PyObject *object, const char *encoding, --- 60,64 ---- */ ! PyAPI_FUNC(PyObject *) PyCodec_Encode( PyObject *object, const char *encoding, *************** *** 76,80 **** */ ! extern DL_IMPORT(PyObject *) PyCodec_Decode( PyObject *object, const char *encoding, --- 76,80 ---- */ ! PyAPI_FUNC(PyObject *) PyCodec_Decode( PyObject *object, const char *encoding, *************** *** 92,96 **** /* Get an encoder function for the given encoding. */ ! extern DL_IMPORT(PyObject *) PyCodec_Encoder( const char *encoding ); --- 92,96 ---- /* Get an encoder function for the given encoding. */ ! PyAPI_FUNC(PyObject *) PyCodec_Encoder( const char *encoding ); *************** *** 98,102 **** /* Get a decoder function for the given encoding. */ ! extern DL_IMPORT(PyObject *) PyCodec_Decoder( const char *encoding ); --- 98,102 ---- /* Get a decoder function for the given encoding. */ ! PyAPI_FUNC(PyObject *) PyCodec_Decoder( const char *encoding ); *************** *** 104,108 **** /* Get a StreamReader factory function for the given encoding. */ ! extern DL_IMPORT(PyObject *) PyCodec_StreamReader( const char *encoding, PyObject *stream, --- 104,108 ---- /* Get a StreamReader factory function for the given encoding. */ ! PyAPI_FUNC(PyObject *) PyCodec_StreamReader( const char *encoding, PyObject *stream, *************** *** 112,116 **** /* Get a StreamWriter factory function for the given encoding. */ ! extern DL_IMPORT(PyObject *) PyCodec_StreamWriter( const char *encoding, PyObject *stream, --- 112,116 ---- /* Get a StreamWriter factory function for the given encoding. */ ! PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( const char *encoding, PyObject *stream, Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** compile.h 12 Apr 2002 01:20:09 -0000 2.37 --- compile.h 12 Aug 2002 07:21:56 -0000 2.38 *************** *** 44,48 **** #define CO_FUTURE_DIVISION 0x2000 ! extern DL_IMPORT(PyTypeObject) PyCode_Type; #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) --- 44,48 ---- #define CO_FUTURE_DIVISION 0x2000 ! PyAPI_DATA(PyTypeObject) PyCode_Type; #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) *************** *** 53,62 **** /* Public interface */ struct _node; /* Declare the existence of this type */ ! DL_IMPORT(PyCodeObject *) PyNode_Compile(struct _node *, char *); ! DL_IMPORT(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ ! DL_IMPORT(int) PyCode_Addr2Line(PyCodeObject *, int); /* Future feature support */ --- 53,62 ---- /* Public interface */ struct _node; /* Declare the existence of this type */ ! PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, char *); ! PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ ! PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* Future feature support */ *************** *** 68,73 **** } PyFutureFeatures; ! DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *); ! DL_IMPORT(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, PyCompilerFlags *); --- 68,73 ---- } PyFutureFeatures; ! PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, char *); ! PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, PyCompilerFlags *); Index: complexobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/complexobject.h,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** complexobject.h 12 Sep 2001 19:12:48 -0000 2.9 --- complexobject.h 12 Aug 2002 07:21:56 -0000 2.10 *************** *** 21,30 **** #define c_pow _Py_c_pow ! extern DL_IMPORT(Py_complex) c_sum(Py_complex, Py_complex); ! extern DL_IMPORT(Py_complex) c_diff(Py_complex, Py_complex); ! extern DL_IMPORT(Py_complex) c_neg(Py_complex); ! extern DL_IMPORT(Py_complex) c_prod(Py_complex, Py_complex); ! extern DL_IMPORT(Py_complex) c_quot(Py_complex, Py_complex); ! extern DL_IMPORT(Py_complex) c_pow(Py_complex, Py_complex); --- 21,30 ---- #define c_pow _Py_c_pow ! PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); ! PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); ! PyAPI_FUNC(Py_complex) c_neg(Py_complex); ! PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); ! PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); ! PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); *************** *** 41,55 **** } PyComplexObject; ! extern DL_IMPORT(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) #define PyComplex_CheckExact(op) ((op)->ob_type == &PyComplex_Type) ! extern DL_IMPORT(PyObject *) PyComplex_FromCComplex(Py_complex); ! extern DL_IMPORT(PyObject *) PyComplex_FromDoubles(double real, double imag); ! extern DL_IMPORT(double) PyComplex_RealAsDouble(PyObject *op); ! extern DL_IMPORT(double) PyComplex_ImagAsDouble(PyObject *op); ! extern DL_IMPORT(Py_complex) PyComplex_AsCComplex(PyObject *op); #ifdef __cplusplus --- 41,55 ---- } PyComplexObject; ! PyAPI_DATA(PyTypeObject) PyComplex_Type; #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) #define PyComplex_CheckExact(op) ((op)->ob_type == &PyComplex_Type) ! PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); ! PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); ! PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); ! PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); ! PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); #ifdef __cplusplus Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/descrobject.h,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** descrobject.h 30 Mar 2002 08:57:12 -0000 2.9 --- descrobject.h 12 Aug 2002 07:21:56 -0000 2.10 *************** *** 68,87 **** } PyWrapperDescrObject; ! extern DL_IMPORT(PyTypeObject) PyWrapperDescr_Type; ! extern DL_IMPORT(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); ! extern DL_IMPORT(PyObject *) PyDescr_NewMember(PyTypeObject *, struct PyMemberDef *); ! extern DL_IMPORT(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); ! extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); ! extern DL_IMPORT(int) PyDescr_IsData(PyObject *); ! extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *); ! extern DL_IMPORT(PyObject *) PyWrapper_New(PyObject *, PyObject *); ! extern DL_IMPORT(PyTypeObject) PyProperty_Type; #ifdef __cplusplus } --- 68,87 ---- } PyWrapperDescrObject; ! PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; ! PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); ! PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, struct PyMemberDef *); ! PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); ! PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); ! PyAPI_FUNC(int) PyDescr_IsData(PyObject *); ! PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); ! PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); ! PyAPI_DATA(PyTypeObject) PyProperty_Type; #ifdef __cplusplus } Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** dictobject.h 11 Apr 2002 20:41:18 -0000 2.24 --- dictobject.h 12 Aug 2002 07:21:56 -0000 2.25 *************** *** 79,101 **** }; ! extern DL_IMPORT(PyTypeObject) PyDict_Type; #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) ! extern DL_IMPORT(PyObject *) PyDict_New(void); ! extern DL_IMPORT(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); ! extern DL_IMPORT(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); ! extern DL_IMPORT(int) PyDict_DelItem(PyObject *mp, PyObject *key); ! extern DL_IMPORT(void) PyDict_Clear(PyObject *mp); ! extern DL_IMPORT(int) PyDict_Next ! (PyObject *mp, int *pos, PyObject **key, PyObject **value); ! extern DL_IMPORT(PyObject *) PyDict_Keys(PyObject *mp); ! extern DL_IMPORT(PyObject *) PyDict_Values(PyObject *mp); ! extern DL_IMPORT(PyObject *) PyDict_Items(PyObject *mp); ! extern DL_IMPORT(int) PyDict_Size(PyObject *mp); ! extern DL_IMPORT(PyObject *) PyDict_Copy(PyObject *mp); /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ ! extern DL_IMPORT(int) PyDict_Update(PyObject *mp, PyObject *other); /* PyDict_Merge updates/merges from a mapping object (an object that --- 79,101 ---- }; ! PyAPI_DATA(PyTypeObject) PyDict_Type; #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) ! PyAPI_FUNC(PyObject *) PyDict_New(void); ! PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); ! PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); ! PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); ! PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); ! PyAPI_FUNC(int) PyDict_Next( ! PyObject *mp, int *pos, PyObject **key, PyObject **value); ! PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); ! PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); ! PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); ! PyAPI_FUNC(int) PyDict_Size(PyObject *mp); ! PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ ! PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); /* PyDict_Merge updates/merges from a mapping object (an object that *************** *** 104,108 **** dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). */ ! extern DL_IMPORT(int) PyDict_Merge(PyObject *mp, PyObject *other, int override); --- 104,108 ---- dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). */ ! PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, PyObject *other, int override); *************** *** 113,123 **** is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). */ ! extern DL_IMPORT(int) PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override); ! extern DL_IMPORT(PyObject *) PyDict_GetItemString(PyObject *dp, char *key); ! extern DL_IMPORT(int) PyDict_SetItemString(PyObject *dp, char *key, PyObject *item); ! extern DL_IMPORT(int) PyDict_DelItemString(PyObject *dp, char *key); #ifdef __cplusplus --- 113,123 ---- is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). */ ! PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override); ! PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, char *key); ! PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, char *key, PyObject *item); ! PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, char *key); #ifdef __cplusplus Index: enumobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/enumobject.h,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -d -r2.1 -r2.2 *** enumobject.h 26 Apr 2002 19:40:56 -0000 2.1 --- enumobject.h 12 Aug 2002 07:21:56 -0000 2.2 *************** *** 8,12 **** #endif ! extern DL_IMPORT(PyTypeObject) PyEnum_Type; #ifdef __cplusplus --- 8,12 ---- #endif ! PyAPI_DATA(PyTypeObject) PyEnum_Type; #ifdef __cplusplus Index: eval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/eval.h,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** eval.h 2 Aug 2001 04:15:00 -0000 2.15 --- eval.h 12 Aug 2002 07:21:56 -0000 2.16 *************** *** 8,14 **** #endif ! DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); ! DL_IMPORT(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, --- 8,14 ---- #endif ! PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** fileobject.h 6 Aug 2002 15:55:28 -0000 2.30 --- fileobject.h 12 Aug 2002 07:21:56 -0000 2.31 *************** *** 27,51 **** } PyFileObject; ! extern DL_IMPORT(PyTypeObject) PyFile_Type; #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) #define PyFile_CheckExact(op) ((op)->ob_type == &PyFile_Type) ! extern DL_IMPORT(PyObject *) PyFile_FromString(char *, char *); ! extern DL_IMPORT(void) PyFile_SetBufSize(PyObject *, int); ! extern DL_IMPORT(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); ! extern DL_IMPORT(FILE *) PyFile_AsFile(PyObject *); ! extern DL_IMPORT(PyObject *) PyFile_Name(PyObject *); ! extern DL_IMPORT(PyObject *) PyFile_GetLine(PyObject *, int); ! extern DL_IMPORT(int) PyFile_WriteObject(PyObject *, PyObject *, int); ! extern DL_IMPORT(int) PyFile_SoftSpace(PyObject *, int); ! extern DL_IMPORT(int) PyFile_WriteString(const char *, PyObject *); ! extern DL_IMPORT(int) PyObject_AsFileDescriptor(PyObject *); /* The default encoding used by the platform file system APIs If non-NULL, this is different than the default encoding for strings */ ! extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding; #ifdef WITH_UNIVERSAL_NEWLINES --- 27,51 ---- } PyFileObject; ! PyAPI_DATA(PyTypeObject) PyFile_Type; #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) #define PyFile_CheckExact(op) ((op)->ob_type == &PyFile_Type) ! PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); ! PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); ! PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); ! PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); ! PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *); ! PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); ! PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); ! PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int); ! PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); ! PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); /* The default encoding used by the platform file system APIs If non-NULL, this is different than the default encoding for strings */ ! PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; #ifdef WITH_UNIVERSAL_NEWLINES Index: floatobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/floatobject.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** floatobject.h 10 Sep 2001 21:28:20 -0000 2.20 --- floatobject.h 12 Aug 2002 07:21:56 -0000 2.21 *************** *** 17,21 **** } PyFloatObject; ! extern DL_IMPORT(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) --- 17,21 ---- } PyFloatObject; ! PyAPI_DATA(PyTypeObject) PyFloat_Type; #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) *************** *** 25,36 **** input, and, if non-NULL, NULL is stored into *junk (this tried to serve a purpose once but can't be made to work as intended). */ ! extern DL_IMPORT(PyObject *) PyFloat_FromString(PyObject*, char** junk); /* Return Python float from C double. */ ! extern DL_IMPORT(PyObject *) PyFloat_FromDouble(double); /* Extract C double from Python float. The macro version trades safety for speed. */ ! extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *); #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) --- 25,36 ---- input, and, if non-NULL, NULL is stored into *junk (this tried to serve a purpose once but can't be made to work as intended). */ ! PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk); /* Return Python float from C double. */ ! PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); /* Extract C double from Python float. The macro version trades safety for speed. */ ! PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) *************** *** 39,43 **** PyFloat_AsReprString(buf, x) strives to print enough digits so that PyFloat_FromString(buf) then reproduces x exactly. */ ! extern DL_IMPORT(void) PyFloat_AsReprString(char*, PyFloatObject *v); /* Write str(v) into the char buffer argument, followed by null byte. The --- 39,43 ---- PyFloat_AsReprString(buf, x) strives to print enough digits so that PyFloat_FromString(buf) then reproduces x exactly. */ ! PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v); /* Write str(v) into the char buffer argument, followed by null byte. The *************** *** 46,50 **** PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to preserve precision across conversions. */ ! extern DL_IMPORT(void) PyFloat_AsString(char*, PyFloatObject *v); #ifdef __cplusplus --- 46,50 ---- PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to preserve precision across conversions. */ ! PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v); #ifdef __cplusplus Index: frameobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/frameobject.h,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** frameobject.h 14 Jul 2002 00:27:25 -0000 2.35 --- frameobject.h 12 Aug 2002 07:21:56 -0000 2.36 *************** *** 45,53 **** /* Standard object interface */ ! extern DL_IMPORT(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) ! DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); --- 45,53 ---- /* Standard object interface */ ! PyAPI_DATA(PyTypeObject) PyFrame_Type; #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) ! PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, PyObject *, PyObject *); *************** *** 57,71 **** /* Block management functions */ ! DL_IMPORT(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); ! DL_IMPORT(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); /* Extend the value stack */ ! DL_IMPORT(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); /* Conversions between "fast locals" and locals in dictionary */ ! DL_IMPORT(void) PyFrame_LocalsToFast(PyFrameObject *, int); ! DL_IMPORT(void) PyFrame_FastToLocals(PyFrameObject *); #ifdef __cplusplus --- 57,71 ---- /* Block management functions */ ! PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); ! PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); /* Extend the value stack */ ! PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); /* Conversions between "fast locals" and locals in dictionary */ ! PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); ! PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); #ifdef __cplusplus Index: funcobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/funcobject.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** funcobject.h 2 Aug 2001 04:15:00 -0000 2.24 --- funcobject.h 12 Aug 2002 07:21:56 -0000 2.25 *************** *** 20,34 **** } PyFunctionObject; ! extern DL_IMPORT(PyTypeObject) PyFunction_Type; #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type) ! extern DL_IMPORT(PyObject *) PyFunction_New(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyFunction_GetCode(PyObject *); ! extern DL_IMPORT(PyObject *) PyFunction_GetGlobals(PyObject *); ! extern DL_IMPORT(PyObject *) PyFunction_GetDefaults(PyObject *); ! extern DL_IMPORT(int) PyFunction_SetDefaults(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyFunction_GetClosure(PyObject *); ! extern DL_IMPORT(int) PyFunction_SetClosure(PyObject *, PyObject *); /* Macros for direct access to these values. Type checks are *not* --- 20,34 ---- } PyFunctionObject; ! PyAPI_DATA(PyTypeObject) PyFunction_Type; #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type) ! PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); ! PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); ! PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); ! PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); ! PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); /* Macros for direct access to these values. Type checks are *not* *************** *** 44,52 **** /* The classmethod and staticmethod types lives here, too */ ! extern DL_IMPORT(PyTypeObject) PyClassMethod_Type; ! extern DL_IMPORT(PyTypeObject) PyStaticMethod_Type; ! extern DL_IMPORT(PyObject *) PyClassMethod_New(PyObject *); ! extern DL_IMPORT(PyObject *) PyStaticMethod_New(PyObject *); #ifdef __cplusplus --- 44,52 ---- /* The classmethod and staticmethod types lives here, too */ ! PyAPI_DATA(PyTypeObject) PyClassMethod_Type; ! PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; ! PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); ! PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); #ifdef __cplusplus Index: intobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/intobject.h,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** intobject.h 3 Apr 2002 22:41:50 -0000 2.25 --- intobject.h 12 Aug 2002 07:21:56 -0000 2.26 *************** *** 26,41 **** } PyIntObject; ! extern DL_IMPORT(PyTypeObject) PyInt_Type; #define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type) #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) ! extern DL_IMPORT(PyObject *) PyInt_FromString(char*, char**, int); #ifdef Py_USING_UNICODE ! extern DL_IMPORT(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int); #endif ! extern DL_IMPORT(PyObject *) PyInt_FromLong(long); ! extern DL_IMPORT(long) PyInt_AsLong(PyObject *); ! extern DL_IMPORT(long) PyInt_GetMax(void); /* Macro, trading safety for speed */ --- 26,41 ---- } PyIntObject; ! PyAPI_DATA(PyTypeObject) PyInt_Type; #define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type) #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) ! PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); #ifdef Py_USING_UNICODE ! PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int); #endif ! PyAPI_FUNC(PyObject *) PyInt_FromLong(long); ! PyAPI_FUNC(long) PyInt_AsLong(PyObject *); ! PyAPI_FUNC(long) PyInt_GetMax(void); /* Macro, trading safety for speed */ *************** *** 43,53 **** /* These aren't really part of the Int object, but they're handy; the protos ! * are necessary for systems that need the magic of DL_IMPORT and that want * to have stropmodule as a dynamically loaded module instead of building it * into the main Python shared library/DLL. Guido thinks I'm weird for * building it this way. :-) [cjh] */ ! extern DL_IMPORT(unsigned long) PyOS_strtoul(char *, char **, int); ! extern DL_IMPORT(long) PyOS_strtol(char *, char **, int); #ifdef __cplusplus --- 43,53 ---- /* These aren't really part of the Int object, but they're handy; the protos ! * are necessary for systems that need the magic of PyAPI_FUNC and that want * to have stropmodule as a dynamically loaded module instead of building it * into the main Python shared library/DLL. Guido thinks I'm weird for * building it this way. :-) [cjh] */ ! PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); ! PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); #ifdef __cplusplus Index: intrcheck.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/intrcheck.h,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** intrcheck.h 1 Sep 2000 23:29:26 -0000 2.9 --- intrcheck.h 12 Aug 2002 07:21:57 -0000 2.10 *************** *** 6,12 **** #endif ! extern DL_IMPORT(int) PyOS_InterruptOccurred(void); ! extern DL_IMPORT(void) PyOS_InitInterrupts(void); ! DL_IMPORT(void) PyOS_AfterFork(void); #ifdef __cplusplus --- 6,12 ---- #endif ! PyAPI_FUNC(int) PyOS_InterruptOccurred(void); ! PyAPI_FUNC(void) PyOS_InitInterrupts(void); ! PyAPI_FUNC(void) PyOS_AfterFork(void); #ifdef __cplusplus Index: iterobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/iterobject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iterobject.h 30 Mar 2002 08:57:12 -0000 1.4 --- iterobject.h 12 Aug 2002 07:21:57 -0000 1.5 *************** *** 6,20 **** #endif ! extern DL_IMPORT(PyTypeObject) PySeqIter_Type; #define PySeqIter_Check(op) ((op)->ob_type == &PySeqIter_Type) ! extern DL_IMPORT(PyObject *) PySeqIter_New(PyObject *); ! extern DL_IMPORT(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) ((op)->ob_type == &PyCallIter_Type) ! extern DL_IMPORT(PyObject *) PyCallIter_New(PyObject *, PyObject *); #ifdef __cplusplus } --- 6,20 ---- #endif ! PyAPI_DATA(PyTypeObject) PySeqIter_Type; #define PySeqIter_Check(op) ((op)->ob_type == &PySeqIter_Type) ! PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); ! PyAPI_DATA(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) ((op)->ob_type == &PyCallIter_Type) ! PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); #ifdef __cplusplus } Index: listobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/listobject.h,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** listobject.h 5 Oct 2001 20:41:38 -0000 2.23 --- listobject.h 12 Aug 2002 07:21:57 -0000 2.24 *************** *** 25,44 **** } PyListObject; ! extern DL_IMPORT(PyTypeObject) PyList_Type; #define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type) #define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type) ! extern DL_IMPORT(PyObject *) PyList_New(int size); ! extern DL_IMPORT(int) PyList_Size(PyObject *); ! extern DL_IMPORT(PyObject *) PyList_GetItem(PyObject *, int); ! extern DL_IMPORT(int) PyList_SetItem(PyObject *, int, PyObject *); ! extern DL_IMPORT(int) PyList_Insert(PyObject *, int, PyObject *); ! extern DL_IMPORT(int) PyList_Append(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) PyList_GetSlice(PyObject *, int, int); ! extern DL_IMPORT(int) PyList_SetSlice(PyObject *, int, int, PyObject *); ! extern DL_IMPORT(int) PyList_Sort(PyObject *); ! extern DL_IMPORT(int) PyList_Reverse(PyObject *); ! extern DL_IMPORT(PyObject *) PyList_AsTuple(PyObject *); /* Macro, trading safety for speed */ --- 25,44 ---- } PyListObject; ! PyAPI_DATA(PyTypeObject) PyList_Type; #define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type) #define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type) ! PyAPI_FUNC(PyObject *) PyList_New(int size); ! PyAPI_FUNC(int) PyList_Size(PyObject *); ! PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, int); ! PyAPI_FUNC(int) PyList_SetItem(PyObject *, int, PyObject *); ! PyAPI_FUNC(int) PyList_Insert(PyObject *, int, PyObject *); ! PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, int, int); ! PyAPI_FUNC(int) PyList_SetSlice(PyObject *, int, int, PyObject *); ! PyAPI_FUNC(int) PyList_Sort(PyObject *); ! PyAPI_FUNC(int) PyList_Reverse(PyObject *); ! PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); /* Macro, trading safety for speed */ Index: longintrepr.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/longintrepr.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** longintrepr.h 2 Mar 2002 04:33:09 -0000 2.13 --- longintrepr.h 12 Aug 2002 07:21:57 -0000 2.14 *************** *** 48,55 **** }; ! DL_IMPORT(PyLongObject *) _PyLong_New(int); /* Return a copy of src. */ ! DL_IMPORT(PyObject *) _PyLong_Copy(PyLongObject *src); #ifdef __cplusplus --- 48,55 ---- }; ! PyAPI_FUNC(PyLongObject *) _PyLong_New(int); /* Return a copy of src. */ ! PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); #ifdef __cplusplus Index: longobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/longobject.h,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** longobject.h 12 Jul 2002 05:01:20 -0000 2.25 --- longobject.h 12 Aug 2002 07:21:57 -0000 2.26 *************** *** 10,23 **** typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ ! extern DL_IMPORT(PyTypeObject) PyLong_Type; #define PyLong_Check(op) PyObject_TypeCheck(op, &PyLong_Type) #define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type) ! extern DL_IMPORT(PyObject *) PyLong_FromLong(long); ! extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong(unsigned long); ! extern DL_IMPORT(PyObject *) PyLong_FromDouble(double); ! extern DL_IMPORT(long) PyLong_AsLong(PyObject *); ! extern DL_IMPORT(unsigned long) PyLong_AsUnsignedLong(PyObject *); /* _PyLong_AsScaledDouble returns a double x and an exponent e such that --- 10,23 ---- typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ ! PyAPI_DATA(PyTypeObject) PyLong_Type; #define PyLong_Check(op) PyObject_TypeCheck(op, &PyLong_Type) #define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type) ! PyAPI_FUNC(PyObject *) PyLong_FromLong(long); ! PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); ! PyAPI_FUNC(PyObject *) PyLong_FromDouble(double); ! PyAPI_FUNC(long) PyLong_AsLong(PyObject *); ! PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); /* _PyLong_AsScaledDouble returns a double x and an exponent e such that *************** *** 27,46 **** be multiplied by SHIFT! There may not be enough room in an int to store e*SHIFT directly. */ ! extern DL_IMPORT(double) _PyLong_AsScaledDouble(PyObject *vv, int *e); ! extern DL_IMPORT(double) PyLong_AsDouble(PyObject *); ! extern DL_IMPORT(PyObject *) PyLong_FromVoidPtr(void *); ! extern DL_IMPORT(void *) PyLong_AsVoidPtr(PyObject *); #ifdef HAVE_LONG_LONG ! extern DL_IMPORT(PyObject *) PyLong_FromLongLong(LONG_LONG); ! extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); ! extern DL_IMPORT(LONG_LONG) PyLong_AsLongLong(PyObject *); ! extern DL_IMPORT(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); #endif /* HAVE_LONG_LONG */ ! DL_IMPORT(PyObject *) PyLong_FromString(char *, char **, int); #ifdef Py_USING_UNICODE ! DL_IMPORT(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); #endif --- 27,46 ---- be multiplied by SHIFT! There may not be enough room in an int to store e*SHIFT directly. */ ! PyAPI_FUNC(double) _PyLong_AsScaledDouble(PyObject *vv, int *e); ! PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); ! PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); ! PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); #ifdef HAVE_LONG_LONG ! PyAPI_FUNC(PyObject *) PyLong_FromLongLong(LONG_LONG); ! PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); ! PyAPI_FUNC(LONG_LONG) PyLong_AsLongLong(PyObject *); ! PyAPI_FUNC(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); #endif /* HAVE_LONG_LONG */ ! PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); #ifdef Py_USING_UNICODE ! PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int); #endif *************** *** 58,62 **** enough memory to create the Python long. */ ! extern DL_IMPORT(PyObject *) _PyLong_FromByteArray( const unsigned char* bytes, size_t n, int little_endian, int is_signed); --- 58,62 ---- enough memory to create the Python long. */ ! PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( const unsigned char* bytes, size_t n, int little_endian, int is_signed); *************** *** 81,85 **** case, but bytes holds the least-signficant n bytes of the true value. */ ! extern DL_IMPORT(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed); --- 81,85 ---- case, but bytes holds the least-signficant n bytes of the true value. */ ! PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed); Index: marshal.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/marshal.h,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** marshal.h 28 Jan 2001 00:27:39 -0000 2.11 --- marshal.h 12 Aug 2002 07:21:57 -0000 2.12 *************** *** 8,21 **** #endif ! DL_IMPORT(void) PyMarshal_WriteLongToFile(long, FILE *); ! DL_IMPORT(void) PyMarshal_WriteShortToFile(int, FILE *); ! DL_IMPORT(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *); ! DL_IMPORT(PyObject *) PyMarshal_WriteObjectToString(PyObject *); ! DL_IMPORT(long) PyMarshal_ReadLongFromFile(FILE *); ! DL_IMPORT(int) PyMarshal_ReadShortFromFile(FILE *); ! DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); ! DL_IMPORT(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); ! DL_IMPORT(PyObject *) PyMarshal_ReadObjectFromString(char *, int); #ifdef __cplusplus --- 8,21 ---- #endif ! PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *); ! PyAPI_FUNC(void) PyMarshal_WriteShortToFile(int, FILE *); ! PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *); ! PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *); ! PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); ! PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); ! PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); ! PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); ! PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, int); #ifdef __cplusplus Index: methodobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/methodobject.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** methodobject.h 28 Mar 2002 05:33:33 -0000 2.24 --- methodobject.h 12 Aug 2002 07:21:57 -0000 2.25 *************** *** 8,12 **** #endif ! extern DL_IMPORT(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type) --- 8,12 ---- #endif ! PyAPI_DATA(PyTypeObject) PyCFunction_Type; #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type) *************** *** 17,23 **** typedef PyObject *(*PyNoArgsFunction)(PyObject *); ! extern DL_IMPORT(PyCFunction) PyCFunction_GetFunction(PyObject *); ! extern DL_IMPORT(PyObject *) PyCFunction_GetSelf(PyObject *); ! extern DL_IMPORT(int) PyCFunction_GetFlags(PyObject *); /* Macros for direct access to these values. Type checks are *not* --- 17,23 ---- typedef PyObject *(*PyNoArgsFunction)(PyObject *); ! PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); ! PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); ! PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); /* Macros for direct access to these values. Type checks are *not* *************** *** 29,33 **** #define PyCFunction_GET_FLAGS(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags) ! extern DL_IMPORT(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); struct PyMethodDef { --- 29,33 ---- #define PyCFunction_GET_FLAGS(func) \ (((PyCFunctionObject *)func) -> m_ml -> ml_flags) ! PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); struct PyMethodDef { *************** *** 39,45 **** typedef struct PyMethodDef PyMethodDef; ! extern DL_IMPORT(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *); ! extern DL_IMPORT(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); /* Flag passed to newmethodobject */ --- 39,45 ---- typedef struct PyMethodDef PyMethodDef; ! PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *); ! PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); /* Flag passed to newmethodobject */ *************** *** 62,66 **** } PyMethodChain; ! extern DL_IMPORT(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, char *); --- 62,66 ---- } PyMethodChain; ! PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, char *); Index: modsupport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/modsupport.h,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** modsupport.h 23 Oct 2001 21:09:29 -0000 2.38 --- modsupport.h 12 Aug 2002 07:21:57 -0000 2.39 *************** *** 10,26 **** #include ! extern DL_IMPORT(int) PyArg_Parse(PyObject *, char *, ...); ! extern DL_IMPORT(int) PyArg_ParseTuple(PyObject *, char *, ...); ! extern DL_IMPORT(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, char *, char **, ...); ! extern DL_IMPORT(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...); ! extern DL_IMPORT(PyObject *) Py_BuildValue(char *, ...); ! extern DL_IMPORT(int) PyArg_VaParse(PyObject *, char *, va_list); ! extern DL_IMPORT(PyObject *) Py_VaBuildValue(char *, va_list); ! extern DL_IMPORT(int) PyModule_AddObject(PyObject *, char *, PyObject *); ! extern DL_IMPORT(int) PyModule_AddIntConstant(PyObject *, char *, long); ! extern DL_IMPORT(int) PyModule_AddStringConstant(PyObject *, char *, char *); #define PYTHON_API_VERSION 1011 --- 10,26 ---- #include ! PyAPI_FUNC(int) PyArg_Parse(PyObject *, char *, ...); ! PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, char *, ...); ! PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, char *, char **, ...); ! PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, char *, int, int, ...); ! PyAPI_FUNC(PyObject *) Py_BuildValue(char *, ...); ! PyAPI_FUNC(int) PyArg_VaParse(PyObject *, char *, va_list); ! PyAPI_FUNC(PyObject *) Py_VaBuildValue(char *, va_list); ! PyAPI_FUNC(int) PyModule_AddObject(PyObject *, char *, PyObject *); ! PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, char *, long); ! PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *); #define PYTHON_API_VERSION 1011 *************** *** 79,83 **** #endif ! extern DL_IMPORT(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver); --- 79,83 ---- #endif ! PyAPI_FUNC(PyObject *) Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver); *************** *** 91,95 **** PYTHON_API_VERSION) ! extern DL_IMPORT(char *) _Py_PackageContext; #ifdef __cplusplus --- 91,95 ---- PYTHON_API_VERSION) ! PyAPI_DATA(char *) _Py_PackageContext; #ifdef __cplusplus Index: moduleobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/moduleobject.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** moduleobject.h 13 Sep 2001 05:38:55 -0000 2.19 --- moduleobject.h 12 Aug 2002 07:21:57 -0000 2.20 *************** *** 8,21 **** #endif ! extern DL_IMPORT(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) ((op)->ob_type == &PyModule_Type) ! extern DL_IMPORT(PyObject *) PyModule_New(char *); ! extern DL_IMPORT(PyObject *) PyModule_GetDict(PyObject *); ! extern DL_IMPORT(char *) PyModule_GetName(PyObject *); ! extern DL_IMPORT(char *) PyModule_GetFilename(PyObject *); ! extern DL_IMPORT(void) _PyModule_Clear(PyObject *); #ifdef __cplusplus --- 8,21 ---- #endif ! PyAPI_DATA(PyTypeObject) PyModule_Type; #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) ((op)->ob_type == &PyModule_Type) ! PyAPI_FUNC(PyObject *) PyModule_New(char *); ! PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); ! PyAPI_FUNC(char *) PyModule_GetName(PyObject *); ! PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); ! PyAPI_FUNC(void) _PyModule_Clear(PyObject *); #ifdef __cplusplus Index: node.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/node.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** node.h 15 Oct 2001 17:23:13 -0000 2.19 --- node.h 12 Aug 2002 07:21:57 -0000 2.20 *************** *** 16,23 **** } node; ! extern DL_IMPORT(node *) PyNode_New(int type); ! extern DL_IMPORT(int) PyNode_AddChild(node *n, int type, char *str, int lineno); ! extern DL_IMPORT(void) PyNode_Free(node *n); /* Node access functions */ --- 16,23 ---- } node; ! PyAPI_FUNC(node *) PyNode_New(int type); ! PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, char *str, int lineno); ! PyAPI_FUNC(void) PyNode_Free(node *n); /* Node access functions */ *************** *** 30,34 **** #define REQ(n, type) assert(TYPE(n) == (type)) ! extern DL_IMPORT(void) PyNode_ListTree(node *); #ifdef __cplusplus --- 30,34 ---- #define REQ(n, type) assert(TYPE(n) == (type)) ! PyAPI_FUNC(void) PyNode_ListTree(node *); #ifdef __cplusplus Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** objimpl.h 7 Jul 2002 03:59:33 -0000 2.56 --- objimpl.h 12 Aug 2002 07:21:57 -0000 2.57 *************** *** 95,101 **** the raw memory. */ ! extern DL_IMPORT(void *) PyObject_Malloc(size_t); ! extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t); ! extern DL_IMPORT(void) PyObject_Free(void *); --- 95,101 ---- the raw memory. */ ! PyAPI_FUNC(void *) PyObject_Malloc(size_t); ! PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t); ! PyAPI_FUNC(void) PyObject_Free(void *); *************** *** 103,112 **** #ifdef WITH_PYMALLOC #ifdef PYMALLOC_DEBUG ! DL_IMPORT(void *) _PyObject_DebugMalloc(size_t nbytes); ! DL_IMPORT(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); ! DL_IMPORT(void) _PyObject_DebugFree(void *p); ! DL_IMPORT(void) _PyObject_DebugDumpAddress(const void *p); ! DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p); ! DL_IMPORT(void) _PyObject_DebugMallocStats(void); #define PyObject_MALLOC _PyObject_DebugMalloc #define PyObject_Malloc _PyObject_DebugMalloc --- 103,112 ---- #ifdef WITH_PYMALLOC #ifdef PYMALLOC_DEBUG ! PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); ! PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); ! PyAPI_FUNC(void) _PyObject_DebugFree(void *p); ! PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p); ! PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p); ! PyAPI_FUNC(void) _PyObject_DebugMallocStats(void); #define PyObject_MALLOC _PyObject_DebugMalloc #define PyObject_Malloc _PyObject_DebugMalloc *************** *** 145,153 **** /* Functions */ ! extern DL_IMPORT(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); ! extern DL_IMPORT(PyVarObject *) PyObject_InitVar(PyVarObject *, PyTypeObject *, int); ! extern DL_IMPORT(PyObject *) _PyObject_New(PyTypeObject *); ! extern DL_IMPORT(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int); #define PyObject_New(type, typeobj) \ --- 145,153 ---- /* Functions */ ! PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); ! PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, PyTypeObject *, int); ! PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); ! PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, int); #define PyObject_New(type, typeobj) \ *************** *** 236,240 **** ((o)->ob_type->tp_is_gc == NULL || (o)->ob_type->tp_is_gc(o))) ! extern DL_IMPORT(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, int); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) --- 236,240 ---- ((o)->ob_type->tp_is_gc == NULL || (o)->ob_type->tp_is_gc(o))) ! PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, int); #define PyObject_GC_Resize(type, op, n) \ ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) *************** *** 287,296 **** } while (0); ! extern DL_IMPORT(PyObject *) _PyObject_GC_Malloc(size_t); ! extern DL_IMPORT(PyObject *) _PyObject_GC_New(PyTypeObject *); ! extern DL_IMPORT(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, int); ! extern DL_IMPORT(void) PyObject_GC_Track(void *); ! extern DL_IMPORT(void) PyObject_GC_UnTrack(void *); ! extern DL_IMPORT(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ --- 287,296 ---- } while (0); ! PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); ! PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); ! PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, int); ! PyAPI_FUNC(void) PyObject_GC_Track(void *); ! PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); ! PyAPI_FUNC(void) PyObject_GC_Del(void *); #define PyObject_GC_New(type, typeobj) \ Index: parsetok.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/parsetok.h,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** parsetok.h 9 Jul 2002 09:23:26 -0000 2.18 --- parsetok.h 12 Aug 2002 07:21:57 -0000 2.19 *************** *** 22,37 **** #endif ! extern DL_IMPORT(node *) PyParser_ParseString(char *, grammar *, int, perrdetail *); ! extern DL_IMPORT(node *) PyParser_ParseFile (FILE *, char *, grammar *, int, char *, char *, perrdetail *); ! extern DL_IMPORT(node *) PyParser_ParseStringFlags(char *, grammar *, int, perrdetail *, int); ! extern DL_IMPORT(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *, int, char *, char *, perrdetail *, int); ! extern DL_IMPORT(node *) PyParser_ParseStringFlagsFilename(char *, char *, grammar *, int, --- 22,37 ---- #endif ! PyAPI_FUNC(node *) PyParser_ParseString(char *, grammar *, int, perrdetail *); ! PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, char *, grammar *, int, char *, char *, perrdetail *); ! PyAPI_FUNC(node *) PyParser_ParseStringFlags(char *, grammar *, int, perrdetail *, int); ! PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, char *, grammar *, int, char *, char *, perrdetail *, int); ! PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(char *, char *, grammar *, int, Index: pgenheaders.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pgenheaders.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** pgenheaders.h 22 Apr 2002 02:33:27 -0000 2.28 --- pgenheaders.h 12 Aug 2002 07:21:57 -0000 2.29 *************** *** 10,16 **** #include "Python.h" ! DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) __attribute__((format(printf, 1, 2))); ! DL_IMPORT(void) PySys_WriteStderr(const char *format, ...) __attribute__((format(printf, 1, 2))); --- 10,16 ---- #include "Python.h" ! 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))); Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** pyerrors.h 29 Jul 2002 14:27:40 -0000 2.55 --- pyerrors.h 12 Aug 2002 07:21:57 -0000 2.56 *************** *** 8,95 **** /* Error handling definitions */ ! DL_IMPORT(void) PyErr_SetNone(PyObject *); ! DL_IMPORT(void) PyErr_SetObject(PyObject *, PyObject *); ! DL_IMPORT(void) PyErr_SetString(PyObject *, const char *); ! DL_IMPORT(PyObject *) PyErr_Occurred(void); ! DL_IMPORT(void) PyErr_Clear(void); ! DL_IMPORT(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); ! DL_IMPORT(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); /* Error testing and normalization */ ! DL_IMPORT(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); ! DL_IMPORT(int) PyErr_ExceptionMatches(PyObject *); ! DL_IMPORT(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); /* Predefined exceptions */ ! extern DL_IMPORT(PyObject *) PyExc_Exception; ! extern DL_IMPORT(PyObject *) PyExc_StopIteration; ! extern DL_IMPORT(PyObject *) PyExc_StandardError; ! extern DL_IMPORT(PyObject *) PyExc_ArithmeticError; ! extern DL_IMPORT(PyObject *) PyExc_LookupError; ! extern DL_IMPORT(PyObject *) PyExc_AssertionError; ! extern DL_IMPORT(PyObject *) PyExc_AttributeError; ! extern DL_IMPORT(PyObject *) PyExc_EOFError; ! extern DL_IMPORT(PyObject *) PyExc_FloatingPointError; ! extern DL_IMPORT(PyObject *) PyExc_EnvironmentError; ! extern DL_IMPORT(PyObject *) PyExc_IOError; ! extern DL_IMPORT(PyObject *) PyExc_OSError; ! extern DL_IMPORT(PyObject *) PyExc_ImportError; ! extern DL_IMPORT(PyObject *) PyExc_IndexError; ! extern DL_IMPORT(PyObject *) PyExc_KeyError; ! extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt; ! extern DL_IMPORT(PyObject *) PyExc_MemoryError; ! extern DL_IMPORT(PyObject *) PyExc_NameError; ! extern DL_IMPORT(PyObject *) PyExc_OverflowError; ! extern DL_IMPORT(PyObject *) PyExc_RuntimeError; ! extern DL_IMPORT(PyObject *) PyExc_NotImplementedError; ! extern DL_IMPORT(PyObject *) PyExc_SyntaxError; ! extern DL_IMPORT(PyObject *) PyExc_IndentationError; ! extern DL_IMPORT(PyObject *) PyExc_TabError; ! extern DL_IMPORT(PyObject *) PyExc_ReferenceError; ! extern DL_IMPORT(PyObject *) PyExc_SystemError; ! extern DL_IMPORT(PyObject *) PyExc_SystemExit; ! extern DL_IMPORT(PyObject *) PyExc_TypeError; ! extern DL_IMPORT(PyObject *) PyExc_UnboundLocalError; ! extern DL_IMPORT(PyObject *) PyExc_UnicodeError; ! extern DL_IMPORT(PyObject *) PyExc_ValueError; ! extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError; #ifdef MS_WINDOWS ! extern DL_IMPORT(PyObject *) PyExc_WindowsError; #endif ! extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst; /* Predefined warning categories */ ! extern DL_IMPORT(PyObject *) PyExc_Warning; ! extern DL_IMPORT(PyObject *) PyExc_UserWarning; ! extern DL_IMPORT(PyObject *) PyExc_DeprecationWarning; ! extern DL_IMPORT(PyObject *) PyExc_PendingDeprecationWarning; ! extern DL_IMPORT(PyObject *) PyExc_SyntaxWarning; ! extern DL_IMPORT(PyObject *) PyExc_OverflowWarning; ! extern DL_IMPORT(PyObject *) PyExc_RuntimeWarning; /* Convenience functions */ ! extern DL_IMPORT(int) PyErr_BadArgument(void); ! extern DL_IMPORT(PyObject *) PyErr_NoMemory(void); ! extern DL_IMPORT(PyObject *) PyErr_SetFromErrno(PyObject *); ! extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); ! extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...) __attribute__((format(printf, 2, 3))); #ifdef MS_WINDOWS ! extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); ! extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int); ! extern DL_IMPORT(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *,int, const char *); ! extern DL_IMPORT(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* Export the old function so that the existing API remains available: */ ! extern DL_IMPORT(void) PyErr_BadInternalCall(void); ! extern DL_IMPORT(void) _PyErr_BadInternalCall(char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ --- 8,95 ---- /* Error handling definitions */ ! PyAPI_FUNC(void) PyErr_SetNone(PyObject *); ! PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); ! PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *); ! PyAPI_FUNC(PyObject *) PyErr_Occurred(void); ! PyAPI_FUNC(void) PyErr_Clear(void); ! PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); ! PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); /* Error testing and normalization */ ! PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); ! PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); ! PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); /* Predefined exceptions */ ! PyAPI_DATA(PyObject *) PyExc_Exception; ! PyAPI_DATA(PyObject *) PyExc_StopIteration; ! PyAPI_DATA(PyObject *) PyExc_StandardError; ! PyAPI_DATA(PyObject *) PyExc_ArithmeticError; ! PyAPI_DATA(PyObject *) PyExc_LookupError; ! PyAPI_DATA(PyObject *) PyExc_AssertionError; ! PyAPI_DATA(PyObject *) PyExc_AttributeError; ! PyAPI_DATA(PyObject *) PyExc_EOFError; ! PyAPI_DATA(PyObject *) PyExc_FloatingPointError; ! PyAPI_DATA(PyObject *) PyExc_EnvironmentError; ! PyAPI_DATA(PyObject *) PyExc_IOError; ! PyAPI_DATA(PyObject *) PyExc_OSError; ! PyAPI_DATA(PyObject *) PyExc_ImportError; ! PyAPI_DATA(PyObject *) PyExc_IndexError; ! PyAPI_DATA(PyObject *) PyExc_KeyError; ! PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; ! PyAPI_DATA(PyObject *) PyExc_MemoryError; ! PyAPI_DATA(PyObject *) PyExc_NameError; ! PyAPI_DATA(PyObject *) PyExc_OverflowError; ! PyAPI_DATA(PyObject *) PyExc_RuntimeError; ! PyAPI_DATA(PyObject *) PyExc_NotImplementedError; ! PyAPI_DATA(PyObject *) PyExc_SyntaxError; ! PyAPI_DATA(PyObject *) PyExc_IndentationError; ! PyAPI_DATA(PyObject *) PyExc_TabError; ! PyAPI_DATA(PyObject *) PyExc_ReferenceError; ! PyAPI_DATA(PyObject *) PyExc_SystemError; ! PyAPI_DATA(PyObject *) PyExc_SystemExit; ! PyAPI_DATA(PyObject *) PyExc_TypeError; ! PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; ! PyAPI_DATA(PyObject *) PyExc_UnicodeError; ! PyAPI_DATA(PyObject *) PyExc_ValueError; ! PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; #ifdef MS_WINDOWS ! PyAPI_DATA(PyObject *) PyExc_WindowsError; #endif ! PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst; /* Predefined warning categories */ ! PyAPI_DATA(PyObject *) PyExc_Warning; ! PyAPI_DATA(PyObject *) PyExc_UserWarning; ! PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; ! PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; ! PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; ! PyAPI_DATA(PyObject *) PyExc_OverflowWarning; ! PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; /* Convenience functions */ ! PyAPI_FUNC(int) PyErr_BadArgument(void); ! PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); ! PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); ! 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 *); ! PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); ! PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *,int, const char *); ! PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* Export the old function so that the existing API remains available: */ ! PyAPI_FUNC(void) PyErr_BadInternalCall(void); ! PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno); /* Mask the old API with a call to the new API for code compiled under Python 2.0: */ *************** *** 97,116 **** /* Function to create a new exception */ ! DL_IMPORT(PyObject *) PyErr_NewException(char *name, PyObject *base, PyObject *dict); ! extern DL_IMPORT(void) PyErr_WriteUnraisable(PyObject *); /* Issue a warning or exception */ ! extern DL_IMPORT(int) PyErr_Warn(PyObject *, char *); ! extern DL_IMPORT(int) PyErr_WarnExplicit(PyObject *, char *, char *, int, char *, PyObject *); /* In sigcheck.c or signalmodule.c */ ! extern DL_IMPORT(int) PyErr_CheckSignals(void); ! extern DL_IMPORT(void) PyErr_SetInterrupt(void); /* Support for adding program text to SyntaxErrors */ ! extern DL_IMPORT(void) PyErr_SyntaxLocation(char *, int); ! extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); /* These APIs aren't really part of the error implementation, but --- 97,116 ---- /* Function to create a new exception */ ! PyAPI_FUNC(PyObject *) PyErr_NewException(char *name, PyObject *base, PyObject *dict); ! PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); /* Issue a warning or exception */ ! PyAPI_FUNC(int) PyErr_Warn(PyObject *, char *); ! PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, char *, char *, int, char *, PyObject *); /* In sigcheck.c or signalmodule.c */ ! PyAPI_FUNC(int) PyErr_CheckSignals(void); ! PyAPI_FUNC(void) PyErr_SetInterrupt(void); /* Support for adding program text to SyntaxErrors */ ! PyAPI_FUNC(void) PyErr_SyntaxLocation(char *, int); ! PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int); /* These APIs aren't really part of the error implementation, but *************** *** 129,135 **** #include ! extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); ! extern DL_IMPORT(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) __attribute__((format(printf, 3, 0))); --- 129,135 ---- #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))); Index: pygetopt.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pygetopt.h,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -d -r2.1 -r2.2 *** pygetopt.h 3 Nov 2000 08:18:37 -0000 2.1 --- pygetopt.h 12 Aug 2002 07:21:57 -0000 2.2 *************** *** 6,14 **** #endif ! extern DL_IMPORT(int) _PyOS_opterr; ! extern DL_IMPORT(int) _PyOS_optind; ! extern DL_IMPORT(char *) _PyOS_optarg; ! DL_IMPORT(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); #ifdef __cplusplus --- 6,14 ---- #endif ! PyAPI_DATA(int) _PyOS_opterr; ! PyAPI_DATA(int) _PyOS_optind; ! PyAPI_DATA(char *) _PyOS_optarg; ! PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); #ifdef __cplusplus Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** pymem.h 28 Apr 2002 04:11:46 -0000 2.15 --- pymem.h 12 Aug 2002 07:21:57 -0000 2.16 *************** *** 48,54 **** */ ! extern DL_IMPORT(void *) PyMem_Malloc(size_t); ! extern DL_IMPORT(void *) PyMem_Realloc(void *, size_t); ! extern DL_IMPORT(void) PyMem_Free(void *); /* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are --- 48,54 ---- */ ! PyAPI_FUNC(void *) PyMem_Malloc(size_t); ! PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t); ! PyAPI_FUNC(void) PyMem_Free(void *); /* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** pystate.h 19 Jul 2001 12:19:11 -0000 2.18 --- pystate.h 12 Aug 2002 07:21:57 -0000 2.19 *************** *** 75,97 **** ! DL_IMPORT(PyInterpreterState *) PyInterpreterState_New(void); ! DL_IMPORT(void) PyInterpreterState_Clear(PyInterpreterState *); ! DL_IMPORT(void) PyInterpreterState_Delete(PyInterpreterState *); ! DL_IMPORT(PyThreadState *) PyThreadState_New(PyInterpreterState *); ! DL_IMPORT(void) PyThreadState_Clear(PyThreadState *); ! DL_IMPORT(void) PyThreadState_Delete(PyThreadState *); #ifdef WITH_THREAD ! DL_IMPORT(void) PyThreadState_DeleteCurrent(void); #endif ! DL_IMPORT(PyThreadState *) PyThreadState_Get(void); ! DL_IMPORT(PyThreadState *) PyThreadState_Swap(PyThreadState *); ! DL_IMPORT(PyObject *) PyThreadState_GetDict(void); /* Variable and macro for in-line access to current thread state */ ! extern DL_IMPORT(PyThreadState *) _PyThreadState_Current; #ifdef Py_DEBUG --- 75,97 ---- ! PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); ! PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); ! PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); ! PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); ! PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); ! PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); #ifdef WITH_THREAD ! PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); #endif ! PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); ! PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); ! PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); /* Variable and macro for in-line access to current thread state */ ! PyAPI_DATA(PyThreadState *) _PyThreadState_Current; #ifdef Py_DEBUG *************** *** 103,110 **** /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ ! DL_IMPORT(PyInterpreterState *) PyInterpreterState_Head(void); ! DL_IMPORT(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); ! DL_IMPORT(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); ! DL_IMPORT(PyThreadState *) PyThreadState_Next(PyThreadState *); #ifdef __cplusplus --- 103,110 ---- /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ ! PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); ! PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); ! PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); ! PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); #ifdef __cplusplus Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** pythonrun.h 2 Aug 2002 02:27:12 -0000 2.52 --- pythonrun.h 12 Aug 2002 07:21:57 -0000 2.53 *************** *** 15,81 **** } PyCompilerFlags; ! DL_IMPORT(void) Py_SetProgramName(char *); ! DL_IMPORT(char *) Py_GetProgramName(void); ! DL_IMPORT(void) Py_SetPythonHome(char *); ! DL_IMPORT(char *) Py_GetPythonHome(void); ! DL_IMPORT(void) Py_Initialize(void); ! DL_IMPORT(void) Py_Finalize(void); ! DL_IMPORT(int) Py_IsInitialized(void); ! DL_IMPORT(PyThreadState *) Py_NewInterpreter(void); ! DL_IMPORT(void) Py_EndInterpreter(PyThreadState *); ! DL_IMPORT(int) PyRun_AnyFile(FILE *, char *); ! DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int); ! DL_IMPORT(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); ! DL_IMPORT(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); ! DL_IMPORT(int) PyRun_SimpleString(char *); ! DL_IMPORT(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *); ! DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *); ! DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); ! DL_IMPORT(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); ! DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); ! DL_IMPORT(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); ! DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); ! DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); ! DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); ! DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); ! DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); ! DL_IMPORT(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *, char *, int, int); ! DL_IMPORT(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, int, int); ! DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); ! DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); ! DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int, PyObject *, PyObject *, int); ! DL_IMPORT(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, PyCompilerFlags *); ! DL_IMPORT(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, PyObject *, PyCompilerFlags *); ! DL_IMPORT(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, PyObject *, int, PyCompilerFlags *); ! DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int); ! DL_IMPORT(PyObject *) Py_CompileStringFlags(char *, char *, int, PyCompilerFlags *); ! DL_IMPORT(struct symtable *) Py_SymtableString(char *, char *, int); ! DL_IMPORT(void) PyErr_Print(void); ! DL_IMPORT(void) PyErr_PrintEx(int); ! DL_IMPORT(void) PyErr_Display(PyObject *, PyObject *, PyObject *); ! DL_IMPORT(int) Py_AtExit(void (*func)(void)); ! DL_IMPORT(void) Py_Exit(int); ! DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *); /* Bootstrap */ --- 15,81 ---- } PyCompilerFlags; ! PyAPI_FUNC(void) Py_SetProgramName(char *); ! PyAPI_FUNC(char *) Py_GetProgramName(void); ! PyAPI_FUNC(void) Py_SetPythonHome(char *); ! PyAPI_FUNC(char *) Py_GetPythonHome(void); ! PyAPI_FUNC(void) Py_Initialize(void); ! PyAPI_FUNC(void) Py_Finalize(void); ! PyAPI_FUNC(int) Py_IsInitialized(void); ! PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); ! PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); ! PyAPI_FUNC(int) PyRun_AnyFile(FILE *, char *); ! PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, char *, int); ! PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); ! PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); ! PyAPI_FUNC(int) PyRun_SimpleString(char *); ! PyAPI_FUNC(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *); ! PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, char *); ! PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, char *, int); ! PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); ! PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, char *); ! PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); ! PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, char *); ! PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); ! PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(char *, int); ! PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); ! PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int); ! PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *, char *, int, int); ! PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *, int, int); ! PyAPI_FUNC(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, char *, int, PyObject *, PyObject *, int); ! PyAPI_FUNC(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, PyCompilerFlags *); ! PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, PyObject *, PyCompilerFlags *); ! PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, PyObject *, int, PyCompilerFlags *); ! PyAPI_FUNC(PyObject *) Py_CompileString(char *, char *, int); ! PyAPI_FUNC(PyObject *) Py_CompileStringFlags(char *, char *, int, PyCompilerFlags *); ! PyAPI_FUNC(struct symtable *) Py_SymtableString(char *, char *, int); ! PyAPI_FUNC(void) PyErr_Print(void); ! PyAPI_FUNC(void) PyErr_PrintEx(int); ! PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); ! PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); ! PyAPI_FUNC(void) Py_Exit(int); ! PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, char *); /* Bootstrap */ *************** *** 96,102 **** /* Internal -- various one-time initializations */ ! DL_IMPORT(PyObject *) _PyBuiltin_Init(void); ! DL_IMPORT(PyObject *) _PySys_Init(void); ! DL_IMPORT(void) _PyImport_Init(void); PyAPI_FUNC(void) _PyExc_Init(void); --- 96,102 ---- /* Internal -- various one-time initializations */ ! PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); ! PyAPI_FUNC(PyObject *) _PySys_Init(void); ! PyAPI_FUNC(void) _PyImport_Init(void); PyAPI_FUNC(void) _PyExc_Init(void); *************** *** 114,120 **** /* Stuff with no proper home (yet) */ ! DL_IMPORT(char *) PyOS_Readline(char *); ! extern DL_IMPORT(int) (*PyOS_InputHook)(void); ! extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *); /* Stack size, in "pointers" (so we get extra safety margins --- 114,120 ---- /* Stuff with no proper home (yet) */ ! PyAPI_FUNC(char *) PyOS_Readline(char *); ! PyAPI_FUNC(int) (*PyOS_InputHook)(void); ! PyAPI_FUNC(char) *(*PyOS_ReadlineFunctionPointer)(char *); /* Stack size, in "pointers" (so we get extra safety margins *************** *** 130,140 **** #ifdef USE_STACKCHECK /* Check that we aren't overflowing our stack */ ! DL_IMPORT(int) PyOS_CheckStack(void); #endif /* Signals */ typedef void (*PyOS_sighandler_t)(int); ! DL_IMPORT(PyOS_sighandler_t) PyOS_getsig(int); ! DL_IMPORT(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); --- 130,140 ---- #ifdef USE_STACKCHECK /* Check that we aren't overflowing our stack */ ! PyAPI_FUNC(int) PyOS_CheckStack(void); #endif /* Signals */ typedef void (*PyOS_sighandler_t)(int); ! PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); ! PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); Index: pythread.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythread.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** pythread.h 19 Jan 2002 22:02:54 -0000 2.19 --- pythread.h 12 Aug 2002 07:21:57 -0000 2.20 *************** *** 13,38 **** #endif ! DL_IMPORT(void) PyThread_init_thread(void); ! DL_IMPORT(long) PyThread_start_new_thread(void (*)(void *), void *); ! DL_IMPORT(void) PyThread_exit_thread(void); ! DL_IMPORT(void) PyThread__PyThread_exit_thread(void); ! DL_IMPORT(long) PyThread_get_thread_ident(void); ! DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock(void); ! DL_IMPORT(void) PyThread_free_lock(PyThread_type_lock); ! DL_IMPORT(int) PyThread_acquire_lock(PyThread_type_lock, int); #define WAIT_LOCK 1 #define NOWAIT_LOCK 0 ! DL_IMPORT(void) PyThread_release_lock(PyThread_type_lock); #ifndef NO_EXIT_PROG ! DL_IMPORT(void) PyThread_exit_prog(int); ! DL_IMPORT(void) PyThread__PyThread_exit_prog(int); #endif ! DL_IMPORT(int) PyThread_create_key(void); ! DL_IMPORT(void) PyThread_delete_key(int); ! DL_IMPORT(int) PyThread_set_key_value(int, void *); ! DL_IMPORT(void *) PyThread_get_key_value(int); #ifdef __cplusplus --- 13,38 ---- #endif ! PyAPI_FUNC(void) PyThread_init_thread(void); ! PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); ! PyAPI_FUNC(void) PyThread_exit_thread(void); ! PyAPI_FUNC(void) PyThread__PyThread_exit_thread(void); ! PyAPI_FUNC(long) PyThread_get_thread_ident(void); ! PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); ! PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); ! PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); #define WAIT_LOCK 1 #define NOWAIT_LOCK 0 ! PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); #ifndef NO_EXIT_PROG ! PyAPI_FUNC(void) PyThread_exit_prog(int); ! PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int); #endif ! PyAPI_FUNC(int) PyThread_create_key(void); ! PyAPI_FUNC(void) PyThread_delete_key(int); ! PyAPI_FUNC(int) PyThread_set_key_value(int, void *); ! PyAPI_FUNC(void *) PyThread_get_key_value(int); #ifdef __cplusplus Index: rangeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/rangeobject.h,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** rangeobject.h 9 Jul 2001 12:30:54 -0000 2.18 --- rangeobject.h 12 Aug 2002 07:21:57 -0000 2.19 *************** *** 16,24 **** */ ! extern DL_IMPORT(PyTypeObject) PyRange_Type; #define PyRange_Check(op) ((op)->ob_type == &PyRange_Type) ! extern DL_IMPORT(PyObject *) PyRange_New(long, long, long, int); #ifdef __cplusplus --- 16,24 ---- */ ! PyAPI_DATA(PyTypeObject) PyRange_Type; #define PyRange_Check(op) ((op)->ob_type == &PyRange_Type) ! PyAPI_FUNC(PyObject *) PyRange_New(long, long, long, int); #ifdef __cplusplus Index: sliceobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/sliceobject.h,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -d -r2.6 -r2.7 *** sliceobject.h 11 Jun 2002 10:55:09 -0000 2.6 --- sliceobject.h 12 Aug 2002 07:21:57 -0000 2.7 *************** *** 7,11 **** /* The unique ellipsis object "..." */ ! extern DL_IMPORT(PyObject) _Py_EllipsisObject; /* Don't use this directly */ #define Py_Ellipsis (&_Py_EllipsisObject) --- 7,11 ---- /* The unique ellipsis object "..." */ ! PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ #define Py_Ellipsis (&_Py_EllipsisObject) *************** *** 25,37 **** } PySliceObject; ! extern DL_IMPORT(PyTypeObject) PySlice_Type; #define PySlice_Check(op) ((op)->ob_type == &PySlice_Type) ! DL_IMPORT(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); ! DL_IMPORT(int) PySlice_GetIndices(PySliceObject *r, int length, int *start, int *stop, int *step); ! DL_IMPORT(int) PySlice_GetIndicesEx(PySliceObject *r, int length, int *start, int *stop, int *step, int *slicelength); --- 25,37 ---- } PySliceObject; ! PyAPI_DATA(PyTypeObject) PySlice_Type; #define PySlice_Check(op) ((op)->ob_type == &PySlice_Type) ! PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, PyObject* step); ! PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, int length, int *start, int *stop, int *step); ! PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, int length, int *start, int *stop, int *step, int *slicelength); Index: stringobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/stringobject.h,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -d -r2.34 -r2.35 *** stringobject.h 24 May 2002 19:01:57 -0000 2.34 --- stringobject.h 12 Aug 2002 07:21:57 -0000 2.35 *************** *** 40,68 **** } PyStringObject; ! extern DL_IMPORT(PyTypeObject) PyBaseString_Type; ! extern DL_IMPORT(PyTypeObject) PyString_Type; #define PyString_Check(op) PyObject_TypeCheck(op, &PyString_Type) #define PyString_CheckExact(op) ((op)->ob_type == &PyString_Type) ! extern DL_IMPORT(PyObject *) PyString_FromStringAndSize(const char *, int); ! extern DL_IMPORT(PyObject *) PyString_FromString(const char *); ! extern DL_IMPORT(PyObject *) PyString_FromFormatV(const char*, va_list) __attribute__((format(printf, 1, 0))); ! extern DL_IMPORT(PyObject *) PyString_FromFormat(const char*, ...) __attribute__((format(printf, 1, 2))); ! extern DL_IMPORT(int) PyString_Size(PyObject *); ! extern DL_IMPORT(char *) PyString_AsString(PyObject *); ! extern DL_IMPORT(void) PyString_Concat(PyObject **, PyObject *); ! extern DL_IMPORT(void) PyString_ConcatAndDel(PyObject **, PyObject *); ! extern DL_IMPORT(int) _PyString_Resize(PyObject **, int); ! extern DL_IMPORT(int) _PyString_Eq(PyObject *, PyObject*); ! extern DL_IMPORT(PyObject *) PyString_Format(PyObject *, PyObject *); ! extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); ! extern DL_IMPORT(void) PyString_InternInPlace(PyObject **); ! extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *); ! extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void); /* Macro, trading safety for speed */ --- 40,68 ---- } PyStringObject; ! PyAPI_DATA(PyTypeObject) PyBaseString_Type; ! PyAPI_DATA(PyTypeObject) PyString_Type; #define PyString_Check(op) PyObject_TypeCheck(op, &PyString_Type) #define PyString_CheckExact(op) ((op)->ob_type == &PyString_Type) ! PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, int); ! 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 *); ! PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); ! PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); ! PyAPI_FUNC(int) _PyString_Resize(PyObject **, int); ! PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); ! PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); ! PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); ! PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); ! PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); ! PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Macro, trading safety for speed */ *************** *** 72,76 **** /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ ! extern DL_IMPORT(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); /* --- Generic Codecs ----------------------------------------------------- */ --- 72,76 ---- /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ ! PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); /* --- Generic Codecs ----------------------------------------------------- */ *************** *** 79,83 **** given size. */ ! extern DL_IMPORT(PyObject*) PyString_Decode( const char *s, /* encoded string */ int size, /* size of buffer */ --- 79,83 ---- given size. */ ! PyAPI_FUNC(PyObject*) PyString_Decode( const char *s, /* encoded string */ int size, /* size of buffer */ *************** *** 89,93 **** Python object. */ ! extern DL_IMPORT(PyObject*) PyString_Encode( const char *s, /* string char buffer */ int size, /* number of chars to encode */ --- 89,93 ---- Python object. */ ! PyAPI_FUNC(PyObject*) PyString_Encode( const char *s, /* string char buffer */ int size, /* number of chars to encode */ *************** *** 99,103 **** object. */ ! extern DL_IMPORT(PyObject*) PyString_AsEncodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ --- 99,103 ---- object. */ ! PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ *************** *** 113,117 **** DEPRECATED - use PyString_AsEncodedObject() instead. */ ! extern DL_IMPORT(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ --- 113,117 ---- DEPRECATED - use PyString_AsEncodedObject() instead. */ ! PyAPI_FUNC(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ *************** *** 122,126 **** object. */ ! extern DL_IMPORT(PyObject*) PyString_AsDecodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ --- 122,126 ---- object. */ ! PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ *************** *** 136,140 **** DEPRECATED - use PyString_AsDecodedObject() instead. */ ! extern DL_IMPORT(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ --- 136,140 ---- DEPRECATED - use PyString_AsDecodedObject() instead. */ ! PyAPI_FUNC(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ *************** *** 148,152 **** cause an exception). */ ! extern DL_IMPORT(int) PyString_AsStringAndSize( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ --- 148,152 ---- cause an exception). */ ! PyAPI_FUNC(int) PyString_AsStringAndSize( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ Index: structmember.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/structmember.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** structmember.h 4 Dec 2001 16:23:42 -0000 2.19 --- structmember.h 12 Aug 2002 07:21:57 -0000 2.20 *************** *** 82,91 **** /* Obsolete API, for binary backwards compatibility */ ! DL_IMPORT(PyObject *) PyMember_Get(char *, struct memberlist *, char *); ! DL_IMPORT(int) PyMember_Set(char *, struct memberlist *, char *, PyObject *); /* Current API, use this */ ! DL_IMPORT(PyObject *) PyMember_GetOne(char *, struct PyMemberDef *); ! DL_IMPORT(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); --- 82,91 ---- /* Obsolete API, for binary backwards compatibility */ ! PyAPI_FUNC(PyObject *) PyMember_Get(char *, struct memberlist *, char *); ! PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, char *, PyObject *); /* Current API, use this */ ! PyAPI_FUNC(PyObject *) PyMember_GetOne(char *, struct PyMemberDef *); ! PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); Index: structseq.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/structseq.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** structseq.h 18 Oct 2001 20:34:25 -0000 1.1 --- structseq.h 12 Aug 2002 07:21:57 -0000 1.2 *************** *** 20,27 **** } PyStructSequence_Desc; ! extern DL_IMPORT(void) PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc); ! extern DL_IMPORT(PyObject *) PyStructSequence_New(PyTypeObject* type); typedef struct { --- 20,27 ---- } PyStructSequence_Desc; ! PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc); ! PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); typedef struct { Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** symtable.h 11 Aug 2001 21:51:17 -0000 2.9 --- symtable.h 12 Aug 2002 07:21:57 -0000 2.10 *************** *** 51,63 **** } PySymtableEntryObject; ! extern DL_IMPORT(PyTypeObject) PySymtableEntry_Type; #define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type) ! extern DL_IMPORT(PyObject *) PySymtableEntry_New(struct symtable *, char *, int, int); ! DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); ! DL_IMPORT(void) PySymtable_Free(struct symtable *); --- 51,63 ---- } PySymtableEntryObject; ! PyAPI_DATA(PyTypeObject) PySymtableEntry_Type; #define PySymtableEntry_Check(op) ((op)->ob_type == &PySymtableEntry_Type) ! PyAPI_FUNC(PyObject *) PySymtableEntry_New(struct symtable *, char *, int, int); ! PyAPI_FUNC(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); ! PyAPI_FUNC(void) PySymtable_Free(struct symtable *); Index: sysmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/sysmodule.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** sysmodule.h 23 Oct 2001 02:21:22 -0000 2.24 --- sysmodule.h 12 Aug 2002 07:21:57 -0000 2.25 *************** *** 8,27 **** #endif ! DL_IMPORT(PyObject *) PySys_GetObject(char *); ! DL_IMPORT(int) PySys_SetObject(char *, PyObject *); ! DL_IMPORT(FILE *) PySys_GetFile(char *, FILE *); ! DL_IMPORT(void) PySys_SetArgv(int, char **); ! DL_IMPORT(void) PySys_SetPath(char *); ! DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) __attribute__((format(printf, 1, 2))); ! DL_IMPORT(void) PySys_WriteStderr(const char *format, ...) __attribute__((format(printf, 1, 2))); ! extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; ! extern DL_IMPORT(int) _PySys_CheckInterval; ! DL_IMPORT(void) PySys_ResetWarnOptions(void); ! DL_IMPORT(void) PySys_AddWarnOption(char *); #ifdef __cplusplus --- 8,27 ---- #endif ! PyAPI_FUNC(PyObject *) PySys_GetObject(char *); ! PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *); ! PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); ! PyAPI_FUNC(void) PySys_SetArgv(int, char **); ! PyAPI_FUNC(void) PySys_SetPath(char *); ! 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; ! PyAPI_DATA(int) _PySys_CheckInterval; ! PyAPI_FUNC(void) PySys_ResetWarnOptions(void); ! PyAPI_FUNC(void) PySys_AddWarnOption(char *); #ifdef __cplusplus Index: token.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/token.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** token.h 8 Aug 2001 05:00:17 -0000 2.19 --- token.h 12 Aug 2002 07:21:57 -0000 2.20 *************** *** 72,79 **** ! extern DL_IMPORT(char *) _PyParser_TokenNames[]; /* Token names */ ! extern DL_IMPORT(int) PyToken_OneChar(int); ! extern DL_IMPORT(int) PyToken_TwoChars(int, int); ! extern DL_IMPORT(int) PyToken_ThreeChars(int, int, int); #ifdef __cplusplus --- 72,79 ---- ! PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ ! PyAPI_FUNC(int) PyToken_OneChar(int); ! PyAPI_FUNC(int) PyToken_TwoChars(int, int); ! PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); #ifdef __cplusplus Index: traceback.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/traceback.h,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** traceback.h 19 Mar 2002 16:02:35 -0000 2.19 --- traceback.h 12 Aug 2002 07:21:57 -0000 2.20 *************** *** 10,18 **** struct _frame; ! DL_IMPORT(int) PyTraceBack_Here(struct _frame *); ! DL_IMPORT(int) PyTraceBack_Print(PyObject *, PyObject *); /* Reveal traceback type so we can typecheck traceback objects */ ! extern DL_IMPORT(PyTypeObject) PyTraceBack_Type; #define PyTraceBack_Check(v) ((v)->ob_type == &PyTraceBack_Type) --- 10,18 ---- struct _frame; ! PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); ! PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); /* Reveal traceback type so we can typecheck traceback objects */ ! PyAPI_DATA(PyTypeObject) PyTraceBack_Type; #define PyTraceBack_Check(v) ((v)->ob_type == &PyTraceBack_Type) Index: tupleobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/tupleobject.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** tupleobject.h 10 Sep 2001 23:37:46 -0000 2.27 --- tupleobject.h 12 Aug 2002 07:21:57 -0000 2.28 *************** *** 25,39 **** } PyTupleObject; ! extern DL_IMPORT(PyTypeObject) PyTuple_Type; #define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type) #define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type) ! extern DL_IMPORT(PyObject *) PyTuple_New(int size); ! extern DL_IMPORT(int) PyTuple_Size(PyObject *); ! extern DL_IMPORT(PyObject *) PyTuple_GetItem(PyObject *, int); ! extern DL_IMPORT(int) PyTuple_SetItem(PyObject *, int, PyObject *); ! extern DL_IMPORT(PyObject *) PyTuple_GetSlice(PyObject *, int, int); ! extern DL_IMPORT(int) _PyTuple_Resize(PyObject **, int); /* Macro, trading safety for speed */ --- 25,39 ---- } PyTupleObject; ! PyAPI_DATA(PyTypeObject) PyTuple_Type; #define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type) #define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type) ! PyAPI_FUNC(PyObject *) PyTuple_New(int size); ! PyAPI_FUNC(int) PyTuple_Size(PyObject *); ! PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, int); ! PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, int, PyObject *); ! PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, int, int); ! PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, int); /* Macro, trading safety for speed */ Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** unicodeobject.h 11 Aug 2002 12:23:03 -0000 2.39 --- unicodeobject.h 12 Aug 2002 07:21:58 -0000 2.40 *************** *** 372,376 **** } PyUnicodeObject; ! extern DL_IMPORT(PyTypeObject) PyUnicode_Type; #define PyUnicode_Check(op) PyObject_TypeCheck(op, &PyUnicode_Type) --- 372,376 ---- } PyUnicodeObject; ! PyAPI_DATA(PyTypeObject) PyUnicode_Type; #define PyUnicode_Check(op) PyObject_TypeCheck(op, &PyUnicode_Type) *************** *** 410,414 **** The buffer is copied into the new object. */ ! extern DL_IMPORT(PyObject*) PyUnicode_FromUnicode( const Py_UNICODE *u, /* Unicode buffer */ int size /* size of buffer */ --- 410,414 ---- The buffer is copied into the new object. */ ! PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( const Py_UNICODE *u, /* Unicode buffer */ int size /* size of buffer */ *************** *** 418,422 **** Py_UNICODE buffer. */ ! extern DL_IMPORT(Py_UNICODE *) PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); --- 418,422 ---- Py_UNICODE buffer. */ ! PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); *************** *** 424,433 **** /* Get the length of the Unicode object. */ ! extern DL_IMPORT(int) PyUnicode_GetSize( PyObject *unicode /* Unicode object */ ); /* Get the maximum ordinal for a Unicode character. */ ! extern DL_IMPORT(Py_UNICODE) PyUnicode_GetMax(void); /* Resize an already allocated Unicode object to the new size length. --- 424,433 ---- /* Get the length of the Unicode object. */ ! PyAPI_FUNC(int) PyUnicode_GetSize( PyObject *unicode /* Unicode object */ ); /* Get the maximum ordinal for a Unicode character. */ ! PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); /* Resize an already allocated Unicode object to the new size length. *************** *** 445,449 **** */ ! extern DL_IMPORT(int) PyUnicode_Resize( PyObject **unicode, /* Pointer to the Unicode object */ int length /* New length */ --- 445,449 ---- */ ! PyAPI_FUNC(int) PyUnicode_Resize( PyObject **unicode, /* Pointer to the Unicode object */ int length /* New length */ *************** *** 467,471 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_FromEncodedObject( register PyObject *obj, /* Object */ const char *encoding, /* encoding */ --- 467,471 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( register PyObject *obj, /* Object */ const char *encoding, /* encoding */ *************** *** 486,490 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_FromObject( register PyObject *obj /* Object */ ); --- 486,490 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_FromObject( register PyObject *obj /* Object */ ); *************** *** 499,503 **** The buffer is copied into the new object. */ ! extern DL_IMPORT(PyObject*) PyUnicode_FromWideChar( register const wchar_t *w, /* wchar_t buffer */ int size /* size of buffer */ --- 499,503 ---- The buffer is copied into the new object. */ ! PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( register const wchar_t *w, /* wchar_t buffer */ int size /* size of buffer */ *************** *** 510,514 **** error. */ ! extern DL_IMPORT(int) PyUnicode_AsWideChar( PyUnicodeObject *unicode, /* Unicode object */ register wchar_t *w, /* wchar_t buffer */ --- 510,514 ---- error. */ ! PyAPI_FUNC(int) PyUnicode_AsWideChar( PyUnicodeObject *unicode, /* Unicode object */ register wchar_t *w, /* wchar_t buffer */ *************** *** 564,568 **** */ ! extern DL_IMPORT(PyObject *) _PyUnicode_AsDefaultEncodedString( PyObject *, const char *); --- 564,568 ---- */ ! PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString( PyObject *, const char *); *************** *** 576,580 **** */ ! extern DL_IMPORT(const char*) PyUnicode_GetDefaultEncoding(void); /* Sets the currently active default encoding. --- 576,580 ---- */ ! PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); /* Sets the currently active default encoding. *************** *** 584,588 **** */ ! extern DL_IMPORT(int) PyUnicode_SetDefaultEncoding( const char *encoding /* Encoding name in standard form */ ); --- 584,588 ---- */ ! PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( const char *encoding /* Encoding name in standard form */ ); *************** *** 593,597 **** given size. */ ! extern DL_IMPORT(PyObject*) PyUnicode_Decode( const char *s, /* encoded string */ int size, /* size of buffer */ --- 593,597 ---- given size. */ ! PyAPI_FUNC(PyObject*) PyUnicode_Decode( const char *s, /* encoded string */ int size, /* size of buffer */ *************** *** 603,607 **** Python string object. */ ! extern DL_IMPORT(PyObject*) PyUnicode_Encode( const Py_UNICODE *s, /* Unicode char buffer */ int size, /* number of Py_UNICODE chars to encode */ --- 603,607 ---- Python string object. */ ! PyAPI_FUNC(PyObject*) PyUnicode_Encode( const Py_UNICODE *s, /* Unicode char buffer */ int size, /* number of Py_UNICODE chars to encode */ *************** *** 613,617 **** object. */ ! extern DL_IMPORT(PyObject*) PyUnicode_AsEncodedString( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ --- 613,617 ---- object. */ ! PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( PyObject *unicode, /* Unicode object */ const char *encoding, /* encoding */ *************** *** 621,625 **** /* --- UTF-7 Codecs ------------------------------------------------------- */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF7( const char *string, /* UTF-7 encoded string */ int length, /* size of string */ --- 621,625 ---- /* --- UTF-7 Codecs ------------------------------------------------------- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( const char *string, /* UTF-7 encoded string */ int length, /* size of string */ *************** *** 627,631 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF7( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ --- 627,631 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ *************** *** 639,643 **** /* --- UTF-8 Codecs ------------------------------------------------------- */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF8( const char *string, /* UTF-8 encoded string */ int length, /* size of string */ --- 639,643 ---- /* --- UTF-8 Codecs ------------------------------------------------------- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( const char *string, /* UTF-8 encoded string */ int length, /* size of string */ *************** *** 645,653 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsUTF8String( PyObject *unicode /* Unicode object */ ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF8( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ --- 645,653 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( PyObject *unicode /* Unicode object */ ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ *************** *** 680,684 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeUTF16( const char *string, /* UTF-16 encoded string */ int length, /* size of string */ --- 680,684 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( const char *string, /* UTF-16 encoded string */ int length, /* size of string */ *************** *** 692,696 **** order. The string always starts with a BOM mark. */ ! extern DL_IMPORT(PyObject*) PyUnicode_AsUTF16String( PyObject *unicode /* Unicode object */ ); --- 692,696 ---- order. The string always starts with a BOM mark. */ ! PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( PyObject *unicode /* Unicode object */ ); *************** *** 716,720 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeUTF16( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ --- 716,720 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* number of Py_UNICODE chars to encode */ *************** *** 725,729 **** /* --- Unicode-Escape Codecs ---------------------------------------------- */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeUnicodeEscape( const char *string, /* Unicode-Escape encoded string */ int length, /* size of string */ --- 725,729 ---- /* --- Unicode-Escape Codecs ---------------------------------------------- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( const char *string, /* Unicode-Escape encoded string */ int length, /* size of string */ *************** *** 731,739 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ int length /* Number of Py_UNICODE chars to encode */ --- 731,739 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ int length /* Number of Py_UNICODE chars to encode */ *************** *** 742,746 **** /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeRawUnicodeEscape( const char *string, /* Raw-Unicode-Escape encoded string */ int length, /* size of string */ --- 742,746 ---- /* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( const char *string, /* Raw-Unicode-Escape encoded string */ int length, /* size of string */ *************** *** 748,756 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsRawUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeRawUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ int length /* Number of Py_UNICODE chars to encode */ --- 748,756 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( PyObject *unicode /* Unicode object */ ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( const Py_UNICODE *data, /* Unicode char buffer */ int length /* Number of Py_UNICODE chars to encode */ *************** *** 763,767 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeLatin1( const char *string, /* Latin-1 encoded string */ int length, /* size of string */ --- 763,767 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( const char *string, /* Latin-1 encoded string */ int length, /* size of string */ *************** *** 769,777 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsLatin1String( PyObject *unicode /* Unicode object */ ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeLatin1( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ --- 769,777 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( PyObject *unicode /* Unicode object */ ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ *************** *** 785,789 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeASCII( const char *string, /* ASCII encoded string */ int length, /* size of string */ --- 785,789 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( const char *string, /* ASCII encoded string */ int length, /* size of string */ *************** *** 791,799 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsASCIIString( PyObject *unicode /* Unicode object */ ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeASCII( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ --- 791,799 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( PyObject *unicode /* Unicode object */ ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ *************** *** 823,827 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeCharmap( const char *string, /* Encoded string */ int length, /* size of string */ --- 823,827 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( const char *string, /* Encoded string */ int length, /* size of string */ *************** *** 831,835 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsCharmapString( PyObject *unicode, /* Unicode object */ PyObject *mapping /* character mapping --- 831,835 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( PyObject *unicode, /* Unicode object */ PyObject *mapping /* character mapping *************** *** 837,841 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ --- 837,841 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ *************** *** 858,862 **** */ ! extern DL_IMPORT(PyObject *) PyUnicode_TranslateCharmap( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ --- 858,862 ---- */ ! PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ *************** *** 869,873 **** /* --- MBCS codecs for Windows -------------------------------------------- */ ! extern DL_IMPORT(PyObject*) PyUnicode_DecodeMBCS( const char *string, /* MBCS encoded string */ int length, /* size of string */ --- 869,873 ---- /* --- MBCS codecs for Windows -------------------------------------------- */ ! PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( const char *string, /* MBCS encoded string */ int length, /* size of string */ *************** *** 875,883 **** ); ! extern DL_IMPORT(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ ); ! extern DL_IMPORT(PyObject*) PyUnicode_EncodeMBCS( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ --- 875,883 ---- ); ! PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ ); ! PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( const Py_UNICODE *data, /* Unicode char buffer */ int length, /* Number of Py_UNICODE chars to encode */ *************** *** 911,915 **** */ ! extern DL_IMPORT(int) PyUnicode_EncodeDecimal( Py_UNICODE *s, /* Unicode buffer */ int length, /* Number of Py_UNICODE chars to encode */ --- 911,915 ---- */ ! PyAPI_FUNC(int) PyUnicode_EncodeDecimal( Py_UNICODE *s, /* Unicode buffer */ int length, /* Number of Py_UNICODE chars to encode */ *************** *** 926,930 **** /* Concat two strings giving a new Unicode string. */ ! extern DL_IMPORT(PyObject*) PyUnicode_Concat( PyObject *left, /* Left string */ PyObject *right /* Right string */ --- 926,930 ---- /* Concat two strings giving a new Unicode string. */ ! PyAPI_FUNC(PyObject*) PyUnicode_Concat( PyObject *left, /* Left string */ PyObject *right /* Right string */ *************** *** 942,946 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_Split( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ --- 942,946 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_Split( PyObject *s, /* String to split */ PyObject *sep, /* String separator */ *************** *** 953,957 **** included in the resulting list. */ ! extern DL_IMPORT(PyObject*) PyUnicode_Splitlines( PyObject *s, /* String to split */ int keepends /* If true, line end markers are included */ --- 953,957 ---- included in the resulting list. */ ! PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( PyObject *s, /* String to split */ int keepends /* If true, line end markers are included */ *************** *** 970,974 **** */ ! extern DL_IMPORT(PyObject *) PyUnicode_Translate( PyObject *str, /* String */ PyObject *table, /* Translate table */ --- 970,974 ---- */ ! PyAPI_FUNC(PyObject *) PyUnicode_Translate( PyObject *str, /* String */ PyObject *table, /* Translate table */ *************** *** 979,983 **** the resulting Unicode string. */ ! extern DL_IMPORT(PyObject*) PyUnicode_Join( PyObject *separator, /* Separator string */ PyObject *seq /* Sequence object */ --- 979,983 ---- the resulting Unicode string. */ ! PyAPI_FUNC(PyObject*) PyUnicode_Join( PyObject *separator, /* Separator string */ PyObject *seq /* Sequence object */ *************** *** 987,991 **** otherwise. */ ! extern DL_IMPORT(int) PyUnicode_Tailmatch( PyObject *str, /* String */ PyObject *substr, /* Prefix or Suffix string */ --- 987,991 ---- otherwise. */ ! PyAPI_FUNC(int) PyUnicode_Tailmatch( PyObject *str, /* String */ PyObject *substr, /* Prefix or Suffix string */ *************** *** 999,1003 **** an error occurred and an exception is set. */ ! extern DL_IMPORT(int) PyUnicode_Find( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ --- 999,1003 ---- an error occurred and an exception is set. */ ! PyAPI_FUNC(int) PyUnicode_Find( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ *************** *** 1009,1013 **** /* Count the number of occurrences of substr in str[start:end]. */ ! extern DL_IMPORT(int) PyUnicode_Count( PyObject *str, /* String */ PyObject *substr, /* Substring to count */ --- 1009,1013 ---- /* Count the number of occurrences of substr in str[start:end]. */ ! PyAPI_FUNC(int) PyUnicode_Count( PyObject *str, /* String */ PyObject *substr, /* Substring to count */ *************** *** 1019,1023 **** and return the resulting Unicode object. */ ! extern DL_IMPORT(PyObject *) PyUnicode_Replace( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ --- 1019,1023 ---- and return the resulting Unicode object. */ ! PyAPI_FUNC(PyObject *) PyUnicode_Replace( PyObject *str, /* String */ PyObject *substr, /* Substring to find */ *************** *** 1030,1034 **** greater than resp. */ ! extern DL_IMPORT(int) PyUnicode_Compare( PyObject *left, /* Left string */ PyObject *right /* Right string */ --- 1030,1034 ---- greater than resp. */ ! PyAPI_FUNC(int) PyUnicode_Compare( PyObject *left, /* Left string */ PyObject *right /* Right string */ *************** *** 1038,1042 **** the resulting Unicode string. */ ! extern DL_IMPORT(PyObject *) PyUnicode_Format( PyObject *format, /* Format string */ PyObject *args /* Argument tuple or dictionary */ --- 1038,1042 ---- the resulting Unicode string. */ ! PyAPI_FUNC(PyObject *) PyUnicode_Format( PyObject *format, /* Format string */ PyObject *args /* Argument tuple or dictionary */ *************** *** 1049,1053 **** returned in case of an error. */ ! extern DL_IMPORT(int) PyUnicode_Contains( PyObject *container, /* Container string */ PyObject *element /* Element string */ --- 1049,1053 ---- returned in case of an error. */ ! PyAPI_FUNC(int) PyUnicode_Contains( PyObject *container, /* Container string */ PyObject *element /* Element string */ *************** *** 1055,1059 **** /* Externally visible for str.strip(unicode) */ ! extern DL_IMPORT(PyObject *) _PyUnicode_XStrip( PyUnicodeObject *self, int striptype, --- 1055,1059 ---- /* Externally visible for str.strip(unicode) */ ! PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( PyUnicodeObject *self, int striptype, *************** *** 1070,1130 **** */ ! extern DL_IMPORT(int) _PyUnicode_IsLowercase( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsUppercase( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsTitlecase( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsWhitespace( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsLinebreak( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToLowercase( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToUppercase( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(Py_UNICODE) _PyUnicode_ToTitlecase( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_ToDecimalDigit( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_ToDigit( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(double) _PyUnicode_ToNumeric( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsDecimalDigit( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsDigit( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsNumeric( Py_UNICODE ch /* Unicode character */ ); ! extern DL_IMPORT(int) _PyUnicode_IsAlpha( Py_UNICODE ch /* Unicode character */ ); --- 1070,1130 ---- */ ! PyAPI_FUNC(int) _PyUnicode_IsLowercase( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsUppercase( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsTitlecase( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsWhitespace( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsLinebreak( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_ToDigit( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(double) _PyUnicode_ToNumeric( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsDigit( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsNumeric( Py_UNICODE ch /* Unicode character */ ); ! PyAPI_FUNC(int) _PyUnicode_IsAlpha( Py_UNICODE ch /* Unicode character */ ); Index: weakrefobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/weakrefobject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** weakrefobject.h 5 Oct 2001 22:06:45 -0000 1.2 --- weakrefobject.h 12 Aug 2002 07:21:58 -0000 1.3 *************** *** 19,25 **** }; ! extern DL_IMPORT(PyTypeObject) _PyWeakref_RefType; ! extern DL_IMPORT(PyTypeObject) _PyWeakref_ProxyType; ! extern DL_IMPORT(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) \ --- 19,25 ---- }; ! PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; ! PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; ! PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; #define PyWeakref_CheckRef(op) \ *************** *** 32,42 **** ! extern DL_IMPORT(PyObject *) PyWeakref_NewRef(PyObject *ob, PyObject *callback); ! extern DL_IMPORT(PyObject *) PyWeakref_NewProxy(PyObject *ob, PyObject *callback); ! extern DL_IMPORT(PyObject *) PyWeakref_GetObject(PyObject *ref); ! extern DL_IMPORT(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head); #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) --- 32,42 ---- ! PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, PyObject *callback); ! PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, PyObject *callback); ! PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); ! PyAPI_FUNC(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head); #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) From lemburg@users.sourceforge.net Mon Aug 12 09:19:12 2002 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Mon, 12 Aug 2002 01:19:12 -0700 Subject: [Python-checkins] python/dist/src/Include unicodeobject.h,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv19880 Modified Files: unicodeobject.h Log Message: Add name mangling for new PyUnicode_FromOrdinal() and fix declaration to use new extern macro. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** unicodeobject.h 12 Aug 2002 07:21:58 -0000 2.40 --- unicodeobject.h 12 Aug 2002 08:19:10 -0000 2.41 *************** *** 175,178 **** --- 175,179 ---- # define PyUnicode_FromEncodedObject PyUnicodeUCS2_FromEncodedObject # define PyUnicode_FromObject PyUnicodeUCS2_FromObject + # define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal # define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode # define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar *************** *** 245,248 **** --- 246,250 ---- # define PyUnicode_FromEncodedObject PyUnicodeUCS4_FromEncodedObject # define PyUnicode_FromObject PyUnicodeUCS4_FromObject + # define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal # define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode # define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar *************** *** 528,532 **** */ ! extern DL_IMPORT(PyObject*) PyUnicode_FromOrdinal(int ordinal); /* === Builtin Codecs ===================================================== --- 530,534 ---- */ ! PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); /* === Builtin Codecs ===================================================== From mwh@users.sourceforge.net Mon Aug 12 12:42:46 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 12 Aug 2002 04:42:46 -0700 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19419/nondist/peps Modified Files: pep-0102.txt Log Message: Woo, these changes have been sitting around for a while. Just a couple of things learnt from 221. Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0102.txt 11 Apr 2002 14:30:15 -0000 1.6 --- pep-0102.txt 12 Aug 2002 11:42:43 -0000 1.7 *************** *** 109,113 **** news.txt file looking for interesting things to add to NEWS. ! ___ Check your NEWS changes into the maintenance branch. ___ Once the release is underway, Fred Drake needs to create the --- 109,114 ---- news.txt file looking for interesting things to add to NEWS. ! ___ Check your NEWS changes into the maintenance branch. It's easy ! to forget to update the release date in this file! ___ Once the release is underway, Fred Drake needs to create the *************** *** 167,171 **** as far as we know, and 2) we're going to max out the compression level, which isn't a supported option. ! % tar cf - Python-2.1.2 | gzip -9 > Python-2.1.2.tgz ___ Calculate the MD5 checksum of the tgz file you just created --- 168,172 ---- as far as we know, and 2) we're going to max out the compression level, which isn't a supported option. ! % tar -cf - Python-2.1.2 | gzip -9 > Python-2.1.2.tgz ___ Calculate the MD5 checksum of the tgz file you just created *************** *** 220,223 **** --- 221,235 ---- python.org; this contains the "full scoop" of changes to Python since the previous release for this version of Python. + + If this is the first release in a series (e.g. 2.2.1c1) then + you'll need to create a new directory (e.g. 2.2.1). It's + probably best to copy the last directory across: + + % cp -r 2.2 2.2.1 + % rm -rf 2.2.1/CVS + % cvs add 2.2.1 + + and then make changes as needed. Verbiage from prereleases of + previous versions can be found in CVS if you're feeling uninspired. ___ Also, update the MD5 checksums. From loewis@users.sourceforge.net Mon Aug 12 12:43:58 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 12 Aug 2002 04:43:58 -0700 Subject: [Python-checkins] python/nondist/peps pep-0277.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19738 Modified Files: pep-0277.txt Log Message: Add reference to SF patch. Index: pep-0277.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0277.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0277.txt 25 Jan 2002 13:09:34 -0000 1.2 --- pep-0277.txt 12 Aug 2002 11:43:56 -0000 1.3 *************** *** 84,88 **** accept 4 byte characters, the features described in this proposal will not work in this mode so the implementation falls back to the ! current 'mbcs' encoding technique. This retriction could be lifted in the future by performing extra conversions using PyUnicode_AsWideChar but for now that would add too much --- 84,88 ---- accept 4 byte characters, the features described in this proposal will not work in this mode so the implementation falls back to the ! current 'mbcs' encoding technique. This restriction could be lifted in the future by performing extra conversions using PyUnicode_AsWideChar but for now that would add too much *************** *** 93,97 **** An experimental implementation is available from ! http://scintilla.sourceforge.net/winunichanges.zip --- 93,100 ---- An experimental implementation is available from ! [2] http://scintilla.sourceforge.net/winunichanges.zip ! ! [3] An updated version is available at ! http://python.org/sf/594001 From Jack.Jansen@cwi.nl Mon Aug 12 13:28:08 2002 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 12 Aug 2002 14:28:08 +0200 Subject: [Python-checkins] python/dist/src/Include Python.h,2.56,2.57 abstract.h,2.44,2.45 boolobject.h,1.3,1.4 bufferobject.h,2.6,2.7 cellobject.h,2.2,2.3 ceval.h,2.44,2.45 classobject.h,2.40,2.41 cobject.h,2.10,2.11 codecs.h,2.3,2.4 compile.h,2.37,2.38 complexobject.h,2.9,2.10 descrobject.h,2.9,2.10 dictobject.h,2.24,2.25 enumobject.h,2.1,2.2 eval.h,2.15,2.16 fileobject.h,2.30,2.31 floatobject.h,2.20,2.21 frameobject.h,2.35,2.36 funcobject.h,2.24,2.25 intobject.h,2.25,2.26 intrcheck.h,2.9,2.10 iterobject.h,1.4,1.5 listobject.h,2.23,2.24 longintrepr.h,2.13,2.14 longobject.h,2.25,2.26 marshal.h,2.11,2.12 methodobject.h,2.24,2.25 modsupport.h,2.38,2.39 moduleobject.h,2.19,2.20 node.h,2.19,2.20 objimpl.h,2.56,2.57 parsetok.h,2.18,2.19 pgenheaders.h,2.28,2.29 pyerrors.h,2.55,2.56 pygetopt.h,2.1,2.2 pymem.h,2.15,2.16 pystate.h,2.18,2.19 pythonrun.h,2.52,2.53 pythread.h,2.19,2.20 rangeobject.h,2.18,2.19 sliceobject.h,2.6,2.7 stringobject.h,2.34,2.35 structmember.h,2.19,2.20 structseq.h,1.1,1.2 symtable.h,2.9,2.10 sysmodule.h,2.24,2.25 token.h,2.19,2.20 traceback.h,2.19,2.20 tupleobject.h,2.27,2.28 unicodeobject.h,2.39,2.40 weakrefobject.h,1.2,1.3 In-Reply-To: Message-ID: Mark, since this checkin my builds fail on MacOSX. pgen doesn't build, with oodles of errors of the following form: /usr/bin/ld: multiple definitions of symbol _PyOS_InputHook Parser/acceler.o definition of _PyOS_InputHook in section (__DATA,__common) Parser/grammar1.o definition of _PyOS_InputHook in section (__DATA,__common) /usr/bin/ld: multiple definitions of symbol _PyOS_ReadlineFunctionPointer Parser/acceler.o definition of _PyOS_ReadlineFunctionPointer in section (__DATA,__common) Parser/grammar1.o definition of _PyOS_ReadlineFunctionPointer in section (__DATA,__common) If I look at the definitions of PyOS_InputHook and PyOS_ReadlineFunctionPointer you're declaring them as PyAPI_FUNC, but they're really data items, no? Otherwise it could be that when building pgen it doesn't have the right set of defines to trigger the correct definition of that macro... On Monday, August 12, 2002, at 09:22 , mhammond@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Include > In directory usw-pr-cvs1:/tmp/cvs-serv3457 > > Modified Files: > Python.h abstract.h boolobject.h bufferobject.h cellobject.h > ceval.h classobject.h cobject.h codecs.h compile.h > complexobject.h descrobject.h dictobject.h enumobject.h eval.h > fileobject.h floatobject.h frameobject.h funcobject.h > intobject.h intrcheck.h iterobject.h listobject.h > longintrepr.h longobject.h marshal.h methodobject.h > modsupport.h moduleobject.h node.h objimpl.h parsetok.h > pgenheaders.h pyerrors.h pygetopt.h pymem.h pystate.h > pythonrun.h pythread.h rangeobject.h sliceobject.h > stringobject.h structmember.h structseq.h symtable.h > sysmodule.h token.h traceback.h tupleobject.h unicodeobject.h > weakrefobject.h > Log Message: > Excise DL_EXPORT from Include. > > Thanks to Skip Montanaro and Kalle Svensson for the patches. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From mhammond@users.sourceforge.net Mon Aug 12 14:06:38 2002 From: mhammond@users.sourceforge.net (mhammond@users.sourceforge.net) Date: Mon, 12 Aug 2002 06:06:38 -0700 Subject: [Python-checkins] python/dist/src/Include pythonrun.h,2.53,2.54 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17449 Modified Files: pythonrun.h Log Message: Correct PyAPI_FUNC to PyAPI_DATA - sorry Jack. Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -d -r2.53 -r2.54 *** pythonrun.h 12 Aug 2002 07:21:57 -0000 2.53 --- pythonrun.h 12 Aug 2002 13:06:35 -0000 2.54 *************** *** 115,120 **** /* Stuff with no proper home (yet) */ PyAPI_FUNC(char *) PyOS_Readline(char *); ! PyAPI_FUNC(int) (*PyOS_InputHook)(void); ! PyAPI_FUNC(char) *(*PyOS_ReadlineFunctionPointer)(char *); /* Stack size, in "pointers" (so we get extra safety margins --- 115,120 ---- /* Stuff with no proper home (yet) */ PyAPI_FUNC(char *) PyOS_Readline(char *); ! PyAPI_DATA(int) (*PyOS_InputHook)(void); ! PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(char *); /* Stack size, in "pointers" (so we get extra safety margins From mhammond@skippinet.com.au Mon Aug 12 14:09:57 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Mon, 12 Aug 2002 23:09:57 +1000 Subject: [Python-checkins] python/dist/src/Include Python.h,2.56,2.57 abstract.h,2.44,2.45 boolobject.h,1.3,1.4 bufferobject.h,2.6,2.7 cellobject.h,2.2,2.3 ceval.h,2.44,2.45 classobject.h,2.40,2.41 cobject.h,2.10,2.11 codecs.h,2.3,2.4 compile.h,2.37,2.38 compl In-Reply-To: Message-ID: > Mark, > since this checkin my builds fail on MacOSX. pgen doesn't build, with > oodles of errors of the following form: Sorry Jack - I have checked in the fix. Mark. From bwarsaw@users.sourceforge.net Mon Aug 12 15:22:35 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 12 Aug 2002 07:22:35 -0700 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13119 Modified Files: pep-0290.txt Log Message: Added a recommendation to use s2 in s1 for Python 2.3 and later. Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0290.txt 30 Jun 2002 23:02:23 -0000 1.2 --- pep-0290.txt 12 Aug 2002 14:22:33 -0000 1.3 *************** *** 154,157 **** --- 154,168 ---- + Pattern: "s1".find("s2") >= 0 or "s1".find("s2") != -1 -> "s2" in "s1" + Idea: In Python 2.3, for "s2" in "s1", the length + restriction on s2 are lifted; they can now be strings + of any length. + Version: 2.3 or later + Benefits: When searching for a substring, where you don't care + about the position of the substring in the original + string, using the `in' operator makes things more + clear. + + References From tim_one@users.sourceforge.net Mon Aug 12 16:08:23 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 08:08:23 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12383/python/Objects Modified Files: longobject.c Log Message: k_mul: Rearranged computation for better cache use. Ignored overflow (it's possible, but should be harmless -- this requires more thought, and allocating enough space in advance to prevent it requires exactly as much thought, to know exactly how much that is -- the end result certainly fits in the allocated space -- hmm, but that's really all the thought it needs! borrows/carries out of the high digits really are harmless). Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** longobject.c 12 Aug 2002 06:17:58 -0000 1.125 --- longobject.c 12 Aug 2002 15:08:20 -0000 1.126 *************** *** 1599,1616 **** k_mul(PyLongObject *a, PyLongObject *b) { PyLongObject *ah = NULL; PyLongObject *al = NULL; PyLongObject *bh = NULL; PyLongObject *bl = NULL; - PyLongObject *albl = NULL; - PyLongObject *ahbh = NULL; - PyLongObject *k = NULL; PyLongObject *ret = NULL; ! PyLongObject *t1, *t2; int shift; /* the number of digits we split off */ int i; ! #ifdef Py_DEBUG ! digit d; ! #endif /* (ah*X+al)(bh*X+bl) = ah*bh*X*X + (ah*bl + al*bh)*X + al*bl * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl --- 1599,1613 ---- k_mul(PyLongObject *a, PyLongObject *b) { + int asize = ABS(a->ob_size); + int bsize = ABS(b->ob_size); PyLongObject *ah = NULL; PyLongObject *al = NULL; PyLongObject *bh = NULL; PyLongObject *bl = NULL; PyLongObject *ret = NULL; ! PyLongObject *t1, *t2, *t3; int shift; /* the number of digits we split off */ int i; ! /* (ah*X+al)(bh*X+bl) = ah*bh*X*X + (ah*bl + al*bh)*X + al*bl * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl *************** *** 1624,1639 **** * is largest. */ ! if (ABS(a->ob_size) > ABS(b->ob_size)) { t1 = a; a = b; b = t1; } /* Use gradeschool math when either number is too small. */ ! if (ABS(a->ob_size) <= KARATSUBA_CUTOFF) { /* 0 is inevitable if one kmul arg has more than twice * the digits of another, so it's worth special-casing. */ ! if (a->ob_size == 0) return _PyLong_New(0); else --- 1621,1640 ---- * is largest. */ ! if (asize > bsize) { t1 = a; a = b; b = t1; + + i = asize; + asize = bsize; + bsize = i; } /* Use gradeschool math when either number is too small. */ ! if (asize <= KARATSUBA_CUTOFF) { /* 0 is inevitable if one kmul arg has more than twice * the digits of another, so it's worth special-casing. */ ! if (asize == 0) return _PyLong_New(0); else *************** *** 1641,1653 **** } ! shift = ABS(b->ob_size) >> 1; if (kmul_split(a, shift, &ah, &al) < 0) goto fail; if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; ! if ((ahbh = k_mul(ah, bh)) == NULL) goto fail; ! assert(ahbh->ob_size >= 0); ! ! /* Allocate result space, and copy ahbh into the high digits. */ ! ret = _PyLong_New(ABS(a->ob_size) + ABS(b->ob_size)); if (ret == NULL) goto fail; #ifdef Py_DEBUG --- 1642,1651 ---- } ! shift = bsize >> 1; if (kmul_split(a, shift, &ah, &al) < 0) goto fail; if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; ! /* Allocate result space. */ ! ret = _PyLong_New(asize + bsize); if (ret == NULL) goto fail; #ifdef Py_DEBUG *************** *** 1655,1680 **** memset(ret->ob_digit, 0xDF, ret->ob_size * sizeof(digit)); #endif - assert(2*shift + ahbh->ob_size <= ret->ob_size); - memcpy(ret->ob_digit + 2*shift, ahbh->ob_digit, - ahbh->ob_size * sizeof(digit)); ! /* Zero-out the digits higher than the ahbh copy. */ ! i = ret->ob_size - 2*shift - ahbh->ob_size; if (i) ! memset(ret->ob_digit + 2*shift + ahbh->ob_size, 0, i * sizeof(digit)); ! /* Compute al*bl, and copy into the low digits. */ ! if ((albl = k_mul(al, bl)) == NULL) goto fail; ! assert(albl->ob_size >= 0); ! assert(albl->ob_size <= 2*shift); /* no overlap with high digits */ ! memcpy(ret->ob_digit, albl->ob_digit, albl->ob_size * sizeof(digit)); /* Zero out remaining digits. */ ! i = 2*shift - albl->ob_size; /* number of uninitialized digits */ if (i) ! memset(ret->ob_digit + albl->ob_size, 0, i * sizeof(digit)); ! /* k = (ah+al)(bh+bl) */ if ((t1 = x_add(ah, al)) == NULL) goto fail; Py_DECREF(ah); --- 1653,1693 ---- memset(ret->ob_digit, 0xDF, ret->ob_size * sizeof(digit)); #endif ! /* t1 <- ah*bh, and copy into high digits of result. */ ! if ((t1 = k_mul(ah, bh)) == NULL) goto fail; ! assert(t1->ob_size >= 0); ! assert(2*shift + t1->ob_size <= ret->ob_size); ! memcpy(ret->ob_digit + 2*shift, t1->ob_digit, ! t1->ob_size * sizeof(digit)); ! ! /* Zero-out the digits higher than the ah*bh copy. */ ! i = ret->ob_size - 2*shift - t1->ob_size; if (i) ! memset(ret->ob_digit + 2*shift + t1->ob_size, 0, i * sizeof(digit)); ! /* t2 <- al*bl, and copy into the low digits. */ ! if ((t2 = k_mul(al, bl)) == NULL) { ! Py_DECREF(t1); ! goto fail; ! } ! assert(t2->ob_size >= 0); ! assert(t2->ob_size <= 2*shift); /* no overlap with high digits */ ! memcpy(ret->ob_digit, t2->ob_digit, t2->ob_size * sizeof(digit)); /* Zero out remaining digits. */ ! i = 2*shift - t2->ob_size; /* number of uninitialized digits */ if (i) ! memset(ret->ob_digit + t2->ob_size, 0, i * sizeof(digit)); ! /* Subtract ah*bh (t1) and al*bl (t2) from "the middle" digits. */ ! i = ret->ob_size - shift; /* # digits after shift */ ! v_isub(ret->ob_digit + shift, i, t2->ob_digit, t2->ob_size); ! Py_DECREF(t2); ! ! v_isub(ret->ob_digit + shift, i, t1->ob_digit, t1->ob_size); ! Py_DECREF(t1); ! ! /* t3 <- (ah+al)(bh+bl) */ if ((t1 = x_add(ah, al)) == NULL) goto fail; Py_DECREF(ah); *************** *** 1690,1723 **** bh = bl = NULL; ! k = k_mul(t1, t2); Py_DECREF(t1); Py_DECREF(t2); ! if (k == NULL) goto fail; ! ! /* Add k into the result, starting at the shift'th LSD. */ ! i = ret->ob_size - shift; /* # digits after shift */ ! #ifdef Py_DEBUG ! d = ! #endif ! v_iadd(ret->ob_digit + shift, i, k->ob_digit, k->ob_size); ! assert(d == 0); ! Py_DECREF(k); ! ! /* Subtract ahbh and albl from the result. Note that this can't ! * become negative, since k = ahbh + albl + other stuff. ! */ ! #ifdef Py_DEBUG ! d = ! #endif ! v_isub(ret->ob_digit + shift, i, ahbh->ob_digit, ahbh->ob_size); ! assert(d == 0); ! Py_DECREF(ahbh); ! #ifdef Py_DEBUG ! d = ! #endif ! v_isub(ret->ob_digit + shift, i, albl->ob_digit, albl->ob_size); ! assert(d == 0); ! Py_DECREF(albl); return long_normalize(ret); --- 1703,1716 ---- bh = bl = NULL; ! t3 = k_mul(t1, t2); ! assert(t3->ob_size >= 0); Py_DECREF(t1); Py_DECREF(t2); ! if (t3 == NULL) goto fail; ! /* Add t3. */ ! v_iadd(ret->ob_digit + shift, ret->ob_size - shift, ! t3->ob_digit, t3->ob_size); ! Py_DECREF(t3); return long_normalize(ret); *************** *** 1729,1735 **** Py_XDECREF(bh); Py_XDECREF(bl); - Py_XDECREF(ahbh); - Py_XDECREF(albl); - Py_XDECREF(k); return NULL; } --- 1722,1725 ---- From gvanrossum@users.sourceforge.net Mon Aug 12 16:15:55 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 08:15:55 -0700 Subject: [Python-checkins] python/dist/src/Lib zipfile.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17035 Modified Files: zipfile.py Log Message: Avoid warnings about <<. external_attr is now an unsigned long. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** zipfile.py 3 Jun 2002 15:58:32 -0000 1.24 --- zipfile.py 12 Aug 2002 15:15:51 -0000 1.25 *************** *** 26,30 **** structEndArchive = "<4s4H2lH" # 9 items, end of archive, 22 bytes stringEndArchive = "PK\005\006" # magic number for end of archive record ! structCentralDir = "<4s4B4H3l5H2l"# 19 items, central directory, 46 bytes stringCentralDir = "PK\001\002" # magic number for central directory structFileHeader = "<4s2B4H3l2H" # 12 items, file header record, 30 bytes --- 26,30 ---- structEndArchive = "<4s4H2lH" # 9 items, end of archive, 22 bytes stringEndArchive = "PK\005\006" # magic number for end of archive record ! structCentralDir = "<4s4B4H3l5HLl"# 19 items, central directory, 46 bytes stringCentralDir = "PK\001\002" # magic number for central directory structFileHeader = "<4s2B4H3l2H" # 12 items, file header record, 30 bytes *************** *** 374,378 **** else: zinfo = ZipInfo(arcname, date_time) ! zinfo.external_attr = st[0] << 16 # Unix attributes if compress_type is None: zinfo.compress_type = self.compression --- 374,378 ---- else: zinfo = ZipInfo(arcname, date_time) ! zinfo.external_attr = st[0] << 16L # Unix attributes if compress_type is None: zinfo.compress_type = self.compression From gvanrossum@users.sourceforge.net Mon Aug 12 16:16:22 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 08:16:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.49,1.50 test_b2.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17178 Modified Files: test_b1.py test_b2.py Log Message: Shut up warnings about hex()/oct() that can't be avoided. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** test_b1.py 30 Jul 2002 23:26:01 -0000 1.49 --- test_b1.py 12 Aug 2002 15:16:20 -0000 1.50 *************** *** 1,4 **** --- 1,8 ---- # Python test set -- part 4a, built-in functions a-m + import warnings + warnings.filterwarnings("ignore", "hex../oct.. of negative int", + DeprecationWarning, __name__) + from test.test_support import TestFailed, fcmp, have_unicode, TESTFN, unlink Index: test_b2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** test_b2.py 30 Jul 2002 23:26:01 -0000 1.36 --- test_b2.py 12 Aug 2002 15:16:20 -0000 1.37 *************** *** 1,4 **** --- 1,8 ---- # Python test set -- part 4b, built-in functions n-z + import warnings + warnings.filterwarnings("ignore", "hex../oct.. of negative int", + DeprecationWarning, __name__) + from test.test_support import TestFailed, fcmp, TESTFN, unlink, vereq From gvanrossum@users.sourceforge.net Mon Aug 12 16:26:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 08:26:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_zlib.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22254 Modified Files: test_zlib.py Log Message: Portable way of producing unsigned 32-bit hex output to print the CRCs. Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_zlib.py 23 Jul 2002 19:04:09 -0000 1.18 --- test_zlib.py 12 Aug 2002 15:26:05 -0000 1.19 *************** *** 13,18 **** # test the checksums (hex so the test doesn't break on 64-bit machines) ! print hex(zlib.crc32('penguin')), hex(zlib.crc32('penguin', 1)) ! print hex(zlib.adler32('penguin')), hex(zlib.adler32('penguin', 1)) # make sure we generate some expected errors --- 13,20 ---- # test the checksums (hex so the test doesn't break on 64-bit machines) ! def fix(x): ! return "0x%x" % (x & 0xffffffffL) ! print fix(zlib.crc32('penguin')), fix(zlib.crc32('penguin', 1)) ! print fix(zlib.adler32('penguin')), fix(zlib.adler32('penguin', 1)) # make sure we generate some expected errors From tim_one@users.sourceforge.net Mon Aug 12 18:36:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 10:36:05 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.464,1.465 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv4820/python/Misc Modified Files: NEWS Log Message: k_mul() and long_mul(): I'm confident that the Karatsuba algorithm is correct now, so added some final comments, did some cleanup, and enabled it for all long-int multiplies. The KARAT envar no longer matters, although I left some #if 0'ed code in there for my own use (temporary). k_mul() is still much slower than x_mul() if the inputs have very differenent sizes, and that still needs to be addressed. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.464 retrieving revision 1.465 diff -C2 -d -r1.464 -r1.465 *** NEWS 12 Aug 2002 03:42:03 -0000 1.464 --- NEWS 12 Aug 2002 17:36:02 -0000 1.465 *************** *** 58,64 **** Core and builtins ! - XXX Karatsuba multiplication. This is currently used if and only ! if envar KARAT exists. It needs more correctness and speed testing, ! the latter especially with unbalanced bit lengths. - u'%c' will now raise a ValueError in case the argument is an --- 58,71 ---- Core and builtins ! - When multiplying very large integers, a version of the so-called ! Karatsuba algorithm is now used. This is most effective if the ! inputs have roughly the same size. If they both have about N digits, ! Karatsuba multiplication has O(N**1.58) runtime (the exponent is ! log_base_2(3)) instead of the previous O(N**2). Measured results may ! be better or worse than that, depending on platform quirks. Note that ! this is a simple implementation, and there's no intent here to compete ! with, e.g., gmp. It simply gives a very nice speedup when it applies. ! XXX Karatsuba multiplication can be slower when the inputs have very ! XXX different sizes. - u'%c' will now raise a ValueError in case the argument is an From tim_one@users.sourceforge.net Mon Aug 12 18:36:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 10:36:05 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.126,1.127 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4820/python/Objects Modified Files: longobject.c Log Message: k_mul() and long_mul(): I'm confident that the Karatsuba algorithm is correct now, so added some final comments, did some cleanup, and enabled it for all long-int multiplies. The KARAT envar no longer matters, although I left some #if 0'ed code in there for my own use (temporary). k_mul() is still much slower than x_mul() if the inputs have very differenent sizes, and that still needs to be addressed. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** longobject.c 12 Aug 2002 15:08:20 -0000 1.126 --- longobject.c 12 Aug 2002 17:36:03 -0000 1.127 *************** *** 1646,1650 **** if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; ! /* Allocate result space. */ ret = _PyLong_New(asize + bsize); if (ret == NULL) goto fail; --- 1646,1666 ---- if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; ! /* The plan: ! * 1. Allocate result space (asize + bsize digits: that's always ! * enough). ! * 2. Compute ah*bh, and copy into result at 2*shift. ! * 3. Compute al*bl, and copy into result at 0. Note that this ! * can't overlap with #2. ! * 4. Subtract al*bl from the result, starting at shift. This may ! * underflow (borrow out of the high digit), but we don't care: ! * we're effectively doing unsigned arithmetic mod ! * BASE**(sizea + sizeb), and so long as the *final* result fits, ! * borrows and carries out of the high digit can be ignored. ! * 5. Subtract ah*bh from the result, starting at shift. ! * 6. Compute (ah+al)*(bh+bl), and add it into the result starting ! * at shift. ! */ ! ! /* 1. Allocate result space. */ ret = _PyLong_New(asize + bsize); if (ret == NULL) goto fail; *************** *** 1654,1658 **** #endif ! /* t1 <- ah*bh, and copy into high digits of result. */ if ((t1 = k_mul(ah, bh)) == NULL) goto fail; assert(t1->ob_size >= 0); --- 1670,1674 ---- #endif ! /* 2. t1 <- ah*bh, and copy into high digits of result. */ if ((t1 = k_mul(ah, bh)) == NULL) goto fail; assert(t1->ob_size >= 0); *************** *** 1667,1671 **** i * sizeof(digit)); ! /* t2 <- al*bl, and copy into the low digits. */ if ((t2 = k_mul(al, bl)) == NULL) { Py_DECREF(t1); --- 1683,1687 ---- i * sizeof(digit)); ! /* 3. t2 <- al*bl, and copy into the low digits. */ if ((t2 = k_mul(al, bl)) == NULL) { Py_DECREF(t1); *************** *** 1681,1693 **** memset(ret->ob_digit + t2->ob_size, 0, i * sizeof(digit)); ! /* Subtract ah*bh (t1) and al*bl (t2) from "the middle" digits. */ i = ret->ob_size - shift; /* # digits after shift */ ! v_isub(ret->ob_digit + shift, i, t2->ob_digit, t2->ob_size); Py_DECREF(t2); ! v_isub(ret->ob_digit + shift, i, t1->ob_digit, t1->ob_size); Py_DECREF(t1); ! /* t3 <- (ah+al)(bh+bl) */ if ((t1 = x_add(ah, al)) == NULL) goto fail; Py_DECREF(ah); --- 1697,1711 ---- memset(ret->ob_digit + t2->ob_size, 0, i * sizeof(digit)); ! /* 4 & 5. Subtract ah*bh (t1) and al*bl (t2). We do al*bl first ! * because it's fresher in cache. ! */ i = ret->ob_size - shift; /* # digits after shift */ ! (void)v_isub(ret->ob_digit + shift, i, t2->ob_digit, t2->ob_size); Py_DECREF(t2); ! (void)v_isub(ret->ob_digit + shift, i, t1->ob_digit, t1->ob_size); Py_DECREF(t1); ! /* 6. t3 <- (ah+al)(bh+bl), and add into result. */ if ((t1 = x_add(ah, al)) == NULL) goto fail; Py_DECREF(ah); *************** *** 1710,1715 **** /* Add t3. */ ! v_iadd(ret->ob_digit + shift, ret->ob_size - shift, ! t3->ob_digit, t3->ob_size); Py_DECREF(t3); --- 1728,1732 ---- /* Add t3. */ ! (void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, t3->ob_size); Py_DECREF(t3); *************** *** 1744,1751 **** --- 1761,1772 ---- } + #if 0 if (Py_GETENV("KARAT") != NULL) z = k_mul(a, b); else z = x_mul(a, b); + #else + z = k_mul(a, b); + #endif if(z == NULL) { Py_DECREF(a); From tim_one@users.sourceforge.net Mon Aug 12 19:25:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 11:25:45 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.127,1.128 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21116/python/Objects Modified Files: longobject.c Log Message: x_mul(): Made life easier for C optimizers in the "grade school" algorithm. MSVC 6 wasn't impressed . Something odd: the x_mul algorithm appears to get substantially worse than quadratic time as the inputs grow larger: bits in each input x_mul time k_mul time ------------------ ---------- ---------- 15360 0.01 0.00 30720 0.04 0.01 61440 0.16 0.04 122880 0.64 0.14 245760 2.56 0.40 491520 10.76 1.23 983040 71.28 3.69 1966080 459.31 11.07 That is, x_mul is perfectly quadratic-time until a little burp at 2.56->10.76, and after that goes to hell in a hurry. Under Karatsuba, doubling the input size "should take" 3 times longer instead of 4, and that remains the case throughout this range. I conclude that my "be nice to the cache" reworkings of k_mul() are paying. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** longobject.c 12 Aug 2002 17:36:03 -0000 1.127 --- longobject.c 12 Aug 2002 18:25:43 -0000 1.128 *************** *** 1540,1543 **** --- 1540,1544 ---- twodigits f = a->ob_digit[i]; int j; + digit *pz = z->ob_digit + i; SIGCHECK({ *************** *** 1546,1557 **** }) for (j = 0; j < size_b; ++j) { ! carry += z->ob_digit[i+j] + b->ob_digit[j] * f; ! z->ob_digit[i+j] = (digit) (carry & MASK); carry >>= SHIFT; } for (; carry != 0; ++j) { assert(i+j < z->ob_size); ! carry += z->ob_digit[i+j]; ! z->ob_digit[i+j] = (digit) (carry & MASK); carry >>= SHIFT; } --- 1547,1558 ---- }) for (j = 0; j < size_b; ++j) { ! carry += *pz + b->ob_digit[j] * f; ! *pz++ = (digit) (carry & MASK); carry >>= SHIFT; } for (; carry != 0; ++j) { assert(i+j < z->ob_size); ! carry += *pz; ! *pz++ = (digit) (carry & MASK); carry >>= SHIFT; } From gvanrossum@users.sourceforge.net Mon Aug 12 20:05:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 12:05:48 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.171,2.172 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11963 Modified Files: typeobject.c Log Message: Refactor how __dict__ and __weakref__ interact with __slots__. 1. You can now have __dict__ and/or __weakref__ in your __slots__ (before only __weakref__ was supported). This is treated differently than before: it merely sets a flag that the object should support the corresponding magic. 2. Dynamic types now always have descriptors __dict__ and __weakref__ thrust upon them. If the type in fact does not support one or the other, that descriptor's __get__ method will raise AttributeError. 3. (This is the reason for all this; it fixes SF bug 575229, reported by Cesar Douady.) Given this code: class A(object): __slots__ = [] class B(object): pass class C(A, B): __slots__ = [] the class object for C was broken; its size was less than that of B, and some descriptors on B could cause a segfault. C now correctly inherits __weakrefs__ and __dict__ from B, even though A is the "primary" base (C.__base__ is A). 4. Some code cleanup, and a few comments added. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.171 retrieving revision 2.172 diff -C2 -d -r2.171 -r2.172 *** typeobject.c 10 Aug 2002 05:41:29 -0000 2.171 --- typeobject.c 12 Aug 2002 19:05:44 -0000 2.172 *************** *** 928,934 **** } static PyGetSetDef subtype_getsets[] = { ! {"__dict__", subtype_dict, subtype_setdict, NULL}, ! {0}, }; --- 928,963 ---- } + static PyObject * + subtype_getweakref(PyObject *obj, void *context) + { + PyObject **weaklistptr; + PyObject *result; + + if (obj->ob_type->tp_weaklistoffset == 0) { + PyErr_SetString(PyExc_AttributeError, + "This object has no __weaklist__"); + return NULL; + } + assert(obj->ob_type->tp_weaklistoffset > 0); + assert(obj->ob_type->tp_weaklistoffset + sizeof(PyObject *) <= + obj->ob_type->tp_basicsize); + weaklistptr = (PyObject **) + ((void *)obj + obj->ob_type->tp_weaklistoffset); + if (*weaklistptr == NULL) + result = Py_None; + else + result = *weaklistptr; + Py_INCREF(result); + return result; + } + static PyGetSetDef subtype_getsets[] = { ! /* Not all objects have these attributes! ! The descriptor's __get__ method may raise AttributeError. */ ! {"__dict__", subtype_dict, subtype_setdict, ! "dictionary for instance variables (if defined)"}, ! {"__weakref__", subtype_getweakref, NULL, ! "list of weak references to the object (if defined)"}, ! {0} }; *************** *** 986,989 **** --- 1015,1019 ---- PyMemberDef *mp; int i, nbases, nslots, slotoffset, add_dict, add_weak; + int j, may_add_dict, may_add_weak; assert(args != NULL && PyTuple_Check(args)); *************** *** 1073,1077 **** add_dict = 0; add_weak = 0; ! if (slots != NULL) { /* Make it into a tuple */ if (PyString_Check(slots)) --- 1103,1119 ---- add_dict = 0; add_weak = 0; ! may_add_dict = base->tp_dictoffset == 0; ! may_add_weak = base->tp_weaklistoffset == 0 && base->tp_itemsize == 0; ! if (slots == NULL) { ! if (may_add_dict) { ! add_dict++; ! } ! if (may_add_weak) { ! add_weak++; ! } ! } ! else { ! /* Have slots */ ! /* Make it into a tuple */ if (PyString_Check(slots)) *************** *** 1081,1084 **** --- 1123,1129 ---- if (slots == NULL) return NULL; + assert(PyTuple_Check(slots)); + + /* Are slots allowed? */ nslots = PyTuple_GET_SIZE(slots); if (nslots > 0 && base->tp_itemsize != 0) { *************** *** 1087,1107 **** "not supported for subtype of '%s'", base->tp_name); return NULL; } for (i = 0; i < nslots; i++) { ! if (!valid_identifier(PyTuple_GET_ITEM(slots, i))) { ! Py_DECREF(slots); ! return NULL; } } ! newslots = PyTuple_New(nslots); if (newslots == NULL) ! return NULL; ! for (i = 0; i < nslots; i++) { tmp = PyTuple_GET_ITEM(slots, i); if (_Py_Mangle(PyString_AS_STRING(name), ! PyString_AS_STRING(tmp), ! buffer, sizeof(buffer))) { tmp = PyString_FromString(buffer); --- 1132,1183 ---- "not supported for subtype of '%s'", base->tp_name); + bad_slots: + Py_DECREF(slots); return NULL; } + + /* Check for valid slot names and two special cases */ for (i = 0; i < nslots; i++) { ! PyObject *tmp = PyTuple_GET_ITEM(slots, i); ! char *s; ! if (!valid_identifier(tmp)) ! goto bad_slots; ! assert(PyString_Check(tmp)); ! s = PyString_AS_STRING(tmp); ! if (strcmp(s, "__dict__") == 0) { ! if (!may_add_dict || add_dict) { ! PyErr_SetString(PyExc_TypeError, ! "__dict__ slot disallowed: " ! "we already got one"); ! goto bad_slots; ! } ! add_dict++; ! } ! if (strcmp(s, "__weakref__") == 0) { ! if (!may_add_weak || add_weak) { ! PyErr_SetString(PyExc_TypeError, ! "__weakref__ slot disallowed: " ! "either we already got one, " ! "or __itemsize__ != 0"); ! goto bad_slots; ! } ! add_weak++; } } ! /* Copy slots into yet another tuple, demangling names */ ! newslots = PyTuple_New(nslots - add_dict - add_weak); if (newslots == NULL) ! goto bad_slots; ! for (i = j = 0; i < nslots; i++) { ! char *s; tmp = PyTuple_GET_ITEM(slots, i); + s = PyString_AS_STRING(tmp); + if ((add_dict && strcmp(s, "__dict__") == 0) || + (add_weak && strcmp(s, "__weakref__") == 0)) + continue; if (_Py_Mangle(PyString_AS_STRING(name), ! PyString_AS_STRING(tmp), ! buffer, sizeof(buffer))) { tmp = PyString_FromString(buffer); *************** *** 1109,1148 **** Py_INCREF(tmp); } ! PyTuple_SET_ITEM(newslots, i, tmp); } Py_DECREF(slots); slots = newslots; - } - if (slots != NULL) { /* See if *this* class defines __getstate__ */ ! PyObject *getstate = PyDict_GetItemString(dict, ! "__getstate__"); ! if (getstate == NULL) { /* If not, provide a bozo that raises TypeError */ if (bozo_obj == NULL) { bozo_obj = PyCFunction_New(&bozo_ml, NULL); ! if (bozo_obj == NULL) { ! /* XXX decref various things */ ! return NULL; ! } } if (PyDict_SetItemString(dict, "__getstate__", ! bozo_obj) < 0) { ! /* XXX decref various things */ ! return NULL; } } - } - if (slots == NULL && base->tp_dictoffset == 0 && - (base->tp_setattro == PyObject_GenericSetAttr || - base->tp_setattro == NULL)) { - add_dict++; - } - if (slots == NULL && base->tp_weaklistoffset == 0 && - base->tp_itemsize == 0) { - nslots++; - add_weak++; } --- 1185,1245 ---- Py_INCREF(tmp); } ! PyTuple_SET_ITEM(newslots, j, tmp); ! j++; } + assert(j == nslots - add_dict - add_weak); + nslots = j; Py_DECREF(slots); slots = newslots; /* See if *this* class defines __getstate__ */ ! if (PyDict_GetItemString(dict, "__getstate__") == NULL) { /* If not, provide a bozo that raises TypeError */ if (bozo_obj == NULL) { bozo_obj = PyCFunction_New(&bozo_ml, NULL); ! if (bozo_obj == NULL) ! goto bad_slots; } if (PyDict_SetItemString(dict, "__getstate__", ! bozo_obj) < 0) ! { ! Py_DECREF(bozo_obj); ! goto bad_slots; ! } ! } ! ! /* Secondary bases may provide weakrefs or dict */ ! if (nbases > 1 && ! ((may_add_dict && !add_dict) || ! (may_add_weak && !add_weak))) { ! for (i = 0; i < nbases; i++) { ! tmp = PyTuple_GET_ITEM(bases, i); ! if (tmp == (PyObject *)base) ! continue; /* Skip primary base */ ! if (PyClass_Check(tmp)) { ! /* Classic base class provides both */ ! if (may_add_dict && !add_dict) ! add_dict++; ! if (may_add_weak && !add_weak) ! add_weak++; ! break; ! } ! assert(PyType_Check(tmp)); ! tmptype = (PyTypeObject *)tmp; ! if (may_add_dict && !add_dict && ! tmptype->tp_dictoffset != 0) ! add_dict++; ! if (may_add_weak && !add_weak && ! tmptype->tp_weaklistoffset != 0) ! add_weak++; ! if (may_add_dict && !add_dict) ! continue; ! if (may_add_weak && !add_weak) ! continue; ! /* Nothing more to check */ ! break; } } } *************** *** 1152,1157 **** /* Allocate the type object */ type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots); ! if (type == NULL) return NULL; /* Keep name and slots alive in the extended type object */ --- 1249,1256 ---- /* Allocate the type object */ type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots); ! if (type == NULL) { ! Py_XDECREF(slots); return NULL; + } /* Keep name and slots alive in the extended type object */ *************** *** 1246,1249 **** --- 1345,1349 ---- if (base->tp_weaklistoffset == 0 && strcmp(mp->name, "__weakref__") == 0) { + add_weak++; mp->type = T_OBJECT; mp->flags = READONLY; *************** *** 1253,1280 **** } } ! else { ! if (add_dict) { ! if (base->tp_itemsize) ! type->tp_dictoffset = ! -(long)sizeof(PyObject *); ! else ! type->tp_dictoffset = slotoffset; ! slotoffset += sizeof(PyObject *); ! type->tp_getset = subtype_getsets; ! } ! if (add_weak) { ! assert(!base->tp_itemsize); ! type->tp_weaklistoffset = slotoffset; ! mp->name = "__weakref__"; ! mp->type = T_OBJECT; ! mp->offset = slotoffset; ! mp->flags = READONLY; ! mp++; ! slotoffset += sizeof(PyObject *); ! } } type->tp_basicsize = slotoffset; type->tp_itemsize = base->tp_itemsize; type->tp_members = et->members; /* Special case some slots */ --- 1353,1372 ---- } } ! if (add_dict) { ! if (base->tp_itemsize) ! type->tp_dictoffset = -(long)sizeof(PyObject *); ! else ! type->tp_dictoffset = slotoffset; ! slotoffset += sizeof(PyObject *); ! } ! if (add_weak) { ! assert(!base->tp_itemsize); ! type->tp_weaklistoffset = slotoffset; ! slotoffset += sizeof(PyObject *); } type->tp_basicsize = slotoffset; type->tp_itemsize = base->tp_itemsize; type->tp_members = et->members; + type->tp_getset = subtype_getsets; /* Special case some slots */ From gvanrossum@users.sourceforge.net Mon Aug 12 20:25:11 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 12:25:11 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.172,2.173 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24028 Modified Files: typeobject.c Log Message: Fix MSVC warnings. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.172 retrieving revision 2.173 diff -C2 -d -r2.172 -r2.173 *** typeobject.c 12 Aug 2002 19:05:44 -0000 2.172 --- typeobject.c 12 Aug 2002 19:25:08 -0000 2.173 *************** *** 941,947 **** assert(obj->ob_type->tp_weaklistoffset > 0); assert(obj->ob_type->tp_weaklistoffset + sizeof(PyObject *) <= ! obj->ob_type->tp_basicsize); weaklistptr = (PyObject **) ! ((void *)obj + obj->ob_type->tp_weaklistoffset); if (*weaklistptr == NULL) result = Py_None; --- 941,947 ---- assert(obj->ob_type->tp_weaklistoffset > 0); assert(obj->ob_type->tp_weaklistoffset + sizeof(PyObject *) <= ! (size_t)(obj->ob_type->tp_basicsize)); weaklistptr = (PyObject **) ! ((char *)obj + obj->ob_type->tp_weaklistoffset); if (*weaklistptr == NULL) result = Py_None; From tim_one@users.sourceforge.net Mon Aug 12 20:30:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 12:30:29 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.128,1.129 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24158/python/Objects Modified Files: longobject.c Log Message: k_mul(): White-box testing turned up that (ah+al)*(bh+bl) can, in rare cases, overflow the allocated result object by 1 bit. In such cases, it would have been brought back into range if we subtracted al*bl and ah*bh from it first, but I don't want to do that because it hurts cache behavior. Instead we just ignore the excess bit when it appears -- in effect, this is forcing unsigned mod BASE**(asize + bsize) arithmetic in a case where that doesn't happen all by itself. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** longobject.c 12 Aug 2002 18:25:43 -0000 1.128 --- longobject.c 12 Aug 2002 19:30:26 -0000 1.129 *************** *** 1664,1668 **** /* 1. Allocate result space. */ ! ret = _PyLong_New(asize + bsize); if (ret == NULL) goto fail; #ifdef Py_DEBUG --- 1664,1668 ---- /* 1. Allocate result space. */ ! ret = _PyLong_New(asize + bsize + 1); if (ret == NULL) goto fail; #ifdef Py_DEBUG *************** *** 1728,1732 **** if (t3 == NULL) goto fail; ! /* Add t3. */ (void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, t3->ob_size); Py_DECREF(t3); --- 1728,1740 ---- if (t3 == NULL) goto fail; ! /* Add t3. Caution: t3 can spill one bit beyond the allocated ! * result space; it's t3-al*bl-ah*bh that always fits. We have ! * to arrange to ignore the hight bit. ! */ ! if (t3->ob_size > i) { ! assert(t3->ob_size == i+1); /* just one digit over */ ! assert(t3->ob_digit[t3->ob_size - 1] == 1); /* & just one bit */ ! --t3->ob_size; /* ignore the overflow bit */ ! } (void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, t3->ob_size); Py_DECREF(t3); *************** *** 1762,1766 **** } ! #if 0 if (Py_GETENV("KARAT") != NULL) z = k_mul(a, b); --- 1770,1774 ---- } ! #if 1 if (Py_GETENV("KARAT") != NULL) z = k_mul(a, b); From tim_one@users.sourceforge.net Mon Aug 12 20:38:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 12:38:03 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30357/python/Objects Modified Files: longobject.c Log Message: k_mul(): Heh -- I checked in two fixes for the last problem. Only keep the good one . Also checked in a test-aid by mistake. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** longobject.c 12 Aug 2002 19:30:26 -0000 1.129 --- longobject.c 12 Aug 2002 19:38:01 -0000 1.130 *************** *** 1664,1668 **** /* 1. Allocate result space. */ ! ret = _PyLong_New(asize + bsize + 1); if (ret == NULL) goto fail; #ifdef Py_DEBUG --- 1664,1668 ---- /* 1. Allocate result space. */ ! ret = _PyLong_New(asize + bsize); if (ret == NULL) goto fail; #ifdef Py_DEBUG *************** *** 1770,1774 **** } ! #if 1 if (Py_GETENV("KARAT") != NULL) z = k_mul(a, b); --- 1770,1774 ---- } ! #if 0 if (Py_GETENV("KARAT") != NULL) z = k_mul(a, b); From tim_one@users.sourceforge.net Mon Aug 12 20:43:52 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 12:43:52 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1521/python/Objects Modified Files: longobject.c Log Message: k_mul(): Moved an assert down. In a debug build, interrupting a multiply via Ctrl+C could cause a NULL-pointer dereference due to the assert. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** longobject.c 12 Aug 2002 19:38:01 -0000 1.130 --- longobject.c 12 Aug 2002 19:43:49 -0000 1.131 *************** *** 1723,1734 **** t3 = k_mul(t1, t2); - assert(t3->ob_size >= 0); Py_DECREF(t1); Py_DECREF(t2); if (t3 == NULL) goto fail; /* Add t3. Caution: t3 can spill one bit beyond the allocated * result space; it's t3-al*bl-ah*bh that always fits. We have ! * to arrange to ignore the hight bit. */ if (t3->ob_size > i) { --- 1723,1734 ---- t3 = k_mul(t1, t2); Py_DECREF(t1); Py_DECREF(t2); if (t3 == NULL) goto fail; + assert(t3->ob_size >= 0); /* Add t3. Caution: t3 can spill one bit beyond the allocated * result space; it's t3-al*bl-ah*bh that always fits. We have ! * to arrange to ignore the high bit. */ if (t3->ob_size > i) { From gvanrossum@users.sourceforge.net Mon Aug 12 21:20:11 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 13:20:11 -0700 Subject: [Python-checkins] python/dist/src/Lib copy.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19737 Modified Files: copy.py Log Message: Make sure that *any* object whose id() is used as a memo key is kept alive in the memo. This fixes SF bug 592567. Index: copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** copy.py 10 Jun 2002 21:10:27 -0000 1.28 --- copy.py 12 Aug 2002 20:20:08 -0000 1.29 *************** *** 186,189 **** --- 186,190 ---- y = copierfunction(x, memo) memo[d] = y + _keep_alive(x, memo) # Make sure x lives at least as long as d return y *************** *** 270,274 **** if hasattr(x, '__getinitargs__'): args = x.__getinitargs__() - _keep_alive(args, memo) args = deepcopy(args, memo) y = apply(x.__class__, args) --- 271,274 ---- *************** *** 279,283 **** if hasattr(x, '__getstate__'): state = x.__getstate__() - _keep_alive(state, memo) else: state = x.__dict__ --- 279,282 ---- From gvanrossum@users.sourceforge.net Mon Aug 12 21:20:41 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 13:20:41 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.193,1.194 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19993 Modified Files: ACKS Log Message: New names. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.193 retrieving revision 1.194 diff -C2 -d -r1.193 -r1.194 *** ACKS 12 Aug 2002 02:31:18 -0000 1.193 --- ACKS 12 Aug 2002 20:20:39 -0000 1.194 *************** *** 122,125 **** --- 122,126 ---- Walter Dörwald Jaromir Dolecek + Cesar Douady Fred L. Drake, Jr. John DuBois *************** *** 242,245 **** --- 243,247 ---- Bill Janssen Drew Jenkins + Jiba Orjan Johansen Simon Johnston From gvanrossum@users.sourceforge.net Mon Aug 12 21:21:45 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 13:21:45 -0700 Subject: [Python-checkins] python/dist/src/Lib copy.py,1.22.10.4,1.22.10.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20433 Modified Files: Tag: release22-maint copy.py Log Message: Backport: Make sure that *any* object whose id() is used as a memo key is kept alive in the memo. This fixes SF bug 592567. Index: copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v retrieving revision 1.22.10.4 retrieving revision 1.22.10.5 diff -C2 -d -r1.22.10.4 -r1.22.10.5 *** copy.py 10 Jun 2002 21:37:00 -0000 1.22.10.4 --- copy.py 12 Aug 2002 20:21:43 -0000 1.22.10.5 *************** *** 186,189 **** --- 186,190 ---- y = copierfunction(x, memo) memo[d] = y + _keep_alive(x, memo) # Make sure x lives at least as long as d return y *************** *** 270,274 **** if hasattr(x, '__getinitargs__'): args = x.__getinitargs__() - _keep_alive(args, memo) args = deepcopy(args, memo) y = apply(x.__class__, args) --- 271,274 ---- *************** *** 279,283 **** if hasattr(x, '__getstate__'): state = x.__getstate__() - _keep_alive(state, memo) else: state = x.__dict__ --- 279,282 ---- From jackjansen@users.sourceforge.net Mon Aug 12 21:46:20 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 12 Aug 2002 13:46:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv29068 Modified Files: README Log Message: Updated for the current state of affairs. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README 2 Aug 2002 21:45:27 -0000 1.5 --- README 12 Aug 2002 20:46:18 -0000 1.6 *************** *** 51,55 **** 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. In addition it has a target "installmacsubtree" that installs the relevant portions of the Mac subtree into the Python.framework. --- 51,56 ---- 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. *************** *** 60,70 **** 2. make 3. make frameworkinstall - 4. make osxapps - 5. [optional] in Mac/OSX do "make installunixprograms", see below. ! This sequence will put the framework in /Library/Framework/Python.framework and ! the applications in /Applications/Python. Building in another place, for instance ! $HOME/Library/Frameworks if you have no admin privileges on your machine, has only ! been tested very lightly. 5. What do all these programs do? --- 61,88 ---- 2. make 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. ! 5. What do all these programs do? *************** *** 86,90 **** be supplied later. Some useful (but outdated) info can be found in Mac/Demo. ! If you install the commandline scripts /usr/local/bin/python and pythonw these can be used to run non-GUI and GUI python scripts from the command line, respectively. --- 104,108 ---- 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. *************** *** 92,106 **** ----------------- - The interesting targets in the makefile are: - installmacsubtree - explained above, - dontinstallmacsubtree - Put only a .pth file into the framework (pointing to this - sourcetree), which may be easier for development, - install_all - install all three .app applications, - install_Python - install the hidden interpreter .app into the framework, - install_PythonLauncher - install the user-visible script launch helper - install_IDE - install the IDE - installunixprograms - install symlinks/scripts mimicking normal unix Python into - /usr/local. - 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 --- 110,113 ---- *************** *** 112,114 **** on the fly that are normal datafork-based resource files. ! Jack Jansen, jack@oratrix.com, 02-Aug-02 \ No newline at end of file --- 119,121 ---- on the fly that are normal datafork-based resource files. ! Jack Jansen, jack@oratrix.com, 12-Aug-02 \ No newline at end of file From gvanrossum@users.sourceforge.net Mon Aug 12 22:54:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 14:54:48 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.254,2.255 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv20166 Modified Files: compile.c Log Message: Use PyErr_WarnExplicit() to warn about hex/oct constants, so the correct filename and line number are reported. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.254 retrieving revision 2.255 diff -C2 -d -r2.254 -r2.255 *** compile.c 11 Aug 2002 14:06:15 -0000 2.254 --- compile.c 12 Aug 2002 21:54:46 -0000 2.255 *************** *** 1158,1165 **** x = (long) PyOS_strtoul(s, &end, 0); if (x < 0 && errno == 0) { ! if (PyErr_Warn(PyExc_DeprecationWarning, ! "hex/oct constants > sys.maxint " ! "will return positive values " ! "in Python 2.4 and up") < 0) return NULL; errno = 0; /* Might be changed by PyErr_Warn() */ --- 1158,1170 ---- x = (long) PyOS_strtoul(s, &end, 0); if (x < 0 && errno == 0) { ! if (PyErr_WarnExplicit( ! PyExc_DeprecationWarning, ! "hex/oct constants > sys.maxint " ! "will return positive values " ! "in Python 2.4 and up", ! co->c_filename, ! co->c_lineno, ! NULL, ! NULL) < 0) return NULL; errno = 0; /* Might be changed by PyErr_Warn() */ From gvanrossum@users.sourceforge.net Mon Aug 12 22:55:53 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 14:55:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20542 Modified Files: regrtest.py Log Message: Suppress warnings about test_grammar.py that can't be suppressed inside that file itself (because it's the parser that reports them). Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** regrtest.py 30 Jul 2002 23:26:00 -0000 1.92 --- regrtest.py 12 Aug 2002 21:55:51 -0000 1.93 *************** *** 64,67 **** --- 64,73 ---- import random import StringIO + import warnings + + # I see no other way to suppress these warnings; + # putting them in test_grammar.py has no effect: + warnings.filterwarnings("ignore", "hex/oct constants", DeprecationWarning, + ".*test.test_grammar$") from test import test_support From gvanrossum@users.sourceforge.net Mon Aug 12 23:01:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 15:01:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22584 Modified Files: test_socket.py Log Message: Don't use hex constants representing negative numbers. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** test_socket.py 8 Aug 2002 20:28:34 -0000 1.55 --- test_socket.py 12 Aug 2002 22:01:24 -0000 1.56 *************** *** 250,254 **** def testNtoH(self): for func in socket.htonl, socket.ntohl: ! for i in (0, 1, 0xffff0000, 2L): self.assertEqual(i, func(func(i))) --- 250,254 ---- def testNtoH(self): for func in socket.htonl, socket.ntohl: ! for i in (0, 1, ~0xffff, 2L): self.assertEqual(i, func(func(i))) From tim_one@users.sourceforge.net Mon Aug 12 23:01:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 15:01:36 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.465,1.466 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21561/python/Misc Modified Files: NEWS Log Message: Added new function k_lopsided_mul(), which is much more efficient than k_mul() when inputs have vastly different sizes, and a little more efficient when they're close to a factor of 2 out of whack. I consider this done now, although I'll set up some more correctness tests to run overnight. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.465 retrieving revision 1.466 diff -C2 -d -r1.465 -r1.466 *** NEWS 12 Aug 2002 17:36:02 -0000 1.465 --- NEWS 12 Aug 2002 22:01:33 -0000 1.466 *************** *** 65,71 **** be better or worse than that, depending on platform quirks. Note that this is a simple implementation, and there's no intent here to compete ! with, e.g., gmp. It simply gives a very nice speedup when it applies. ! XXX Karatsuba multiplication can be slower when the inputs have very ! XXX different sizes. - u'%c' will now raise a ValueError in case the argument is an --- 65,71 ---- be better or worse than that, depending on platform quirks. Note that this is a simple implementation, and there's no intent here to compete ! with, e.g., GMP. It gives a very nice speedup when it applies, but ! a package devoted to fast large-integer arithmetic should run circles ! around it. - u'%c' will now raise a ValueError in case the argument is an From tim_one@users.sourceforge.net Mon Aug 12 23:01:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 15:01:36 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21561/python/Objects Modified Files: longobject.c Log Message: Added new function k_lopsided_mul(), which is much more efficient than k_mul() when inputs have vastly different sizes, and a little more efficient when they're close to a factor of 2 out of whack. I consider this done now, although I'll set up some more correctness tests to run overnight. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** longobject.c 12 Aug 2002 19:43:49 -0000 1.131 --- longobject.c 12 Aug 2002 22:01:34 -0000 1.132 *************** *** 1593,1596 **** --- 1593,1598 ---- } + static PyLongObject *k_lopsided_mul(PyLongObject *a, PyLongObject *b); + /* Karatsuba multiplication. Ignores the input signs, and returns the * absolute value of the product (or NULL if error). *************** *** 1634,1640 **** /* Use gradeschool math when either number is too small. */ if (asize <= KARATSUBA_CUTOFF) { - /* 0 is inevitable if one kmul arg has more than twice - * the digits of another, so it's worth special-casing. - */ if (asize == 0) return _PyLong_New(0); --- 1636,1639 ---- *************** *** 1643,1646 **** --- 1642,1654 ---- } + /* If a is small compared to b, splitting on b gives a degenerate + * case with ah==0, and Karatsuba may be (even much) less efficient + * than "grade school" then. However, we can still win, by viewing + * b as a string of "big digits", each of width a->ob_size. That + * leads to a sequence of balanced calls to k_mul. + */ + if (2 * asize <= bsize) + return k_lopsided_mul(a, b); + shift = bsize >> 1; if (kmul_split(a, shift, &ah, &al) < 0) goto fail; *************** *** 1751,1754 **** --- 1759,1823 ---- } + /* b has at least twice the digits of a, and a is big enough that Karatsuba + * would pay off *if* the inputs had balanced sizes. View b as a sequence + * of slices, each with a->ob_size digits, and multiply the slices by a, + * one at a time. This gives k_mul balanced inputs to work with, and is + * also cache-friendly (we compute one double-width slice of the result + * at a time, then move on, never bactracking except for the helpful + * single-width slice overlap between successive partial sums). + */ + static PyLongObject * + k_lopsided_mul(PyLongObject *a, PyLongObject *b) + { + const int asize = ABS(a->ob_size); + int bsize = ABS(b->ob_size); + int nbdone; /* # of b digits already multiplied */ + PyLongObject *ret; + PyLongObject *bslice = NULL; + + assert(asize > KARATSUBA_CUTOFF); + assert(2 * asize <= bsize); + + /* Allocate result space, and zero it out. */ + ret = _PyLong_New(asize + bsize); + if (ret == NULL) + return NULL; + memset(ret->ob_digit, 0, ret->ob_size * sizeof(digit)); + + /* Successive slices of b are copied into bslice. */ + bslice = _PyLong_New(bsize); + if (bslice == NULL) + goto fail; + + nbdone = 0; + while (bsize > 0) { + PyLongObject *product; + const int nbtouse = MIN(bsize, asize); + + /* Multiply the next slice of b by a. */ + memcpy(bslice->ob_digit, b->ob_digit + nbdone, + nbtouse * sizeof(digit)); + bslice->ob_size = nbtouse; + product = k_mul(a, bslice); + if (product == NULL) + goto fail; + + /* Add into result. */ + (void)v_iadd(ret->ob_digit + nbdone, ret->ob_size - nbdone, + product->ob_digit, product->ob_size); + Py_DECREF(product); + + bsize -= nbtouse; + nbdone += nbtouse; + } + + Py_DECREF(bslice); + return long_normalize(ret); + + fail: + Py_DECREF(ret); + Py_XDECREF(bslice); + return NULL; + } static PyObject * *************** *** 1770,1781 **** } - #if 0 - if (Py_GETENV("KARAT") != NULL) - z = k_mul(a, b); - else - z = x_mul(a, b); - #else z = k_mul(a, b); - #endif if(z == NULL) { Py_DECREF(a); --- 1839,1843 ---- From fdrake@users.sourceforge.net Mon Aug 12 23:01:45 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 12 Aug 2002 15:01:45 -0700 Subject: [Python-checkins] python/dist/src/Doc python-docs.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv22707 Added Files: python-docs.txt Log Message: The auto-reply text for the python-docs address. This is not automatically updated when checkins are made, but I can get that updated when needed. --- NEW FILE: python-docs.txt --- This message is being sent in response to your message to the Python documentation maintainers (python-docs@python.org). Your message will be handled by a human, but this message serves to answer the most common questions sent to this address. You will only receive this message if it has not been sent to you for at least three months. If your question is answered below, you may not receive an additional message from the documentation maintainers. If you feel the answers below are not sufficient and you do not receive an additional response within a week, please do send a note letting us know that your question has not been properly answered, and be specific regarding what additional information you are looking for. -Fred Frequently Asked Questions about the Python Documentation --------------------------------------------------------- 1. Can I download HTML/PDF/PostScript versions of the docs? 2. Where can I download Python? 3. I can't unpack a downloaded copy on Windows; what should I do? 4. I can't unpack a downloaded copy on MacOS; what should I do? 5. What can I use Python for? 6. How do I use module/function/whatever XXX? 7. What about JPython? 8. I found a bug in the documentation, who should I tell? 9. Can I get an algorithm to do THIS in language THAT? 10. How do I decode an XXX file from my email on a YYY computer? 11. Acrobat Reader won't print the PDF. What's wrong? 12. Where can I find documentation in my native language? Answers to the Questions ------------------------ 1. Can I download HTML/PDF/PostScript/ versions of the docs? Yes. These are available via the Web and traditional FTP. For Web access to the latest version, see: http://www.python.org/doc/ For FTP access to the latest version and archives of previous versions, see: ftp.python.org:/pub/python/doc/ 2. Where can I download Python? You can get Python in source form and as a Windows installer from the main Python website. You can also find information about pre-built packages for other platforms there as well. Downloading information at the website is at the URL: http://www.python.org/download/ The sources and Windows installer can be downloaded from the FTP site as well: ftp://ftp.python.org/pub/python/ 3. I can't unpack a downloaded archive on Windows; what should I do? Make sure the archive was saved with the .tgz extension; you may need to watch carefully when telling the browser where to save the file, as the default may change the extension to .tar or even .exe. Once you're sure the file has the right extension, use a recent version of WinZip to upack the file (version 7.0 works). Get WinZip from: http://www.winzip.com/ 4. I can't unpack a downloaded archive on MacOS; what should I do? Stuffit Expander 4.5 (and probably other versions) cannot handle the "tar" archive, although it can decompress it from the .tgz file. Expander Enhancer, which you have to pay for, can handle the tar archive. 5. What can I use Python for? Python is a general purpose programming language. See the Python home page at http://www.python.org/ for more information; introductory material is available at: http://www.python.org/doc/Intros.html 6. How do I use module/function/whatever XXX? Start by reading the documentation for XXX. If the documentation doesn't make sense or seems incomplete, please file a specific bug report to python-docs@python.org (the address you sent your question to). Otherwise, you probably sent your question to the wrong place (which does not preclude an answer, if I know it). If you're looking for examples or tutorial information on how to use a particular Python library component, check the Demo/ directory of the source distribution or Windows installation; there might be an example. If that doesn't help, point your Web browser to http://www.python.org/doc/ and look around; there may be a link to some interesting examples online. After that, try searching the Python Web site at http://www.python.org/search/. If your question still hasn't been answered, you may send your query to the Python newsgroup (comp.lang.python) or the mailing list (see http://www.python.org/mailman/listinfo/python-list). If you'd rather not send you message to a public forum, you can try sending it to python-help@python.org. (This is typically slower than sending your question to the public list, however.) 7. What about Jython and JPython? If your question is specific to Jython or JPython, you should consult the Jython website at: http://www.jython.org/ Chances are very good that the person who answers questions posted to python-docs@python.org doesn't use Jython very often, and won't be able to give you a meaningful answer beyond "Look at the Jython website." Sorry, I don't have *all* the answers! 8. I found a bug in the documentation, who should I tell? If you're reading this, you've found the right address! Send all documentation bug reports to python-docs@python.org. If you prefer to use a Web-based reporting mechanism, you can use the bug database at http://www.python.org/python-bugs/. 9. Can I get an algorithm to do THIS in language THAT? If THAT is Python, look in the standard library. If THAT isn't Python, use your favorite Internet search engine. 10. How do I decode an XXX file from my email on a YYY computer? I really, honestly do not know. I don't even know why this question gets asked here. Since I don't have a YYY computer, I couldn't even try a few things out for you. 11. Acrobat Reader won't print the PDF. What's wrong? Adobe has reportedly admitted that there is a bug Acrobat Reader 5.0 which causes it not to print at least some PDF files generated by pdfTeX. This software is used to produce the PDF version of the Python documentation, and our documents definately trigger this bug in Acrobat Reader. To print the PDF files, use Acrobat Reader 4.x, ghostscript, or xpdf. Information on ghostscript can be found at: http://www.ghostscript.com/ Information on xpdf can be found at: http://www.foolabs.com/xpdf/ 12. There is a lot of contributed documentation in languages other than English. Some of the documents are translations of English documents, and others were originally authored in other languages. If we know about it, it will be listed at: http://www.python.org/doc/NonEnglish.html From tim_one@users.sourceforge.net Mon Aug 12 23:10:02 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 15:10:02 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24738/python/Objects Modified Files: longobject.c Log Message: k_lopsided_mul(): This allocated more space for bslice than necessary. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** longobject.c 12 Aug 2002 22:01:34 -0000 1.132 --- longobject.c 12 Aug 2002 22:10:00 -0000 1.133 *************** *** 1786,1790 **** /* Successive slices of b are copied into bslice. */ ! bslice = _PyLong_New(bsize); if (bslice == NULL) goto fail; --- 1786,1790 ---- /* Successive slices of b are copied into bslice. */ ! bslice = _PyLong_New(asize); if (bslice == NULL) goto fail; From gvanrossum@users.sourceforge.net Mon Aug 12 23:11:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 15:11:30 -0700 Subject: [Python-checkins] python/dist/src/Lib aifc.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25252 Modified Files: aifc.py Log Message: Fix wanrings about unsigned hex constants. Index: aifc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/aifc.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** aifc.py 11 Feb 2002 17:56:27 -0000 1.41 --- aifc.py 12 Aug 2002 22:11:28 -0000 1.42 *************** *** 143,147 **** pass ! _AIFC_version = 0xA2805140 # Version 1 of AIFF-C _skiplist = 'COMT', 'INST', 'MIDI', 'AESD', \ --- 143,147 ---- pass ! _AIFC_version = 0xA2805140L # Version 1 of AIFF-C _skiplist = 'COMT', 'INST', 'MIDI', 'AESD', \ *************** *** 310,314 **** self._ssnd_seek_needed = 0 elif chunkname == 'FVER': ! self._version = _read_long(chunk) elif chunkname == 'MARK': self._readmark(chunk) --- 310,314 ---- self._ssnd_seek_needed = 0 elif chunkname == 'FVER': ! self._version = _read_ulong(chunk) elif chunkname == 'MARK': self._readmark(chunk) From jeremy@alum.mit.edu Mon Aug 12 23:49:45 2002 From: jeremy@alum.mit.edu (Jeremy Hylton) Date: Mon, 12 Aug 2002 18:49:45 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.55,1.56 In-Reply-To: References: Message-ID: <15704.15241.364947.821395@slothrop.zope.com> >>>>> "GvR" == gvanrossum writes: GvR> Update of /cvsroot/python/python/dist/src/Lib/test In directory GvR> usw-pr-cvs1:/tmp/cvs-serv22584 GvR> Modified Files: GvR> test_socket.py GvR> Log Message: Don't use hex constants representing negative GvR> numbers. The test in question won't work quite the same anymore. I can't really tell if that matters, but it will now test something different on platforms with 64-bit ints, right? The C functions being wrapped by the socket module takes 32-bit unsigned ints. I wanted to pass the bits that would represent the unsigned long with the upper half of the bits set. Jeremy From gvanrossum@users.sourceforge.net Tue Aug 13 01:25:00 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 12 Aug 2002 17:25:00 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26827 Modified Files: longobject.c Log Message: Fix comment for PyLong_AsUnsignedLong() to say that the return value is an *unsigned* long. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** longobject.c 12 Aug 2002 22:10:00 -0000 1.133 --- longobject.c 13 Aug 2002 00:24:58 -0000 1.134 *************** *** 229,233 **** } ! /* Get a C long int from a long int object. Returns -1 and sets an error condition if overflow occurs. */ --- 229,233 ---- } ! /* Get a C unsigned long int from a long int object. Returns -1 and sets an error condition if overflow occurs. */ From guido@python.org Tue Aug 13 01:24:59 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 12 Aug 2002 20:24:59 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.55,1.56 In-Reply-To: Your message of "Mon, 12 Aug 2002 18:49:45 EDT." <15704.15241.364947.821395@slothrop.zope.com> References: <15704.15241.364947.821395@slothrop.zope.com> Message-ID: <200208130024.g7D0Oxq26559@pcp02138704pcs.reston01.va.comcast.net> > GvR> Modified Files: > GvR> test_socket.py > GvR> Log Message: Don't use hex constants representing negative > GvR> numbers. > > The test in question won't work quite the same anymore. On 32-bit platforms it will: 0xffff0000 is the same value as ~0xffff there. There were no comments in the code indicating whether the test was ever tried on a 64-bit platform. > I can't really tell if that matters, but it will now test something > different on platforms with 64-bit ints, right? Yes; on a 64-bit platform, it would check whether 4294901760 would be converted into itself (this is hex 0xffff0000 seen as an unsigned). > The C functions being wrapped by the socket module takes 32-bit > unsigned ints. I wanted to pass the bits that would represent the > unsigned long with the upper half of the bits set. Does the test have to test for a number with the high bit set? You can portably test what it does for e.g. 0x7fff0000. Also, perhaps the function could be defined better? On a 32-bit platform it can now return a negative value, but on a 64-bit platform it cannot. Maybe it should return a positive Python long on a 32-bit platform when the high bit of the result is set? --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@users.sourceforge.net Tue Aug 13 03:17:13 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 19:17:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_long.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21177/python/Lib/test Modified Files: test_long.py Log Message: Machines-- and Python --are a lot faster in relevant ways since this test was written. So boosted the number of "digits" this generates, and also beefed up the "* / divmod" test to tickle numbers big enough to trigger the Karatsuba algorithm. It takes about 2 seconds now on my box. Index: test_long.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_long.py 23 Jul 2002 19:03:56 -0000 1.17 --- test_long.py 13 Aug 2002 02:17:11 -0000 1.18 *************** *** 7,14 **** BASE = 2 ** SHIFT MASK = BASE - 1 # Max number of base BASE digits to use in test cases. Doubling ! # this will at least quadruple the runtime. ! MAXDIGITS = 10 # build some special values --- 7,15 ---- BASE = 2 ** SHIFT MASK = BASE - 1 + KARATSUBA_CUTOFF = 35 # from longobject.c # Max number of base BASE digits to use in test cases. Doubling ! # this will more than double the runtime. ! MAXDIGITS = 15 # build some special values *************** *** 91,95 **** if verbose: print "long / * % divmod" ! digits = range(1, maxdigits+1) for lenx in digits: x = getran(lenx) --- 92,97 ---- if verbose: print "long / * % divmod" ! digits = range(1, maxdigits+1) + range(KARATSUBA_CUTOFF, ! KARATSUBA_CUTOFF + 15) for lenx in digits: x = getran(lenx) From tim_one@users.sourceforge.net Tue Aug 13 03:24:27 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 Aug 2002 19:24:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_long.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23067/python/Lib/test Modified Files: test_long.py Log Message: test_division(): Added one larger digits value, to ensure that the "lopsided Karatsuba" driver also gets some exercise. Index: test_long.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_long.py 13 Aug 2002 02:17:11 -0000 1.18 --- test_long.py 13 Aug 2002 02:24:25 -0000 1.19 *************** *** 93,97 **** print "long / * % divmod" digits = range(1, maxdigits+1) + range(KARATSUBA_CUTOFF, ! KARATSUBA_CUTOFF + 15) for lenx in digits: x = getran(lenx) --- 93,98 ---- print "long / * % divmod" digits = range(1, maxdigits+1) + range(KARATSUBA_CUTOFF, ! KARATSUBA_CUTOFF + 14) ! digits.append(KARATSUBA_CUTOFF * 3) for lenx in digits: x = getran(lenx) From gvanrossum@users.sourceforge.net Tue Aug 13 11:06:02 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 13 Aug 2002 03:06:02 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.89,2.90 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9729 Modified Files: intobject.c Log Message: Add an improvement wrinkle to Neil Schemenauer's change to int_mul (rev. 2.86). The other type is only disqualified from sq_repeat when it has the CHECKTYPES flag. This means that for extension types that only support "old-style" numeric ops, such as Zope 2's ExtensionClass, sq_repeat still trumps nb_multiply. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -d -r2.89 -r2.90 *** intobject.c 11 Aug 2002 17:54:42 -0000 2.89 --- intobject.c 13 Aug 2002 10:05:56 -0000 2.90 *************** *** 346,351 **** o->ob_type->tp_as_sequence && \ o->ob_type->tp_as_sequence->sq_repeat && \ ! (!o->ob_type->tp_as_number || \ ! !o->ob_type->tp_as_number->nb_multiply)) static PyObject * int_mul(PyObject *v, PyObject *w) --- 346,353 ---- o->ob_type->tp_as_sequence && \ o->ob_type->tp_as_sequence->sq_repeat && \ ! !(o->ob_type->tp_as_number && \ ! o->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES && \ ! o->ob_type->tp_as_number->nb_multiply)) ! static PyObject * int_mul(PyObject *v, PyObject *w) From gvanrossum@users.sourceforge.net Tue Aug 13 11:07:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 13 Aug 2002 03:07:19 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.79.6.3,2.79.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10125 Modified Files: Tag: release22-maint intobject.c Log Message: Backport: Add an improvement wrinkle to Neil Schemenauer's change to int_mul (rev. 2.79.6.3). The other type is only disqualified from sq_repeat when it has the CHECKTYPES flag. This means that for extension types that only support "old-style" numeric ops, such as Zope 2's ExtensionClass, sq_repeat still trumps nb_multiply. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.79.6.3 retrieving revision 2.79.6.4 diff -C2 -d -r2.79.6.3 -r2.79.6.4 *** intobject.c 9 Aug 2002 15:46:50 -0000 2.79.6.3 --- intobject.c 13 Aug 2002 10:07:17 -0000 2.79.6.4 *************** *** 349,354 **** o->ob_type->tp_as_sequence && \ o->ob_type->tp_as_sequence->sq_repeat && \ ! (!o->ob_type->tp_as_number || \ ! !o->ob_type->tp_as_number->nb_multiply)) static PyObject * int_mul(PyObject *v, PyObject *w) --- 349,356 ---- o->ob_type->tp_as_sequence && \ o->ob_type->tp_as_sequence->sq_repeat && \ ! !(o->ob_type->tp_as_number && \ ! o->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES && \ ! o->ob_type->tp_as_number->nb_multiply)) ! static PyObject * int_mul(PyObject *v, PyObject *w) From jlt63@users.sourceforge.net Tue Aug 13 12:42:43 2002 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Tue, 13 Aug 2002 04:42:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1741 Modified Files: test_b1.py Log Message: 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. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** test_b1.py 12 Aug 2002 15:16:20 -0000 1.50 --- test_b1.py 13 Aug 2002 11:42:41 -0000 1.51 *************** *** 535,538 **** --- 535,543 ---- # 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: From fdrake@users.sourceforge.net Tue Aug 13 14:59:58 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 13 Aug 2002 06:59:58 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24647 Modified Files: urllib2.py Log Message: Remove ugly irregular spaces from in front of some comments. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** urllib2.py 16 Jul 2002 21:35:23 -0000 1.33 --- urllib2.py 13 Aug 2002 13:59:55 -0000 1.34 *************** *** 142,146 **** # do these error classes make sense? # make sure all of the IOError stuff is overridden. we just want to be ! # subtypes. class URLError(IOError): --- 142,146 ---- # do these error classes make sense? # make sure all of the IOError stuff is overridden. we just want to be ! # subtypes. class URLError(IOError): *************** *** 351,357 **** # XXX probably also want an abstract factory that knows things like ! # the fact that a ProxyHandler needs to get inserted first. # would also know when it makes sense to skip a superclass in favor of ! # a subclass and when it might make sense to include both def build_opener(*handlers): --- 351,357 ---- # XXX probably also want an abstract factory that knows things like ! # the fact that a ProxyHandler needs to get inserted first. # would also know when it makes sense to skip a superclass in favor of ! # a subclass and when it might make sense to include both def build_opener(*handlers): From nnorwitz@users.sourceforge.net Tue Aug 13 18:16:51 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 10:16:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.153,1.154 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11580/Lib/test Modified Files: test_descr.py Log Message: Add test for SF bug # 575229, multiple inheritance w/ slots dumps core Fix already checked in by Guido Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** test_descr.py 10 Aug 2002 05:42:07 -0000 1.153 --- test_descr.py 13 Aug 2002 17:16:49 -0000 1.154 *************** *** 3238,3241 **** --- 3238,3251 ---- del o + def slotmultipleinheritance(): + # SF bug 575229, multiple inheritance w/ slots dumps core + class A(object): + __slots__=() + class B(object): + pass + class C(A,B) : + __slots__=() + C().x=2 + def testrmul(): # SF patch 592646 *************** *** 3345,3348 **** --- 3355,3359 ---- subtype_resurrection() slottrash() + slotmultipleinheritance() testrmul() if verbose: print "All OK" From nnorwitz@users.sourceforge.net Tue Aug 13 18:18:47 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 10:18:47 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.173,2.174 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12360/Objects Modified Files: typeobject.c Log Message: Allow docstrings to be removed during compilation Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.173 retrieving revision 2.174 diff -C2 -d -r2.173 -r2.174 *** typeobject.c 12 Aug 2002 19:25:08 -0000 2.173 --- typeobject.c 13 Aug 2002 17:18:45 -0000 2.174 *************** *** 956,962 **** The descriptor's __get__ method may raise AttributeError. */ {"__dict__", subtype_dict, subtype_setdict, ! "dictionary for instance variables (if defined)"}, {"__weakref__", subtype_getweakref, NULL, ! "list of weak references to the object (if defined)"}, {0} }; --- 956,962 ---- The descriptor's __get__ method may raise AttributeError. */ {"__dict__", subtype_dict, subtype_setdict, ! PyDoc_STR("dictionary for instance variables (if defined)")}, {"__weakref__", subtype_getweakref, NULL, ! PyDoc_STR("list of weak references to the object (if defined)")}, {0} }; *************** *** 1879,1883 **** static PyGetSetDef object_getsets[] = { {"__class__", object_get_class, object_set_class, ! "the object's class"}, {0} }; --- 1879,1883 ---- static PyGetSetDef object_getsets[] = { {"__class__", object_get_class, object_set_class, ! PyDoc_STR("the object's class")}, {0} }; From nnorwitz@users.sourceforge.net Tue Aug 13 18:42:59 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 10:42:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils util.py,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv20321/Lib/distutils Modified Files: util.py Log Message: SF bug #574235, convert_path fails with empty pathname Index: util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** util.py 9 Aug 2002 16:37:34 -0000 1.69 --- util.py 13 Aug 2002 17:42:57 -0000 1.70 *************** *** 85,91 **** if os.sep == '/': return pathname ! if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname ! if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname --- 85,93 ---- if os.sep == '/': return pathname ! if not pathname: ! return pathname ! if pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname ! if pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname From nnorwitz@users.sourceforge.net Tue Aug 13 18:49:20 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 10:49:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils util.py,1.65,1.65.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv22433/Lib/distutils Modified Files: Tag: release22-maint util.py Log Message: SF bug #574235, convert_path fails with empty pathname Index: util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v retrieving revision 1.65 retrieving revision 1.65.6.1 diff -C2 -d -r1.65 -r1.65.6.1 *** util.py 6 Dec 2001 20:51:35 -0000 1.65 --- util.py 13 Aug 2002 17:49:18 -0000 1.65.6.1 *************** *** 85,88 **** --- 85,90 ---- if os.sep == '/': return pathname + if not pathname: + return pathname if pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname From guido@python.org Tue Aug 13 19:21:49 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 13 Aug 2002 14:21:49 -0400 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.173,2.174 In-Reply-To: Your message of "Tue, 13 Aug 2002 10:18:47 PDT." References: Message-ID: <200208131821.g7DILnk09401@odiug.zope.com> > typeobject.c > Log Message: > Allow docstrings to be removed during compilation Can you also do this for the TPSLOT macro and friends? --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum@users.sourceforge.net Tue Aug 13 19:26:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 13 Aug 2002 11:26:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.154,1.155 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1483 Modified Files: test_descr.py Log Message: Add tests for including __dict__ and/or __weakref__ in __slots__. Add some more rigor to slotmultipleinheritance(). Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** test_descr.py 13 Aug 2002 17:16:49 -0000 1.154 --- test_descr.py 13 Aug 2002 18:26:26 -0000 1.155 *************** *** 1176,1179 **** --- 1176,1224 ---- vereq(orig_objects, new_objects) + def slotspecials(): + if verbose: print "Testing __dict__ and __weakref__ in __slots__..." + + class D(object): + __slots__ = ["__dict__"] + a = D() + verify(hasattr(a, "__dict__")) + verify(not hasattr(a, "__weakref__")) + a.foo = 42 + vereq(a.__dict__, {"foo": 42}) + + class W(object): + __slots__ = ["__weakref__"] + a = W() + verify(hasattr(a, "__weakref__")) + verify(not hasattr(a, "__dict__")) + try: + a.foo = 42 + except AttributeError: + pass + else: + raise TestFailed, "shouldn't be allowed to set a.foo" + + class C1(W, D): + __slots__ = [] + a = C1() + verify(hasattr(a, "__dict__")) + verify(hasattr(a, "__weakref__")) + a.foo = 42 + vereq(a.__dict__, {"foo": 42}) + + class C2(D, W): + __slots__ = [] + a = C2() + verify(hasattr(a, "__dict__")) + verify(hasattr(a, "__weakref__")) + a.foo = 42 + vereq(a.__dict__, {"foo": 42}) + + class C3(C1, C2): + __slots__ = [] + + class C4(C2, C1): + __slots__ = [] + def dynamics(): if verbose: print "Testing class attribute propagation..." *************** *** 3246,3250 **** class C(A,B) : __slots__=() ! C().x=2 def testrmul(): --- 3291,3298 ---- class C(A,B) : __slots__=() ! vereq(C.__basicsize__, B.__basicsize__) ! verify(hasattr(C, '__dict__')) ! verify(hasattr(C, '__weakref__')) ! C().x = 2 def testrmul(): *************** *** 3305,3308 **** --- 3353,3357 ---- objects() slots() + slotspecials() dynamics() errors() From nnorwitz@users.sourceforge.net Tue Aug 13 20:01:42 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 12:01:42 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.174,2.175 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13364/Objects Modified Files: typeobject.c Log Message: Allow docstrings to be removed during compilation for *SLOT macro and friends Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.174 retrieving revision 2.175 diff -C2 -d -r2.174 -r2.175 *** typeobject.c 13 Aug 2002 17:18:45 -0000 2.174 --- typeobject.c 13 Aug 2002 19:01:38 -0000 2.175 *************** *** 3851,3860 **** #define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ! {NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, DOC} #define FLSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, FLAGS) \ {NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ ! DOC, FLAGS} #define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ! {NAME, offsetof(etype, SLOT), (void *)(FUNCTION), WRAPPER, DOC} #define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC) --- 3851,3862 ---- #define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ! {NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ ! PyDoc_STR(DOC)} #define FLSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, FLAGS) \ {NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ ! PyDoc_STR(DOC), FLAGS} #define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ! {NAME, offsetof(etype, SLOT), (void *)(FUNCTION), WRAPPER, \ ! PyDoc_STR(DOC)} #define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC) From neal@metaslash.com Tue Aug 13 20:03:11 2002 From: neal@metaslash.com (Neal Norwitz) Date: Tue, 13 Aug 2002 15:03:11 -0400 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.173,2.174 References: <200208131821.g7DILnk09401@odiug.zope.com> Message-ID: <3D5957EF.B5239A66@metaslash.com> Guido van Rossum wrote: > > > typeobject.c > > Log Message: > > Allow docstrings to be removed during compilation > > Can you also do this for the TPSLOT macro and friends? Done. Let me know if there are any other places where docstrings may be lurking. Neal From bwarsaw@users.sourceforge.net Tue Aug 13 21:09:29 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 13 Aug 2002 13:09:29 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.105,1.106 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv1772 Modified Files: setup.py Log Message: Regress Guido's change of 2002/08/06 to check for the zlib version 1.1.4. Redhat hasn't upgraded but does provide a patched 1.1.3 package, so checking for 1.1.4 just makes life difficult. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** setup.py 6 Aug 2002 17:28:30 -0000 1.105 --- setup.py 13 Aug 2002 20:09:26 -0000 1.106 *************** *** 653,664 **** ! # Andrew Kuchling's zlib module. ! # This requires zlib 1.1.4 (1.1.3 has a security problem). ! # See http://www.gzip.org/zlib/ zlib_inc = find_file('zlib.h', [], inc_dirs) if zlib_inc is not None: zlib_h = zlib_inc[0] + '/zlib.h' version = '"0.0.0"' ! version_req = '"1.1.4"' fp = open(zlib_h) while 1: --- 653,673 ---- ! # Andrew Kuchling's zlib module. Note that some versions of zlib ! # 1.1.3 have security problems. See CERT Advisory CA-2002-07: ! # http://www.cert.org/advisories/CA-2002-07.html ! # ! # zlib 1.1.4 is fixed, but at least one vendor (RedHat) has decided to ! # patch its zlib 1.1.3 package instead of upgrading to 1.1.4. For ! # now, we still accept 1.1.3, because we think it's difficult to ! # exploit this in Python, and we'd rather make it RedHat's problem ! # than our problem . ! # ! # You can upgrade zlib to version 1.1.4 yourself by going to ! # http://www.gzip.org/zlib/ zlib_inc = find_file('zlib.h', [], inc_dirs) if zlib_inc is not None: zlib_h = zlib_inc[0] + '/zlib.h' version = '"0.0.0"' ! version_req = '"1.1.3"' fp = open(zlib_h) while 1: From tim_one@users.sourceforge.net Tue Aug 13 21:37:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 13:37:56 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.134,1.135 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9254/python/Objects Modified Files: longobject.c Log Message: k_mul(): The fix for (ah+al)*(bh+bl) spilling 1 bit beyond the allocated space is no longer needed, so removed the code. It was only possible when a degenerate (ah->ob_size == 0) split happened, but after that fix went in I added k_lopsided_mul(), which saves the body of k_mul() from seeing a degenerate split. So this removes code, and adds a honking long comment block explaining why spilling out of bounds isn't possible anymore. Note: ff we end up spilling out of bounds anyway , an assert in v_iadd() is certain to trigger. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** longobject.c 13 Aug 2002 00:24:58 -0000 1.134 --- longobject.c 13 Aug 2002 20:37:51 -0000 1.135 *************** *** 1651,1656 **** --- 1651,1659 ---- return k_lopsided_mul(a, b); + /* Split a & b into hi & lo pieces. */ shift = bsize >> 1; if (kmul_split(a, shift, &ah, &al) < 0) goto fail; + assert(ah->ob_size > 0); /* the split isn't degenerate */ + if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; *************** *** 1736,1748 **** assert(t3->ob_size >= 0); ! /* Add t3. Caution: t3 can spill one bit beyond the allocated ! * result space; it's t3-al*bl-ah*bh that always fits. We have ! * to arrange to ignore the high bit. */ - if (t3->ob_size > i) { - assert(t3->ob_size == i+1); /* just one digit over */ - assert(t3->ob_digit[t3->ob_size - 1] == 1); /* & just one bit */ - --t3->ob_size; /* ignore the overflow bit */ - } (void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, t3->ob_size); Py_DECREF(t3); --- 1739,1745 ---- assert(t3->ob_size >= 0); ! /* Add t3. It's not obvious why we can't run out of room here. ! * See the (*) comment after this function. */ (void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, t3->ob_size); Py_DECREF(t3); *************** *** 1758,1761 **** --- 1755,1797 ---- return NULL; } + + /* (*) Why adding t3 can't "run out of room" above. + + We allocated space for asize + bsize result digits. We're adding t3 at an + offset of shift digits, so there are asize + bsize - shift allocated digits + remaining. Because degenerate shifts of "a" were weeded out, asize is at + least shift + 1. If bsize is odd then bsize == 2*shift + 1, else bsize == + 2*shift. Therefore there are at least shift+1 + 2*shift - shift = + + 2*shift+1 allocated digits remaining when bsize is even, or at least + 2*shift+2 allocated digits remaining when bsize is odd. + + Now in bh+bl, if bsize is even bh has at most shift digits, while if bsize + is odd bh has at most shift+1 digits. The sum bh+bl has at most + + shift digits plus 1 bit when bsize is even + shift+1 digits plus 1 bit when bsize is odd + + The same is true of ah+al, so (ah+al)(bh+bl) has at most + + 2*shift digits + 2 bits when bsize is even + 2*shift+2 digits + 2 bits when bsize is odd + + If bsize is even, we have at most 2*shift digits + 2 bits to fit into at + least 2*shift+1 digits. Since a digit has SHIFT bits, and SHIFT >= 2, + there's always enough room to fit the 2 bits into the "spare" digit. + + If bsize is odd, we have at most 2*shift+2 digits + 2 bits to fit into at + least 2*shift+2 digits, and there's not obviously enough room for the + extra two bits. We need a sharper analysis in this case. The major + laziness was in the "the same is true of ah+al" clause: ah+al can't actually + have shift+1 digits + 1 bit unless bsize is odd and asize == bsize. In that + case, we actually have (2*shift+1)*2 - shift = 3*shift + 2 allocated digits + remaining, and that's obviously plenty to hold 2*shift + 2 digits + 2 bits. + Else (bsize is odd and asize < bsize) ah and al each have at most shift digits, + so ah+al has at most shift digits + 1 bit, and (ah+al)*(bh+bl) has at most + 2*shift+1 digits + 2 bits, and again 2*shift+2 digits + 2 bits is + enough to hold it. + */ /* b has at least twice the digits of a, and a is big enough that Karatsuba From tim_one@users.sourceforge.net Tue Aug 13 21:42:02 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 13:42:02 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12143/python/Objects Modified Files: longobject.c Log Message: Fixed error in new comment. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** longobject.c 13 Aug 2002 20:37:51 -0000 1.135 --- longobject.c 13 Aug 2002 20:42:00 -0000 1.136 *************** *** 1787,1796 **** laziness was in the "the same is true of ah+al" clause: ah+al can't actually have shift+1 digits + 1 bit unless bsize is odd and asize == bsize. In that ! case, we actually have (2*shift+1)*2 - shift = 3*shift + 2 allocated digits ! remaining, and that's obviously plenty to hold 2*shift + 2 digits + 2 bits. Else (bsize is odd and asize < bsize) ah and al each have at most shift digits, so ah+al has at most shift digits + 1 bit, and (ah+al)*(bh+bl) has at most ! 2*shift+1 digits + 2 bits, and again 2*shift+2 digits + 2 bits is ! enough to hold it. */ --- 1787,1795 ---- laziness was in the "the same is true of ah+al" clause: ah+al can't actually have shift+1 digits + 1 bit unless bsize is odd and asize == bsize. In that ! case, we actually have (2*shift+1)*2 - shift = 3*shift+2 allocated digits ! remaining, and that's obviously plenty to hold 2*shift+2 digits + 2 bits. Else (bsize is odd and asize < bsize) ah and al each have at most shift digits, so ah+al has at most shift digits + 1 bit, and (ah+al)*(bh+bl) has at most ! 2*shift+1 digits + 2 bits, and again 2*shift+2 digits is enough to hold it. */ From jhylton@users.sourceforge.net Tue Aug 13 21:43:48 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 13 Aug 2002 13:43:48 -0700 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12734 Modified Files: unittest.py Log Message: Add a missing call to _strclass(). Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** unittest.py 9 Aug 2002 09:46:23 -0000 1.18 --- unittest.py 13 Aug 2002 20:43:46 -0000 1.19 *************** *** 193,197 **** def __str__(self): ! return "%s (%s)" % (self.__testMethodName, self.__class__) def __repr__(self): --- 193,197 ---- def __str__(self): ! return "%s (%s)" % (self.__testMethodName, _strclass(self.__class__)) def __repr__(self): From tim_one@users.sourceforge.net Tue Aug 13 22:06:57 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 14:06:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_long.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21095/python/Lib/test Modified Files: test_long.py Log Message: Added a test specifically to tickle Karatsuba; it costs no appreciable runtime. Index: test_long.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_long.py 13 Aug 2002 02:24:25 -0000 1.19 --- test_long.py 13 Aug 2002 21:06:55 -0000 1.20 *************** *** 100,104 **** --- 100,129 ---- y = getran(leny) or 1L test_division_2(x, y) + # ------------------------------------------------------------ karatsuba + + def test_karatsuba(): + if verbose: + print "Karatsuba" + + digits = range(1, 5) + range(KARATSUBA_CUTOFF, KARATSUBA_CUTOFF + 10) + digits.extend([KARATSUBA_CUTOFF * 10, KARATSUBA_CUTOFF * 100]) + + bits = [digit * SHIFT for digit in digits] + + # Test products of long strings of 1 bits -- (2**x-1)*(2**y-1) == + # 2**(x+y) - 2**x - 2**y + 1, so the proper result is easy to check. + for abits in bits: + a = (1L << abits) - 1 + for bbits in bits: + if bbits < abits: + continue + b = (1L << bbits) - 1 + x = a * b + y = ((1L << (abits + bbits)) - + (1L << abits) - + (1L << bbits) + + 1) + check(x == y, "bad result for", a, "*", b, x, y) # -------------------------------------------------------------- ~ & | ^ *************** *** 404,407 **** --- 429,433 ---- test_division() + test_karatsuba() test_bitop_identities() test_format() From nnorwitz@users.sourceforge.net Tue Aug 13 23:19:16 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 15:19:16 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.175,2.176 descrobject.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11266/Objects Modified Files: typeobject.c descrobject.c Log Message: Allow more docstrings to be removed during compilation Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.175 retrieving revision 2.176 diff -C2 -d -r2.175 -r2.176 *** typeobject.c 13 Aug 2002 19:01:38 -0000 2.175 --- typeobject.c 13 Aug 2002 22:19:12 -0000 2.176 *************** *** 1578,1584 **** static PyMethodDef type_methods[] = { {"mro", (PyCFunction)mro_external, METH_NOARGS, ! "mro() -> list\nreturn a type's method resolution order"}, {"__subclasses__", (PyCFunction)type_subclasses, METH_NOARGS, ! "__subclasses__() -> list of immediate subclasses"}, {0} }; --- 1578,1584 ---- static PyMethodDef type_methods[] = { {"mro", (PyCFunction)mro_external, METH_NOARGS, ! PyDoc_STR("mro() -> list\nreturn a type's method resolution order")}, {"__subclasses__", (PyCFunction)type_subclasses, METH_NOARGS, ! PyDoc_STR("__subclasses__() -> list of immediate subclasses")}, {0} }; *************** *** 1904,1908 **** static PyMethodDef object_methods[] = { ! {"__reduce__", object_reduce, METH_NOARGS, "helper for pickle"}, {0} }; --- 1904,1909 ---- static PyMethodDef object_methods[] = { ! {"__reduce__", object_reduce, METH_NOARGS, ! PyDoc_STR("helper for pickle")}, {0} }; *************** *** 1930,1934 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ ! "The most base type", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ --- 1931,1935 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ ! PyDoc_STR("The most base type"), /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ *************** *** 2977,2981 **** static struct PyMethodDef tp_new_methoddef[] = { {"__new__", (PyCFunction)tp_new_wrapper, METH_KEYWORDS, ! "T.__new__(S, ...) -> a new object with type S, a subtype of T"}, {0} }; --- 2978,2983 ---- static struct PyMethodDef tp_new_methoddef[] = { {"__new__", (PyCFunction)tp_new_wrapper, METH_KEYWORDS, ! PyDoc_STR("T.__new__(S, ...) -> " ! "a new object with type S, a subtype of T")}, {0} }; Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** descrobject.c 14 Jun 2002 20:41:15 -0000 2.27 --- descrobject.c 13 Aug 2002 22:19:13 -0000 2.28 *************** *** 669,689 **** static PyMethodDef proxy_methods[] = { {"has_key", (PyCFunction)proxy_has_key, METH_O, ! "D.has_key(k) -> 1 if D has a key k, else 0"}, {"get", (PyCFunction)proxy_get, METH_VARARGS, ! "D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None."}, {"keys", (PyCFunction)proxy_keys, METH_NOARGS, ! "D.keys() -> list of D's keys"}, {"values", (PyCFunction)proxy_values, METH_NOARGS, ! "D.values() -> list of D's values"}, {"items", (PyCFunction)proxy_items, METH_NOARGS, ! "D.items() -> list of D's (key, value) pairs, as 2-tuples"}, {"iterkeys", (PyCFunction)proxy_iterkeys, METH_NOARGS, ! "D.iterkeys() -> an iterator over the keys of D"}, {"itervalues",(PyCFunction)proxy_itervalues, METH_NOARGS, ! "D.itervalues() -> an iterator over the values of D"}, {"iteritems", (PyCFunction)proxy_iteritems, METH_NOARGS, ! "D.iteritems() -> an iterator over the (key, value) items of D"}, {"copy", (PyCFunction)proxy_copy, METH_NOARGS, ! "D.copy() -> a shallow copy of D"}, {0} }; --- 669,691 ---- static PyMethodDef proxy_methods[] = { {"has_key", (PyCFunction)proxy_has_key, METH_O, ! PyDoc_STR("D.has_key(k) -> 1 if D has a key k, else 0")}, {"get", (PyCFunction)proxy_get, METH_VARARGS, ! PyDoc_STR("D.get(k[,d]) -> D[k] if D.has_key(k), else d." ! " d defaults to None.")}, {"keys", (PyCFunction)proxy_keys, METH_NOARGS, ! PyDoc_STR("D.keys() -> list of D's keys")}, {"values", (PyCFunction)proxy_values, METH_NOARGS, ! PyDoc_STR("D.values() -> list of D's values")}, {"items", (PyCFunction)proxy_items, METH_NOARGS, ! PyDoc_STR("D.items() -> list of D's (key, value) pairs, as 2-tuples")}, {"iterkeys", (PyCFunction)proxy_iterkeys, METH_NOARGS, ! PyDoc_STR("D.iterkeys() -> an iterator over the keys of D")}, {"itervalues",(PyCFunction)proxy_itervalues, METH_NOARGS, ! PyDoc_STR("D.itervalues() -> an iterator over the values of D")}, {"iteritems", (PyCFunction)proxy_iteritems, METH_NOARGS, ! PyDoc_STR("D.iteritems() ->" ! " an iterator over the (key, value) items of D")}, {"copy", (PyCFunction)proxy_copy, METH_NOARGS, ! PyDoc_STR("D.copy() -> a shallow copy of D")}, {0} }; From nnorwitz@users.sourceforge.net Tue Aug 13 23:20:43 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 15:20:43 -0700 Subject: [Python-checkins] python/dist/src/Modules symtablemodule.c,1.6,1.7 parsermodule.c,2.72,2.73 cPickle.c,2.93,2.94 operator.c,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11602/Modules Modified Files: symtablemodule.c parsermodule.c cPickle.c operator.c Log Message: Allow more docstrings to be removed during compilation in some modules Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** symtablemodule.c 2 Aug 2002 02:27:13 -0000 1.6 --- symtablemodule.c 13 Aug 2002 22:20:40 -0000 1.7 *************** *** 40,44 **** static PyMethodDef symtable_methods[] = { {"symtable", symtable_symtable, METH_VARARGS, ! "Return symbol and scope dictionaries used internally by compiler."}, {NULL, NULL} /* sentinel */ }; --- 40,45 ---- static PyMethodDef symtable_methods[] = { {"symtable", symtable_symtable, METH_VARARGS, ! PyDoc_STR("Return symbol and scope dictionaries" ! " used internally by compiler.")}, {NULL, NULL} /* sentinel */ }; Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.72 retrieving revision 2.73 diff -C2 -d -r2.72 -r2.73 *** parsermodule.c 23 Jul 2002 06:31:13 -0000 2.72 --- parsermodule.c 13 Aug 2002 22:20:40 -0000 2.73 *************** *** 443,455 **** parser_methods[] = { {"compile", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, ! "Compile this ST object into a code object."}, {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, ! "Determines if this ST object was created from an expression."}, {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, ! "Determines if this ST object was created from a suite."}, {"tolist", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, ! "Creates a list-tree representation of this ST."}, {"totuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, ! "Creates a tuple-tree representation of this ST."}, {NULL, NULL, 0, NULL} --- 443,455 ---- parser_methods[] = { {"compile", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Compile this ST object into a code object.")}, {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Determines if this ST object was created from an expression.")}, {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Determines if this ST object was created from a suite.")}, {"tolist", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates a list-tree representation of this ST.")}, {"totuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates a tuple-tree representation of this ST.")}, {NULL, NULL, 0, NULL} *************** *** 2817,2851 **** static PyMethodDef parser_functions[] = { {"ast2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, ! "Creates a tuple-tree representation of an ST."}, {"ast2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, ! "Creates a list-tree representation of an ST."}, {"compileast", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, ! "Compiles an ST object into a code object."}, {"compilest", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, ! "Compiles an ST object into a code object."}, {"expr", (PyCFunction)parser_expr, PUBLIC_METHOD_TYPE, ! "Creates an ST object from an expression."}, {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, ! "Determines if an ST object was created from an expression."}, {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, ! "Determines if an ST object was created from a suite."}, {"suite", (PyCFunction)parser_suite, PUBLIC_METHOD_TYPE, ! "Creates an ST object from a suite."}, {"sequence2ast", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! "Creates an ST object from a tree representation."}, {"sequence2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! "Creates an ST object from a tree representation."}, {"st2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, ! "Creates a tuple-tree representation of an ST."}, {"st2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, ! "Creates a list-tree representation of an ST."}, {"tuple2ast", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! "Creates an ST object from a tree representation."}, {"tuple2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! "Creates an ST object from a tree representation."}, /* private stuff: support pickle module */ {"_pickler", (PyCFunction)parser__pickler, METH_VARARGS, ! "Returns the pickle magic to allow ST objects to be pickled."}, {NULL, NULL, 0, NULL} --- 2817,2851 ---- static PyMethodDef parser_functions[] = { {"ast2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates a tuple-tree representation of an ST.")}, {"ast2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates a list-tree representation of an ST.")}, {"compileast", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Compiles an ST object into a code object.")}, {"compilest", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Compiles an ST object into a code object.")}, {"expr", (PyCFunction)parser_expr, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates an ST object from an expression.")}, {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Determines if an ST object was created from an expression.")}, {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Determines if an ST object was created from a suite.")}, {"suite", (PyCFunction)parser_suite, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates an ST object from a suite.")}, {"sequence2ast", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates an ST object from a tree representation.")}, {"sequence2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates an ST object from a tree representation.")}, {"st2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates a tuple-tree representation of an ST.")}, {"st2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates a list-tree representation of an ST.")}, {"tuple2ast", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates an ST object from a tree representation.")}, {"tuple2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, ! PyDoc_STR("Creates an ST object from a tree representation.")}, /* private stuff: support pickle module */ {"_pickler", (PyCFunction)parser__pickler, METH_VARARGS, ! PyDoc_STR("Returns the pickle magic to allow ST objects to be pickled.")}, {NULL, NULL, 0, NULL} Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -d -r2.93 -r2.94 *** cPickle.c 4 Aug 2002 08:20:23 -0000 2.93 --- cPickle.c 13 Aug 2002 22:20:40 -0000 2.94 *************** *** 2296,2305 **** { {"dump", (PyCFunction)Pickler_dump, METH_VARARGS, ! "dump(object) --" ! "Write an object in pickle format to the object's pickle stream"}, {"clear_memo", (PyCFunction)Pickle_clear_memo, METH_NOARGS, ! "clear_memo() -- Clear the picklers memo"}, {"getvalue", (PyCFunction)Pickle_getvalue, METH_VARARGS, ! "getvalue() -- Finish picking a list-based pickle"}, {NULL, NULL} /* sentinel */ }; --- 2296,2305 ---- { {"dump", (PyCFunction)Pickler_dump, METH_VARARGS, ! PyDoc_STR("dump(object) -- " ! "Write an object in pickle format to the object's pickle stream")}, {"clear_memo", (PyCFunction)Pickle_clear_memo, METH_NOARGS, ! PyDoc_STR("clear_memo() -- Clear the picklers memo")}, {"getvalue", (PyCFunction)Pickle_getvalue, METH_VARARGS, ! PyDoc_STR("getvalue() -- Finish picking a list-based pickle")}, {NULL, NULL} /* sentinel */ }; *************** *** 4302,4308 **** static struct PyMethodDef Unpickler_methods[] = { {"load", (PyCFunction)Unpickler_load, METH_VARARGS, ! "load() -- Load a pickle" }, {"noload", (PyCFunction)Unpickler_noload, METH_VARARGS, "noload() -- not load a pickle, but go through most of the motions\n" "\n" --- 4302,4309 ---- static struct PyMethodDef Unpickler_methods[] = { {"load", (PyCFunction)Unpickler_load, METH_VARARGS, ! PyDoc_STR("load() -- Load a pickle") }, {"noload", (PyCFunction)Unpickler_noload, METH_VARARGS, + PyDoc_STR( "noload() -- not load a pickle, but go through most of the motions\n" "\n" *************** *** 4310,4314 **** "any objects or importing any modules. It can also be used to find all\n" "persistent references without instantiating any objects or importing\n" ! "any modules.\n" }, {NULL, NULL} /* sentinel */ --- 4311,4315 ---- "any objects or importing any modules. It can also be used to find all\n" "persistent references without instantiating any objects or importing\n" ! "any modules.\n") }, {NULL, NULL} /* sentinel */ *************** *** 4649,4680 **** static struct PyMethodDef cPickle_methods[] = { {"dump", (PyCFunction)cpm_dump, METH_VARARGS, ! "dump(object, file, [binary]) --" "Write an object in pickle format to the given file\n" "\n" "If the optional argument, binary, is provided and is true, then the\n" "pickle will be written in binary format, which is more space and\n" ! "computationally efficient. \n" }, {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS, ! "dumps(object, [binary]) --" "Return a string containing an object in pickle format\n" "\n" "If the optional argument, binary, is provided and is true, then the\n" "pickle will be written in binary format, which is more space and\n" ! "computationally efficient. \n" }, {"load", (PyCFunction)cpm_load, METH_VARARGS, ! "load(file) -- Load a pickle from the given file"}, {"loads", (PyCFunction)cpm_loads, METH_VARARGS, ! "loads(string) -- Load a pickle from the given string"}, {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS, ! "Pickler(file, [binary]) -- Create a pickler\n" "\n" "If the optional argument, binary, is provided and is true, then\n" "pickles will be written in binary format, which is more space and\n" ! "computationally efficient. \n" }, {"Unpickler", (PyCFunction)get_Unpickler, METH_VARARGS, ! "Unpickler(file) -- Create an unpickler"}, { NULL, NULL } }; --- 4650,4681 ---- static struct PyMethodDef cPickle_methods[] = { {"dump", (PyCFunction)cpm_dump, METH_VARARGS, ! PyDoc_STR("dump(object, file, [binary]) --" "Write an object in pickle format to the given file\n" "\n" "If the optional argument, binary, is provided and is true, then the\n" "pickle will be written in binary format, which is more space and\n" ! "computationally efficient. \n") }, {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS, ! PyDoc_STR("dumps(object, [binary]) --" "Return a string containing an object in pickle format\n" "\n" "If the optional argument, binary, is provided and is true, then the\n" "pickle will be written in binary format, which is more space and\n" ! "computationally efficient. \n") }, {"load", (PyCFunction)cpm_load, METH_VARARGS, ! PyDoc_STR("load(file) -- Load a pickle from the given file")}, {"loads", (PyCFunction)cpm_loads, METH_VARARGS, ! PyDoc_STR("loads(string) -- Load a pickle from the given string")}, {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS, ! PyDoc_STR("Pickler(file, [binary]) -- Create a pickler\n" "\n" "If the optional argument, binary, is provided and is true, then\n" "pickles will be written in binary format, which is more space and\n" ! "computationally efficient. \n") }, {"Unpickler", (PyCFunction)get_Unpickler, METH_VARARGS, ! PyDoc_STR("Unpickler(file) -- Create an unpickler")}, { NULL, NULL } }; Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** operator.c 2 Aug 2002 02:27:13 -0000 2.22 --- operator.c 13 Aug 2002 22:20:41 -0000 2.23 *************** *** 147,153 **** #undef spam1 #undef spam2 ! #define spam1(OP,DOC) {#OP, OP, METH_VARARGS, DOC}, #define spam2(OP,ALTOP,DOC) {#OP, op_##OP, METH_VARARGS, DOC}, \ ! {#ALTOP, op_##OP, METH_VARARGS, DOC}, static struct PyMethodDef operator_methods[] = { --- 147,153 ---- #undef spam1 #undef spam2 ! #define spam1(OP,DOC) {#OP, OP, METH_VARARGS, PyDoc_STR(DOC)}, #define spam2(OP,ALTOP,DOC) {#OP, op_##OP, METH_VARARGS, DOC}, \ ! {#ALTOP, op_##OP, METH_VARARGS, PyDoc_STR(DOC)}, static struct PyMethodDef operator_methods[] = { From tim_one@users.sourceforge.net Wed Aug 14 00:29:23 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 16:29:23 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30312/python/Lib Modified Files: tempfile.py Log Message: _once(): Simplified dict manipulation. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** tempfile.py 9 Aug 2002 18:00:27 -0000 1.41 --- tempfile.py 13 Aug 2002 23:29:21 -0000 1.42 *************** *** 102,111 **** # Check first outside the lock. ! if var in vars and vars[var] is not None: return try: lock.acquire() # Check again inside the lock. ! if var in vars and vars[var] is not None: return vars[var] = initializer() --- 102,111 ---- # Check first outside the lock. ! if vars.get(var) is not None: return try: lock.acquire() # Check again inside the lock. ! if vars.get(var) is not None: return vars[var] = initializer() From tim_one@users.sourceforge.net Wed Aug 14 00:31:04 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 16:31:04 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30656/python/Lib Modified Files: tempfile.py Log Message: _once(): Removed obfuscating aliasing of _once_lock. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tempfile.py 13 Aug 2002 23:29:21 -0000 1.42 --- tempfile.py 13 Aug 2002 23:31:02 -0000 1.43 *************** *** 99,109 **** vars = globals() - lock = _once_lock - # Check first outside the lock. if vars.get(var) is not None: return try: ! lock.acquire() # Check again inside the lock. if vars.get(var) is not None: --- 99,107 ---- vars = globals() # Check first outside the lock. if vars.get(var) is not None: return try: ! _once_lock.acquire() # Check again inside the lock. if vars.get(var) is not None: *************** *** 111,115 **** vars[var] = initializer() finally: ! lock.release() class _RandomNameSequence: --- 109,113 ---- vars[var] = initializer() finally: ! _once_lock.release() class _RandomNameSequence: From tim_one@users.sourceforge.net Wed Aug 14 00:33:59 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 16:33:59 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31318/python/Lib Modified Files: tempfile.py Log Message: template: removed special-casing for NT; there isn't an 8-character limit. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tempfile.py 13 Aug 2002 23:31:02 -0000 1.43 --- tempfile.py 13 Aug 2002 23:33:56 -0000 1.44 *************** *** 73,80 **** TMP_MAX = 10000 ! if _os.name == 'nt': ! template = '~t' # cater to eight-letter limit ! else: ! template = "tmp" tempdir = None --- 73,77 ---- TMP_MAX = 10000 ! template = "tmp" tempdir = None From tim_one@users.sourceforge.net Wed Aug 14 00:36:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 16:36:03 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31716/python/Lib Modified Files: tempfile.py Log Message: NamedTemporaryFile(), TemporaryFile(): removed needless local vrbl 'bin'. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** tempfile.py 13 Aug 2002 23:33:56 -0000 1.44 --- tempfile.py 13 Aug 2002 23:36:01 -0000 1.45 *************** *** 397,403 **** """ ! bin = 'b' in mode ! if bin: flags = _bin_openflags ! else: flags = _text_openflags # Setting O_TEMPORARY in the flags causes the OS to delete --- 397,404 ---- """ ! if 'b' in mode: ! flags = _bin_openflags ! else: ! flags = _text_openflags # Setting O_TEMPORARY in the flags causes the OS to delete *************** *** 429,435 **** """ ! bin = 'b' in mode ! if bin: flags = _bin_openflags ! else: flags = _text_openflags (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) --- 430,437 ---- """ ! if 'b' in mode: ! flags = _bin_openflags ! else: ! flags = _text_openflags (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) From tim_one@users.sourceforge.net Wed Aug 14 00:38:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 16:38:32 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32236/python/Lib Modified Files: tempfile.py Log Message: mkstemp(): The optional "binary" argument is clearly intended to be a Boolean, so changed its default value from 1 to True. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tempfile.py 13 Aug 2002 23:36:01 -0000 1.45 --- tempfile.py 13 Aug 2002 23:38:30 -0000 1.46 *************** *** 251,255 **** return tempdir ! def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=1): """mkstemp([suffix, [prefix, [dir, [binary]]]]) User-callable function to create and return a unique temporary --- 251,255 ---- return tempdir ! def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=True): """mkstemp([suffix, [prefix, [dir, [binary]]]]) User-callable function to create and return a unique temporary From tim_one@users.sourceforge.net Wed Aug 14 01:49:53 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 17:49:53 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16084/python/Lib Modified Files: tempfile.py Log Message: mkstemp(): Repaired error in docstring (the sense of the 'binary' flag was reversed). Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tempfile.py 13 Aug 2002 23:38:30 -0000 1.46 --- tempfile.py 14 Aug 2002 00:49:50 -0000 1.47 *************** *** 266,271 **** otherwise a default directory is used. ! If 'binary' is specified and false, the file is opened in binary ! mode. Otherwise, the file is opened in text mode. On some operating systems, this makes no difference. --- 266,271 ---- otherwise a default directory is used. ! If 'binary' is specified and false, the file is opened in text ! mode. Otherwise, the file is opened in binary mode. On some operating systems, this makes no difference. From tim_one@users.sourceforge.net Wed Aug 14 02:05:59 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 13 Aug 2002 18:05:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pkg.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18298/python/Lib/test Modified Files: test_pkg.py Log Message: runtest(): I don't know why we don't just use TESTFN, but if we have to do bizarre things to get a temp file, I changed it to use mkstemp instead of NamedTemporaryFile. This tried to leave the file open while passing its name to execfile(). On Win2K (but not Win9X), though, a file created with O_TEMPORARY cannot be opened again, so the test failed with a permission error when execfile tried to open it. Closer to the truth: a file created with O_TEMPORARY can be opened again, but only if the file is also created with SHARE_DELETE access via the Win32 CreateFile() function. There's no way to get at that from MS's version of libc, though (we'd have to ditch the "std" C file functions in favor of Win32 API calls). Index: test_pkg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkg.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_pkg.py 9 Aug 2002 16:37:35 -0000 1.16 --- test_pkg.py 14 Aug 2002 01:05:57 -0000 1.17 *************** *** 57,72 **** mkhier(root, hier) savepath = sys.path[:] ! codefile = tempfile.NamedTemporaryFile() ! codefile.write(code) ! codefile.flush() try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: ! execfile(codefile.name, globals(), {}) except: traceback.print_exc(file=sys.stdout) finally: sys.path[:] = savepath try: cleanout(root) --- 57,73 ---- mkhier(root, hier) savepath = sys.path[:] ! fd, fname = tempfile.mkstemp(binary=False) ! os.write(fd, code) ! os.close(fd) try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: ! execfile(fname, globals(), {}) except: traceback.print_exc(file=sys.stdout) finally: sys.path[:] = savepath + os.unlink(fname) try: cleanout(root) From montanaro@users.sourceforge.net Wed Aug 14 02:44:36 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 13 Aug 2002 18:44:36 -0700 Subject: [Python-checkins] python/dist/src/Modules xxmodule.c,2.31,2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv4607 Modified Files: xxmodule.c Log Message: add PyDoc_STR and PyDoc_STRVAR calls as examples for module authors Index: xxmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxmodule.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** xxmodule.c 2 Aug 2002 02:27:13 -0000 2.31 --- xxmodule.c 14 Aug 2002 01:44:33 -0000 2.32 *************** *** 58,62 **** static PyMethodDef Xxo_methods[] = { ! {"demo", (PyCFunction)Xxo_demo, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; --- 58,63 ---- static PyMethodDef Xxo_methods[] = { ! {"demo", (PyCFunction)Xxo_demo, METH_VARARGS, ! PyDoc_STR("demo() -> None")}, {NULL, NULL} /* sentinel */ }; *************** *** 144,147 **** --- 145,153 ---- /* Function of two integers returning integer */ + PyDoc_STRVAR(xx_foo_doc, + "foo(i,j)\n\ + \n\ + Return the sum of i and j."); + static PyObject * xx_foo(PyObject *self, PyObject *args) *************** *** 209,219 **** static PyMethodDef xx_methods[] = { ! {"roj", xx_roj, METH_VARARGS}, ! {"foo", xx_foo, METH_VARARGS}, ! {"new", xx_new, METH_VARARGS}, ! {"bug", xx_bug, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; /* Initialization function for the module (*must* be called initxx) */ --- 215,231 ---- static PyMethodDef xx_methods[] = { ! {"roj", xx_roj, METH_VARARGS, ! PyDoc_STR("roj(a,b) -> None")}, ! {"foo", xx_foo, METH_VARARGS, ! xx_foo_doc}, ! {"new", xx_new, METH_VARARGS, ! PyDoc_STR("new() -> new Xx object")}, ! {"bug", xx_bug, METH_VARARGS, ! PyDoc_STR("bug(o) -> None")}, {NULL, NULL} /* sentinel */ }; + PyDoc_STRVAR(module_doc, + "This is a template module just for instruction."); /* Initialization function for the module (*must* be called initxx) */ *************** *** 229,233 **** /* Create the module and add the functions */ ! m = Py_InitModule("xx", xx_methods); /* Add some symbolic constants to the module */ --- 241,245 ---- /* Create the module and add the functions */ ! m = Py_InitModule3("xx", xx_methods, module_doc); /* Add some symbolic constants to the module */ From montanaro@users.sourceforge.net Wed Aug 14 02:45:40 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 13 Aug 2002 18:45:40 -0700 Subject: [Python-checkins] python/dist/src/Modules xxsubtype.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5178 Modified Files: xxsubtype.c Log Message: add some example docstrings using PyDoc_STR Index: xxsubtype.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xxsubtype.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** xxsubtype.c 2 Aug 2002 02:27:13 -0000 2.17 --- xxsubtype.c 14 Aug 2002 01:45:37 -0000 2.18 *************** *** 66,80 **** static PyMethodDef spamlist_methods[] = { {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, ! "getstate() -> state"}, {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, ! "setstate(state)"}, /* These entries differ only in the flags; they are used by the tests in test.test_descr. */ {"classmeth", (PyCFunction)spamlist_specialmeth, METH_VARARGS | METH_KEYWORDS | METH_CLASS, ! "classmeth(*args, **kw)"}, {"staticmeth", (PyCFunction)spamlist_specialmeth, METH_VARARGS | METH_KEYWORDS | METH_STATIC, ! "staticmeth(*args, **kw)"}, {NULL, NULL}, }; --- 66,80 ---- static PyMethodDef spamlist_methods[] = { {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, ! PyDoc_STR("getstate() -> state")}, {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, ! PyDoc_STR("setstate(state)")}, /* These entries differ only in the flags; they are used by the tests in test.test_descr. */ {"classmeth", (PyCFunction)spamlist_specialmeth, METH_VARARGS | METH_KEYWORDS | METH_CLASS, ! PyDoc_STR("classmeth(*args, **kw)")}, {"staticmeth", (PyCFunction)spamlist_specialmeth, METH_VARARGS | METH_KEYWORDS | METH_STATIC, ! PyDoc_STR("staticmeth(*args, **kw)")}, {NULL, NULL}, }; *************** *** 99,103 **** static PyGetSetDef spamlist_getsets[] = { {"state", (getter)spamlist_state_get, NULL, ! "an int variable for demonstration purposes"}, {0} }; --- 99,103 ---- static PyGetSetDef spamlist_getsets[] = { {"state", (getter)spamlist_state_get, NULL, ! PyDoc_STR("an int variable for demonstration purposes")}, {0} }; *************** *** 174,180 **** static PyMethodDef spamdict_methods[] = { {"getstate", (PyCFunction)spamdict_getstate, METH_VARARGS, ! "getstate() -> state"}, {"setstate", (PyCFunction)spamdict_setstate, METH_VARARGS, ! "setstate(state)"}, {NULL, NULL}, }; --- 174,180 ---- static PyMethodDef spamdict_methods[] = { {"getstate", (PyCFunction)spamdict_getstate, METH_VARARGS, ! PyDoc_STR("getstate() -> state")}, {"setstate", (PyCFunction)spamdict_setstate, METH_VARARGS, ! PyDoc_STR("setstate(state)")}, {NULL, NULL}, }; *************** *** 193,197 **** static PyMemberDef spamdict_members[] = { {"state", T_INT, offsetof(spamdictobject, state), READONLY, ! "an int variable for demonstration purposes"}, {0} }; --- 193,197 ---- static PyMemberDef spamdict_members[] = { {"state", T_INT, offsetof(spamdictobject, state), READONLY, ! PyDoc_STR("an int variable for demonstration purposes")}, {0} }; From nnorwitz@users.sourceforge.net Wed Aug 14 03:03:52 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 13 Aug 2002 19:03:52 -0700 Subject: [Python-checkins] python/dist/src/Modules mpzmodule.c,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13175/Modules Modified Files: mpzmodule.c Log Message: Fix memory leaks reported by valgrind Index: mpzmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** mpzmodule.c 2 Aug 2002 02:27:13 -0000 2.45 --- mpzmodule.c 14 Aug 2002 02:03:50 -0000 2.46 *************** *** 962,966 **** PyObject *base, *exp, *mod; mpzobject *mpzbase = NULL, *mpzexp = NULL, *mpzmod = NULL; ! mpzobject *z; int tstres; --- 962,966 ---- PyObject *base, *exp, *mod; mpzobject *mpzbase = NULL, *mpzexp = NULL, *mpzmod = NULL; ! mpzobject *z = NULL; int tstres; *************** *** 976,983 **** --- 976,988 ---- Py_XDECREF(mpzexp); Py_XDECREF(mpzmod); + Py_XDECREF(z); return NULL; } if ((tstres=mpz_cmp_ui(&mpzexp->mpz, (unsigned long int)0)) == 0) { + Py_DECREF(mpzbase); + Py_DECREF(mpzexp); + Py_DECREF(mpzmod); + Py_DECREF(z); Py_INCREF(mpz_value_one); return (PyObject *)mpz_value_one; *************** *** 988,991 **** --- 993,997 ---- Py_DECREF(mpzexp); Py_DECREF(mpzmod); + Py_DECREF(z); PyErr_SetString(PyExc_ValueError, "modulus cannot be 0"); return NULL; From montanaro@users.sourceforge.net Wed Aug 14 03:58:18 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 13 Aug 2002 19:58:18 -0700 Subject: [Python-checkins] python/dist/src/Lib fileinput.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2831 Modified Files: fileinput.py Log Message: tightening up a few except: clauses see bug 411881 Index: fileinput.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/fileinput.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** fileinput.py 6 Jun 2002 09:48:12 -0000 1.14 --- fileinput.py 14 Aug 2002 02:58:16 -0000 1.15 *************** *** 262,266 **** if backupfilename and not self._backup: try: os.unlink(backupfilename) ! except: pass self._isstdin = False --- 262,266 ---- if backupfilename and not self._backup: try: os.unlink(backupfilename) ! except OSError: pass self._isstdin = False *************** *** 302,306 **** try: perm = os.fstat(self._file.fileno()).st_mode ! except: self._output = open(self._filename, "w") else: --- 302,306 ---- try: perm = os.fstat(self._file.fileno()).st_mode ! except OSError: self._output = open(self._filename, "w") else: *************** *** 311,315 **** try: os.chmod(self._filename, perm) ! except: pass self._savestdout = sys.stdout --- 311,315 ---- try: os.chmod(self._filename, perm) ! except OSError: pass self._savestdout = sys.stdout From loewis@users.sourceforge.net Wed Aug 14 08:46:25 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:46:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings string_escape.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv761/Lib/encodings Added Files: string_escape.py Log Message: Patch #505705: Remove eval in pickle and cPickle. --- NEW FILE: string_escape.py --- (This appears to be a binary file; contents omitted.) From loewis@users.sourceforge.net Wed Aug 14 08:46:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:46:35 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.255,2.256 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv761/Python Modified Files: compile.c Log Message: Patch #505705: Remove eval in pickle and cPickle. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.255 retrieving revision 2.256 diff -C2 -d -r2.255 -r2.256 *** compile.c 12 Aug 2002 21:54:46 -0000 2.255 --- compile.c 14 Aug 2002 07:46:28 -0000 2.256 *************** *** 1227,1233 **** char *p; char *end; ! int c; ! int first = *s; ! int quote = first; int rawmode = 0; char* encoding = ((com == NULL) ? NULL : com->c_encoding); --- 1227,1231 ---- char *p; char *end; ! int quote = *s; int rawmode = 0; char* encoding = ((com == NULL) ? NULL : com->c_encoding); *************** *** 1348,1447 **** } } ! v = PyString_FromStringAndSize((char *)NULL, /* XXX 4 is enough? */ ! need_encoding ? len * 4 : len); if (v == NULL) ! return NULL; ! p = buf = PyString_AsString(v); ! end = s + len; ! while (s < end) { ! if (*s != '\\') { ! ORDINAL: ! if (need_encoding && (*s & 0x80)) { ! char *r; ! int rn; ! PyObject* w = decode_utf8(&s, end, encoding); ! if (w == NULL) ! return NULL; ! r = PyString_AsString(w); ! rn = PyString_Size(w); ! memcpy(p, r, rn); ! p += rn; ! Py_DECREF(w); ! } else { ! *p++ = *s++; ! } ! continue; ! } ! s++; ! switch (*s++) { ! /* XXX This assumes ASCII! */ ! case '\n': break; ! case '\\': *p++ = '\\'; break; ! case '\'': *p++ = '\''; break; ! case '\"': *p++ = '\"'; break; ! case 'b': *p++ = '\b'; break; ! case 'f': *p++ = '\014'; break; /* FF */ ! case 't': *p++ = '\t'; break; ! case 'n': *p++ = '\n'; break; ! case 'r': *p++ = '\r'; break; ! case 'v': *p++ = '\013'; break; /* VT */ ! case 'a': *p++ = '\007'; break; /* BEL, not classic C */ ! case '0': case '1': case '2': case '3': ! case '4': case '5': case '6': case '7': ! c = s[-1] - '0'; ! if ('0' <= *s && *s <= '7') { ! c = (c<<3) + *s++ - '0'; ! if ('0' <= *s && *s <= '7') ! c = (c<<3) + *s++ - '0'; ! } ! *p++ = c; ! break; ! case 'x': ! if (isxdigit(Py_CHARMASK(s[0])) ! && isxdigit(Py_CHARMASK(s[1]))) { ! unsigned int x = 0; ! c = Py_CHARMASK(*s); ! s++; ! if (isdigit(c)) ! x = c - '0'; ! else if (islower(c)) ! x = 10 + c - 'a'; ! else ! x = 10 + c - 'A'; ! x = x << 4; ! c = Py_CHARMASK(*s); ! s++; ! if (isdigit(c)) ! x += c - '0'; ! else if (islower(c)) ! x += 10 + c - 'a'; ! else ! x += 10 + c - 'A'; ! *p++ = x; ! break; ! } ! Py_DECREF(v); ! com_error(com, PyExc_ValueError, ! "invalid \\x escape"); ! return NULL; ! #ifndef Py_USING_UNICODE ! case 'u': ! case 'U': ! case 'N': ! if (unicode) { ! Py_DECREF(v); ! com_error(com, PyExc_ValueError, ! "Unicode escapes not legal " ! "when Unicode disabled"); ! return NULL; ! } ! #endif ! default: ! *p++ = '\\'; ! s--; ! goto ORDINAL; ! } ! } ! _PyString_Resize(&v, (int)(p - buf)); return v; } --- 1346,1354 ---- } } ! ! v = PyString_DecodeEscape(s, len, NULL, unicode, ! need_encoding ? encoding : NULL); if (v == NULL) ! PyErr_SyntaxLocation(com->c_filename, com->c_lineno); return v; } From loewis@users.sourceforge.net Wed Aug 14 08:46:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:46:55 -0700 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv761/Lib Modified Files: pickle.py Log Message: Patch #505705: Remove eval in pickle and cPickle. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** pickle.py 16 Jul 2002 19:47:43 -0000 1.68 --- pickle.py 14 Aug 2002 07:46:22 -0000 1.69 *************** *** 127,130 **** --- 127,132 ---- del x + _quotes = ["'", '"'] + class Pickler: *************** *** 741,748 **** def load_string(self): rep = self.readline()[:-1] ! if not self._is_string_secure(rep): raise ValueError, "insecure string pickle" ! self.append(eval(rep, ! {'__builtins__': {}})) # Let's be careful dispatch[STRING] = load_string --- 743,755 ---- def load_string(self): rep = self.readline()[:-1] ! for q in _quotes: ! if rep.startswith(q): ! if not rep.endswith(q): ! raise ValueError, "insecure string pickle" ! rep = rep[len(q):-len(q)] ! break ! else: raise ValueError, "insecure string pickle" ! self.append(rep.decode("string-escape")) dispatch[STRING] = load_string From loewis@users.sourceforge.net Wed Aug 14 08:46:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:46:55 -0700 Subject: [Python-checkins] python/dist/src/Include stringobject.h,2.35,2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv761/Include Modified Files: stringobject.h Log Message: Patch #505705: Remove eval in pickle and cPickle. Index: stringobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/stringobject.h,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** stringobject.h 12 Aug 2002 07:21:57 -0000 2.35 --- stringobject.h 14 Aug 2002 07:46:22 -0000 2.36 *************** *** 54,57 **** --- 54,58 ---- PyAPI_FUNC(int) PyString_Size(PyObject *); PyAPI_FUNC(char *) PyString_AsString(PyObject *); + PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); *************** *** 61,64 **** --- 62,68 ---- PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); + extern DL_IMPORT(PyObject *) PyString_DecodeEscape(const char *, int, + const char *, int, + const char *); PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); From loewis@users.sourceforge.net Wed Aug 14 08:46:56 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:46:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv761/Lib/test Modified Files: pickletester.py Log Message: Patch #505705: Remove eval in pickle and cPickle. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pickletester.py 9 Aug 2002 16:37:35 -0000 1.17 --- pickletester.py 14 Aug 2002 07:46:23 -0000 1.18 *************** *** 196,206 **** def test_insecure_strings(self): insecure = ["abc", "2 + 2", # not quoted ! "'abc' + 'def'", # not a single quoted string "'abc", # quote is not closed "'abc\"", # open quote and close quote don't match "'abc' ?", # junk after close quote # some tests of the quoting rules ! "'abc\"\''", ! "'\\\\a\'\'\'\\\'\\\\\''", ] for s in insecure: --- 196,206 ---- def test_insecure_strings(self): insecure = ["abc", "2 + 2", # not quoted ! #"'abc' + 'def'", # not a single quoted string "'abc", # quote is not closed "'abc\"", # open quote and close quote don't match "'abc' ?", # junk after close quote # some tests of the quoting rules ! #"'abc\"\''", ! #"'\\\\a\'\'\'\\\'\\\\\''", ] for s in insecure: From loewis@users.sourceforge.net Wed Aug 14 08:46:58 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:46:58 -0700 Subject: [Python-checkins] python/dist/src/Modules _codecsmodule.c,2.13,2.14 cPickle.c,2.94,2.95 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv761/Modules Modified Files: _codecsmodule.c cPickle.c Log Message: Patch #505705: Remove eval in pickle and cPickle. Index: _codecsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_codecsmodule.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** _codecsmodule.c 2 Aug 2002 02:27:13 -0000 2.13 --- _codecsmodule.c 14 Aug 2002 07:46:24 -0000 2.14 *************** *** 72,76 **** } - #ifdef Py_USING_UNICODE /* --- Helpers ------------------------------------------------------------ */ --- 72,75 ---- *************** *** 98,101 **** --- 97,143 ---- } + /* --- String codecs ------------------------------------------------------ */ + static PyObject * + escape_decode(PyObject *self, + PyObject *args) + { + const char *errors = NULL; + const char *data; + int size; + + if (!PyArg_ParseTuple(args, "s#|z:escape_decode", + &data, &size, &errors)) + return NULL; + return codec_tuple(PyString_DecodeEscape(data, size, errors, 0, NULL), + size); + } + + static PyObject * + escape_encode(PyObject *self, + PyObject *args) + { + PyObject *str; + const char *errors = NULL; + char *buf; + int len; + + if (!PyArg_ParseTuple(args, "O!|z:escape_encode", + &PyString_Type, &str, &errors)) + return NULL; + + str = PyString_Repr(str, 0); + if (!str) + return NULL; + + /* The string will be quoted. Unquote, similar to unicode-escape. */ + buf = PyString_AS_STRING (str); + len = PyString_GET_SIZE (str); + memmove(buf, buf+1, len-2); + _PyString_Resize(&str, len-2); + + return codec_tuple(str, PyString_Size(str)); + } + + #ifdef Py_USING_UNICODE /* --- Decoder ------------------------------------------------------------ */ *************** *** 670,673 **** --- 712,717 ---- {"register", codecregister, METH_VARARGS}, {"lookup", codeclookup, METH_VARARGS}, + {"escape_encode", escape_encode, METH_VARARGS}, + {"escape_decode", escape_decode, METH_VARARGS}, #ifdef Py_USING_UNICODE {"utf_8_encode", utf_8_encode, METH_VARARGS}, Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.94 retrieving revision 2.95 diff -C2 -d -r2.94 -r2.95 *** cPickle.c 13 Aug 2002 22:20:40 -0000 2.94 --- cPickle.c 14 Aug 2002 07:46:26 -0000 2.95 *************** *** 2865,2872 **** { PyObject *str = 0; ! int len, res = -1, nslash; ! char *s, q, *p; ! ! static PyObject *eval_dict = 0; if ((len = (*self->readline_func)(self, &s)) < 0) return -1; --- 2865,2870 ---- { PyObject *str = 0; ! int len, res = -1; ! char *s, *p; if ((len = (*self->readline_func)(self, &s)) < 0) return -1; *************** *** 2874,2908 **** if (!( s=pystrndup(s,len))) return -1; ! /* Check for unquoted quotes (evil strings) */ ! q=*s; ! if (q != '"' && q != '\'') goto insecure; ! for (p=s+1, nslash=0; *p; p++) { ! if (*p==q && nslash%2==0) break; ! if (*p=='\\') nslash++; ! else nslash=0; ! } ! if (*p == q) { ! for (p++; *p; p++) ! if (*(unsigned char *)p > ' ') ! goto insecure; ! } ! else goto insecure; /********************************************/ ! if (!( eval_dict )) ! if (!( eval_dict = Py_BuildValue("{s{}}", "__builtins__"))) ! goto finally; ! ! if (!( str = PyRun_String(s, Py_eval_input, eval_dict, eval_dict))) ! goto finally; ! ! free(s); ! PDATA_PUSH(self->stack, str, -1); ! return 0; ! ! finally: free(s); - return res; --- 2872,2897 ---- if (!( s=pystrndup(s,len))) return -1; ! ! /* Strip outermost quotes */ ! while (s[len-1] <= ' ') ! len--; ! if(s[0]=='"' && s[len-1]=='"'){ ! s[len-1] = '\0'; ! p = s + 1 ; ! len -= 2; ! } else if(s[0]=='\'' && s[len-1]=='\''){ ! s[len-1] = '\0'; ! p = s + 1 ; ! len -= 2; ! } else goto insecure; /********************************************/ ! str = PyString_DecodeEscape(p, len, NULL, 0, NULL); ! if (str) { ! PDATA_PUSH(self->stack, str, -1); ! res = 0; ! } free(s); return res; From loewis@users.sourceforge.net Wed Aug 14 08:47:00 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 00:47:00 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.176,2.177 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv761/Objects Modified Files: stringobject.c Log Message: Patch #505705: Remove eval in pickle and cPickle. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.176 retrieving revision 2.177 diff -C2 -d -r2.176 -r2.177 *** stringobject.c 11 Aug 2002 04:24:11 -0000 2.176 --- stringobject.c 14 Aug 2002 07:46:26 -0000 2.177 *************** *** 490,493 **** --- 490,639 ---- } + /* Unescape a backslash-escaped string. If unicode is non-zero, + the string is a u-literal. If recode_encoding is non-zero, + the string is UTF-8 encoded and should be re-encoded in the + specified encoding. */ + + PyObject *PyString_DecodeEscape(const char *s, + int len, + const char *errors, + int unicode, + const char *recode_encoding) + { + int c; + char *p, *buf; + const char *end; + PyObject *v; + v = PyString_FromStringAndSize((char *)NULL, + recode_encoding ? 4*len:len); + if (v == NULL) + return NULL; + p = buf = PyString_AsString(v); + end = s + len; + while (s < end) { + if (*s != '\\') { + #ifdef Py_USING_UNICODE + if (recode_encoding && (*s & 0x80)) { + PyObject *u, *w; + char *r; + const char* t; + int rn; + t = s; + /* Decode non-ASCII bytes as UTF-8. */ + while (t < end && (*t & 0x80)) t++; + u = PyUnicode_DecodeUTF8(s, t - s, errors); + if(!u) goto failed; + + /* Recode them in target encoding. */ + w = PyUnicode_AsEncodedString( + u, recode_encoding, errors); + Py_DECREF(u); + if (!w) goto failed; + + /* Append bytes to output buffer. */ + r = PyString_AsString(w); + rn = PyString_Size(w); + memcpy(p, r, rn); + p += rn; + Py_DECREF(w); + s = t; + } else { + *p++ = *s++; + } + #else + *p++ = *s++; + #endif + continue; + } + s++; + switch (*s++) { + /* XXX This assumes ASCII! */ + case '\n': break; + case '\\': *p++ = '\\'; break; + case '\'': *p++ = '\''; break; + case '\"': *p++ = '\"'; break; + case 'b': *p++ = '\b'; break; + case 'f': *p++ = '\014'; break; /* FF */ + case 't': *p++ = '\t'; break; + case 'n': *p++ = '\n'; break; + case 'r': *p++ = '\r'; break; + case 'v': *p++ = '\013'; break; /* VT */ + case 'a': *p++ = '\007'; break; /* BEL, not classic C */ + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = s[-1] - '0'; + if ('0' <= *s && *s <= '7') { + c = (c<<3) + *s++ - '0'; + if ('0' <= *s && *s <= '7') + c = (c<<3) + *s++ - '0'; + } + *p++ = c; + break; + case 'x': + if (isxdigit(Py_CHARMASK(s[0])) + && isxdigit(Py_CHARMASK(s[1]))) { + unsigned int x = 0; + c = Py_CHARMASK(*s); + s++; + if (isdigit(c)) + x = c - '0'; + else if (islower(c)) + x = 10 + c - 'a'; + else + x = 10 + c - 'A'; + x = x << 4; + c = Py_CHARMASK(*s); + s++; + if (isdigit(c)) + x += c - '0'; + else if (islower(c)) + x += 10 + c - 'a'; + else + x += 10 + c - 'A'; + *p++ = x; + break; + } + if (!errors || strcmp(errors, "strict") == 0) { + Py_DECREF(v); + PyErr_SetString(PyExc_ValueError, + "invalid \\x escape"); + return NULL; + } + if (strcmp(errors, "replace") == 0) { + *p++ = '?'; + } else if (strcmp(errors, "ignore") == 0) + /* do nothing */; + else { + PyErr_Format(PyExc_ValueError, + "decoding error; " + "unknown error handling code: %.400s", + errors); + return NULL; + } + #ifndef Py_USING_UNICODE + case 'u': + case 'U': + case 'N': + if (unicode) { + Py_DECREF(v); + com_error(com, PyExc_ValueError, + "Unicode escapes not legal " + "when Unicode disabled"); + return NULL; + } + #endif + default: + *p++ = '\\'; + *p++ = s[-1]; + break; + } + } + _PyString_Resize(&v, (int)(p - buf)); + return v; + failed: + Py_DECREF(v); + return NULL; + } + static int string_getsize(register PyObject *op) *************** *** 615,621 **** } ! static PyObject * ! string_repr(register PyStringObject *op) { size_t newsize = 2 + 4 * op->ob_size * sizeof(char); PyObject *v; --- 761,768 ---- } ! PyObject * ! PyString_Repr(PyObject *obj, int smartquotes) { + register PyStringObject* op = (PyStringObject*) obj; size_t newsize = 2 + 4 * op->ob_size * sizeof(char); PyObject *v; *************** *** 636,640 **** /* figure out which quote to use; single is preferred */ quote = '\''; ! if (memchr(op->ob_sval, '\'', op->ob_size) && !memchr(op->ob_sval, '"', op->ob_size)) quote = '"'; --- 783,788 ---- /* figure out which quote to use; single is preferred */ quote = '\''; ! if (smartquotes && ! memchr(op->ob_sval, '\'', op->ob_size) && !memchr(op->ob_sval, '"', op->ob_size)) quote = '"'; *************** *** 672,675 **** --- 820,829 ---- return v; } + } + + static PyObject * + string_repr(PyObject *op) + { + return PyString_Repr(op, 1); } From loewis@users.sourceforge.net Wed Aug 14 09:22:52 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 01:22:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10028/Lib/test Modified Files: pickletester.py Log Message: Check for trailing backslash. Fixes #593656. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pickletester.py 14 Aug 2002 07:46:23 -0000 1.18 --- pickletester.py 14 Aug 2002 08:22:50 -0000 1.19 *************** *** 200,203 **** --- 200,204 ---- "'abc\"", # open quote and close quote don't match "'abc' ?", # junk after close quote + "'\\'", # trailing backslash # some tests of the quoting rules #"'abc\"\''", From loewis@users.sourceforge.net Wed Aug 14 09:22:53 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 01:22:53 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.177,2.178 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10028/Objects Modified Files: stringobject.c Log Message: Check for trailing backslash. Fixes #593656. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.177 retrieving revision 2.178 diff -C2 -d -r2.177 -r2.178 *** stringobject.c 14 Aug 2002 07:46:26 -0000 2.177 --- stringobject.c 14 Aug 2002 08:22:50 -0000 2.178 *************** *** 547,550 **** --- 547,555 ---- } s++; + if (s==end) { + PyErr_SetString(PyExc_ValueError, + "Trailing \\ in string"); + goto failed; + } switch (*s++) { /* XXX This assumes ASCII! */ *************** *** 595,602 **** } if (!errors || strcmp(errors, "strict") == 0) { - Py_DECREF(v); PyErr_SetString(PyExc_ValueError, "invalid \\x escape"); ! return NULL; } if (strcmp(errors, "replace") == 0) { --- 600,606 ---- } if (!errors || strcmp(errors, "strict") == 0) { PyErr_SetString(PyExc_ValueError, "invalid \\x escape"); ! goto failed; } if (strcmp(errors, "replace") == 0) { *************** *** 609,613 **** "unknown error handling code: %.400s", errors); ! return NULL; } #ifndef Py_USING_UNICODE --- 613,617 ---- "unknown error handling code: %.400s", errors); ! goto failed; } #ifndef Py_USING_UNICODE *************** *** 616,624 **** case 'N': if (unicode) { - Py_DECREF(v); com_error(com, PyExc_ValueError, "Unicode escapes not legal " "when Unicode disabled"); ! return NULL; } #endif --- 620,627 ---- case 'N': if (unicode) { com_error(com, PyExc_ValueError, "Unicode escapes not legal " "when Unicode disabled"); ! goto failed; } #endif From jlt63@users.sourceforge.net Wed Aug 14 12:13:55 2002 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Wed, 14 Aug 2002 04:13:55 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.106,1.107 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv21613 Modified Files: setup.py Log Message: Patch #588564: _locale library patch This patch enables setup.py to find gettext routines when they are located in libintl instead of libc. Although I developed this patch for Cygwin, I hope that it can be easily updated to support other platforms (if necessary). I tested this patch under Cygwin and Red Hat Linux 7.1. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** setup.py 13 Aug 2002 20:09:26 -0000 1.106 --- setup.py 14 Aug 2002 11:13:52 -0000 1.107 *************** *** 303,307 **** exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support ! exts.append( Extension('_locale', ['_localemodule.c']) ) # Modules with some UNIX dependencies -- on by default: --- 303,312 ---- exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support ! if platform in ['cygwin']: ! locale_libs = ['intl'] ! else: ! locale_libs = [] ! exts.append( Extension('_locale', ['_localemodule.c'], ! libraries=locale_libs ) ) # Modules with some UNIX dependencies -- on by default: From gvanrossum@users.sourceforge.net Wed Aug 14 15:52:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 07:52:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29055 Modified Files: test_tempfile.py Log Message: test_many(): open only 100 temp files, not 1000. Some systems don't allow that many open files per process. I don't see that 1000 makes any difference for the test. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_tempfile.py 9 Aug 2002 18:13:51 -0000 1.4 --- test_tempfile.py 14 Aug 2002 14:52:02 -0000 1.5 *************** *** 157,161 **** dict = {} r = self.r ! for i in xrange(1000): s = r.next() self.nameCheck(s, '', '', '') --- 157,161 ---- dict = {} r = self.r ! for i in xrange(100): s = r.next() self.nameCheck(s, '', '', '') From bwarsaw@users.sourceforge.net Wed Aug 14 16:09:14 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:09:14 -0700 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5800 Modified Files: gettext.py Log Message: Patch by Tim to shut up the compiler's DeprecationWarnings on the high-bit-set hex constants. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gettext.py 1 Jun 2002 01:29:16 -0000 1.14 --- gettext.py 14 Aug 2002 15:09:12 -0000 1.15 *************** *** 140,151 **** class GNUTranslations(NullTranslations): # Magic number of .mo files ! LE_MAGIC = 0x950412de ! BE_MAGIC = 0xde120495 def _parse(self, fp): """Override this method to support alternative .mo formats.""" - # We need to & all 32 bit unsigned integers with 0xffffffff for - # portability to 64 bit machines. - MASK = 0xffffffff unpack = struct.unpack filename = getattr(fp, 'name', '') --- 140,148 ---- class GNUTranslations(NullTranslations): # Magic number of .mo files ! LE_MAGIC = 0x950412deL ! BE_MAGIC = 0xde120495L def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') *************** *** 156,181 **** buflen = len(buf) # Are we big endian or little endian? ! magic = unpack('4i', buf[4:20]) ! ii = '>ii' else: raise IOError(0, 'Bad magic number', filename) - # more unsigned ints - msgcount &= MASK - masteridx &= MASK - transidx &= MASK # Now put all messages from the .mo file buffer into the catalog # dictionary. for i in xrange(0, msgcount): mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) ! moff &= MASK ! mend = moff + (mlen & MASK) tlen, toff = unpack(ii, buf[transidx:transidx+8]) ! toff &= MASK ! tend = toff + (tlen & MASK) if mend < buflen and tend < buflen: tmsg = buf[toff:tend] --- 153,172 ---- buflen = len(buf) # Are we big endian or little endian? ! magic = unpack('4I', buf[4:20]) ! ii = '>II' else: raise IOError(0, 'Bad magic number', filename) # Now put all messages from the .mo file buffer into the catalog # dictionary. for i in xrange(0, msgcount): mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) ! mend = moff + mlen tlen, toff = unpack(ii, buf[transidx:transidx+8]) ! tend = toff + tlen if mend < buflen and tend < buflen: tmsg = buf[toff:tend] From jlt63@users.sourceforge.net Wed Aug 14 16:10:11 2002 From: jlt63@users.sourceforge.net (jlt63@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:10:11 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4384 Modified Files: tempfile.py Log Message: Patch #595014: Cygwin tempfile patch Although Cygwin attempts to be as Posix compliant as possible, it has difficulties unlinking open files. This is not surprising given that Cygwin is dependent on Win32 which in turn has this problem itself. The attached tempfile patch acknowledges this Cygwin limitation. Without this patch, Cygwin fails test_tempfile (i.e., test_has_no_name) as follows: $ ./python -E -tt ../Lib/test/regrtest.py -l test_tempfile test_tempfile test test_tempfile failed -- Traceback (most recent call last): File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 689, in test_has_no_name self.failOnException("rmdir", ei) File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 33, in failOnException self.fail("%s raised %s: %s" % (what, ei[0], ei[1])) File "/home/jt/src/PythonCvs/Lib/unittest.py", line 260, in fail raise self.failureException, msg AssertionError: rmdir raised exceptions.OSError: [Errno 90] Directory not empty: '/mnt/c/DOCUME~1/jatis/LOCALS~1/Temp/tmpM_z8nj' Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** tempfile.py 14 Aug 2002 00:49:50 -0000 1.47 --- tempfile.py 14 Aug 2002 15:10:09 -0000 1.48 *************** *** 411,417 **** return _TemporaryFileWrapper(file, name) ! if _os.name != 'posix': ! # On non-POSIX systems, assume that we cannot unlink a file while ! # it is open. TemporaryFile = NamedTemporaryFile --- 411,417 ---- return _TemporaryFileWrapper(file, name) ! if _os.name != 'posix' or _os.sys.platform == 'cygwin': ! # On non-POSIX and Cygwin systems, assume that we cannot unlink a file ! # while it is open. TemporaryFile = NamedTemporaryFile From fdrake@users.sourceforge.net Wed Aug 14 16:26:20 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:26:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.168,1.169 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv16813 Modified Files: tut.tex Log Message: Remove a broken example of extreme backward compatibility; it is simply not relevant any more. Closes SF bug #595032. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -d -r1.168 -r1.169 *** tut.tex 7 Aug 2002 20:20:52 -0000 1.168 --- tut.tex 14 Aug 2002 15:26:18 -0000 1.169 *************** *** 4019,4043 **** when referencing \code{__dict__} directly. - Here's an example of a class that implements its own - \method{__getattr__()} and \method{__setattr__()} methods and stores - all attributes in a private variable, in a way that works in all - versions of Python, including those available before this feature was - added: - - \begin{verbatim} - class VirtualAttributes: - __vdict = None - __vdict_name = locals().keys()[0] - - def __init__(self): - self.__dict__[self.__vdict_name] = {} - - def __getattr__(self, name): - return self.__vdict[name] - - def __setattr__(self, name, value): - self.__vdict[name] = value - \end{verbatim} - \section{Odds and Ends \label{odds}} --- 4019,4022 ---- From fdrake@users.sourceforge.net Wed Aug 14 16:27:21 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:27:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.8,1.156.4.1.2.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv17404 Modified Files: Tag: release22-maint tut.tex Log Message: Remove a broken example of extreme backward compatibility; it is simply not relevant any more. Closes SF bug #595032. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.8 retrieving revision 1.156.4.1.2.9 diff -C2 -d -r1.156.4.1.2.8 -r1.156.4.1.2.9 *** tut.tex 7 Aug 2002 20:23:00 -0000 1.156.4.1.2.8 --- tut.tex 14 Aug 2002 15:27:19 -0000 1.156.4.1.2.9 *************** *** 3976,4000 **** when referencing \code{__dict__} directly. - Here's an example of a class that implements its own - \method{__getattr__()} and \method{__setattr__()} methods and stores - all attributes in a private variable, in a way that works in all - versions of Python, including those available before this feature was - added: - - \begin{verbatim} - class VirtualAttributes: - __vdict = None - __vdict_name = locals().keys()[0] - - def __init__(self): - self.__dict__[self.__vdict_name] = {} - - def __getattr__(self, name): - return self.__vdict[name] - - def __setattr__(self, name, value): - self.__vdict[name] = value - \end{verbatim} - \section{Odds and Ends \label{odds}} --- 3976,3979 ---- From tim_one@users.sourceforge.net Wed Aug 14 16:41:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:41:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pkg.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25409/python/lib/test Modified Files: test_pkg.py Log Message: tempfile's mkstemp(): Changed last argument from binary=True to text=False by BDFL Pronouncement. All other changes follow from this. The change to the docs is ready to go, but blocked by another JackMacLock in the doc directory. Index: test_pkg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkg.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_pkg.py 14 Aug 2002 01:05:57 -0000 1.17 --- test_pkg.py 14 Aug 2002 15:41:26 -0000 1.18 *************** *** 57,61 **** mkhier(root, hier) savepath = sys.path[:] ! fd, fname = tempfile.mkstemp(binary=False) os.write(fd, code) os.close(fd) --- 57,61 ---- mkhier(root, hier) savepath = sys.path[:] ! fd, fname = tempfile.mkstemp(text=True) os.write(fd, code) os.close(fd) From tim_one@users.sourceforge.net Wed Aug 14 16:41:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:41:28 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25409/python/lib Modified Files: tempfile.py Log Message: tempfile's mkstemp(): Changed last argument from binary=True to text=False by BDFL Pronouncement. All other changes follow from this. The change to the docs is ready to go, but blocked by another JackMacLock in the doc directory. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** tempfile.py 14 Aug 2002 15:10:09 -0000 1.48 --- tempfile.py 14 Aug 2002 15:41:26 -0000 1.49 *************** *** 251,256 **** return tempdir ! def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=True): ! """mkstemp([suffix, [prefix, [dir, [binary]]]]) User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the --- 251,256 ---- return tempdir ! def mkstemp(suffix="", prefix=template, dir=gettempdir(), text=False): ! """mkstemp([suffix, [prefix, [dir, [text]]]]) User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the *************** *** 266,272 **** otherwise a default directory is used. ! If 'binary' is specified and false, the file is opened in text ! mode. Otherwise, the file is opened in binary mode. On some ! operating systems, this makes no difference. The file is readable and writable only by the creating user ID. --- 266,272 ---- otherwise a default directory is used. ! If 'text' is specified and true, the file is opened in text ! mode. Else (the default) the file is opened in binary mode. On ! some operating systems, this makes no difference. The file is readable and writable only by the creating user ID. *************** *** 278,285 **** """ ! if binary: ! flags = _bin_openflags ! else: flags = _text_openflags return _mkstemp_inner(dir, prefix, suffix, flags) --- 278,285 ---- """ ! if text: flags = _text_openflags + else: + flags = _bin_openflags return _mkstemp_inner(dir, prefix, suffix, flags) *************** *** 291,295 **** directory. The return value is the pathname of the directory. ! Arguments are as for mkstemp, except that the 'binary' argument is not accepted. --- 291,295 ---- directory. The return value is the pathname of the directory. ! Arguments are as for mkstemp, except that the 'text' argument is not accepted. *************** *** 320,324 **** file is not created. ! Arguments are as for mkstemp, except that the 'binary' argument is not accepted. --- 320,324 ---- file is not created. ! Arguments are as for mkstemp, except that the 'text' argument is not accepted. From loewis@users.sourceforge.net Wed Aug 14 16:46:04 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:46:04 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.262,2.263 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28831/Python Modified Files: bltinmodule.c Log Message: Patch #550192: Set softspace to 0 in raw_input(). Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.262 retrieving revision 2.263 diff -C2 -d -r2.262 -r2.263 *** bltinmodule.c 11 Aug 2002 12:23:04 -0000 2.262 --- bltinmodule.c 14 Aug 2002 15:46:02 -0000 2.263 *************** *** 1290,1299 **** { PyObject *v = NULL; ! PyObject *f; if (!PyArg_ParseTuple(args, "|O:[raw_]input", &v)) return NULL; ! if (PyFile_AsFile(PySys_GetObject("stdin")) == stdin && ! PyFile_AsFile(PySys_GetObject("stdout")) == stdout && isatty(fileno(stdin)) && isatty(fileno(stdout))) { PyObject *po; --- 1290,1312 ---- { PyObject *v = NULL; ! PyObject *fin = PySys_GetObject("stdin"); ! PyObject *fout = PySys_GetObject("stdout"); if (!PyArg_ParseTuple(args, "|O:[raw_]input", &v)) return NULL; ! ! if (fin == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "lost sys.stdin"); ! return NULL; ! } ! if (fout == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); ! return NULL; ! } ! if (PyFile_SoftSpace(fout, 0)) { ! if (PyFile_WriteString(" ", fout) != 0) ! return NULL; ! } ! if (PyFile_AsFile(fin) == stdin && PyFile_AsFile(fout) == stdout && isatty(fileno(stdin)) && isatty(fileno(stdout))) { PyObject *po; *************** *** 1326,1334 **** size_t len = strlen(s); if (len > INT_MAX) { ! PyErr_SetString(PyExc_OverflowError, "input too long"); result = NULL; } else { ! result = PyString_FromStringAndSize(s, (int)(len-1)); } } --- 1339,1349 ---- size_t len = strlen(s); if (len > INT_MAX) { ! PyErr_SetString(PyExc_OverflowError, ! "input too long"); result = NULL; } else { ! result = PyString_FromStringAndSize(s, ! (int)(len-1)); } } *************** *** 1337,1355 **** } if (v != NULL) { ! f = PySys_GetObject("stdout"); ! if (f == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); ! return NULL; ! } ! if (Py_FlushLine() != 0 || ! PyFile_WriteObject(v, f, Py_PRINT_RAW) != 0) return NULL; } ! f = PySys_GetObject("stdin"); ! if (f == NULL) { ! PyErr_SetString(PyExc_RuntimeError, "lost sys.stdin"); ! return NULL; ! } ! return PyFile_GetLine(f, -1); } --- 1352,1359 ---- } if (v != NULL) { ! if (PyFile_WriteObject(v, fout, Py_PRINT_RAW) != 0) return NULL; } ! return PyFile_GetLine(fin, -1); } From bwarsaw@users.sourceforge.net Wed Aug 14 16:51:30 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:51:30 -0700 Subject: [Python-checkins] python/dist/src/Include pyerrors.h,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv32164/Include Modified Files: pyerrors.h Log Message: Added a FutureWarning for constructs that will change semantically in the future. Changed PEP 237 hex constant warnings from DeprecationWarning to FutureWarning. Updated the documentation. Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -d -r2.56 -r2.57 *** pyerrors.h 12 Aug 2002 07:21:57 -0000 2.56 --- pyerrors.h 14 Aug 2002 15:51:28 -0000 2.57 *************** *** 71,74 **** --- 71,75 ---- PyAPI_DATA(PyObject *) PyExc_OverflowWarning; PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; + PyAPI_DATA(PyObject *) PyExc_FutureWarning; From bwarsaw@users.sourceforge.net Wed Aug 14 16:51:31 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 14 Aug 2002 08:51:31 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.256,2.257 exceptions.c,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv32164/Python Modified Files: compile.c exceptions.c Log Message: Added a FutureWarning for constructs that will change semantically in the future. Changed PEP 237 hex constant warnings from DeprecationWarning to FutureWarning. Updated the documentation. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.256 retrieving revision 2.257 diff -C2 -d -r2.256 -r2.257 *** compile.c 14 Aug 2002 07:46:28 -0000 2.256 --- compile.c 14 Aug 2002 15:51:28 -0000 2.257 *************** *** 1159,1163 **** if (x < 0 && errno == 0) { if (PyErr_WarnExplicit( ! PyExc_DeprecationWarning, "hex/oct constants > sys.maxint " "will return positive values " --- 1159,1163 ---- if (x < 0 && errno == 0) { if (PyErr_WarnExplicit( ! PyExc_FutureWarning, "hex/oct constants > sys.maxint " "will return positive values " Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** exceptions.c 29 Jul 2002 13:42:14 -0000 1.33 --- exceptions.c 14 Aug 2002 15:51:29 -0000 1.34 *************** *** 113,117 **** +-- SyntaxWarning\n\ +-- OverflowWarning\n\ ! +-- RuntimeWarning" ); --- 113,118 ---- +-- SyntaxWarning\n\ +-- OverflowWarning\n\ ! +-- RuntimeWarning\n\ ! +-- FutureWarning" ); *************** *** 903,906 **** --- 904,911 ---- "Base class for warnings about dubious runtime behavior."); + PyDoc_STRVAR(FutureWarning__doc__, + "Base class for warnings about constructs that will change semantically " + "in the future."); + *************** *** 965,968 **** --- 970,974 ---- PyObject *PyExc_OverflowWarning; PyObject *PyExc_RuntimeWarning; + PyObject *PyExc_FutureWarning; *************** *** 1045,1048 **** --- 1051,1056 ---- {"RuntimeWarning", &PyExc_RuntimeWarning, &PyExc_Warning, RuntimeWarning__doc__}, + {"FutureWarning", &PyExc_FutureWarning, &PyExc_Warning, + FutureWarning__doc__}, /* Sentinel */ {NULL} From bwarsaw@users.sourceforge.net Wed Aug 14 17:06:30 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 14 Aug 2002 09:06:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv8505 Modified Files: exceptions.tex Log Message: Document PyExc_FutureWarning Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** exceptions.tex 29 Jul 2002 14:27:40 -0000 1.8 --- exceptions.tex 14 Aug 2002 16:06:28 -0000 1.9 *************** *** 266,273 **** These have the type \ctype{PyObject*}; they are all class objects. Their names are \cdata{PyExc_Warning}, \cdata{PyExc_UserWarning}, ! \cdata{PyExc_DeprecationWarning}, \cdata{PyExc_SyntaxWarning}, and ! \cdata{PyExc_RuntimeWarning}. \cdata{PyExc_Warning} is a subclass ! of \cdata{PyExc_Exception}; the other warning categories are ! subclasses of \cdata{PyExc_Warning}. For information about warning control, see the documentation for the --- 266,273 ---- These have the type \ctype{PyObject*}; they are all class objects. Their names are \cdata{PyExc_Warning}, \cdata{PyExc_UserWarning}, ! \cdata{PyExc_DeprecationWarning}, \cdata{PyExc_SyntaxWarning}, ! \cdata{PyExc_RuntimeWarning}, and \cdata{PyExc_FutureWarning}. ! \cdata{PyExc_Warning} is a subclass of \cdata{PyExc_Exception}; the ! other warning categories are subclasses of \cdata{PyExc_Warning}. For information about warning control, see the documentation for the From gvanrossum@users.sourceforge.net Wed Aug 14 17:11:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 09:11:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.466,1.467 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11068 Modified Files: NEWS Log Message: Add news about FutureWarning and PEP 237 stage B0. Tim predicts that we might as well call this CassandraWarning. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.466 retrieving revision 1.467 diff -C2 -d -r1.466 -r1.467 *** NEWS 12 Aug 2002 22:01:33 -0000 1.466 --- NEWS 14 Aug 2002 16:11:30 -0000 1.467 *************** *** 58,61 **** --- 58,84 ---- Core and builtins + - There's a new warning category, FutureWarning. This is used to warn + about a number of situations where the value or sign of an integer + result will change in Python 2.4 as a result of PEP 237 (integer + unification). The warnings implement stage B0 mentioned in that + PEP. The warnings are about the following situations: + + - Octal and hex literals without 'L' prefix in the inclusive range + [0x80000000..0xffffffff]; these are currently negative ints, but + in Python 2.4 they will be positive longs with the same bit + pattern. + + - Left shifts on integer values that cause the outcome to lose + bits or have a different sign than the left operand. To be + precise: x< Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23186/python/objects Modified Files: longobject.c Log Message: k_mul() comments: Explained why there's always enough room to subtract ah*bh and al*bl. This is much easier than explaining why that's true for (ah+al)*(bh+bl), and follows directly from the simple part of the (ah+al)*(bh+bl) explanation. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** longobject.c 13 Aug 2002 20:42:00 -0000 1.136 --- longobject.c 14 Aug 2002 16:36:23 -0000 1.137 *************** *** 1792,1795 **** --- 1792,1802 ---- so ah+al has at most shift digits + 1 bit, and (ah+al)*(bh+bl) has at most 2*shift+1 digits + 2 bits, and again 2*shift+2 digits is enough to hold it. + + Note that the "lazy" analysis is enough to show that there's always enough + room to subtract al*bl and ah*bh. al and bl each have no more than shift + digits, so al*bl has no more than 2*shift, so there's at least one digit + to spare in the remaining allocated digits. The same is true for ah*bh when + bsize is even. When bsize is odd, ah*bh has at most 2*shift+2 digits, and + there are at least that many remaining allocated digits when bsize is odd. */ From tim_one@users.sourceforge.net Wed Aug 14 17:37:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 14 Aug 2002 09:37:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtempfile.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24168/python/Doc/lib Modified Files: libtempfile.tex Log Message: mkstemp's last argument changed from binary=True to text=False. Index: libtempfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtempfile.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** libtempfile.tex 9 Aug 2002 16:16:30 -0000 1.18 --- libtempfile.tex 14 Aug 2002 16:37:10 -0000 1.19 *************** *** 68,72 **** \optional{, prefix} \optional{, dir} ! \optional{, binary=1}} Creates a temporary file in the most secure manner possible. There are no race conditions in the file's creation, assuming that the --- 68,72 ---- \optional{, prefix} \optional{, dir} ! \optional{, text=False}} Creates a temporary file in the most secure manner possible. There are no race conditions in the file's creation, assuming that the *************** *** 91,95 **** otherwise, a default directory is used. ! If \var{binary} is specified, it indicates whether to open the file in binary mode (the default) or text mode. On some platforms, this makes no difference. --- 91,95 ---- otherwise, a default directory is used. ! If \var{text} is specified, it indicates whether to open the file in binary mode (the default) or text mode. On some platforms, this makes no difference. From bwarsaw@users.sourceforge.net Wed Aug 14 17:40:56 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 14 Aug 2002 09:40:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv26224/Doc/doc Modified Files: doc.tex Log Message: More updates describing FutureWarnings. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** doc.tex 29 Jun 2002 01:23:45 -0000 1.67 --- doc.tex 14 Aug 2002 16:40:54 -0000 1.68 *************** *** 1307,1310 **** --- 1307,1313 ---- \lineii{RuntimeWarning} {Base category for warnings about dubious runtime features.} + \lineii{FutureWarning} + {Base category for warnings about constructs that will change + semantically in the future.} \end{tableii} \end{verbatim} From bwarsaw@users.sourceforge.net Wed Aug 14 17:40:56 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 14 Aug 2002 09:40:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.46,1.47 libwarnings.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv26224/Doc/lib Modified Files: libexcs.tex libwarnings.tex Log Message: More updates describing FutureWarnings. Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** libexcs.tex 29 May 2002 15:54:55 -0000 1.46 --- libexcs.tex 14 Aug 2002 16:40:54 -0000 1.47 *************** *** 363,367 **** The following exceptions are used as warning categories; see the ! \module{warnings} module for more information. \begin{excdesc}{Warning} --- 363,367 ---- The following exceptions are used as warning categories; see the ! \refmodule{warnings} module for more information. \begin{excdesc}{Warning} *************** *** 389,392 **** --- 389,397 ---- \end{excdesc} + \begin{excdesc}{FutureWarning} + Base class for warnings about constructs that will change semantically + in the future. + \end{excdesc} + The class hierarchy for built-in exceptions is: *************** *** 432,434 **** --- 437,440 ---- +-- OverflowWarning +-- RuntimeWarning + +-- FutureWarning \end{verbatim} Index: libwarnings.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwarnings.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libwarnings.tex 21 Mar 2002 12:58:54 -0000 1.9 --- libwarnings.tex 14 Aug 2002 16:40:54 -0000 1.10 *************** *** 69,72 **** --- 69,75 ---- runtime features.} + \lineii{FutureWarning}{Base category for warnings about constructs + that will change semantically in the future.} + \end{tableii} From tim_one@users.sourceforge.net Wed Aug 14 18:07:35 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:07:35 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.137,1.138 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7625/python/Objects Modified Files: longobject.c Log Message: k_mul() comments: Simplified the simplified explanation of why ah*bh and al*bl "always fit": it's actually trivial given what came before. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** longobject.c 14 Aug 2002 16:36:23 -0000 1.137 --- longobject.c 14 Aug 2002 17:07:32 -0000 1.138 *************** *** 1793,1802 **** 2*shift+1 digits + 2 bits, and again 2*shift+2 digits is enough to hold it. ! Note that the "lazy" analysis is enough to show that there's always enough ! room to subtract al*bl and ah*bh. al and bl each have no more than shift ! digits, so al*bl has no more than 2*shift, so there's at least one digit ! to spare in the remaining allocated digits. The same is true for ah*bh when ! bsize is even. When bsize is odd, ah*bh has at most 2*shift+2 digits, and ! there are at least that many remaining allocated digits when bsize is odd. */ --- 1793,1799 ---- 2*shift+1 digits + 2 bits, and again 2*shift+2 digits is enough to hold it. ! Note that since there's always enough room for (ah+al)*(bh+bl), and that's ! clearly >= each of ah*bh and al*bl, there's always enough room to subtract ! ah*bh and al*bl too. */ From gvanrossum@users.sourceforge.net Wed Aug 14 18:26:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:26:33 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.176,2.177 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17052 Modified Files: typeobject.c Log Message: PyType_Ready(): initialize the base class a bit earlier, so that if we copy the metatype from the base, the base actually has one! Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.176 retrieving revision 2.177 diff -C2 -d -r2.176 -r2.177 *** typeobject.c 13 Aug 2002 22:19:12 -0000 2.176 --- typeobject.c 14 Aug 2002 17:26:30 -0000 2.177 *************** *** 2295,2298 **** --- 2295,2304 ---- base = type->tp_base = &PyBaseObject_Type; + /* Initialize the base class */ + if (base && base->tp_dict == NULL) { + if (PyType_Ready(base) < 0) + goto error; + } + /* Initialize ob_type if NULL. This means extensions that want to be compilable separately on Windows can call PyType_Ready() instead of *************** *** 2311,2320 **** goto error; type->tp_bases = bases; - } - - /* Initialize the base class */ - if (base && base->tp_dict == NULL) { - if (PyType_Ready(base) < 0) - goto error; } --- 2317,2320 ---- From gvanrossum@users.sourceforge.net Wed Aug 14 18:36:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:36:29 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.22,2.126.4.23 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22664 Modified Files: Tag: release22-maint typeobject.c Log Message: Backport: PyType_Ready(): initialize the base class a bit earlier, so that if we copy the metatype from the base, the base actually has one! Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.22 retrieving revision 2.126.4.23 diff -C2 -d -r2.126.4.22 -r2.126.4.23 *** typeobject.c 1 Aug 2002 19:03:43 -0000 2.126.4.22 --- typeobject.c 14 Aug 2002 17:36:26 -0000 2.126.4.23 *************** *** 2115,2118 **** --- 2115,2124 ---- base = type->tp_base = &PyBaseObject_Type; + /* Initialize the base class */ + if (base && base->tp_dict == NULL) { + if (PyType_Ready(base) < 0) + goto error; + } + /* Initialize ob_type if NULL. This means extensions that want to be compilable separately on Windows can call PyType_Ready() instead of *************** *** 2131,2140 **** goto error; type->tp_bases = bases; - } - - /* Initialize the base class */ - if (base && base->tp_dict == NULL) { - if (PyType_Ready(base) < 0) - goto error; } --- 2137,2140 ---- From jhylton@users.sourceforge.net Wed Aug 14 18:44:02 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:44:02 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26719 Modified Files: threading.py Log Message: Explain a minor mystery. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** threading.py 30 Jun 2002 03:39:14 -0000 1.24 --- threading.py 14 Aug 2002 17:43:59 -0000 1.25 *************** *** 173,176 **** --- 173,177 ---- def _is_owned(self): + # This method is called only if __lock doesn't have _is_owned(). if self.__lock.acquire(0): self.__lock.release() From jhylton@users.sourceforge.net Wed Aug 14 18:46:42 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:46:42 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28173 Modified Files: threading.py Log Message: Explain a little more. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** threading.py 14 Aug 2002 17:43:59 -0000 1.25 --- threading.py 14 Aug 2002 17:46:40 -0000 1.26 *************** *** 173,176 **** --- 173,177 ---- def _is_owned(self): + # Return True if lock is owned by currentThread. # This method is called only if __lock doesn't have _is_owned(). if self.__lock.acquire(0): From gvanrossum@users.sourceforge.net Wed Aug 14 18:54:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:54:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31943 Modified Files: regrtest.py Log Message: The filterwarnings() call here should be updated to filter out FutureWarning. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** regrtest.py 12 Aug 2002 21:55:51 -0000 1.93 --- regrtest.py 14 Aug 2002 17:54:48 -0000 1.94 *************** *** 68,72 **** # I see no other way to suppress these warnings; # putting them in test_grammar.py has no effect: ! warnings.filterwarnings("ignore", "hex/oct constants", DeprecationWarning, ".*test.test_grammar$") --- 68,72 ---- # I see no other way to suppress these warnings; # putting them in test_grammar.py has no effect: ! warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, ".*test.test_grammar$") From jhylton@users.sourceforge.net Wed Aug 14 18:56:15 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 14 Aug 2002 10:56:15 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32675 Modified Files: threading.py Log Message: Explain use of currentThread() in _Condition methods. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** threading.py 14 Aug 2002 17:46:40 -0000 1.26 --- threading.py 14 Aug 2002 17:56:13 -0000 1.27 *************** *** 182,186 **** def wait(self, timeout=None): ! me = currentThread() assert self._is_owned(), "wait() of un-acquire()d lock" waiter = _allocate_lock() --- 182,186 ---- def wait(self, timeout=None): ! currentThread() # for side-effect assert self._is_owned(), "wait() of un-acquire()d lock" waiter = _allocate_lock() *************** *** 224,228 **** def notify(self, n=1): ! me = currentThread() assert self._is_owned(), "notify() of un-acquire()d lock" __waiters = self.__waiters --- 224,228 ---- def notify(self, n=1): ! currentThread() # for side-effect assert self._is_owned(), "notify() of un-acquire()d lock" __waiters = self.__waiters From gvanrossum@users.sourceforge.net Wed Aug 14 19:38:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 11:38:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.51,1.52 test_b2.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23675/Lib/test Modified Files: test_b1.py test_b2.py Log Message: More changes of DeprecationWarning to FutureWarning. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** test_b1.py 13 Aug 2002 11:42:41 -0000 1.51 --- test_b1.py 14 Aug 2002 18:38:27 -0000 1.52 *************** *** 3,7 **** import warnings warnings.filterwarnings("ignore", "hex../oct.. of negative int", ! DeprecationWarning, __name__) from test.test_support import TestFailed, fcmp, have_unicode, TESTFN, unlink --- 3,7 ---- import warnings warnings.filterwarnings("ignore", "hex../oct.. of negative int", ! FutureWarning, __name__) from test.test_support import TestFailed, fcmp, have_unicode, TESTFN, unlink Index: test_b2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test_b2.py 12 Aug 2002 15:16:20 -0000 1.37 --- test_b2.py 14 Aug 2002 18:38:27 -0000 1.38 *************** *** 3,7 **** import warnings warnings.filterwarnings("ignore", "hex../oct.. of negative int", ! DeprecationWarning, __name__) from test.test_support import TestFailed, fcmp, TESTFN, unlink, vereq --- 3,7 ---- import warnings warnings.filterwarnings("ignore", "hex../oct.. of negative int", ! FutureWarning, __name__) from test.test_support import TestFailed, fcmp, TESTFN, unlink, vereq From gvanrossum@users.sourceforge.net Wed Aug 14 19:38:29 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 11:38:29 -0700 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.90,2.91 stringobject.c,2.178,2.179 unicodeobject.c,2.162,2.163 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23675/Objects Modified Files: intobject.c stringobject.c unicodeobject.c Log Message: More changes of DeprecationWarning to FutureWarning. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -d -r2.90 -r2.91 *** intobject.c 13 Aug 2002 10:05:56 -0000 2.90 --- intobject.c 14 Aug 2002 18:38:27 -0000 2.91 *************** *** 672,676 **** return int_pos(v); if (b >= LONG_BIT) { ! if (PyErr_Warn(PyExc_DeprecationWarning, "x<= LONG_BIT) { ! if (PyErr_Warn(PyExc_FutureWarning, "x< ob_ival; if (x < 0) { ! if (PyErr_Warn(PyExc_DeprecationWarning, "hex()/oct() of negative int will return " "a signed string in Python 2.4 and up") < 0) --- 775,779 ---- long x = v -> ob_ival; if (x < 0) { ! if (PyErr_Warn(PyExc_FutureWarning, "hex()/oct() of negative int will return " "a signed string in Python 2.4 and up") < 0) *************** *** 793,797 **** long x = v -> ob_ival; if (x < 0) { ! if (PyErr_Warn(PyExc_DeprecationWarning, "hex()/oct() of negative int will return " "a signed string in Python 2.4 and up") < 0) --- 793,797 ---- long x = v -> ob_ival; if (x < 0) { ! if (PyErr_Warn(PyExc_FutureWarning, "hex()/oct() of negative int will return " "a signed string in Python 2.4 and up") < 0) Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.178 retrieving revision 2.179 diff -C2 -d -r2.178 -r2.179 *** stringobject.c 14 Aug 2002 08:22:50 -0000 2.178 --- stringobject.c 14 Aug 2002 18:38:27 -0000 2.179 *************** *** 3470,3474 **** } if (x < 0 && type != 'd' && type != 'i') { ! if (PyErr_Warn(PyExc_DeprecationWarning, "%u/%o/%x/%X of negative int will return " "a signed string in Python 2.4 and up") < 0) --- 3470,3474 ---- } if (x < 0 && type != 'd' && type != 'i') { ! if (PyErr_Warn(PyExc_FutureWarning, "%u/%o/%x/%X of negative int will return " "a signed string in Python 2.4 and up") < 0) Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.162 retrieving revision 2.163 diff -C2 -d -r2.162 -r2.163 *** unicodeobject.c 11 Aug 2002 12:23:04 -0000 2.162 --- unicodeobject.c 14 Aug 2002 18:38:27 -0000 2.163 *************** *** 5339,5343 **** return -1; if (x < 0 && type != 'd' && type != 'i') { ! if (PyErr_Warn(PyExc_DeprecationWarning, "%u/%o/%x/%X of negative int will return " "a signed string in Python 2.4 and up") < 0) --- 5339,5343 ---- return -1; if (x < 0 && type != 'd' && type != 'i') { ! if (PyErr_Warn(PyExc_FutureWarning, "%u/%o/%x/%X of negative int will return " "a signed string in Python 2.4 and up") < 0) From loewis@users.sourceforge.net Wed Aug 14 19:52:57 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 14 Aug 2002 11:52:57 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.194,1.195 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29739 Modified Files: ACKS Log Message: Added Hisao Suzuki. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.194 retrieving revision 1.195 diff -C2 -d -r1.194 -r1.195 *** ACKS 12 Aug 2002 20:20:39 -0000 1.194 --- ACKS 14 Aug 2002 18:52:54 -0000 1.195 *************** *** 455,458 **** --- 455,459 ---- Nathan Sullivan Mark Summerfield + Hisao Suzuki Kalle Svensson Hajime Saitou From jhylton@users.sourceforge.net Wed Aug 14 20:25:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 14 Aug 2002 12:25:44 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10594 Modified Files: threading.py Log Message: Docstring nits: The module is neither proposed nor new. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** threading.py 14 Aug 2002 17:56:13 -0000 1.27 --- threading.py 14 Aug 2002 19:25:42 -0000 1.28 *************** *** 1,3 **** ! """Proposed new threading module, emulating a subset of Java's threading model.""" import sys --- 1,3 ---- ! """Thread module emulating a subset of Java's threading model.""" import sys From fdrake@users.sourceforge.net Wed Aug 14 21:57:59 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 14 Aug 2002 13:57:59 -0700 Subject: [Python-checkins] python/dist/src/Python modsupport.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv21645 Modified Files: modsupport.c Log Message: Py_InitModule4(): Accept NULL for the 'methods' argument. This makes sense now that extension types can support __init__ directly rather than requiring function constructors. Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** modsupport.c 28 Jul 2002 10:23:27 -0000 2.61 --- modsupport.c 14 Aug 2002 20:57:56 -0000 2.62 *************** *** 57,76 **** return NULL; d = PyModule_GetDict(m); ! for (ml = methods; ml->ml_name != NULL; ml++) { ! if ((ml->ml_flags & METH_CLASS) || ! (ml->ml_flags & METH_STATIC)) { ! PyErr_SetString(PyExc_ValueError, ! "module functions cannot set" ! " METH_CLASS or METH_STATIC"); ! return NULL; ! } ! v = PyCFunction_New(ml, passthrough); ! if (v == NULL) ! return NULL; ! if (PyDict_SetItemString(d, ml->ml_name, v) != 0) { Py_DECREF(v); - return NULL; } - Py_DECREF(v); } if (doc != NULL) { --- 57,78 ---- return NULL; d = PyModule_GetDict(m); ! if (methods != NULL) { ! for (ml = methods; ml->ml_name != NULL; ml++) { ! if ((ml->ml_flags & METH_CLASS) || ! (ml->ml_flags & METH_STATIC)) { ! PyErr_SetString(PyExc_ValueError, ! "module functions cannot set" ! " METH_CLASS or METH_STATIC"); ! return NULL; ! } ! v = PyCFunction_New(ml, passthrough); ! if (v == NULL) ! return NULL; ! if (PyDict_SetItemString(d, ml->ml_name, v) != 0) { ! Py_DECREF(v); ! return NULL; ! } Py_DECREF(v); } } if (doc != NULL) { From fdrake@users.sourceforge.net Wed Aug 14 21:59:40 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 14 Aug 2002 13:59:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv22594 Modified Files: newtypes.tex Log Message: Py_InitModule() and friends now accept NULL for the 'methods' argument. This makes sense now that extension types can support __init__ directly rather than requiring function constructors. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** newtypes.tex 6 Aug 2002 17:18:56 -0000 1.14 --- newtypes.tex 14 Aug 2002 20:59:38 -0000 1.15 *************** *** 84,87 **** --- 84,90 ---- Create a new module object based on a name and table of functions, returning the new module object. + + \versionchanged[Older versions of Python did not support \NULL{} as + the value for the \var{methods} argument]{2.3} \end{cfuncdesc} *************** *** 92,95 **** --- 95,101 ---- returning the new module object. If \var{doc} is non-\NULL, it will be used to define the docstring for the module. + + \versionchanged[Older versions of Python did not support \NULL{} as + the value for the \var{methods} argument]{2.3} \end{cfuncdesc} *************** *** 110,113 **** --- 116,122 ---- the \cfunction{Py_InitModule3()} instead; only use this if you are sure you need it.} + + \versionchanged[Older versions of Python did not support \NULL{} as + the value for the \var{methods} argument]{2.3} \end{cfuncdesc} From jhylton@users.sourceforge.net Wed Aug 14 22:01:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 14 Aug 2002 14:01:44 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.167,2.168 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23684 Modified Files: fileobject.c Log Message: Reflow long lines. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.167 retrieving revision 2.168 diff -C2 -d -r2.167 -r2.168 *** fileobject.c 6 Aug 2002 21:50:54 -0000 2.167 --- fileobject.c 14 Aug 2002 21:01:41 -0000 2.168 *************** *** 91,95 **** char *msg = "Is a directory"; #endif ! PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)", EISDIR, msg); PyErr_SetObject(PyExc_IOError, exc); return NULL; --- 91,96 ---- char *msg = "Is a directory"; #endif ! PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)", ! EISDIR, msg); PyErr_SetObject(PyExc_IOError, exc); return NULL; *************** *** 144,148 **** if (PyEval_GetRestricted()) { PyErr_SetString(PyExc_IOError, ! "file() constructor not accessible in restricted mode"); return NULL; } --- 145,149 ---- if (PyEval_GetRestricted()) { PyErr_SetString(PyExc_IOError, ! "file() constructor not accessible in restricted mode"); return NULL; } *************** *** 706,710 **** if (buffersize > INT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "requested number of bytes is more than a Python string can hold"); return NULL; } --- 707,711 ---- if (buffersize > INT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "requested number of bytes is more than a Python string can hold"); return NULL; } *************** *** 717,721 **** errno = 0; chunksize = Py_UniversalNewlineFread(BUF(v) + bytesread, ! buffersize - bytesread, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS if (chunksize == 0) { --- 718,722 ---- errno = 0; chunksize = Py_UniversalNewlineFread(BUF(v) + bytesread, ! buffersize - bytesread, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS if (chunksize == 0) { *************** *** 756,760 **** Py_BEGIN_ALLOW_THREADS errno = 0; ! nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp, (PyObject *)f); Py_END_ALLOW_THREADS if (nnow == 0) { --- 757,762 ---- Py_BEGIN_ALLOW_THREADS errno = 0; ! nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp, ! (PyObject *)f); Py_END_ALLOW_THREADS if (nnow == 0) { *************** *** 1026,1032 **** skipnextlf = 0; if (c == '\n') { ! /* Seeing a \n here with skipnextlf true ! ** means we saw a \r before. ! */ newlinetypes |= NEWLINE_CRLF; c = GETC(fp); --- 1028,1035 ---- skipnextlf = 0; if (c == '\n') { ! /* Seeing a \n here with ! * skipnextlf true means we ! * saw a \r before. ! */ newlinetypes |= NEWLINE_CRLF; c = GETC(fp); *************** *** 1401,1405 **** &len))) { PyErr_SetString(PyExc_TypeError, ! "writelines() argument must be a sequence of strings"); goto error; } --- 1404,1408 ---- &len))) { PyErr_SetString(PyExc_TypeError, ! "writelines() argument must be a sequence of strings"); goto error; } *************** *** 1535,1555 **** static PyMethodDef file_methods[] = { ! {"readline", (PyCFunction)file_readline, METH_VARARGS, readline_doc}, ! {"read", (PyCFunction)file_read, METH_VARARGS, read_doc}, ! {"write", (PyCFunction)file_write, METH_VARARGS, write_doc}, ! {"fileno", (PyCFunction)file_fileno, METH_NOARGS, fileno_doc}, ! {"seek", (PyCFunction)file_seek, METH_VARARGS, seek_doc}, #ifdef HAVE_FTRUNCATE ! {"truncate", (PyCFunction)file_truncate, METH_VARARGS, truncate_doc}, #endif ! {"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc}, ! {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, ! {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, ! {"xreadlines", (PyCFunction)file_getiter, METH_NOARGS, xreadlines_doc}, ! {"writelines", (PyCFunction)file_writelines, METH_O, writelines_doc}, ! {"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc}, ! {"close", (PyCFunction)file_close, METH_NOARGS, close_doc}, ! {"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc}, ! {NULL, NULL} /* sentinel */ }; --- 1538,1558 ---- static PyMethodDef file_methods[] = { ! {"readline", (PyCFunction)file_readline, METH_VARARGS, readline_doc}, ! {"read", (PyCFunction)file_read, METH_VARARGS, read_doc}, ! {"write", (PyCFunction)file_write, METH_VARARGS, write_doc}, ! {"fileno", (PyCFunction)file_fileno, METH_NOARGS, fileno_doc}, ! {"seek", (PyCFunction)file_seek, METH_VARARGS, seek_doc}, #ifdef HAVE_FTRUNCATE ! {"truncate", (PyCFunction)file_truncate, METH_VARARGS, truncate_doc}, #endif ! {"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc}, ! {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, ! {"readlines", (PyCFunction)file_readlines,METH_VARARGS, readlines_doc}, ! {"xreadlines",(PyCFunction)file_getiter, METH_NOARGS, xreadlines_doc}, ! {"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc}, ! {"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc}, ! {"close", (PyCFunction)file_close, METH_NOARGS, close_doc}, ! {"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc}, ! {NULL, NULL} /* sentinel */ }; *************** *** 1595,1599 **** return Py_BuildValue("(sss)", "\r", "\n", "\r\n"); default: ! PyErr_Format(PyExc_SystemError, "Unknown newlines value 0x%x\n", f->f_newlinetypes); return NULL; } --- 1598,1604 ---- return Py_BuildValue("(sss)", "\r", "\n", "\r\n"); default: ! PyErr_Format(PyExc_SystemError, ! "Unknown newlines value 0x%x\n", ! f->f_newlinetypes); return NULL; } *************** *** 1604,1608 **** {"closed", (getter)get_closed, NULL, "True if the file is closed"}, #ifdef WITH_UNIVERSAL_NEWLINES ! {"newlines", (getter)get_newlines, NULL, "end-of-line convention used in this file"}, #endif {0}, --- 1609,1614 ---- {"closed", (getter)get_closed, NULL, "True if the file is closed"}, #ifdef WITH_UNIVERSAL_NEWLINES ! {"newlines", (getter)get_newlines, NULL, ! "end-of-line convention used in this file"}, #endif {0}, From gvanrossum@users.sourceforge.net Wed Aug 14 22:20:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 14 Aug 2002 14:20:35 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.467,1.468 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv32617 Modified Files: NEWS Log Message: Add news about Fred's change to Py_InitModule4(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.467 retrieving revision 1.468 diff -C2 -d -r1.467 -r1.468 *** NEWS 14 Aug 2002 16:11:30 -0000 1.467 --- NEWS 14 Aug 2002 21:20:32 -0000 1.468 *************** *** 483,486 **** --- 483,490 ---- C API + - The Py_InitModule*() functions now accept NULL for the 'methods' + argument. Modules without global functions are becoming more common + now that factories can be types rather than functions. + - New C API PyUnicode_FromOrdinal() which exposes unichr() at C level. From akuchling@users.sourceforge.net Thu Aug 15 01:40:23 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 14 Aug 2002 17:40:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv31401 Modified Files: whatsnew23.tex Log Message: Add 'in' change Revise sentence Add two reminders Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** whatsnew23.tex 6 Aug 2002 01:40:48 -0000 1.43 --- whatsnew23.tex 15 Aug 2002 00:40:21 -0000 1.44 *************** *** 16,19 **** --- 16,23 ---- % % New sorting code + % + % Karatsuba multiplication for long ints (#560379) + % + % xreadlines obsolete; files are their own iterator %\section{Introduction \label{intro}} *************** *** 481,487 **** \end{verbatim} ! From this example you can also see that the builtin ``\var{slice}'' ! object is now the type of slice objects, not a function (so is now ! consistent with \var{int}, \var{str}, etc from 2.2). %====================================================================== --- 485,493 ---- \end{verbatim} ! From this example you can also see that the builtin ``\class{slice}'' ! object is now the type object for the slice type, and is no longer a ! function. This is consistent with Python 2.2, where \class{int}, ! \class{str}, etc., underwent the same change. ! %====================================================================== *************** *** 494,497 **** --- 500,523 ---- \item The \keyword{yield} statement is now always a keyword, as described in section~\ref{section-generators} of this document. + + \item The \code{in} operator now works differently for strings. + Previously, when evaluating \code{\var{X} in \var{Y}} where \var{X} + and \var{Y} are strings, \var{X} could only be a single character. + That's now changed; \var{X} can be a string of any length, and + \code{\var{X} in \var{Y}} will return \constant{True} if \var{X} is a + substring of \var{Y}. If \var{X} is the empty string, the result is + always \constant{True}. + + \begin{verbatim} + >>> 'ab' in 'abcd' + True + >>> 'ad' in 'abcd' + False + >>> '' in 'abcd' + True + \end{verbatim} + + Note that this doesn't tell you where the substring starts; the + \method{find()} method is still necessary to figure that out. \item A new built-in function \function{enumerate()} From montanaro@users.sourceforge.net Thu Aug 15 02:20:18 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 Aug 2002 18:20:18 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv15875/Parser Modified Files: tokenizer.c Log Message: provide less mysterious error messages when seeing end-of-line in single-quoted strings or end-of-file in triple-quoted strings. closes patch 586561. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** tokenizer.c 7 Aug 2002 15:18:56 -0000 2.63 --- tokenizer.c 15 Aug 2002 01:20:16 -0000 2.64 *************** *** 1277,1281 **** if (c == '\n') { if (!triple) { ! tok->done = E_TOKEN; tok_backup(tok, c); return ERRORTOKEN; --- 1277,1281 ---- if (c == '\n') { if (!triple) { ! tok->done = E_EOLS; tok_backup(tok, c); return ERRORTOKEN; *************** *** 1284,1288 **** } else if (c == EOF) { ! tok->done = E_TOKEN; tok->cur = tok->inp; return ERRORTOKEN; --- 1284,1291 ---- } else if (c == EOF) { ! if (triple) ! tok->done = E_EOFS; ! else ! tok->done = E_EOLS; tok->cur = tok->inp; return ERRORTOKEN; *************** *** 1306,1310 **** c = tok_nextc(tok); if (c == EOF) { ! tok->done = E_TOKEN; tok->cur = tok->inp; return ERRORTOKEN; --- 1309,1313 ---- c = tok_nextc(tok); if (c == EOF) { ! tok->done = E_EOLS; tok->cur = tok->inp; return ERRORTOKEN; From montanaro@users.sourceforge.net Thu Aug 15 02:20:18 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 Aug 2002 18:20:18 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.165,2.166 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15875/Python Modified Files: pythonrun.c Log Message: provide less mysterious error messages when seeing end-of-line in single-quoted strings or end-of-file in triple-quoted strings. closes patch 586561. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.165 retrieving revision 2.166 diff -C2 -d -r2.165 -r2.166 *** pythonrun.c 4 Aug 2002 17:29:52 -0000 2.165 --- pythonrun.c 15 Aug 2002 01:20:16 -0000 2.166 *************** *** 1248,1251 **** --- 1248,1257 ---- msg = "invalid token"; break; + case E_EOFS: + msg = "EOF while scanning triple-quoted string"; + break; + case E_EOLS: + msg = "EOL while scanning single-quoted string"; + break; case E_INTR: PyErr_SetNone(PyExc_KeyboardInterrupt); From montanaro@users.sourceforge.net Thu Aug 15 02:20:18 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 Aug 2002 18:20:18 -0700 Subject: [Python-checkins] python/dist/src/Include errcode.h,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv15875/Include Modified Files: errcode.h Log Message: provide less mysterious error messages when seeing end-of-line in single-quoted strings or end-of-file in triple-quoted strings. closes patch 586561. Index: errcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/errcode.h,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** errcode.h 4 Aug 2002 17:29:52 -0000 2.15 --- errcode.h 15 Aug 2002 01:20:16 -0000 2.16 *************** *** 27,30 **** --- 27,32 ---- #define E_DEDENT 21 /* No matching outer block for dedent */ #define E_DECODE 22 /* Error in decoding into Unicode */ + #define E_EOFS 23 /* EOF in triple-quoted string */ + #define E_EOLS 24 /* EOL in single-quoted string */ #ifdef __cplusplus From montanaro@users.sourceforge.net Thu Aug 15 02:28:57 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 Aug 2002 18:28:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_eof.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22152 Added Files: test_eof.py Log Message: forgot the best part - the new tests... see patch 586561 --- NEW FILE: test_eof.py --- #! /usr/bin/env python """test script for a few new invalid token catches""" import os import unittest from test import test_support class EOFTestCase(unittest.TestCase): def test_EOFC(self): try: eval("""'this is a test\ """) except SyntaxError, msg: self.assertEqual(str(msg), "EOL while scanning single-quoted string (line 1)") else: raise test_support.TestFailed def test_EOFS(self): try: eval("""'''this is a test""") except SyntaxError, msg: self.assertEqual(str(msg), "EOF while scanning triple-quoted string (line 1)") else: raise test_support.TestFailed def test_main(): test_support.run_unittest(EOFTestCase) if __name__ == "__main__": test_main() From montanaro@users.sourceforge.net Thu Aug 15 02:34:40 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 Aug 2002 18:34:40 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.107,1.108 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv25138 Modified Files: setup.py Log Message: Slight reordering of directories searched for BerkDB libs and include files. Push /usr/... further down the list - always check /usr/local/... before /usr/... Doubt this will help with http://python.org/sf/589427 or not, but these changes were prompted by my investigation of that bug report. I wasn't able to reproduce that problem though Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** setup.py 14 Aug 2002 11:13:52 -0000 1.107 --- setup.py 15 Aug 2002 01:34:38 -0000 1.108 *************** *** 443,446 **** --- 443,447 ---- '/usr/local/BerkeleyDB.4.1/lib', '/usr/local/BerkeleyDB.4.0/lib', + '/usr/local/lib', '/usr/lib', '/opt/sfw', *************** *** 452,459 **** '/usr/local/BerkeleyDB.4.1/include', '/usr/local/BerkeleyDB.4.0/include', ! '/usr/include/db3', '/opt/sfw/include/db3', '/sw/include/db3', ! '/usr/local/include/db3', ), 'incs': ('db_185.h',)}, --- 453,460 ---- '/usr/local/BerkeleyDB.4.1/include', '/usr/local/BerkeleyDB.4.0/include', ! '/usr/local/include/db3', '/opt/sfw/include/db3', '/sw/include/db3', ! '/usr/include/db3', ), 'incs': ('db_185.h',)}, *************** *** 463,469 **** '/usr/local/BerkeleyDB.3.1/lib', '/usr/local/BerkeleyDB.3.0/lib', ! '/usr/lib', '/opt/sfw', '/sw/lib', '/lib', ), --- 464,471 ---- '/usr/local/BerkeleyDB.3.1/lib', '/usr/local/BerkeleyDB.3.0/lib', ! '/usr/local/lib', '/opt/sfw', '/sw/lib', + '/usr/lib', '/lib', ), *************** *** 472,494 **** '/usr/local/BerkeleyDB.3.1/include', '/usr/local/BerkeleyDB.3.0/include', ! '/usr/include/db3', '/opt/sfw/include/db3', '/sw/include/db3', ! '/usr/local/include/db3', ), 'incs': ('db_185.h',)}, 'db2': {'libs': ('db2',), ! 'libdirs': ('/usr/lib', '/sw/lib', '/lib'), ! 'incdirs': ('/usr/include/db2', ! '/usr/local/include/db2', '/sw/include/db2'), 'incs': ('db_185.h',)}, # if you are willing to risk hash db file corruption you can # uncomment the lines below for db1. Note that this will affect # not only the bsddb module, but the dbhash and anydbm modules ! # as well. you have been warned!!! ##'db1': {'libs': ('db1', 'db'), ! ## 'libdirs': ('/usr/lib', '/sw/lib', '/lib'), ! ## 'incdirs': ('/usr/include/db1', '/usr/local/include/db1', ! ## '/usr/include', '/usr/local/include'), ## 'incs': ('db.h',)}, } --- 474,505 ---- '/usr/local/BerkeleyDB.3.1/include', '/usr/local/BerkeleyDB.3.0/include', ! '/usr/local/include/db3', '/opt/sfw/include/db3', '/sw/include/db3', ! '/usr/include/db3', ), 'incs': ('db_185.h',)}, 'db2': {'libs': ('db2',), ! 'libdirs': ('/usr/local/lib', ! '/sw/lib', ! '/usr/lib', ! '/lib'), ! 'incdirs': ('/usr/local/include/db2', ! '/sw/include/db2', ! '/usr/include/db2'), 'incs': ('db_185.h',)}, # if you are willing to risk hash db file corruption you can # uncomment the lines below for db1. Note that this will affect # not only the bsddb module, but the dbhash and anydbm modules ! # as well. YOU HAVE BEEN WARNED!!! ##'db1': {'libs': ('db1', 'db'), ! ## 'libdirs': ('/usr/local/lib', ! ## '/sw/lib', ! ## '/usr/lib', ! ## '/lib'), ! ## 'incdirs': ('/usr/local/include/db1', ! ## '/usr/local/include', ! ## '/usr/include/db1', ! ## '/usr/include'), ## 'incs': ('db.h',)}, } From gvanrossum@users.sourceforge.net Thu Aug 15 14:56:08 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 06:56:08 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.340,1.341 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv8305 Modified Files: configure.in Log Message: Fix typo. It's --with-universal-newlines, not --with-universal-newline. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.340 retrieving revision 1.341 diff -C2 -d -r1.340 -r1.341 *** configure.in 4 Aug 2002 12:38:50 -0000 1.340 --- configure.in 15 Aug 2002 13:56:06 -0000 1.341 *************** *** 1485,1489 **** # Check for universal newline support ! AC_MSG_CHECKING(for --with-universal-newline) AC_ARG_WITH(universal-newlines, [ --with(out)-universal-newlines disable/enable foreign newlines]) --- 1485,1489 ---- # Check for universal newline support ! AC_MSG_CHECKING(for --with-universal-newlines) AC_ARG_WITH(universal-newlines, [ --with(out)-universal-newlines disable/enable foreign newlines]) From gvanrossum@users.sourceforge.net Thu Aug 15 14:56:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 06:56:37 -0700 Subject: [Python-checkins] python/dist/src configure,1.329,1.330 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv8695 Modified Files: configure Log Message: Fix typo. It's --with-universal-newlines, not --with-universal-newline. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.329 retrieving revision 1.330 diff -C2 -d -r1.329 -r1.330 *** configure 4 Aug 2002 12:38:49 -0000 1.329 --- configure 15 Aug 2002 13:56:35 -0000 1.330 *************** *** 11170,11175 **** # Check for universal newline support ! echo "$as_me:$LINENO: checking for --with-universal-newline" >&5 ! echo $ECHO_N "checking for --with-universal-newline... $ECHO_C" >&6 # Check whether --with-universal-newlines or --without-universal-newlines was given. --- 11170,11175 ---- # Check for universal newline support ! echo "$as_me:$LINENO: checking for --with-universal-newlines" >&5 ! echo $ECHO_N "checking for --with-universal-newlines... $ECHO_C" >&6 # Check whether --with-universal-newlines or --without-universal-newlines was given. From gvanrossum@users.sourceforge.net Thu Aug 15 15:01:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:01:17 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.468,1.469 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11750 Modified Files: NEWS Log Message: Add notes about universal newlines. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.468 retrieving revision 1.469 diff -C2 -d -r1.468 -r1.469 *** NEWS 14 Aug 2002 21:20:32 -0000 1.468 --- NEWS 15 Aug 2002 14:01:14 -0000 1.469 *************** *** 234,237 **** --- 234,243 ---- correctly and without raising exceptions for unpaired ones. + - Universal newlines (PEP 278) is implemented. Briefly, using 'U' + instead of 'r' when opening a text file for reading changes the line + ending convention so that any of '\r', '\r\n', and '\n' is + recognized (even mixed in one file); all three are converted to + '\n', the standard Python line end character. + - file.xreadlines() now raises a ValueError if the file is closed: Previously, an xreadlines object was returned which would raise *************** *** 464,469 **** size of the executable. ! - XXX WITH_UNIVERSAL_NEWLINES Somebody fill this in; the PEP doesn't ! say how or when to configure it, or how to turn it off. - On Unix, a shared libpython2.3.so can be created with --enable-shared. --- 470,477 ---- size of the executable. ! - The universal newlines option (PEP 278) is on by default. On Unix ! it can be disabled by passing --without-universal-newlines to the ! configure script. On other platforms, remove ! WITH_UNIVERSAL_NEWLINES from pyconfig.h. - On Unix, a shared libpython2.3.so can be created with --enable-shared. From mwh@users.sourceforge.net Thu Aug 15 15:59:03 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hotshot.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10908/Lib/test Modified Files: test_hotshot.py Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_hotshot.py 5 Aug 2002 22:16:40 -0000 1.11 --- test_hotshot.py 15 Aug 2002 14:59:01 -0000 1.12 *************** *** 92,99 **** g_lineno = g.func_code.co_firstlineno events = [(ENTER, ("test_hotshot", g_lineno, "g")), - (LINE, ("test_hotshot", g_lineno, "g")), (LINE, ("test_hotshot", g_lineno+1, "g")), (ENTER, ("test_hotshot", f_lineno, "f")), - (LINE, ("test_hotshot", f_lineno, "f")), (LINE, ("test_hotshot", f_lineno+1, "f")), (LINE, ("test_hotshot", f_lineno+2, "f")), --- 92,97 ---- From mwh@users.sourceforge.net Thu Aug 15 15:59:02 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:02 -0700 Subject: [Python-checkins] python/dist/src/Include opcode.h,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv10908/Include Modified Files: opcode.h Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** opcode.h 13 Jun 2002 17:59:51 -0000 2.39 --- opcode.h 15 Aug 2002 14:59:00 -0000 2.40 *************** *** 72,75 **** --- 72,78 ---- #define BREAK_LOOP 80 + #define RETURN_NONE 81 /* *only* for function epilogues + -- see comments in + ceval.c:maybe_call_line_trace for why */ #define LOAD_LOCALS 82 #define RETURN_VALUE 83 *************** *** 119,124 **** #define STORE_FAST 125 /* Local variable number */ #define DELETE_FAST 126 /* Local variable number */ - - #define SET_LINENO 127 /* Current line number */ #define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ --- 122,125 ---- From mwh@users.sourceforge.net Thu Aug 15 15:59:03 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:03 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.469,1.470 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10908/Misc Modified Files: NEWS Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.469 retrieving revision 1.470 diff -C2 -d -r1.469 -r1.470 *** NEWS 15 Aug 2002 14:01:14 -0000 1.469 --- NEWS 15 Aug 2002 14:59:01 -0000 1.470 *************** *** 58,61 **** --- 58,66 ---- Core and builtins + - SET_LINENO is gone. co_lnotab is now consulted to determine when to + call the trace function. C code that accessed f_lineno should call + PyCode_Addr2Line instead (f_lineno is still there, but not kept up + to date). + - There's a new warning category, FutureWarning. This is used to warn about a number of situations where the value or sign of an integer From mwh@users.sourceforge.net Thu Aug 15 15:59:04 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:04 -0700 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10908/Modules Modified Files: _hotshot.c Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** _hotshot.c 8 Aug 2002 19:46:15 -0000 1.25 --- _hotshot.c 15 Aug 2002 14:59:01 -0000 1.26 *************** *** 153,157 **** * 0x00 ENTER enter a frame * 0x01 EXIT exit a frame ! * 0x02 LINENO SET_LINENO instruction was executed * 0x03 OTHER more bits are needed to deecode * --- 153,157 ---- * 0x00 ENTER enter a frame * 0x01 EXIT exit a frame ! * 0x02 LINENO execution moved onto a different line * 0x03 OTHER more bits are needed to deecode * *************** *** 889,895 **** 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: --- 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: *************** *** 1228,1233 **** "closed: True if the profiler has already been closed.\n" "frametimings: True if ENTER/EXIT events collect timing information.\n" ! "lineevents: True if SET_LINENO events are reported to the profiler.\n" ! "linetimings: True if SET_LINENO events collect timing information."); static PyTypeObject ProfilerType = { --- 1231,1236 ---- "closed: True if the profiler has already been closed.\n" "frametimings: True if ENTER/EXIT events collect timing information.\n" ! "lineevents: True if line events are reported to the profiler.\n" ! "linetimings: True if line events collect timing information."); static PyTypeObject ProfilerType = { From mwh@users.sourceforge.net Thu Aug 15 15:59:03 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:03 -0700 Subject: [Python-checkins] python/dist/src/Lib dis.py,1.41,1.42 inspect.py,1.37,1.38 pdb.py,1.54,1.55 traceback.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10908/Lib Modified Files: dis.py inspect.py pdb.py traceback.py Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** dis.py 13 Jun 2002 17:59:51 -0000 1.41 --- dis.py 15 Aug 2002 14:59:00 -0000 1.42 *************** *** 56,59 **** --- 56,73 ---- """Disassemble a code object.""" code = co.co_code + + byte_increments = [ord(c) for c in co.co_lnotab[0::2]] + line_increments = [ord(c) for c in co.co_lnotab[1::2]] + table_length = len(byte_increments) # == len(line_increments) + + lineno = co.co_firstlineno + table_index = 0 + while (table_index < table_length + and byte_increments[table_index] == 0): + lineno += line_increments[table_index] + table_index += 1 + addr = 0 + line_incr = 0 + labels = findlabels(code) n = len(code) *************** *** 64,68 **** c = code[i] op = ord(c) ! if op == SET_LINENO and i > 0: print # Extra blank line if i == lasti: print '-->', else: print ' ', --- 78,98 ---- c = code[i] op = ord(c) ! ! if i >= addr: ! lineno += line_incr ! while table_index < table_length: ! addr += byte_increments[table_index] ! line_incr = line_increments[table_index] ! table_index += 1 ! if line_incr: ! break ! else: ! addr = sys.maxint ! if i > 0: ! print ! print "%3d"%lineno, ! else: ! print ' ', ! if i == lasti: print '-->', else: print ' ', *************** *** 225,228 **** --- 255,259 ---- def_op('BREAK_LOOP', 80) + def_op('RETURN_NONE', 81) def_op('LOAD_LOCALS', 82) def_op('RETURN_VALUE', 83) *************** *** 277,283 **** def_op('DELETE_FAST', 126) # Local variable number haslocal.append(126) - - def_op('SET_LINENO', 127) # Current line number - SET_LINENO = 127 def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3) --- 308,311 ---- Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** inspect.py 4 Aug 2002 17:22:59 -0000 1.37 --- inspect.py 15 Aug 2002 14:59:00 -0000 1.38 *************** *** 712,716 **** filename = getsourcefile(frame) or getfile(frame) ! lineno = getlineno(frame) if context > 0: start = lineno - 1 - context//2 --- 712,716 ---- filename = getsourcefile(frame) or getfile(frame) ! lineno = frame.f_lineno if context > 0: start = lineno - 1 - context//2 *************** *** 731,746 **** def getlineno(frame): """Get the line number from a frame object, allowing for optimization.""" ! # Written by Marc-André Lemburg; revised by Jim Hugunin and Fredrik Lundh. ! lineno = frame.f_lineno ! code = frame.f_code ! if hasattr(code, 'co_lnotab'): ! table = code.co_lnotab ! lineno = code.co_firstlineno ! addr = 0 ! for i in range(0, len(table), 2): ! addr = addr + ord(table[i]) ! if addr > frame.f_lasti: break ! lineno = lineno + ord(table[i+1]) ! return lineno def getouterframes(frame, context=1): --- 731,736 ---- def getlineno(frame): """Get the line number from a frame object, allowing for optimization.""" ! # FrameType.f_lineno is now a descriptor that grovels co_lnotab ! return frame.f_lineno def getouterframes(frame, context=1): Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** pdb.py 12 Jul 2002 13:10:53 -0000 1.54 --- pdb.py 15 Aug 2002 14:59:00 -0000 1.55 *************** *** 106,110 **** self.onecmd(line) ! # Override Bdb methods (except user_call, for now) def user_line(self, frame): --- 106,116 ---- self.onecmd(line) ! # Override Bdb methods ! ! def user_call(self, frame, argument_list): ! """This method is called when there is the remote possibility ! that we ever need to stop in this function.""" ! print '--Call--' ! self.interaction(frame, None) def user_line(self, frame): Index: traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/traceback.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** traceback.py 2 Jun 2002 03:04:51 -0000 1.27 --- traceback.py 15 Aug 2002 14:59:00 -0000 1.28 *************** *** 60,64 **** while tb is not None and (limit is None or n < limit): f = tb.tb_frame ! lineno = tb_lineno(tb) co = f.f_code filename = co.co_filename --- 60,64 ---- while tb is not None and (limit is None or n < limit): f = tb.tb_frame ! lineno = tb.tb_lineno co = f.f_code filename = co.co_filename *************** *** 93,97 **** while tb is not None and (limit is None or n < limit): f = tb.tb_frame ! lineno = tb_lineno(tb) co = f.f_code filename = co.co_filename --- 93,97 ---- while tb is not None and (limit is None or n < limit): f = tb.tb_frame ! lineno = tb.tb_lineno co = f.f_code filename = co.co_filename *************** *** 264,268 **** n = 0 while f is not None and (limit is None or n < limit): ! lineno = f.f_lineno # XXX Too bad if -O is used co = f.f_code filename = co.co_filename --- 264,268 ---- n = 0 while f is not None and (limit is None or n < limit): ! lineno = f.f_lineno co = f.f_code filename = co.co_filename *************** *** 280,301 **** """Calculate correct line number of traceback given in tb. ! Even works with -O on. """ ! # Coded by Marc-Andre Lemburg from the example of PyCode_Addr2Line() ! # in compile.c. ! # Revised version by Jim Hugunin to work with JPython too. ! ! c = tb.tb_frame.f_code ! if not hasattr(c, 'co_lnotab'): ! return tb.tb_lineno ! ! tab = c.co_lnotab ! line = c.co_firstlineno ! stopat = tb.tb_lasti ! addr = 0 ! for i in range(0, len(tab), 2): ! addr = addr + ord(tab[i]) ! if addr > stopat: ! break ! line = line + ord(tab[i+1]) ! return line --- 280,284 ---- """Calculate correct line number of traceback given in tb. ! Obsolete in 2.3. """ ! return tb.tb_lineno From mwh@users.sourceforge.net Thu Aug 15 15:59:04 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:04 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10908/Objects Modified Files: frameobject.c Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** frameobject.c 1 Aug 2002 18:50:33 -0000 2.63 --- frameobject.c 15 Aug 2002 14:59:02 -0000 2.64 *************** *** 17,21 **** {"f_globals", T_OBJECT, OFF(f_globals), RO}, {"f_lasti", T_INT, OFF(f_lasti), RO}, - {"f_lineno", T_INT, OFF(f_lineno), RO}, {"f_restricted",T_INT, OFF(f_restricted),RO}, {"f_trace", T_OBJECT, OFF(f_trace)}, --- 17,20 ---- *************** *** 34,39 **** --- 33,49 ---- } + static PyObject * + frame_getlineno(PyFrameObject *f, void *closure) + { + 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} }; *************** *** 307,311 **** f->f_tstate = tstate; ! f->f_lasti = 0; f->f_lineno = code->co_firstlineno; f->f_restricted = (builtins != tstate->interp->builtins); --- 317,321 ---- f->f_tstate = tstate; ! f->f_lasti = -1; f->f_lineno = code->co_firstlineno; f->f_restricted = (builtins != tstate->interp->builtins); From mwh@users.sourceforge.net Thu Aug 15 15:59:04 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:04 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts trace.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv10908/Tools/scripts Modified Files: trace.py Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** trace.py 25 Jul 2002 16:09:35 -0000 1.7 --- trace.py 15 Aug 2002 14:59:02 -0000 1.8 *************** *** 371,409 **** sys.stderr.write("cannot save counts files because %s" % err) ! # Given a code string, return the SET_LINENO information ! def _find_LINENO_from_string(co_code): ! """return all of the SET_LINENO information from a code string""" ! import dis linenos = {} ! # This code was filched from the `dis' module then modified ! n = len(co_code) ! i = 0 ! prev_op = None ! prev_lineno = 0 ! while i < n: ! c = co_code[i] ! op = ord(c) ! if op == dis.SET_LINENO: ! if prev_op == op: ! # two SET_LINENO in a row, so the previous didn't ! # indicate anything. This occurs with triple ! # quoted strings (?). Remove the old one. ! del linenos[prev_lineno] ! prev_lineno = ord(co_code[i+1]) + ord(co_code[i+2])*256 ! linenos[prev_lineno] = 1 ! if op >= dis.HAVE_ARGUMENT: ! i = i + 3 ! else: ! i = i + 1 ! prev_op = op return linenos def _find_LINENO(code): ! """return all of the SET_LINENO information from a code object""" import types # get all of the lineno information from the code of this scope level ! linenos = _find_LINENO_from_string(code.co_code) # and check the constants for references to other code objects --- 371,397 ---- sys.stderr.write("cannot save counts files because %s" % err) ! def _find_LINENO_from_code(code): ! """return the numbers of the lines containing the source code that ! was compiled into code""" linenos = {} ! line_increments = [ord(c) for c in code.co_lnotab[1::2]] ! table_length = len(line_increments) ! ! lineno = code.co_first_lineno ! ! for li in line_increments: ! linenos[lineno] = 1 ! lineno += li ! linenos[lineno] = 1 ! return linenos def _find_LINENO(code): ! """return all of the lineno information from a code object""" import types # get all of the lineno information from the code of this scope level ! linenos = _find_LINENO_from_code(code) # and check the constants for references to other code objects *************** *** 417,423 **** """return a dict of the line numbers from executable statements in a file - Works by finding all of the code-like objects in the module then searching - the byte code for 'SET_LINENO' terms (so this won't work one -O files). - """ import parser --- 405,408 ---- *************** *** 428,435 **** ast = parser.suite(prog) code = parser.compileast(ast, filename) - - # The only way I know to find line numbers is to look for the - # SET_LINENO instructions. Isn't there some way to get it from - # the AST? return _find_LINENO(code) --- 413,416 ---- From mwh@users.sourceforge.net Thu Aug 15 15:59:04 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:04 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.323,2.324 compile.c,2.257,2.258 frozen.c,1.12,1.13 import.c,2.208,2.209 traceback.c,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10908/Python Modified Files: ceval.c compile.c frozen.c import.c traceback.c Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.323 retrieving revision 2.324 diff -C2 -d -r2.323 -r2.324 *** ceval.c 9 Aug 2002 18:35:52 -0000 2.323 --- ceval.c 15 Aug 2002 14:59:02 -0000 2.324 *************** *** 52,55 **** --- 52,58 ---- PyFrameObject *, int); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); + static void maybe_call_line_trace(int, Py_tracefunc, PyObject *, + PyFrameObject *, int *, int *); + static PyObject *apply_slice(PyObject *, PyObject *, PyObject *); static int assign_slice(PyObject *, PyObject *, *************** *** 500,503 **** --- 503,516 ---- PyThreadState *tstate = PyThreadState_GET(); PyCodeObject *co; + + /* when tracing we set things up so that + + not (instr_lb <= current_bytecode_offset < instr_ub) + + is true when the line being executed has changed. The + initial values are such as to make this false the first + time it is tested. */ + int instr_ub = -1, instr_lb = 0; + unsigned char *first_instr; PyObject *names; *************** *** 587,591 **** freevars = f->f_localsplus + f->f_nlocals; _PyCode_GETCODEPTR(co, &first_instr); ! next_instr = first_instr + f->f_lasti; stack_pointer = f->f_stacktop; assert(stack_pointer != NULL); --- 600,609 ---- freevars = f->f_localsplus + f->f_nlocals; _PyCode_GETCODEPTR(co, &first_instr); ! if (f->f_lasti < 0) { ! next_instr = first_instr; ! } ! else { ! next_instr = first_instr + f->f_lasti; ! } stack_pointer = f->f_stacktop; assert(stack_pointer != NULL); *************** *** 638,643 **** for (;;) { ! assert(stack_pointer >= f->f_valuestack); /* else underflow */ ! assert(STACK_LEVEL() <= f->f_stacksize); /* else overflow */ /* Do periodic things. Doing this every time through the loop would add too much overhead, so we do it --- 656,662 ---- for (;;) { ! assert(stack_pointer >= f->f_valuestack); /* else underflow */ ! assert(STACK_LEVEL() <= f->f_stacksize); /* else overflow */ ! /* Do periodic things. Doing this every time through the loop would add too much overhead, so we do it *************** *** 659,664 **** /* If we have true signals, the signal handler will call Py_AddPendingCall() so we don't ! have to call sigcheck(). On the Mac and ! DOS, alas, we have to call it. */ if (PyErr_CheckSignals()) { why = WHY_EXCEPTION; --- 678,683 ---- /* If we have true signals, the signal handler will call Py_AddPendingCall() so we don't ! have to call PyErr_CheckSignals(). On the ! Mac and DOS, alas, we have to call it. */ if (PyErr_CheckSignals()) { why = WHY_EXCEPTION; *************** *** 687,693 **** /* Extract opcode and argument */ - #if defined(Py_DEBUG) || defined(LLTRACE) f->f_lasti = INSTR_OFFSET(); - #endif opcode = NEXTOP(); --- 706,710 ---- *************** *** 709,721 **** if (HAS_ARG(opcode)) { printf("%d: %d, %d\n", ! (int) (INSTR_OFFSET() - 3), ! opcode, oparg); } else { printf("%d: %d\n", ! (int) (INSTR_OFFSET() - 1), opcode); } } #endif /* Main switch on opcode */ --- 726,749 ---- if (HAS_ARG(opcode)) { printf("%d: %d, %d\n", ! f->f_lasti, opcode, oparg); } else { printf("%d: %d\n", ! f->f_lasti, opcode); } } #endif + + /* line-by-line tracing support */ + + if (tstate->c_tracefunc != NULL && !tstate->tracing) { + /* see maybe_call_line_trace + for expository comments */ + maybe_call_line_trace(opcode, + tstate->c_tracefunc, + tstate->c_traceobj, + f, &instr_lb, &instr_ub); + } + /* Main switch on opcode */ *************** *** 729,752 **** /* case STOP_CODE: this is an error! */ - case SET_LINENO: - #ifdef LLTRACE - if (lltrace) - printf("--- %s:%d \n", filename, oparg); - #endif - f->f_lineno = oparg; - if (tstate->c_tracefunc == NULL || tstate->tracing) - goto fast_next_opcode; - /* Trace each line of code reached */ - f->f_lasti = INSTR_OFFSET(); - /* Inline call_trace() for performance: */ - tstate->tracing++; - tstate->use_tracing = 0; - err = (tstate->c_tracefunc)(tstate->c_traceobj, f, - PyTrace_LINE, Py_None); - tstate->use_tracing = (tstate->c_tracefunc - || tstate->c_profilefunc); - tstate->tracing--; - break; - case LOAD_FAST: x = GETLOCAL(oparg); --- 757,760 ---- *************** *** 1505,1511 **** --- 1513,1527 ---- break; + case RETURN_NONE: + retval = Py_None; + Py_INCREF(retval); + why = WHY_RETURN; + break; + case YIELD_VALUE: retval = POP(); f->f_stacktop = stack_pointer; + /* abuse the lasti field: here it points to + the *next* instruction */ f->f_lasti = INSTR_OFFSET(); why = WHY_YIELD; *************** *** 1955,1959 **** PyObject **pfunc = stack_pointer - n - 1; PyObject *func = *pfunc; - f->f_lasti = INSTR_OFFSET() - 3; /* For tracing */ /* Always dispatch PyCFunction first, because --- 1971,1974 ---- *************** *** 2023,2027 **** pfunc = stack_pointer - n - 1; func = *pfunc; - f->f_lasti = INSTR_OFFSET() - 3; /* For tracing */ if (PyMethod_Check(func) --- 2038,2041 ---- *************** *** 2135,2139 **** fprintf(stderr, "XXX lineno: %d, opcode: %d\n", ! f->f_lineno, opcode); PyErr_SetString(PyExc_SystemError, "unknown opcode"); why = WHY_EXCEPTION; --- 2149,2154 ---- fprintf(stderr, "XXX lineno: %d, opcode: %d\n", ! PyCode_Addr2Line(f->f_code, f->f_lasti), ! opcode); PyErr_SetString(PyExc_SystemError, "unknown opcode"); why = WHY_EXCEPTION; *************** *** 2190,2196 **** if (why == WHY_EXCEPTION) { - f->f_lasti = INSTR_OFFSET() - 1; - if (HAS_ARG(opcode)) - f->f_lasti -= 2; PyTraceBack_Here(f); --- 2205,2208 ---- *************** *** 2874,2877 **** --- 2886,3008 ---- tstate->tracing--; return result; + } + + static void + maybe_call_line_trace(int opcode, Py_tracefunc func, PyObject *obj, + PyFrameObject *frame, int *instr_lb, int *instr_ub) + { + /* The theory of SET_LINENO-less tracing. + + In a nutshell, we use the co_lnotab field of the code object + to tell when execution has moved onto a different line. + + As mentioned above, the basic idea is so set things up so + that + + *instr_lb <= frame->f_lasti < *instr_ub + + is true so long as execution does not change lines. + + This is all fairly simple. Digging the information out of + co_lnotab takes some work, but is conceptually clear. + + Somewhat harder to explain is why we don't call the line + trace function when executing a POP_TOP or RETURN_NONE + opcodes. An example probably serves best. + + Consider this code: + + 1: def f(a): + 2: if a: + 3: print 1 + 4: else: + 5: print 2 + + which compiles to this: + + 2 0 LOAD_FAST 0 (a) + 3 JUMP_IF_FALSE 9 (to 15) + 6 POP_TOP + + 3 7 LOAD_CONST 1 (1) + 10 PRINT_ITEM + 11 PRINT_NEWLINE + 12 JUMP_FORWARD 6 (to 21) + >> 15 POP_TOP + + 5 16 LOAD_CONST 2 (2) + 19 PRINT_ITEM + 20 PRINT_NEWLINE + >> 21 RETURN_NONE + + 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 + associate the POP_TOP with line 4, but that doesn't make + sense in all cases (I think). + + On the other hand, if 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. + + This is why it is important that RETURN_NONE is *only* used + for the "falling off the end of the function" form of + returning None -- using it for code like + + 1: def f(): + 2: return + + would, once again, lead to misleading tracing behaviour. + + It is also worth mentioning that getting tracing behaviour + right is the *entire* motivation for adding the RETURN_NONE + opcode. + */ + + if (opcode != POP_TOP && opcode != RETURN_NONE && + (frame->f_lasti < *instr_lb || frame->f_lasti > *instr_ub)) { + PyCodeObject* co = frame->f_code; + int size, addr; + unsigned char* p; + + call_trace(func, obj, frame, PyTrace_LINE, Py_None); + + size = PyString_Size(co->co_lnotab) / 2; + p = (unsigned char*)PyString_AsString(co->co_lnotab); + + /* possible optimization: if f->f_lasti == instr_ub + (likely to be a common case) then we already know + instr_lb -- if we stored the matching value of p + somwhere we could skip the first while loop. */ + + addr = 0; + + /* see comments in compile.c for the description of + co_lnotab. A point to remember: increments to p + should come in pairs -- although we don't care about + the line increments here, treating them as byte + increments gets confusing, to say the least. */ + + while (size >= 0) { + if (addr + *p > frame->f_lasti) + break; + addr += *p++; + p++; + --size; + } + *instr_lb = addr; + if (size > 0) { + while (--size >= 0) { + addr += *p++; + if (*p++) + break; + } + *instr_ub = addr; + } + else { + *instr_ub = INT_MAX; + } + } } Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.257 retrieving revision 2.258 diff -C2 -d -r2.257 -r2.258 *** compile.c 14 Aug 2002 15:51:28 -0000 2.257 --- compile.c 15 Aug 2002 14:59:02 -0000 2.258 *************** *** 408,414 **** /* All about c_lnotab. ! c_lnotab is an array of unsigned bytes disguised as a Python string. In -O ! mode, SET_LINENO opcodes aren't generated, and bytecode offsets are mapped ! to source code line #s (when needed for tracebacks) via c_lnotab instead. The array is conceptually a list of (bytecode offset increment, line number increment) --- 408,415 ---- /* All about c_lnotab. ! c_lnotab is an array of unsigned bytes disguised as a Python string. Since ! version 2.3, SET_LINENO opcodes are never generated and bytecode offsets are ! mapped to source code line #s via c_lnotab instead. ! The array is conceptually a list of (bytecode offset increment, line number increment) *************** *** 831,839 **** { int extended_arg = arg >> 16; - if (op == SET_LINENO) { - com_set_lineno(c, arg); - if (Py_OptimizeFlag) - return; - } if (extended_arg){ com_addbyte(c, EXTENDED_ARG); --- 832,835 ---- *************** *** 1739,1743 **** if (ch->n_lineno != lineno) { lineno = ch->n_lineno; ! com_addoparg(c, SET_LINENO, lineno); } com_argument(c, ch, &keywords); --- 1735,1739 ---- if (ch->n_lineno != lineno) { lineno = ch->n_lineno; ! com_set_lineno(c, lineno); } com_argument(c, ch, &keywords); *************** *** 3169,3173 **** } if (i > 0) ! com_addoparg(c, SET_LINENO, ch->n_lineno); com_node(c, ch); com_addfwref(c, JUMP_IF_FALSE, &a); --- 3165,3169 ---- } if (i > 0) ! com_set_lineno(c, ch->n_lineno); com_node(c, ch); com_addfwref(c, JUMP_IF_FALSE, &a); *************** *** 3196,3200 **** block_push(c, SETUP_LOOP); c->c_begin = c->c_nexti; ! com_addoparg(c, SET_LINENO, n->n_lineno); com_node(c, CHILD(n, 1)); com_addfwref(c, JUMP_IF_FALSE, &anchor); --- 3192,3196 ---- block_push(c, SETUP_LOOP); c->c_begin = c->c_nexti; ! com_set_lineno(c, n->n_lineno); com_node(c, CHILD(n, 1)); com_addfwref(c, JUMP_IF_FALSE, &anchor); *************** *** 3229,3233 **** com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; ! com_addoparg(c, SET_LINENO, n->n_lineno); com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); --- 3225,3229 ---- com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; ! com_set_lineno(c, n->n_lineno); com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); *************** *** 3340,3344 **** except_anchor = 0; com_push(c, 3); /* tb, val, exc pushed by exception */ ! com_addoparg(c, SET_LINENO, ch->n_lineno); if (NCH(ch) > 1) { com_addbyte(c, DUP_TOP); --- 3336,3340 ---- except_anchor = 0; com_push(c, 3); /* tb, val, exc pushed by exception */ ! com_set_lineno(c, ch->n_lineno); if (NCH(ch) > 1) { com_addbyte(c, DUP_TOP); *************** *** 3402,3406 **** com_backpatch(c, finally_anchor); ch = CHILD(n, NCH(n)-1); ! com_addoparg(c, SET_LINENO, ch->n_lineno); com_node(c, ch); com_addbyte(c, END_FINALLY); --- 3398,3402 ---- com_backpatch(c, finally_anchor); ch = CHILD(n, NCH(n)-1); ! com_set_lineno(c, ch->n_lineno); com_node(c, ch); com_addbyte(c, END_FINALLY); *************** *** 3728,3732 **** case simple_stmt: /* small_stmt (';' small_stmt)* [';'] NEWLINE */ ! com_addoparg(c, SET_LINENO, n->n_lineno); { int i; --- 3724,3728 ---- case simple_stmt: /* small_stmt (';' small_stmt)* [';'] NEWLINE */ ! com_set_lineno(c, n->n_lineno); { int i; *************** *** 3737,3741 **** case compound_stmt: ! com_addoparg(c, SET_LINENO, n->n_lineno); n = CHILD(n, 0); goto loop; --- 3733,3737 ---- case compound_stmt: ! com_set_lineno(c, n->n_lineno); n = CHILD(n, 0); goto loop; *************** *** 3991,3998 **** com_node(c, CHILD(n, 4)); c->c_infunction = 0; ! com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); ! com_push(c, 1); ! com_addbyte(c, RETURN_VALUE); ! com_pop(c, 1); } --- 3987,3991 ---- com_node(c, CHILD(n, 4)); c->c_infunction = 0; ! com_addbyte(c, RETURN_NONE); } *************** *** 4051,4055 **** compile_node(struct compiling *c, node *n) { ! com_addoparg(c, SET_LINENO, n->n_lineno); switch (TYPE(n)) { --- 4044,4048 ---- compile_node(struct compiling *c, node *n) { ! com_set_lineno(c, n->n_lineno); switch (TYPE(n)) { *************** *** 4061,4068 **** if (TYPE(n) != NEWLINE) com_node(c, n); ! com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); ! com_push(c, 1); ! com_addbyte(c, RETURN_VALUE); ! com_pop(c, 1); c->c_interactive--; break; --- 4054,4058 ---- if (TYPE(n) != NEWLINE) com_node(c, n); ! com_addbyte(c, RETURN_NONE); c->c_interactive--; break; *************** *** 4070,4077 **** case file_input: /* A whole file, or built-in function exec() */ com_file_input(c, n); ! com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); ! com_push(c, 1); ! com_addbyte(c, RETURN_VALUE); ! com_pop(c, 1); break; --- 4060,4064 ---- case file_input: /* A whole file, or built-in function exec() */ com_file_input(c, n); ! com_addbyte(c, RETURN_NONE); break; Index: frozen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/frozen.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** frozen.c 14 Jun 2002 01:11:57 -0000 1.12 --- frozen.c 15 Aug 2002 14:59:02 -0000 1.13 *************** *** 14,23 **** static unsigned char M___hello__[] = { 99,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, ! 0,115,15,0,0,0,127,0,0,127,1,0,100,0,0,71, ! 72,100,1,0,83,40,2,0,0,0,115,14,0,0,0,72, ! 101,108,108,111,32,119,111,114,108,100,46,46,46,78,40,0, ! 0,0,0,40,0,0,0,0,40,0,0,0,0,40,0,0, ! 0,0,115,8,0,0,0,104,101,108,108,111,46,112,121,115, ! 1,0,0,0,63,1,0,0,0,115,0,0,0,0, }; --- 14,23 ---- static unsigned char M___hello__[] = { 99,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, ! 0,115,9,0,0,0,100,0,0,71,72,100,1,0,83,40, ! 2,0,0,0,115,14,0,0,0,72,101,108,108,111,32,119, ! 111,114,108,100,46,46,46,78,40,0,0,0,0,40,0,0, ! 0,0,40,0,0,0,0,40,0,0,0,0,115,8,0,0, ! 0,104,101,108,108,111,46,112,121,115,1,0,0,0,63,1, ! 0,0,0,115,0,0,0,0, }; Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.208 retrieving revision 2.209 diff -C2 -d -r2.208 -r2.209 *** import.c 30 Jun 2002 15:26:10 -0000 2.208 --- import.c 15 Aug 2002 14:59:02 -0000 2.209 *************** *** 50,53 **** --- 50,56 ---- start counting in increments of 10 from now on ?! + MWH, 2002-08-03: Removed SET_LINENO. Couldn't be bothered figuring + out the MAGIC schemes, so just incremented it by 10. + Known values: Python 1.5: 20121 *************** *** 61,66 **** Python 2.2: 60717 Python 2.3a0: 62011 */ ! #define MAGIC (62011 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the --- 64,70 ---- Python 2.2: 60717 Python 2.3a0: 62011 + Python 2.3a0: 62021 */ ! #define MAGIC (62021 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the Index: traceback.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/traceback.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** traceback.c 14 Apr 2002 20:12:41 -0000 2.38 --- traceback.c 15 Aug 2002 14:59:02 -0000 2.39 *************** *** 104,109 **** static tracebackobject * ! newtracebackobject(tracebackobject *next, PyFrameObject *frame, int lasti, ! int lineno) { tracebackobject *tb; --- 104,108 ---- static tracebackobject * ! newtracebackobject(tracebackobject *next, PyFrameObject *frame) { tracebackobject *tb; *************** *** 119,124 **** Py_XINCREF(frame); tb->tb_frame = frame; ! tb->tb_lasti = lasti; ! tb->tb_lineno = lineno; PyObject_GC_Track(tb); } --- 118,124 ---- Py_XINCREF(frame); tb->tb_frame = frame; ! tb->tb_lasti = frame->f_lasti; ! tb->tb_lineno = PyCode_Addr2Line(frame->f_code, ! frame->f_lasti); PyObject_GC_Track(tb); } *************** *** 131,136 **** PyThreadState *tstate = frame->f_tstate; tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback; ! tracebackobject *tb = newtracebackobject(oldtb, ! frame, frame->f_lasti, frame->f_lineno); if (tb == NULL) return -1; --- 131,135 ---- PyThreadState *tstate = frame->f_tstate; tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback; ! tracebackobject *tb = newtracebackobject(oldtb, frame); if (tb == NULL) return -1; From mwh@users.sourceforge.net Thu Aug 15 15:59:32 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.38,1.39 libtraceback.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10908/Doc/lib Modified Files: libdis.tex libtraceback.tex Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** libdis.tex 5 Aug 2002 23:33:54 -0000 1.38 --- libdis.tex 15 Aug 2002 14:58:59 -0000 1.39 *************** *** 24,38 **** \begin{verbatim} >>> dis.dis(myfunc) ! 0 SET_LINENO 1 ! ! 3 SET_LINENO 2 ! 6 LOAD_GLOBAL 0 (len) ! 9 LOAD_FAST 0 (alist) ! 12 CALL_FUNCTION 1 ! 15 RETURN_VALUE ! 16 LOAD_CONST 0 (None) ! 19 RETURN_VALUE \end{verbatim} The \module{dis} module defines the following functions and constants: --- 24,36 ---- \begin{verbatim} >>> dis.dis(myfunc) ! 2 0 LOAD_GLOBAL 0 (len) ! 3 LOAD_FAST 0 (alist) ! 6 CALL_FUNCTION 1 ! 9 RETURN_VALUE ! 10 RETURN_NONE \end{verbatim} + (The ``2'' is a line number). + The \module{dis} module defines the following functions and constants: *************** *** 57,60 **** --- 55,59 ---- \begin{enumerate} + \item the line number, for the first instruction of each line \item the current instruction, indicated as \samp{-->}, \item a labelled instruction, indicated with \samp{>\code{>}}, *************** *** 403,406 **** --- 402,413 ---- \end{opcodedesc} + \begin{opcodedesc}{RETURN_NONE}{} + Returns \constant{None} to the caller of the function. This opcode is + generated as the last opcode of every function and only then, for + reasons to do with tracing support. See the comments in the function + \cfunction{maybe_call_line_trace} in \file{Python/ceval.c} for the + gory details. \versionadded{2.3}. + \end{opcodedesc} + \begin{opcodedesc}{YIELD_VALUE}{} Pops \code{TOS} and yields it from a generator. *************** *** 622,626 **** \begin{opcodedesc}{SET_LINENO}{lineno} ! Sets the current line number to \var{lineno}. \end{opcodedesc} --- 629,633 ---- \begin{opcodedesc}{SET_LINENO}{lineno} ! This opcode is obsolete. \end{opcodedesc} Index: libtraceback.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtraceback.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libtraceback.tex 25 Jul 2002 21:11:23 -0000 1.15 --- libtraceback.tex 15 Aug 2002 14:59:00 -0000 1.16 *************** *** 119,126 **** \begin{funcdesc}{tb_lineno}{tb} This function returns the current line number set in the traceback ! object. This is normally the same as the \code{\var{tb}.tb_lineno} ! field of the object, but when optimization is used (the -O flag) this ! field is not updated correctly; this function calculates the correct ! value. \end{funcdesc} --- 119,126 ---- \begin{funcdesc}{tb_lineno}{tb} This function returns the current line number set in the traceback ! object. This function was necessary because in versions of Python ! prior to 2.3 when the \programopt{O} flag was passed to Python the ! \code{\var{tb}.tb_lineno} was not updated correctly. This function ! has no use in versions past 2.3. \end{funcdesc} From mwh@users.sourceforge.net Thu Aug 15 15:59:32 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv10908/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** whatsnew23.tex 15 Aug 2002 00:40:21 -0000 1.44 --- whatsnew23.tex 15 Aug 2002 14:59:00 -0000 1.45 *************** *** 659,663 **** \end{itemize} - %====================================================================== \section{New and Improved Modules} --- 659,662 ---- *************** *** 988,994 **** Palkovsky.) ! \item The \csimplemacro{DL_EXPORT} and \csimplemacro{DL_IMPORT} macros are now ! deprecated. Initialization functions for Python extension modules ! should now be declared using the new macro \csimplemacro{PyMODINIT_FUNC}, while the Python core will generally use the \csimplemacro{PyAPI_FUNC} and \csimplemacro{PyAPI_DATA} --- 987,993 ---- Palkovsky.) ! \item The \csimplemacro{DL_EXPORT} and \csimplemacro{DL_IMPORT} macros ! are now deprecated. Initialization functions for Python extension ! modules should now be declared using the new macro \csimplemacro{PyMODINIT_FUNC}, while the Python core will generally use the \csimplemacro{PyAPI_FUNC} and \csimplemacro{PyAPI_DATA} *************** *** 1076,1079 **** --- 1075,1101 ---- \item The tools used to build the documentation now work under Cygwin as well as \UNIX. + + \item The \code{SET_LINENO} opcode has been removed. Back in the + mists of time, this opcode was needed to produce line numbers in + tracebacks and support trace functions (for, e.g., \module{pdb}). + Since Python 1.5, the line numbers in tracebacks have been computed + using a different mechanism that works with ``python -O''. For Python + 2.3 Michael Hudson implemented a similar scheme to determine when to + call the trace function, removing the need for \code{SET_LINENO} + entirely. + + Python code will be hard pushed to notice a difference from this + change, apart from a slight speed up when python is run without + \programopt{-O}. + + C extensions that access the \member{f_lineno} field of frame objects + should instead call \code{PyCode_Addr2Line(f->f_code, f->f_lasti)}. + This will have the added effect of making the code work as desired + under ``python -O'' in earlier versions of Python. + + To make tracing work as expected, it was found necessary to add a new + opcode, \cdata{RETURN_NONE}, to the VM. If you want to know why, read + the comments in the function \cfunction{maybe_call_line_trace} in + \file{Python/ceval.c}. \end{itemize} From mwh@users.sourceforge.net Thu Aug 15 15:59:32 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 15 Aug 2002 07:59:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.169,1.170 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv10908/Doc/tut Modified Files: tut.tex Log Message: This is my patch [ 587993 ] SET_LINENO killer Remove SET_LINENO. Tracing is now supported by inspecting co_lnotab. Many sundry changes to document and adapt to this change. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** tut.tex 14 Aug 2002 15:26:18 -0000 1.169 --- tut.tex 15 Aug 2002 14:59:00 -0000 1.170 *************** *** 2341,2350 **** \item When the Python interpreter is invoked with the \programopt{-O} flag, ! optimized code is generated and stored in \file{.pyo} files. ! The optimizer currently doesn't help much; it only removes ! \keyword{assert} statements and \code{SET_LINENO} instructions. ! When \programopt{-O} is used, \emph{all} bytecode is optimized; ! \code{.pyc} files are ignored and \code{.py} files are compiled to ! optimized bytecode. \item --- 2341,2349 ---- \item When the Python interpreter is invoked with the \programopt{-O} flag, ! optimized code is generated and stored in \file{.pyo} files. The ! optimizer currently doesn't help much; it only removes ! \keyword{assert} statements. When \programopt{-O} is used, \emph{all} ! bytecode is optimized; \code{.pyc} files are ignored and \code{.py} ! files are compiled to optimized bytecode. \item From gvanrossum@users.sourceforge.net Thu Aug 15 17:50:57 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 09:50:57 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6671 Modified Files: pep-0283.txt Log Message: Another status update. Added new sections "Completed" and "Unlikely". Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pep-0283.txt 10 Aug 2002 05:14:13 -0000 1.14 --- pep-0283.txt 15 Aug 2002 16:50:55 -0000 1.15 *************** *** 33,36 **** --- 33,80 ---- + Completed features for 2.3 + + This list is not complete; e.g. missing are bool, PyMalloc, and + universal newlines, which were in before this PEP appeared. + + - PEP 263 Defining Python Source Code Encodings + + Implemented (at least phase 1, which is all that's planned for + 2.3). + + - Extended slice notation for all built-in sequences. The patch + by Michael Hudson is now all checked in. + + - Speed up list iterations by filling tp_iter and other tweaks. + See http://www.python.org/sf/560736; also done for xrange and + tuples. + + - Timeout sockets. http://www.python.org/sf/555085 + + - Stage B0 of the int/long integration (PEP 237). This means + issuing a FutureWarning about situations where hex or oct + conversions or left shifts returns a different value for an int + than for a long with the same value. The semantics do *not* + change in Python 2.3; that will happen in Python 2.4. + + - Nuke SET_LINENO from all code objects (providing a different way + to set debugger breakpoints). This can boost pystone by >5%. + http://www.python.org/sf/587993, now checked in. (Unfortunately + the pystone boost didn't happen. What happened?) + + - Write a pymemcompat.h that people can bundle with their + extensions and then use the 2.3 memory interface with all + Pythons in the range 1.5.2 to 2.3. (Michael Hudson checked in + Misc/pymemcompat.h.) + + - Add a new concept, "pending deprecation", with associated + warning PendingDeprecationWarning. This warning is normally + suppressed, but can be enabled by a suitable -W option. (This + has been added, but nothing uses it yet.) + + - Warn when an extension type's tp_compare returns anything except + -1, 0 or 1. http://www.python.org/sf/472523 + + Planned features for 2.3 *************** *** 38,43 **** comments in "parade of the PEPs" style. Not all of these will be part of the final 2.3 release; we'll update the list as decisions ! crystallize. (There's also a bunch of things already implemented, ! like bool, PyMalloc, and universal newlines.) This is pretty much an unordered laundry list. Please send --- 82,86 ---- comments in "parade of the PEPs" style. Not all of these will be part of the final 2.3 release; we'll update the list as decisions ! crystallize. This is pretty much an unordered laundry list. Please send *************** *** 45,83 **** life of the 2.3 development process. - - PEP 266 Optimizing Global Variable/Attribute Access Montanaro - PEP 267 Optimized Access to Module Namespaces Hylton - PEP 280 Optimizing access to globals van Rossum - - These are basically three friendly competing proposals. Jeremy - has made a little progress with a new compiler, but it's going - slow and the compiler is only the first step. Maybe we'll be - able to refactor the compiler in this release. I'm tempted to - say we won't hold our breath. In the mean time, Oren Tirosh has - a much simpler idea that may give a serious boost to the - performance of accessing globals and built-ins, by optimizing - and inlining the dict access: - http://tothink.com/python/fastnames/ - - - PEP 269 Pgen Module for Python Riehl - - I haven't heard from Jon Riehl, so I consider dropping this idea. - - PEP 273 Import Modules from Zip Archives Ahlstrom ! This project has been dormant too long. Somebody wake it up! http://www.python.org/sf/492105 - PEP 282 A Logging System Mick ! Vinay Sajip's implementation is close to completion IMO. I ! expect that his code will be incorporated in the near future. http://www.python.org/sf/578494 ! - PEP 263 Defining Python Source Code Encodings ! ! Implemented (at least phase 1, which is all that's planned for ! 2.3). ! ! - PEP 218 Adding a Built-In Set Object Type I think it would be good to revive this in some form, using a --- 88,104 ---- life of the 2.3 development process. - PEP 273 Import Modules from Zip Archives Ahlstrom ! There's hope for an updated patch at http://www.python.org/sf/492105 - PEP 282 A Logging System Mick ! Vinay Sajip's implementation is close to completion, but could ! stand a restructuring (some of the classes don't belong in the ! core module; maybe the whole thing should become a package). http://www.python.org/sf/578494 ! - PEP 218 Adding a Built-In Set Object Type Wilson I think it would be good to revive this in some form, using a *************** *** 86,90 **** - A new command line option parser. Greg Ward's Optik ! (http://optik.sf.net) would fit the bill fine; there's only some question about whether it should be given a less "cutesy" name. See also http://www.python.org/sigs/getopt-sig/ --- 107,111 ---- - A new command line option parser. Greg Ward's Optik ! (http://optik.sf.net) fits the bill fine; there's only some question about whether it should be given a less "cutesy" name. See also http://www.python.org/sigs/getopt-sig/ *************** *** 95,108 **** Unfortunately there hasn't been much progress on this. - - Extended slice notation for all built-in sequences. Completed: - patch by Michael Hudson is now all checked in. - - An iterator tools module featuring goodies from SML and Haskell? http://mail.python.org/pipermail/python-dev/2002-May/024418.html - - Speed up list iterations by filling tp_iter and other tweaks? - http://www.python.org/sf/560736 (This is done; also for xrange - and tuple objects.) - - Deprecate the buffer object. http://mail.python.org/pipermail/python-dev/2002-July/026388.html --- 116,122 ---- *************** *** 112,146 **** what that need is and how much of the buffer object we can retire. - - Lazily tracking tuples? - http://mail.python.org/pipermail/python-dev/2002-May/023926.html - http://www.python.org/sf/558745 - Not much enthusiasm I believe. - - - Timeout sockets. Completed. - http://www.python.org/sf/555085 - - - Making None a keyword. Can't be done right away, but a warning - would be a first step. - http://mail.python.org/pipermail/python-dev/2002-April/023600.html - Ditto for 'as', which has been a pseudo-keyword long enough. - - - Stage 2 of the int/long integration (PEP 237). This mostly - means warning about situations where hex, oct or shift of an int - returns a different value than for the same value as a long. I - propose *not* to change the semantics this time; that will - happen in the next release, still with a warning. (I think the - PEP misses this step, but it's necessary -- we can't just change - the semantics silently without warning first.) Does this need a - __future__ statement??? - - - Nuke SET_LINENO from all code objects (providing a different way - to set debugger breakpoints). This can boost pystone by >5%. - http://www.python.org/sf/587993 awaiting review. - - - Write a pymemcompat.h that people can bundle with their - extensions and then use the 2.3 memory interface with all - Pythons in the range 1.5.2 to 2.3. (Michael Hudson has done - this; it's in Misc/pymemcompat.h.) - - PEP 262 Database of Installed Python Packages Kuchling --- 126,129 ---- *************** *** 148,162 **** - Add support for the long-awaited Python catalog. Kapil ! Thangavelu is working on an implementation (he's planning a demo ! for OSCON 2002). What else is needed? ! ! - PEP 286 Enhanced Argument Tuples von Loewis ! ! I haven't had the time to review this thoroughly. It seems a ! deep optimization hack (also makes better correctness guarantees ! though). ! ! - Warn when an extension type's tp_compare returns anything except ! -1, 0 or 1. http://www.python.org/sf/472523 (This is done.) - A standard datetime type. An implementation effort is under way: --- 131,137 ---- - Add support for the long-awaited Python catalog. Kapil ! Thangavelu has a Zope-based implementation that he demoed at ! OSCON 2002. Now all we need is a place to host it and a person ! to champion it. - A standard datetime type. An implementation effort is under way: *************** *** 170,178 **** http://mail.python.org/pipermail/python-dev/2002-April/023165.html - - Add a new concept, "pending deprecation", with associated - warning PendingDeprecationWarning. This warning is normally - suppressed, but can be enabled by a suitable -W option. (This - has been added now, but nothing uses it yet.) - - Use pending deprecation for the types and string modules. This requires providing alternatives for the parts that aren't --- 145,148 ---- *************** *** 193,197 **** - Remove use of deprecated features in the core. ! - Doc deprecated features appropriately - Move deprecated features under Py_DEPRECATED (or whatever is decided) --- 163,167 ---- - Remove use of deprecated features in the core. ! - Document deprecated features appropriately. - Move deprecated features under Py_DEPRECATED (or whatever is decided) *************** *** 201,204 **** --- 171,213 ---- - In general, lots of cleanup so it is easier to move forward. + + + Features unlikely to make it into Python 2.3 + + - PEP 266 Optimizing Global Variable/Attribute Access Montanaro + PEP 267 Optimized Access to Module Namespaces Hylton + PEP 280 Optimizing access to globals van Rossum + + These are basically three friendly competing proposals. Jeremy + has made a little progress with a new compiler, but it's going + slow and the compiler is only the first step. Maybe we'll be + able to refactor the compiler in this release. I'm tempted to + say we won't hold our breath. In the mean time, Oren Tirosh has + a much simpler idea that may give a serious boost to the + performance of accessing globals and built-ins, by optimizing + and inlining the dict access: + http://tothink.com/python/fastnames/ + + - PEP 269 Pgen Module for Python Riehl + + Based on Jonathan Riehl's latest posts in the parser-sig, e.g. + http://mail.python.org/pipermail/parser-sig/2002-August/000012.html + I consider this project dead. + + - Lazily tracking tuples? + http://mail.python.org/pipermail/python-dev/2002-May/023926.html + http://www.python.org/sf/558745 + Not much enthusiasm I believe. + + - Making None a keyword. Can't be done right away, but a warning + would be a first step. + http://mail.python.org/pipermail/python-dev/2002-April/023600.html + Ditto for 'as', which has been a pseudo-keyword long enough. + + - PEP 286 Enhanced Argument Tuples von Loewis + + I haven't had the time to review this thoroughly. It seems a + deep optimization hack (also makes better correctness guarantees + though). From tim_one@users.sourceforge.net Thu Aug 15 20:41:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 Aug 2002 12:41:08 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.138,1.139 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1607/python/Objects Modified Files: longobject.c Log Message: long_mul(): Simplified exit code. In particular, k_mul() returns a normalized result, so no point to normalizing it again. The number of test+branches was also excessive. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** longobject.c 14 Aug 2002 17:07:32 -0000 1.138 --- longobject.c 15 Aug 2002 19:41:06 -0000 1.139 *************** *** 1879,1894 **** z = k_mul(a, b); ! if(z == NULL) { ! Py_DECREF(a); ! Py_DECREF(b); ! return NULL; ! } ! if (a->ob_size < 0) ! z->ob_size = -(z->ob_size); ! if (b->ob_size < 0) z->ob_size = -(z->ob_size); Py_DECREF(a); Py_DECREF(b); ! return (PyObject *) long_normalize(z); } --- 1879,1888 ---- z = k_mul(a, b); ! /* Negate if exactly one of the inputs is negative. */ ! if (((a->ob_size ^ b->ob_size) < 0) && z) z->ob_size = -(z->ob_size); Py_DECREF(a); Py_DECREF(b); ! return (PyObject *)z; } From tim_one@users.sourceforge.net Thu Aug 15 21:06:04 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 Aug 2002 13:06:04 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.139,1.140 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14195/python/Objects Modified Files: longobject.c Log Message: k_mul() comments: In honor of Dijkstra, made the proof that "t3 fits" rigorous instead of hoping for testing not to turn up counterexamples. Call me heretical, but despite that I'm wholly confident in the proof, and have done it two different ways now, I still put more faith in testing ... Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** longobject.c 15 Aug 2002 19:41:06 -0000 1.139 --- longobject.c 15 Aug 2002 20:06:00 -0000 1.140 *************** *** 1758,1795 **** /* (*) Why adding t3 can't "run out of room" above. ! We allocated space for asize + bsize result digits. We're adding t3 at an ! offset of shift digits, so there are asize + bsize - shift allocated digits ! remaining. Because degenerate shifts of "a" were weeded out, asize is at ! least shift + 1. If bsize is odd then bsize == 2*shift + 1, else bsize == ! 2*shift. Therefore there are at least shift+1 + 2*shift - shift = ! 2*shift+1 allocated digits remaining when bsize is even, or at least ! 2*shift+2 allocated digits remaining when bsize is odd. ! Now in bh+bl, if bsize is even bh has at most shift digits, while if bsize ! is odd bh has at most shift+1 digits. The sum bh+bl has at most ! shift digits plus 1 bit when bsize is even ! shift+1 digits plus 1 bit when bsize is odd ! The same is true of ah+al, so (ah+al)(bh+bl) has at most ! 2*shift digits + 2 bits when bsize is even ! 2*shift+2 digits + 2 bits when bsize is odd ! If bsize is even, we have at most 2*shift digits + 2 bits to fit into at ! least 2*shift+1 digits. Since a digit has SHIFT bits, and SHIFT >= 2, ! there's always enough room to fit the 2 bits into the "spare" digit. ! If bsize is odd, we have at most 2*shift+2 digits + 2 bits to fit into at ! least 2*shift+2 digits, and there's not obviously enough room for the ! extra two bits. We need a sharper analysis in this case. The major ! laziness was in the "the same is true of ah+al" clause: ah+al can't actually ! have shift+1 digits + 1 bit unless bsize is odd and asize == bsize. In that ! case, we actually have (2*shift+1)*2 - shift = 3*shift+2 allocated digits ! remaining, and that's obviously plenty to hold 2*shift+2 digits + 2 bits. ! Else (bsize is odd and asize < bsize) ah and al each have at most shift digits, ! so ah+al has at most shift digits + 1 bit, and (ah+al)*(bh+bl) has at most ! 2*shift+1 digits + 2 bits, and again 2*shift+2 digits is enough to hold it. Note that since there's always enough room for (ah+al)*(bh+bl), and that's --- 1758,1798 ---- /* (*) Why adding t3 can't "run out of room" above. ! Let f(x) mean the floor of x and c(x) mean the ceiling of x. Some facts ! to start with: ! 1. For any integer i, i = c(i/2) + f(i/2). In particular, ! bsize = c(bsize/2) + f(bsize/2). ! 2. shift = f(bsize/2) ! 3. asize <= bsize ! 4. Since we call k_lopsided_mul if asize*2 <= bsize, asize*2 > bsize in this ! routine, so asize > bsize/2 >= f(bsize/2) in this routine. ! We allocated asize + bsize result digits, and add t3 into them at an offset ! of shift. This leaves asize+bsize-shift allocated digit positions for t3 ! to fit into, = (by #1 and #2) asize + f(bsize/2) + c(bsize/2) - f(bsize/2) = ! asize + c(bsize/2) available digit positions. ! bh has c(bsize/2) digits, and bl at most f(size/2) digits. So bh+hl has ! at most c(bsize/2) digits + 1 bit. ! If asize == bsize, ah has c(bsize/2) digits, else ah has at most f(bsize/2) ! digits, and al has at most f(bsize/2) digits in any case. So ah+al has at ! most (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 1 bit. ! The product (ah+al)*(bh+bl) therefore has at most ! c(bsize/2) + (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits ! and we have asize + c(bsize/2) available digit positions. We need to show ! this is always enough. An instance of c(bsize/2) cancels out in both, so ! the question reduces to whether asize digits is enough to hold ! (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits. If asize < bsize, ! then we're asking whether asize digits >= f(bsize/2) digits + 2 bits. By #4, ! asize is at least f(bsize/2)+1 digits, so this in turn reduces to whether 1 ! digit is enough to hold 2 bits. This is so since SHIFT=15 >= 2. If ! asize == bsize, then we're asking whether bsize digits is enough to hold ! f(bsize/2) digits + 2 bits, or equivalently (by #1) whether c(bsize/2) digits ! is enough to hold 2 bits. This is so if bsize >= 1, which holds because ! bsize >= KARATSUBA_CUTOFF >= 1. Note that since there's always enough room for (ah+al)*(bh+bl), and that's From tim_one@users.sourceforge.net Thu Aug 15 21:10:48 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 Aug 2002 13:10:48 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.140,1.141 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17572/python/Objects Modified Files: longobject.c Log Message: Illustrating by example one good reason not to trust a proof . Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** longobject.c 15 Aug 2002 20:06:00 -0000 1.140 --- longobject.c 15 Aug 2002 20:10:45 -0000 1.141 *************** *** 1792,1798 **** digit is enough to hold 2 bits. This is so since SHIFT=15 >= 2. If asize == bsize, then we're asking whether bsize digits is enough to hold ! f(bsize/2) digits + 2 bits, or equivalently (by #1) whether c(bsize/2) digits ! is enough to hold 2 bits. This is so if bsize >= 1, which holds because ! bsize >= KARATSUBA_CUTOFF >= 1. Note that since there's always enough room for (ah+al)*(bh+bl), and that's --- 1792,1798 ---- digit is enough to hold 2 bits. This is so since SHIFT=15 >= 2. If asize == bsize, then we're asking whether bsize digits is enough to hold ! c(bsize/2) digits + 2 bits, or equivalently (by #1) whether f(bsize/2) digits ! is enough to hold 2 bits. This is so if bsize >= 2, which holds because ! bsize >= KARATSUBA_CUTOFF >= 2. Note that since there's always enough room for (ah+al)*(bh+bl), and that's From gvanrossum@users.sourceforge.net Thu Aug 15 21:36:53 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 13:36:53 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets set.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv32323 Modified Files: set.py Log Message: New version. I started with Alex Martelli's version from SF patch 580995, and then did a major rewrite (e.g. getting rid of list comprehensions). I'll work on the test suite tomorrow. Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** set.py 28 Aug 2001 16:19:35 -0000 1.3 --- set.py 15 Aug 2002 20:36:51 -0000 1.4 *************** *** 1,171 **** ! """A class to represent sets in Python. ! This class implements sets as dictionaries whose values are ignored. ! The usual operations (union, intersection, deletion, etc.) are ! provided as both methods and operators. The only unusual feature of ! this class is that once a set's hash code has been calculated (for ! example, once it has been used as a dictionary key, or as an element ! in another set), that set 'freezes', and becomes immutable. See ! PEP-0218 for a full discussion. """ ! __version__ = "$Revision$" ! __author__ = "$Author$" ! __date__ = "$Date$" - from copy import deepcopy ! class Set(dictionary): - # Displayed when operation forbidden because set has been frozen - _Frozen_Msg = "Set is frozen: %s not permitted" ! #---------------------------------------- ! def __init__(self, seq=None, sort_repr=0): ! """Construct a set, optionally initializing it with elements ! drawn from a sequence. If 'sort_repr' is true, the set's ! elements are displayed in sorted order. This slows down ! conversion, but simplifies comparison during testing. The ! 'hashcode' element is given a non-None value the first time ! the set's hashcode is calculated; the set is frozen ! thereafter.""" ! self.sort_repr = sort_repr if seq is not None: ! for x in seq: ! self[x] = None ! self.hashcode = None ! #---------------------------------------- ! def __str__(self): ! """Convert set to string.""" ! content = self.keys() ! if self.sort_repr: ! content.sort() ! return 'Set(' + `content` + ')' ! #---------------------------------------- ! # '__repr__' returns the same thing as '__str__' ! __repr__ = __str__ - #---------------------------------------- def __iter__(self): ! """Return iterator for enumerating set elements. This is a ! keys iterator for the underlying dictionary.""" ! return self.iterkeys() ! #---------------------------------------- ! # Comparisons def __lt__(self, other): ! return self._generic_cmp(other, dictionary.__lt__) def __le__(self, other): ! return self._generic_cmp(other, dictionary.__le__) def __eq__(self, other): ! return self._generic_cmp(other, dictionary.__eq__) def __ne__(self, other): ! return self._generic_cmp(other, dictionary.__ne__) def __gt__(self, other): ! return self._generic_cmp(other, dictionary.__gt__) def __ge__(self, other): ! return self._generic_cmp(other, dictionary.__ge__) ! ! #---------------------------------------- ! def __hash__(self): ! ! """Calculate hash code for set by xor'ing hash codes of set ! elements. This algorithm ensures that the hash code does not ! depend on the order in which elements are added to the ! code.""" ! ! # If set already has hashcode, the set has been frozen, so ! # code is still valid. ! if self.hashcode is not None: ! return self.hashcode ! ! # Combine hash codes of set elements to produce set's hash code. ! self.hashcode = 0 ! for elt in self: ! self.hashcode ^= hash(elt) ! return self.hashcode ! ! #---------------------------------------- ! def is_frozen(self): ! ! """Report whether set is frozen or not. A frozen set is one ! whose hash code has already been calculated. Frozen sets may ! not be mutated, but unfrozen sets can be.""" ! return self.hashcode is not None ! #---------------------------------------- ! def __copy__(self): ! """Return a shallow copy of the set.""" ! result = Set() ! for elt in self: ! result[elt] = None ! return result ! #---------------------------------------- ! # Define 'copy' method as readable alias for '__copy__'. ! copy = __copy__ - #---------------------------------------- def __deepcopy__(self, memo): ! result = Set() ! memo[id(self)] = result for elt in self: ! result[deepcopy(elt, memo)] = None return result ! #---------------------------------------- ! def clear(self): ! """Remove all elements of unfrozen set.""" ! if self.hashcode is not None: ! raise ValueError, Set._Frozen_Msg % "clearing" ! dictionary.clear(self) ! ! #---------------------------------------- ! def union_update(self, other): ! """Update set with union of its own elements and the elements ! in another set.""" ! ! self._binary_sanity_check(other, "updating union") ! self.update(other) ! return self - #---------------------------------------- def union(self, other): ! """Create new set whose elements are the union of this set's ! and another's.""" self._binary_sanity_check(other) ! result = self.__copy__() ! result.union_update(other) return result ! #---------------------------------------- ! def intersect_update(self, other): ! """Update set with intersection of its own elements and the ! elements in another set.""" ! ! self._binary_sanity_check(other, "updating intersection") ! old_elements = self.keys() ! self.clear() ! for elt in old_elements: ! if elt in other: ! self[elt] = None ! return self ! #---------------------------------------- ! def intersect(self, other): ! """Create new set whose elements are the intersection of this ! set's and another's.""" self._binary_sanity_check(other) if len(self) <= len(other): --- 1,172 ---- ! """Classes to represent arbitrary sets (including sets of sets). ! ! This module implements sets using dictionaries whose values are ! ignored. The usual operations (union, intersection, deletion, etc.) ! are provided as both methods and operators. ! ! The following classes are provided: ! ! BaseSet -- All the operations common to both mutable and immutable ! sets. This is an abstract class, not meant to be directly ! instantiated. ! ! Set -- Mutable sets, subclass of BaseSet; not hashable. ! ! ImmutableSet -- Immutable sets, subclass of BaseSet; hashable. ! An iterable argument is mandatory to create an ImmutableSet. ! ! _TemporarilyImmutableSet -- Not a subclass of BaseSet: just a wrapper ! around a Set, hashable, giving the same hash value as the ! immutable set equivalent would have. Do not use this class ! directly. ! ! Only hashable objects can be added to a Set. In particular, you cannot ! really add a Set as an element to another Set; if you try, what is ! actuallly added is an ImmutableSet built from it (it compares equal to ! the one you tried adding). ! ! When you ask if `x in y' where x is a Set and y is a Set or ! ImmutableSet, x is wrapped into a _TemporarilyImmutableSet z, and ! what's tested is actually `z in y'. ! """ ! # Code history: ! # ! # - Greg V. Wilson wrote the first version, using a different approach ! # to the mutable/immutable problem, and inheriting from dict. ! # ! # - Alex Martelli modified Greg's version to implement the current ! # Set/ImmutableSet approach, and make the data an attribute. ! # ! # - Guido van Rossum rewrote much of the code, made some API changes, ! # and cleaned up the docstrings. ! __all__ = ['BaseSet', 'Set', 'ImmutableSet'] ! class BaseSet(object): ! """Common base class for mutable and immutable sets.""" ! # Constructor ! def __init__(self, seq=None, sort_repr=False): ! """Construct a set, optionally initializing it from a sequence. ! ! If the optional keyword argument sort_repr is True, the set's ! elements are displayed in sorted order. This slows down ! conversion to string, but simplifies comparison during testing. ! """ ! self._sort_repr = sort_repr ! self._data = {} if seq is not None: ! # I don't know a faster way to do this in pure Python. ! # Custom code written in C only did it 65% faster, ! # preallocating the dict to len(seq); without ! # preallocation it was only 25% faster. So the speed of ! # this Python code is respectable. Just copying True into ! # a local variable is responsible for a 7-8% speedup. ! data = self._data ! value = True ! for key in seq: ! data[key] = value ! # Standard protocols: __len__, __repr__, __str__, __iter__ ! def __len__(self): ! """Return the number of elements of a set.""" ! return len(self._data) ! ! def __repr__(self): ! """Return string representation of a set. ! ! This looks like 'Set([])'. ! """ ! elements = self._data.keys() ! if self._sort_repr: ! elements.sort() ! return '%s(%r)' % (self.__class__.__name__, elements) ! ! # __str__ is the same as __repr__ ! __str__ = __repr__ def __iter__(self): ! """Return an iterator over the elements or a set. ! This is the keys iterator for the underlying dict. ! """ ! return self._data.iterkeys() ! ! # Comparisons. Ordering is determined by the ordering of the ! # underlying dicts (which is consistent though unpredictable). def __lt__(self, other): ! self._binary_sanity_check(other) ! return self._data < other._data def __le__(self, other): ! self._binary_sanity_check(other) ! return self._data <= other._data def __eq__(self, other): ! self._binary_sanity_check(other) ! return self._data == other._data def __ne__(self, other): ! self._binary_sanity_check(other) ! return self._data != other._data def __gt__(self, other): ! self._binary_sanity_check(other) ! return self._data > other._data def __ge__(self, other): ! self._binary_sanity_check(other) ! return self._data >= other._data ! # Copying operations ! def copy(self): ! """Return a shallow copy of a set.""" ! return self.__class__(self, sort_repr=self._sort_repr) ! __copy__ = copy # For the copy module def __deepcopy__(self, memo): ! """Return a deep copy of a set; used by copy module.""" ! # This pre-creates the result and inserts it in the memo ! # early, in case the deep copy recurses into another reference ! # to this same set. A set can't be an element of itself, but ! # it can certainly contain an object that has a reference to ! # itself. ! from copy import deepcopy ! result = self.__class__([], self._sort_repr) ! memo[id(self)] = result ! data = result._data ! value = True for elt in self: ! data[deepcopy(elt, memo)] = value return result ! # Standard set operations: union, intersection, both differences def union(self, other): ! """Return the union of two sets as a new set. + (I.e. all elements that are in either set.) + """ self._binary_sanity_check(other) ! result = self.__class__(self._data, self._sort_repr) ! result._data.update(other._data) return result ! __or__ = union ! def intersection(self, other): ! """Return the intersection of two sets as a new set. + (I.e. all elements that are in both sets.) + """ self._binary_sanity_check(other) if len(self) <= len(other): *************** *** 173,340 **** else: little, big = other, self ! result = Set() for elt in little: if elt in big: ! result[elt] = None return result ! #---------------------------------------- ! def sym_difference_update(self, other): ! """Update set with symmetric difference of its own elements ! and the elements in another set. A value 'x' is in the result ! if it was originally present in one or the other set, but not ! in both.""" ! ! self._binary_sanity_check(other, "updating symmetric difference") ! self = self._raw_sym_difference(self, other) ! return self ! #---------------------------------------- ! def sym_difference(self, other): ! """Create new set with symmetric difference of this set's own ! elements and the elements in another set. A value 'x' is in ! the result if it was originally present in one or the other ! set, but not in both.""" self._binary_sanity_check(other) ! result = Set() ! result = self._raw_sym_difference(self, other) return result ! #---------------------------------------- ! def difference_update(self, other): ! """Remove all elements of another set from this set.""" ! self._binary_sanity_check(other, "updating difference") ! old_elements = self.keys() ! self.clear() ! for elt in old_elements: if elt not in other: ! self[elt] = None ! return self ! #---------------------------------------- ! def difference(self, other): ! """Create new set containing elements of this set that are not ! present in another set.""" self._binary_sanity_check(other) - result = Set() for elt in self: if elt not in other: ! result[elt] = None return result - #---------------------------------------- - # Arithmetic forms of operations - __or__ = union - __ror__ = union - __ior__ = union_update - __and__ = intersect - __rand__ = intersect - __iand__ = intersect_update - __xor__ = sym_difference - __rxor__ = sym_difference - __ixor__ = sym_difference_update - __sub__ = difference - __rsub__ = difference - __isub__ = difference_update ! #---------------------------------------- ! def add(self, item): ! """Add an item to a set. This has no effect if the item is ! already present.""" ! if self.hashcode is not None: ! raise ValueError, Set._Frozen_Msg % "adding an element" ! self[item] = None - #---------------------------------------- def update(self, iterable): ! """Add all values from an iteratable (such as a tuple, list, ! or file) to this set.""" ! if self.hashcode is not None: ! raise ValueError, Set._Frozen_Msg % "adding an element" ! for item in iterable: ! self[item] = None ! #---------------------------------------- ! def remove(self, item): ! """Remove an element from a set if it is present, or raise a ! LookupError if it is not.""" ! if self.hashcode is not None: ! raise ValueError, Set._Frozen_Msg % "removing an element" ! del self[item] ! #---------------------------------------- ! def discard(self, item): ! """Remove an element from a set if it is present, or do ! nothing if it is not.""" ! if self.hashcode is not None: ! raise ValueError, Set._Frozen_Msg % "removing an element" try: ! del self[item] except KeyError: pass - #---------------------------------------- def popitem(self): """Remove and return a randomly-chosen set element.""" ! if self.hashcode is not None: ! raise ValueError, Set._Frozen_Msg % "removing an element" ! return dictionary.popitem(self)[0] ! #---------------------------------------- ! def is_subset_of(self, other): ! """Reports whether other set contains this set.""" ! if not isinstance(other, Set): ! raise ValueError, "Subset tests only permitted between sets" ! for element in self: ! if element not in other: ! return 0 ! return 1 - #---------------------------------------- - # Generic comparison - def _generic_cmp(self, other, method): - """Compare one set with another using a dictionary method. - Sets may only be compared with sets; ordering is determined - by the keys in the underlying dictionary.""" - if not isinstance(other, Set): - raise ValueError, "Sets can only be compared to sets" - return method(self, other) ! #---------------------------------------- ! # Check that the other argument to a binary operation is also a ! # set, and that this set is still mutable (if appropriate), ! # raising a ValueError if either condition is not met. ! def _binary_sanity_check(self, other, updating_op=''): ! if updating_op and (self.hashcode is not None): ! raise ValueError, Set._Frozen_Msg % updating_op ! if not isinstance(other, Set): ! raise ValueError, "Binary operation only permitted between sets" - #---------------------------------------- - # Calculate the symmetric difference between the keys in two - # dictionaries with don't-care values. - def _raw_sym_difference(self, left, right): - result = {} - for elt in left: - if elt not in right: - result[elt] = None - for elt in right: - if elt not in left: - result[elt] = None - return result - #---------------------------------------------------------------------- # Rudimentary self-tests - #---------------------------------------------------------------------- ! if __name__ == "__main__": # Empty set --- 174,442 ---- else: little, big = other, self ! result = self.__class__([], self._sort_repr) ! data = result._data ! value = True for elt in little: if elt in big: ! data[elt] = value return result ! __and__ = intersection ! def symmetric_difference(self, other): ! """Return the symmetric difference of two sets as a new set. + (I.e. all elements that are in exactly one of the sets.) + """ self._binary_sanity_check(other) ! result = self.__class__([], self._sort_repr) ! data = result._data ! value = True ! for elt in self: ! if elt not in other: ! data[elt] = value ! for elt in other: ! if elt not in self: ! data[elt] = value return result ! __xor__ = symmetric_difference ! def difference(self, other): ! """Return the difference of two sets as a new Set. ! ! (I.e. all elements that are in this set and not in the other.) ! """ ! self._binary_sanity_check(other) ! result = self.__class__([], self._sort_repr) ! data = result._data ! value = True ! for elt in self: if elt not in other: ! data[elt] = value ! return result ! __sub__ = difference ! ! # Membership test + def __contains__(self, element): + """Report whether an element is a member of a set. + + (Called in response to the expression `element in self'.) + """ + try: + transform = element._as_temporarily_immutable + except AttributeError: + pass + else: + element = transform() + return element in self._data + + # Subset and superset test + + def issubset(self, other): + """Report whether another set contains this set.""" self._binary_sanity_check(other) for elt in self: if elt not in other: ! return False ! return True ! ! def issuperset(self, other): ! """Report whether this set contains another set.""" ! self._binary_sanity_check(other) ! for elt in other: ! if elt not in self: ! return False ! return True ! ! # Assorted helpers ! ! def _binary_sanity_check(self, other): ! # Check that the other argument to a binary operation is also ! # a set, raising a TypeError otherwise. ! if not isinstance(other, BaseSet): ! raise TypeError, "Binary operation only permitted between sets" ! ! def _compute_hash(self): ! # Calculate hash code for a set by xor'ing the hash codes of ! # the elements. This algorithm ensures that the hash code ! # does not depend on the order in which elements are added to ! # the code. This is not called __hash__ because a BaseSet ! # should not be hashable; only an ImmutableSet is hashable. ! result = 0 ! for elt in self: ! result ^= hash(elt) return result ! class ImmutableSet(BaseSet): ! """Immutable set class.""" ! # BaseSet + hashing ! ! _hashcode = None ! ! def __init__(self, seq, sort_repr=0): ! """Construct an immutable set from a sequence. ! ! If the optional keyword argument sort_repr is True, the set's ! elements are displayed in sorted order. This slows down ! conversion to string, but simplifies comparison during testing. ! """ ! # Override the constructor to make 'seq' a required argument ! BaseSet.__init__(self, seq, sort_repr) ! ! def __hash__(self): ! if self._hashcode is None: ! self._hashcode = self._compute_hash() ! return self._hashcode ! ! ! class Set(BaseSet): ! """ Mutable set class.""" ! ! # BaseSet + operations requiring mutability; no hashing ! ! # In-place union, intersection, differences ! ! def union_update(self, other): ! """Update a set with the union of itself and another.""" ! self._binary_sanity_check(other) ! self._data.update(other._data) ! return self ! ! __ior__ = union_update ! ! def intersection_update(self, other): ! """Update a set with the intersection of itself and another.""" ! self._binary_sanity_check(other) ! for elt in self._data.keys(): ! if elt not in other: ! del self._data[elt] ! return self ! ! __iand__ = intersection_update ! ! def symmetric_difference_update(self, other): ! """Update a set with the symmetric difference of itself and another.""" ! self._binary_sanity_check(other) ! data = self._data ! value = True ! for elt in other: ! if elt in data: ! del data[elt] ! else: ! data[elt] = value ! return self ! ! __ixor__ = symmetric_difference_update ! ! def difference_update(self, other): ! """Remove all elements of another set from this set.""" ! self._binary_sanity_check(other) ! data = self._data ! value = True ! for elt in other: ! if elt in data: ! del data[elt] ! return self ! ! __isub__ = difference_update ! ! # Python dict-like mass mutations: update, clear def update(self, iterable): ! """Add all values from an iterable (such as a list or file).""" ! value = True ! for elt in iterable: ! try: ! transform = elt._as_immutable ! except AttributeError: ! pass ! else: ! elt = transform() ! self._data[elt] = elt ! def clear(self): ! """Remove all elements from this set.""" ! self._data.clear() ! # Single-element mutations: add, remove, discard ! def add(self, element): ! """Add an element to a set. ! This has no effect if the element is already present. ! """ ! try: ! transform = element._as_immutable ! except AttributeError: ! pass ! else: ! element = transform() ! self._data[element] = True ! def remove(self, element): ! """Remove an element from a set; it must be a member. ! ! If the element is not a member, raise a KeyError. ! """ try: ! transform = element._as_temporarily_immutable ! except AttributeError: ! pass ! else: ! element = transform() ! del self._data[element] ! ! def discard(self, element): ! """Remove an element from a set if it is a member. ! ! If the element is not a member, do nothing. ! """ ! try: ! del self._data[element] except KeyError: pass def popitem(self): """Remove and return a randomly-chosen set element.""" + return self._data.popitem()[0] ! def _as_immutable(self): ! # Return a copy of self as an immutable set ! return ImmutableSet(self) ! def _as_temporarily_immutable(self): ! # Return self wrapped in a temporarily immutable set ! return _TemporarilyImmutableSet(self) ! class _TemporarilyImmutableSet(object): ! # Wrap a mutable set as if it was temporarily immutable. ! # This only supplies hashing and equality comparisons. ! ! _hashcode = None ! ! def __init__(self, set): ! self._set = _set ! ! def __hash__(self): ! if self._hashcode is None: ! self._hashcode = self._set._compute_hash() ! return self._hashcode ! ! def __eq__(self, other): ! return self._set == other ! ! def __ne__(self, other): ! return self._set != other # Rudimentary self-tests ! def _test(): # Empty set *************** *** 425,426 **** --- 527,532 ---- print "All tests passed" + + + if __name__ == "__main__": + _test() From gvanrossum@users.sourceforge.net Thu Aug 15 21:42:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 13:42:17 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets set.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv2168 Modified Files: set.py Log Message: Fix a bug in update(); it was setting the value to elt instead of True. Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** set.py 15 Aug 2002 20:36:51 -0000 1.4 --- set.py 15 Aug 2002 20:42:15 -0000 1.5 *************** *** 350,353 **** --- 350,354 ---- def update(self, iterable): """Add all values from an iterable (such as a list or file).""" + data = self._data value = True for elt in iterable: *************** *** 358,362 **** else: elt = transform() ! self._data[elt] = elt def clear(self): --- 359,363 ---- else: elt = transform() ! data[elt] = value def clear(self): From gvanrossum@users.sourceforge.net Thu Aug 15 21:43:09 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 13:43:09 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets test_set.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv2516 Modified Files: test_set.py Log Message: Changes by Alex Martelli. Fixed to reflect name change of is_subset_of() to issubset(). Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/test_set.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_set.py 28 Aug 2001 16:19:35 -0000 1.3 --- test_set.py 15 Aug 2002 20:43:07 -0000 1.4 *************** *** 1,5 **** #!/usr/bin/env python ! from set import Set import unittest, operator, copy --- 1,5 ---- #!/usr/bin/env python ! from set import Set, ImmutableSet import unittest, operator, copy *************** *** 318,331 **** self.values = [0, 1] self.set = Set(self.values) hash(self.set) - def test_freeze_after_hash(self): - assert self.set.is_frozen(), "Set not frozen after hashing" - def test_clear_after_freeze(self): try: self.set.clear() assert 0, "Empty disregards freezing" ! except ValueError: pass --- 318,329 ---- self.values = [0, 1] self.set = Set(self.values) + self.set = ImmutableSet(self.set) hash(self.set) def test_clear_after_freeze(self): try: self.set.clear() assert 0, "Empty disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 334,338 **** self.set |= Set([2]) assert 0, "Union update disregards freezing" ! except ValueError: pass --- 332,336 ---- self.set |= Set([2]) assert 0, "Union update disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 341,345 **** self.set &= Set([2]) assert 0, "Intersection update disregards freezing" ! except ValueError: pass --- 339,343 ---- self.set &= Set([2]) assert 0, "Intersection update disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 348,352 **** self.set ^= Set([2]) assert 0, "Symmetric difference update disregards freezing" ! except ValueError: pass --- 346,350 ---- self.set ^= Set([2]) assert 0, "Symmetric difference update disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 355,359 **** self.set -= Set([2]) assert 0, "Difference update disregards freezing" ! except ValueError: pass --- 353,357 ---- self.set -= Set([2]) assert 0, "Difference update disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 362,366 **** self.set.add(4) assert 0, "Add disregards freezing" ! except ValueError: pass --- 360,364 ---- self.set.add(4) assert 0, "Add disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 369,373 **** self.set.update([4, 5]) assert 0, "Update disregards freezing" ! except ValueError: pass --- 367,371 ---- self.set.update([4, 5]) assert 0, "Update disregards freezing" ! except (TypeError, AttributeError): pass *************** *** 376,381 **** class TestSubsets(unittest.TestCase): ! def test_is_subset_of(self): ! result = self.left.is_subset_of(self.right) if "<" in self.cases: assert result, "subset: " + self.name --- 374,379 ---- class TestSubsets(unittest.TestCase): ! def test_issubset(self): ! result = self.left.issubset(self.right) if "<" in self.cases: assert result, "subset: " + self.name *************** *** 436,445 **** self.other < self.set assert 0, "Comparison with non-set on left" ! except ValueError: pass try: self.set >= self.other assert 0, "Comparison with non-set on right" ! except ValueError: pass --- 434,443 ---- self.other < self.set assert 0, "Comparison with non-set on left" ! except TypeError: pass try: self.set >= self.other assert 0, "Comparison with non-set on right" ! except TypeError: pass *************** *** 448,452 **** self.set |= self.other assert 0, "Union update with non-set" ! except ValueError: pass --- 446,450 ---- self.set |= self.other assert 0, "Union update with non-set" ! except TypeError: pass *************** *** 455,464 **** self.other | self.set assert 0, "Union with non-set on left" ! except ValueError: pass try: self.set | self.other assert 0, "Union with non-set on right" ! except ValueError: pass --- 453,462 ---- self.other | self.set assert 0, "Union with non-set on left" ! except TypeError: pass try: self.set | self.other assert 0, "Union with non-set on right" ! except TypeError: pass *************** *** 467,471 **** self.set &= self.other assert 0, "Intersection update with non-set" ! except ValueError: pass --- 465,469 ---- self.set &= self.other assert 0, "Intersection update with non-set" ! except TypeError: pass *************** *** 474,483 **** self.other & self.set assert 0, "Intersection with non-set on left" ! except ValueError: pass try: self.set & self.other assert 0, "Intersection with non-set on right" ! except ValueError: pass --- 472,481 ---- self.other & self.set assert 0, "Intersection with non-set on left" ! except TypeError: pass try: self.set & self.other assert 0, "Intersection with non-set on right" ! except TypeError: pass *************** *** 486,490 **** self.set ^= self.other assert 0, "Symmetric difference update with non-set" ! except ValueError: pass --- 484,488 ---- self.set ^= self.other assert 0, "Symmetric difference update with non-set" ! except TypeError: pass *************** *** 493,502 **** self.other ^ self.set assert 0, "Symmetric difference with non-set on left" ! except ValueError: pass try: self.set ^ self.other assert 0, "Symmetric difference with non-set on right" ! except ValueError: pass --- 491,500 ---- self.other ^ self.set assert 0, "Symmetric difference with non-set on left" ! except TypeError: pass try: self.set ^ self.other assert 0, "Symmetric difference with non-set on right" ! except TypeError: pass *************** *** 505,509 **** self.set -= self.other assert 0, "Symmetric difference update with non-set" ! except ValueError: pass --- 503,507 ---- self.set -= self.other assert 0, "Symmetric difference update with non-set" ! except TypeError: pass *************** *** 512,521 **** self.other - self.set assert 0, "Symmetric difference with non-set on left" ! except ValueError: pass try: self.set - self.other assert 0, "Symmetric difference with non-set on right" ! except ValueError: pass --- 510,519 ---- self.other - self.set assert 0, "Symmetric difference with non-set on left" ! except TypeError: pass try: self.set - self.other assert 0, "Symmetric difference with non-set on right" ! except TypeError: pass *************** *** 555,558 **** --- 553,557 ---- def test_deep_copy(self): dup = copy.deepcopy(self.set) + ##print type(dup), `dup` dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() From gvanrossum@users.sourceforge.net Thu Aug 15 21:47:33 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 13:47:33 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets test_set.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv4209 Modified Files: test_set.py Log Message: Get rid of TestFreeze -- we don't need freezing semantics any more. Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/test_set.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_set.py 15 Aug 2002 20:43:07 -0000 1.4 --- test_set.py 15 Aug 2002 20:47:31 -0000 1.5 *************** *** 6,10 **** empty_set = Set() ! #=============================================================================== class TestBasicOps(unittest.TestCase): --- 6,10 ---- empty_set = Set() ! #============================================================================== class TestBasicOps(unittest.TestCase): *************** *** 74,78 **** assert v in self.values, "Missing item in iteration for " + self.case ! #------------------------------------------------------------------------------- class TestBasicOpsEmpty(TestBasicOps): --- 74,78 ---- assert v in self.values, "Missing item in iteration for " + self.case ! #------------------------------------------------------------------------------ class TestBasicOpsEmpty(TestBasicOps): *************** *** 85,89 **** self.repr = "Set([])" ! #------------------------------------------------------------------------------- class TestBasicOpsSingleton(TestBasicOps): --- 85,89 ---- self.repr = "Set([])" ! #------------------------------------------------------------------------------ class TestBasicOpsSingleton(TestBasicOps): *************** *** 102,106 **** assert 2 not in self.set, "Non-valueship for unit set" ! #------------------------------------------------------------------------------- class TestBasicOpsTuple(TestBasicOps): --- 102,106 ---- assert 2 not in self.set, "Non-valueship for unit set" ! #------------------------------------------------------------------------------ class TestBasicOpsTuple(TestBasicOps): *************** *** 119,123 **** assert 9 not in self.set, "Non-valueship for tuple set" ! #------------------------------------------------------------------------------- class TestBasicOpsTriple(TestBasicOps): --- 119,123 ---- assert 9 not in self.set, "Non-valueship for tuple set" ! #------------------------------------------------------------------------------ class TestBasicOpsTriple(TestBasicOps): *************** *** 130,134 **** self.repr = None ! #=============================================================================== class TestBinaryOps(unittest.TestCase): --- 130,134 ---- self.repr = None ! #============================================================================== class TestBinaryOps(unittest.TestCase): *************** *** 184,188 **** assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" ! #=============================================================================== class TestUpdateOps(unittest.TestCase): --- 184,188 ---- assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" ! #============================================================================== class TestUpdateOps(unittest.TestCase): *************** *** 238,242 **** assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" ! #=============================================================================== class TestMutate(unittest.TestCase): --- 238,242 ---- assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" ! #============================================================================== class TestMutate(unittest.TestCase): *************** *** 312,374 **** assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" ! #=============================================================================== ! ! class TestFreeze(unittest.TestCase): ! def setUp(self): ! self.values = [0, 1] ! self.set = Set(self.values) ! self.set = ImmutableSet(self.set) ! hash(self.set) ! ! def test_clear_after_freeze(self): ! try: ! self.set.clear() ! assert 0, "Empty disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! def test_union_after_freeze(self): ! try: ! self.set |= Set([2]) ! assert 0, "Union update disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! def test_intersection_after_freeze(self): ! try: ! self.set &= Set([2]) ! assert 0, "Intersection update disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! def test_sym_difference_after_freeze(self): ! try: ! self.set ^= Set([2]) ! assert 0, "Symmetric difference update disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! def test_difference_after_freeze(self): ! try: ! self.set -= Set([2]) ! assert 0, "Difference update disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! def test_add_after_freeze(self): ! try: ! self.set.add(4) ! assert 0, "Add disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! def test_update_after_freeze(self): ! try: ! self.set.update([4, 5]) ! assert 0, "Update disregards freezing" ! except (TypeError, AttributeError): ! pass ! ! #=============================================================================== class TestSubsets(unittest.TestCase): --- 312,316 ---- assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" ! #============================================================================== class TestSubsets(unittest.TestCase): *************** *** 381,385 **** assert not result, "non-subset: " + self.name ! #------------------------------------------------------------------------------- class TestSubsetEqualEmpty(TestSubsets): --- 323,327 ---- assert not result, "non-subset: " + self.name ! #------------------------------------------------------------------------------ class TestSubsetEqualEmpty(TestSubsets): *************** *** 390,394 **** self.cases = "<>" ! #------------------------------------------------------------------------------- class TestSubsetEqualNonEmpty(TestSubsets): --- 332,336 ---- self.cases = "<>" ! #------------------------------------------------------------------------------ class TestSubsetEqualNonEmpty(TestSubsets): *************** *** 399,403 **** self.cases = "<>" ! #------------------------------------------------------------------------------- class TestSubsetEmptyNonEmpty(TestSubsets): --- 341,345 ---- self.cases = "<>" ! #------------------------------------------------------------------------------ class TestSubsetEmptyNonEmpty(TestSubsets): *************** *** 408,412 **** self.cases = "<" ! #------------------------------------------------------------------------------- class TestSubsetPartial(TestSubsets): --- 350,354 ---- self.cases = "<" ! #------------------------------------------------------------------------------ class TestSubsetPartial(TestSubsets): *************** *** 417,421 **** self.cases = "<" ! #------------------------------------------------------------------------------- class TestSubsetNonOverlap(TestSubsets): --- 359,363 ---- self.cases = "<" ! #------------------------------------------------------------------------------ class TestSubsetNonOverlap(TestSubsets): *************** *** 426,430 **** self.cases = "" ! #=============================================================================== class TestOnlySetsInBinaryOps(unittest.TestCase): --- 368,372 ---- self.cases = "" ! #============================================================================== class TestOnlySetsInBinaryOps(unittest.TestCase): *************** *** 518,522 **** pass ! #------------------------------------------------------------------------------- class TestOnlySetsNumeric(TestOnlySetsInBinaryOps): --- 460,464 ---- pass ! #------------------------------------------------------------------------------ class TestOnlySetsNumeric(TestOnlySetsInBinaryOps): *************** *** 525,529 **** self.other = 19 ! #------------------------------------------------------------------------------- class TestOnlySetsDict(TestOnlySetsInBinaryOps): --- 467,471 ---- self.other = 19 ! #------------------------------------------------------------------------------ class TestOnlySetsDict(TestOnlySetsInBinaryOps): *************** *** 532,536 **** self.other = {1:2, 3:4} ! #------------------------------------------------------------------------------- class TestOnlySetsOperator(TestOnlySetsInBinaryOps): --- 474,478 ---- self.other = {1:2, 3:4} ! #------------------------------------------------------------------------------ class TestOnlySetsOperator(TestOnlySetsInBinaryOps): *************** *** 539,543 **** self.other = operator.add ! #=============================================================================== class TestCopying(unittest.TestCase): --- 481,485 ---- self.other = operator.add ! #============================================================================== class TestCopying(unittest.TestCase): *************** *** 560,564 **** assert dup_list[i] == set_list[i], "Unequal items after deep copy" ! #------------------------------------------------------------------------------- class TestCopyingEmpty(TestCopying): --- 502,506 ---- assert dup_list[i] == set_list[i], "Unequal items after deep copy" ! #------------------------------------------------------------------------------ class TestCopyingEmpty(TestCopying): *************** *** 566,570 **** self.set = Set() ! #------------------------------------------------------------------------------- class TestCopyingSingleton(TestCopying): --- 508,512 ---- self.set = Set() ! #------------------------------------------------------------------------------ class TestCopyingSingleton(TestCopying): *************** *** 572,576 **** self.set = Set(["hello"]) ! #------------------------------------------------------------------------------- class TestCopyingTriple(TestCopying): --- 514,518 ---- self.set = Set(["hello"]) ! #------------------------------------------------------------------------------ class TestCopyingTriple(TestCopying): *************** *** 578,582 **** self.set = Set(["zero", 0, None]) ! #------------------------------------------------------------------------------- class TestCopyingTuple(TestCopying): --- 520,524 ---- self.set = Set(["zero", 0, None]) ! #------------------------------------------------------------------------------ class TestCopyingTuple(TestCopying): *************** *** 584,588 **** self.set = Set([(1, 2)]) ! #------------------------------------------------------------------------------- class TestCopyingNested(TestCopying): --- 526,530 ---- self.set = Set([(1, 2)]) ! #------------------------------------------------------------------------------ class TestCopyingNested(TestCopying): *************** *** 590,594 **** self.set = Set([((1, 2), (3, 4))]) ! #=============================================================================== def makeAllTests(): --- 532,536 ---- self.set = Set([((1, 2), (3, 4))]) ! #============================================================================== def makeAllTests(): *************** *** 601,605 **** suite.addTest(unittest.makeSuite(TestUpdateOps)) suite.addTest(unittest.makeSuite(TestMutate)) - suite.addTest(unittest.makeSuite(TestFreeze)) suite.addTest(unittest.makeSuite(TestSubsetEqualEmpty)) suite.addTest(unittest.makeSuite(TestSubsetEqualNonEmpty)) --- 543,546 ---- *************** *** 617,621 **** return suite ! #------------------------------------------------------------------------------- if __name__ == "__main__": --- 558,562 ---- return suite ! #------------------------------------------------------------------------------ if __name__ == "__main__": From jackjansen@users.sourceforge.net Thu Aug 15 22:31:20 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:31:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv22565 Modified Files: Makefile Log Message: Try to cater for a source tree checked out with MacCVS in stead of unix cvs. In this case the resource files are actual resource files in stead of AppleSingle encoded files. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile 9 Aug 2002 14:15:46 -0000 1.21 --- Makefile 15 Aug 2002 21:31:18 -0000 1.22 *************** *** 39,42 **** --- 39,43 ---- REZ=/Developer/Tools/Rez DEREZ=/Developer/Tools/DeRez + CPMAC=/Developer/Tools/CpMac PYTHON=$(builddir)/python.exe *************** *** 93,101 **** done $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python ! # Create a temporary version of the resources here ! $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc ! $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc ! $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r ! $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) --- 94,118 ---- done $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python ! # Create a temporary version of the resources here ! # Note that the resource files can either be real 2-fork resource files ! # or AppleSingle encoded files. ! @if test -s $(RESOURCEDIR)/dialogs.rsrc; then \ ! echo $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc ;\ ! $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc ; \ ! echo $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r ; \ ! $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r ; \ ! else \ ! echo $(DEREZ) -skip ckid $(RESOURCEDIR)/dialogs.rsrc > dialogs.r ; \ ! $(DEREZ) -skip ckid $(RESOURCEDIR)/dialogs.rsrc > dialogs.r ; \ ! fi ! @if test -s $(RESOURCEDIR)/errors.rsrc; then \ ! echo $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc ;\ ! $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc ; \ ! echo $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r ; \ ! $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r ; \ ! else \ ! echo $(DEREZ) -skip ckid $(RESOURCEDIR)/errors.rsrc > errors.r ; \ ! $(DEREZ) -skip ckid $(RESOURCEDIR)/errors.rsrc > errors.r ; \ ! fi $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) *************** *** 155,159 **** fi; \ done ! @for i in $(MACLIBSRC)/*.py $(MACLIBSRC)/*.rsrc; \ do \ if test -x $$i; then \ --- 172,176 ---- fi; \ done ! @for i in $(MACLIBSRC)/*.py; \ do \ if test -x $$i; then \ *************** *** 165,168 **** --- 182,190 ---- fi; \ done + ## @for i in $(MACLIBSRC)/*.rsrc; \ + ## do \ + ## echo $(CPMAC) $$i $$b ; \ + ## $(CPMAC) $$i $$b ; \ + ## done @for d in $(MACLIBSUBDIRS); \ do \ *************** *** 177,180 **** --- 199,206 ---- *.orig) ;; \ *~) ;; \ + *.rsrc) \ + echo $(CPMAC) $$i $$b ; \ + $(CPMAC) $$i $$b ; \ + ;; \ *) \ if test -d $$i; then continue; fi; \ *************** *** 212,215 **** --- 238,245 ---- *.orig) ;; \ *~) ;; \ + *.rsrc) \ + echo $(CPMAC) $$i $$b ; \ + $(CPMAC) $$i $$b ; \ + ;; \ *) \ if test -d $$i; then continue; fi; \ From jackjansen@users.sourceforge.net Thu Aug 15 22:48:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/app appscan.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv31021/app Modified Files: appscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: appscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appscan.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** appscan.py 5 Aug 2002 15:39:24 -0000 1.9 --- appscan.py 15 Aug 2002 21:48:12 -0000 1.10 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf cfscan.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv31021/cf Modified Files: cfscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: cfscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfscan.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** cfscan.py 5 Aug 2002 15:39:25 -0000 1.11 --- cfscan.py 15 Aug 2002 21:48:13 -0000 1.12 *************** *** 45,48 **** --- 45,50 ---- scanner.gentypetest(SHORT+"typetest.py") scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg cgscan.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory usw-pr-cvs1:/tmp/cvs-serv31021/cg Modified Files: cgscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: cgscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/cgscan.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cgscan.py 5 Aug 2002 15:39:26 -0000 1.2 --- cgscan.py 15 Aug 2002 21:48:13 -0000 1.3 *************** *** 23,26 **** --- 23,28 ---- scanner.gentypetest(SHORT+"typetest.py") scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/help helpscan.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory usw-pr-cvs1:/tmp/cvs-serv31021/help Modified Files: helpscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: helpscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/helpscan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** helpscan.py 5 Aug 2002 15:39:27 -0000 1.5 --- helpscan.py 15 Aug 2002 21:48:14 -0000 1.6 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/htmlrender htmlscan.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/htmlrender In directory usw-pr-cvs1:/tmp/cvs-serv31021/htmlrender Modified Files: htmlscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: htmlscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/htmlrender/htmlscan.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** htmlscan.py 5 Aug 2002 15:39:27 -0000 1.3 --- htmlscan.py 15 Aug 2002 21:48:14 -0000 1.4 *************** *** 20,23 **** --- 20,25 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/evt evtscan.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory usw-pr-cvs1:/tmp/cvs-serv31021/evt Modified Files: evtscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: evtscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/evtscan.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** evtscan.py 5 Aug 2002 15:39:27 -0000 1.11 --- evtscan.py 15 Aug 2002 21:48:14 -0000 1.12 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/dlg dlgscan.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv31021/dlg Modified Files: dlgscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: dlgscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/dlgscan.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dlgscan.py 5 Aug 2002 15:39:26 -0000 1.16 --- dlgscan.py 15 Aug 2002 21:48:13 -0000 1.17 *************** *** 19,22 **** --- 19,24 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/icn icnscan.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory usw-pr-cvs1:/tmp/cvs-serv31021/icn Modified Files: icnscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: icnscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnscan.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** icnscan.py 5 Aug 2002 15:39:28 -0000 1.8 --- icnscan.py 15 Aug 2002 21:48:14 -0000 1.9 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt CarbonEvtscan.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory usw-pr-cvs1:/tmp/cvs-serv31021/carbonevt Modified Files: CarbonEvtscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: CarbonEvtscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/CarbonEvtscan.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CarbonEvtscan.py 5 Aug 2002 15:39:24 -0000 1.8 --- CarbonEvtscan.py 15 Aug 2002 21:48:13 -0000 1.9 *************** *** 20,23 **** --- 20,25 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "--done scanning, importing--" import CarbonEvtsupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon IBCarbonscan.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv31021/ibcarbon Modified Files: IBCarbonscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: IBCarbonscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/IBCarbonscan.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IBCarbonscan.py 5 Aug 2002 15:39:28 -0000 1.3 --- IBCarbonscan.py 15 Aug 2002 21:48:14 -0000 1.4 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "--done scanning, importing--" import IBCarbonsupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cm cmscan.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv31021/cm Modified Files: cmscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: cmscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmscan.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** cmscan.py 5 Aug 2002 15:39:26 -0000 1.9 --- cmscan.py 15 Aug 2002 21:48:13 -0000 1.10 *************** *** 17,20 **** --- 17,22 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ae aescan.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv31021/ae Modified Files: aescan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: aescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aescan.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** aescan.py 5 Aug 2002 15:39:23 -0000 1.14 --- aescan.py 15 Aug 2002 21:48:12 -0000 1.15 *************** *** 21,24 **** --- 21,26 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done Scanning and Generating, now doing 'import aesupport' ===" import aesupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl ctlscan.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv31021/ctl Modified Files: ctlscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: ctlscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ctlscan.py 5 Aug 2002 15:39:26 -0000 1.28 --- ctlscan.py 15 Aug 2002 21:48:13 -0000 1.29 *************** *** 15,18 **** --- 15,20 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now doing 'import ctlsupport' ===" import ctlsupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag dragscan.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv31021/drag Modified Files: dragscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: dragscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragscan.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dragscan.py 5 Aug 2002 21:13:07 -0000 1.4 --- dragscan.py 15 Aug 2002 21:48:13 -0000 1.5 *************** *** 26,29 **** --- 26,31 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now doing 'import dragsupport' ===" import dragsupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/fm fmscan.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/fm In directory usw-pr-cvs1:/tmp/cvs-serv31021/fm Modified Files: fmscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: fmscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/fmscan.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** fmscan.py 5 Aug 2002 15:39:27 -0000 1.11 --- fmscan.py 15 Aug 2002 21:48:14 -0000 1.12 *************** *** 17,20 **** --- 17,22 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 23:06:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:06:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte mltescan.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv7639/mlte Modified Files: mltescan.py Log Message: Fixed the bugs in the constant definitions, and in the code to test them. The FutureWarnings are still there, until a way has been found to say "I know what I'm doing here when I say 0xff000000". Index: mltescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltescan.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mltescan.py 15 Aug 2002 21:48:14 -0000 1.9 --- mltescan.py 15 Aug 2002 22:05:58 -0000 1.10 *************** *** 51,54 **** --- 51,56 ---- kTXNEndOffset = 0x7FFFFFFF MovieFileType = FOUR_CHAR_CODE('moov') + kTXNUseEncodingWordRulesMask = 0x80000000 + kTXNFontSizeAttributeSize = 4 """) *************** *** 73,76 **** --- 75,80 ---- "kTXNQDFontColorAttributeSize", "kTXNTextEncodingAttributeSize", + "kTXNUseEncodingWordRulesMask", + "kTXNFontSizeAttributeSize", "status", "justification", From jackjansen@users.sourceforge.net Thu Aug 15 23:06:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:06:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag dragscan.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv7639/drag Modified Files: dragscan.py Log Message: Fixed the bugs in the constant definitions, and in the code to test them. The FutureWarnings are still there, until a way has been found to say "I know what I'm doing here when I say 0xff000000". Index: dragscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragscan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dragscan.py 15 Aug 2002 21:48:13 -0000 1.5 --- dragscan.py 15 Aug 2002 22:05:58 -0000 1.6 *************** *** 46,51 **** def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") ! self.defsfile.write("from TextEdit import *\n") ! self.defsfile.write("from QuickDraw import *\n") self.defsfile.write("\n") # Defines unparseable in Drag.h --- 46,51 ---- def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") ! self.defsfile.write("from Carbon.TextEdit import *\n") ! self.defsfile.write("from Carbon.QuickDraw import *\n") self.defsfile.write("\n") # Defines unparseable in Drag.h From jackjansen@users.sourceforge.net Thu Aug 15 23:06:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:06:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl ctlscan.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv7639/ctl Modified Files: ctlscan.py Log Message: Fixed the bugs in the constant definitions, and in the code to test them. The FutureWarnings are still there, until a way has been found to say "I know what I'm doing here when I say 0xff000000". Index: ctlscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ctlscan.py 15 Aug 2002 21:48:13 -0000 1.29 --- ctlscan.py 15 Aug 2002 22:05:58 -0000 1.30 *************** *** 35,46 **** def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") ! self.defsfile.write("from TextEdit import *\n") ! self.defsfile.write("from QuickDraw import *\n") ! self.defsfile.write("from Dragconst import *\n") ! self.defsfile.write("from CarbonEvents import *\n") ! self.defsfile.write("from Appearance import *\n") self.defsfile.write("kDataBrowserItemAnyState = -1\n") self.defsfile.write("kControlBevelButtonCenterPopupGlyphTag = -1\n") ! self.defsfile.write("kDataBrowserClientPropertyFlagsMask = 0xFF << 24 # kDataBrowserClientPropertyFlagsOffset\n") self.defsfile.write("\n") --- 35,46 ---- def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") ! self.defsfile.write("from Carbon.TextEdit import *\n") ! self.defsfile.write("from Carbon.QuickDraw import *\n") ! self.defsfile.write("from Carbon.Dragconst import *\n") ! self.defsfile.write("from Carbon.CarbonEvents import *\n") ! self.defsfile.write("from Carbon.Appearance import *\n") self.defsfile.write("kDataBrowserItemAnyState = -1\n") self.defsfile.write("kControlBevelButtonCenterPopupGlyphTag = -1\n") ! self.defsfile.write("kDataBrowserClientPropertyFlagsMask = 0xFF000000\n") self.defsfile.write("\n") From jackjansen@users.sourceforge.net Thu Aug 15 23:06:01 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:06:01 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/scrap scrapscan.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory usw-pr-cvs1:/tmp/cvs-serv7639/scrap Modified Files: scrapscan.py Log Message: Fixed the bugs in the constant definitions, and in the code to test them. The FutureWarnings are still there, until a way has been found to say "I know what I'm doing here when I say 0xff000000". Index: scrapscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/scrapscan.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** scrapscan.py 15 Aug 2002 21:48:15 -0000 1.7 --- scrapscan.py 15 Aug 2002 22:05:58 -0000 1.8 *************** *** 20,25 **** scanner.scan() scanner.close() ! print "=== Testing definitions output code ===" ! execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" --- 20,25 ---- scanner.scan() scanner.close() ! ## print "=== Testing definitions output code ===" ! ## execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/scrap scrapscan.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory usw-pr-cvs1:/tmp/cvs-serv31021/scrap Modified Files: scrapscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: scrapscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/scrapscan.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** scrapscan.py 5 Aug 2002 15:39:30 -0000 1.6 --- scrapscan.py 15 Aug 2002 21:48:15 -0000 1.7 *************** *** 20,23 **** --- 20,25 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd qdscan.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv31021/qd Modified Files: qdscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: qdscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdscan.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** qdscan.py 5 Aug 2002 15:39:29 -0000 1.26 --- qdscan.py 15 Aug 2002 21:48:15 -0000 1.27 *************** *** 41,44 **** --- 41,46 ---- ofp.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" import qdsupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qdoffs qdoffsscan.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv31021/qdoffs Modified Files: qdoffsscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: qdoffsscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/qdoffsscan.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** qdoffsscan.py 5 Aug 2002 15:39:29 -0000 1.3 --- qdoffsscan.py 15 Aug 2002 21:48:15 -0000 1.4 *************** *** 14,17 **** --- 14,19 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" import qdoffssupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte mltescan.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv31021/mlte Modified Files: mltescan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: mltescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltescan.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mltescan.py 5 Aug 2002 15:39:29 -0000 1.8 --- mltescan.py 15 Aug 2002 21:48:14 -0000 1.9 *************** *** 20,23 **** --- 20,25 ---- scanner.gentypetest(SHORT+"typetest.py") scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/res resscan.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv31021/res Modified Files: resscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: resscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/resscan.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** resscan.py 5 Aug 2002 15:39:29 -0000 1.17 --- resscan.py 15 Aug 2002 21:48:15 -0000 1.18 *************** *** 20,23 **** --- 20,25 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now doing 'import ressupport' ===" import ressupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:17 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:17 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qt qtscan.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv31021/qt Modified Files: qtscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: qtscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/qtscan.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** qtscan.py 5 Aug 2002 15:39:29 -0000 1.19 --- qtscan.py 15 Aug 2002 21:48:15 -0000 1.20 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/list listscan.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv31021/list Modified Files: listscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: listscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listscan.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** listscan.py 5 Aug 2002 15:39:28 -0000 1.10 --- listscan.py 15 Aug 2002 21:48:14 -0000 1.11 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:16 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu menuscan.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv31021/menu Modified Files: menuscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: menuscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menuscan.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** menuscan.py 5 Aug 2002 15:39:28 -0000 1.13 --- menuscan.py 15 Aug 2002 21:48:14 -0000 1.14 *************** *** 14,17 **** --- 14,19 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now doing 'import menusupport' ===" import menusupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/snd sndscan.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv31021/snd Modified Files: sndscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: sndscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/sndscan.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** sndscan.py 5 Aug 2002 15:39:30 -0000 1.17 --- sndscan.py 15 Aug 2002 21:48:15 -0000 1.18 *************** *** 17,20 **** --- 17,22 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now doing 'import sndsupport' ===" import sndsupport From jackjansen@users.sourceforge.net Thu Aug 15 22:48:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastescan.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv31021/waste Modified Files: wastescan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: wastescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastescan.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** wastescan.py 5 Aug 2002 21:13:07 -0000 1.10 --- wastescan.py 15 Aug 2002 21:48:16 -0000 1.11 *************** *** 25,28 **** --- 25,30 ---- ## scanner.gentypetest(SHORT+"typetest.py") scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/te tescan.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv31021/te Modified Files: tescan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: tescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/tescan.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tescan.py 5 Aug 2002 15:39:30 -0000 1.6 --- tescan.py 15 Aug 2002 21:48:16 -0000 1.7 *************** *** 18,21 **** --- 18,23 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" From jackjansen@users.sourceforge.net Thu Aug 15 22:48:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 15 Aug 2002 14:48:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/win winscan.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv31021/win Modified Files: winscan.py Log Message: After generating the Python file with definitions try to run it, so we catch errors during the build process in stead of later during runtime. Index: winscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winscan.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** winscan.py 5 Aug 2002 15:39:30 -0000 1.22 --- winscan.py 15 Aug 2002 21:48:16 -0000 1.23 *************** *** 14,17 **** --- 14,19 ---- scanner.scan() scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" import winsupport From bwarsaw@users.sourceforge.net Thu Aug 15 23:14:26 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:14:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_base64.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13052/Lib/test Modified Files: test_base64.py Log Message: base64.decodestring('') should return '' instead of raising an exception. The bug fix for SF #430849 wasn't quite right. This closes SF bug #595671. I'll backport this to Python 2.2. Index: test_base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_base64.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_base64.py 23 Jul 2002 19:03:45 -0000 1.3 --- test_base64.py 15 Aug 2002 22:14:24 -0000 1.4 *************** *** 45,54 **** "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}", reason = "long decodestring failed") ! try: ! base64.decodestring("") ! except binascii_error: ! pass ! else: ! self.fail("expected a binascii.Error on null decode request") def test_main(): --- 45,49 ---- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}", reason = "long decodestring failed") ! test_support.verify(base64.decodestring('') == '') def test_main(): From bwarsaw@users.sourceforge.net Thu Aug 15 23:14:26 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:14:26 -0700 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13052/Modules Modified Files: binascii.c Log Message: base64.decodestring('') should return '' instead of raising an exception. The bug fix for SF #430849 wasn't quite right. This closes SF bug #595671. I'll backport this to Python 2.2. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** binascii.c 2 Aug 2002 02:27:13 -0000 2.37 --- binascii.c 15 Aug 2002 22:14:24 -0000 2.38 *************** *** 347,354 **** return NULL; - if ( ascii_len == 0) { - PyErr_SetString(Error, "Cannot decode empty input"); - return NULL; - } bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ --- 347,350 ---- *************** *** 414,418 **** /* and set string size correctly */ ! _PyString_Resize(&rv, bin_len); return rv; } --- 410,415 ---- /* and set string size correctly */ ! if (bin_len > 0) ! _PyString_Resize(&rv, bin_len); return rv; } From bwarsaw@users.sourceforge.net Thu Aug 15 23:18:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:18:13 -0700 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.33,2.33.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14843/Modules Modified Files: Tag: release22-maint binascii.c Log Message: Backport of fix for SF bug #595671 from Python 2.3cvs: base64.decodestring('') should return '' instead of raising an exception. The bug fix for SF #430849 wasn't quite right. This closes SF bug #595671. I'll backport this to Python 2.2. One addition here is that there was no test of the base64 module in Python 2.2 cvs yet, so I added that too. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.33 retrieving revision 2.33.4.1 diff -C2 -d -r2.33 -r2.33.4.1 *** binascii.c 19 Dec 2001 04:41:35 -0000 2.33 --- binascii.c 15 Aug 2002 22:18:11 -0000 2.33.4.1 *************** *** 347,354 **** return NULL; - if ( ascii_len == 0) { - PyErr_SetString(Error, "Cannot decode empty input"); - return NULL; - } bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ --- 347,350 ---- *************** *** 414,418 **** /* and set string size correctly */ ! _PyString_Resize(&rv, bin_len); return rv; } --- 410,415 ---- /* and set string size correctly */ ! if (bin_len > 0) ! _PyString_Resize(&rv, bin_len); return rv; } From bwarsaw@users.sourceforge.net Thu Aug 15 23:18:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:18:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_base64,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv14843/Lib/test/output Added Files: Tag: release22-maint test_base64 Log Message: Backport of fix for SF bug #595671 from Python 2.3cvs: base64.decodestring('') should return '' instead of raising an exception. The bug fix for SF #430849 wasn't quite right. This closes SF bug #595671. I'll backport this to Python 2.2. One addition here is that there was no test of the base64 module in Python 2.2 cvs yet, so I added that too. --- NEW FILE: test_base64 --- test_base64 Testing decode string ... ok Testing encode string ... ok ---------------------------------------------------------------------- Ran 2 tests in 0.001s OK From bwarsaw@users.sourceforge.net Thu Aug 15 23:18:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 15 Aug 2002 15:18:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_base64.py,NONE,1.4.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14843/Lib/test Added Files: Tag: release22-maint test_base64.py Log Message: Backport of fix for SF bug #595671 from Python 2.3cvs: base64.decodestring('') should return '' instead of raising an exception. The bug fix for SF #430849 wasn't quite right. This closes SF bug #595671. I'll backport this to Python 2.2. One addition here is that there was no test of the base64 module in Python 2.2 cvs yet, so I added that too. --- NEW FILE: test_base64.py --- import unittest from test import test_support import base64 from binascii import Error as binascii_error class Base64TestCase(unittest.TestCase): def test_encode_string(self): """Testing encode string""" test_support.verify(base64.encodestring("www.python.org") == "d3d3LnB5dGhvbi5vcmc=\n", reason="www.python.org encodestring failed") test_support.verify(base64.encodestring("a") == "YQ==\n", reason="a encodestring failed") test_support.verify(base64.encodestring("ab") == "YWI=\n", reason="ab encodestring failed") test_support.verify(base64.encodestring("abc") == "YWJj\n", reason="abc encodestring failed") test_support.verify(base64.encodestring("") == "", reason="null encodestring failed") test_support.verify(base64.encodestring( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}") == "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n", reason = "long encodestring failed") def test_decode_string(self): """Testing decode string""" test_support.verify(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n") == "www.python.org", reason="www.python.org decodestring failed") test_support.verify(base64.decodestring("YQ==\n") == "a", reason="a decodestring failed") test_support.verify(base64.decodestring("YWI=\n") == "ab", reason="ab decodestring failed") test_support.verify(base64.decodestring("YWJj\n") == "abc", reason="abc decodestring failed") test_support.verify(base64.decodestring( "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") == "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}", reason = "long decodestring failed") test_support.verify(base64.decodestring('') == '') def test_main(): test_support.run_unittest(Base64TestCase) if __name__ == "__main__": test_main() From gvanrossum@users.sourceforge.net Fri Aug 16 02:57:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 18:57:34 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.258,2.259 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv6967 Modified Files: compile.c Log Message: Minor cleanup of parsename() and parsestr(): the 'struct compiling *' argument should be called 'c', like everywhere else. Renamed a complex variable 'c' to 'z' and moved it inside the only scope where it's used. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.258 retrieving revision 2.259 diff -C2 -d -r2.258 -r2.259 *** compile.c 15 Aug 2002 14:59:02 -0000 2.258 --- compile.c 16 Aug 2002 01:57:32 -0000 2.259 *************** *** 1134,1138 **** static PyObject * ! parsenumber(struct compiling *co, char *s) { char *end; --- 1134,1138 ---- static PyObject * ! parsenumber(struct compiling *c, char *s) { char *end; *************** *** 1140,1144 **** double dx; #ifndef WITHOUT_COMPLEX - Py_complex c; int imflag; #endif --- 1140,1143 ---- *************** *** 1159,1164 **** "will return positive values " "in Python 2.4 and up", ! co->c_filename, ! co->c_lineno, NULL, NULL) < 0) --- 1158,1163 ---- "will return positive values " "in Python 2.4 and up", ! c->c_filename, ! c->c_lineno, NULL, NULL) < 0) *************** *** 1177,1185 **** #ifndef WITHOUT_COMPLEX if (imflag) { ! c.real = 0.; PyFPE_START_PROTECT("atof", return 0) ! c.imag = atof(s); ! PyFPE_END_PROTECT(c) ! return PyComplex_FromCComplex(c); } else --- 1176,1185 ---- #ifndef WITHOUT_COMPLEX if (imflag) { ! Py_complex z; ! z.real = 0.; PyFPE_START_PROTECT("atof", return 0) ! z.imag = atof(s); ! PyFPE_END_PROTECT(z) ! return PyComplex_FromCComplex(z); } else *************** *** 1216,1220 **** static PyObject * ! parsestr(struct compiling *com, char *s) { PyObject *v; --- 1216,1220 ---- static PyObject * ! parsestr(struct compiling *c, char *s) { PyObject *v; *************** *** 1225,1229 **** int quote = *s; int rawmode = 0; ! char* encoding = ((com == NULL) ? NULL : com->c_encoding); int need_encoding; int unicode = 0; --- 1225,1229 ---- int quote = *s; int rawmode = 0; ! char* encoding = ((c == NULL) ? NULL : c->c_encoding); int need_encoding; int unicode = 0; *************** *** 1246,1250 **** len = strlen(s); if (len > INT_MAX) { ! com_error(com, PyExc_OverflowError, "string to parse is too long"); return NULL; --- 1246,1250 ---- len = strlen(s); if (len > INT_MAX) { ! com_error(c, PyExc_OverflowError, "string to parse is too long"); return NULL; *************** *** 1316,1320 **** Py_XDECREF(u); if (v == NULL) ! PyErr_SyntaxLocation(com->c_filename, com->c_lineno); return v; --- 1316,1320 ---- Py_XDECREF(u); if (v == NULL) ! PyErr_SyntaxLocation(c->c_filename, c->c_lineno); return v; *************** *** 1346,1350 **** need_encoding ? encoding : NULL); if (v == NULL) ! PyErr_SyntaxLocation(com->c_filename, com->c_lineno); return v; } --- 1346,1350 ---- need_encoding ? encoding : NULL); if (v == NULL) ! PyErr_SyntaxLocation(c->c_filename, c->c_lineno); return v; } From gvanrossum@users.sourceforge.net Fri Aug 16 03:13:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 19:13:51 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.259,2.260 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11705 Modified Files: compile.c Log Message: Add warnings for assignment or deletion of variables and attributes named 'None'. Still to do: function definition parameter lists, and function call keyword arguments. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.259 retrieving revision 2.260 diff -C2 -d -r2.259 -r2.260 *** compile.c 16 Aug 2002 01:57:32 -0000 2.259 --- compile.c 16 Aug 2002 02:13:49 -0000 2.260 *************** *** 575,578 **** --- 575,579 ---- /* Prototype forward declarations */ + static int issue_warning(char *, char *, int); static int com_init(struct compiling *, char *); static void com_free(struct compiling *); *************** *** 989,992 **** --- 990,1010 ---- } + static int + none_assignment_check(struct compiling *c, char *name, int assigning) + { + if (name[0] == 'N' && strcmp(name, "None") == 0) { + char *msg; + if (assigning) + msg = "assigment to None"; + else + msg = "deleting None"; + if (issue_warning(msg, c->c_filename, c->c_lineno) < 0) { + c->c_errors++; + return -1; + } + } + return 0; + } + static void com_addop_varname(struct compiling *c, int kind, char *name) *************** *** 998,1001 **** --- 1016,1026 ---- char buffer[MANGLE_LEN]; + if (kind != VAR_LOAD && + none_assignment_check(c, name, kind == VAR_STORE)) + { + c->c_errors++; + i = 255; + goto done; + } if (_Py_Mangle(c->c_private, name, buffer, sizeof(buffer))) name = buffer; *************** *** 2490,2493 **** --- 2515,2520 ---- com_assign_attr(struct compiling *c, node *n, int assigning) { + if (none_assignment_check(c, STR(n), assigning)) + return; com_addopname(c, assigning ? STORE_ATTR : DELETE_ATTR, n); com_pop(c, assigning ? 2 : 1); From gvanrossum@users.sourceforge.net Fri Aug 16 03:24:59 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 19:24:59 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.260,2.261 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14977 Modified Files: compile.c Log Message: Add warning for None used as keyword argument name in function call. Still to do: function definition arguments (including *None and **None). Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.260 retrieving revision 2.261 diff -C2 -d -r2.260 -r2.261 *** compile.c 16 Aug 2002 02:13:49 -0000 2.260 --- compile.c 16 Aug 2002 02:24:56 -0000 2.261 *************** *** 1715,1718 **** --- 1715,1719 ---- else { PyObject *v = PyString_InternFromString(STR(m)); + (void) none_assignment_check(c, STR(m), 1); if (v != NULL && *pkeywords == NULL) *pkeywords = PyDict_New(); From tim_one@users.sourceforge.net Fri Aug 16 03:27:17 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 Aug 2002 19:27:17 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hotshot.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15549/python/lib/test Modified Files: test_hotshot.py Log Message: check_events(): This was failing under -O, due to not expecting any LINE events when not __debug__. But we get them anyway under -O now, so just stop special-casing non-__debug__ mode. Index: test_hotshot.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hotshot.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_hotshot.py 15 Aug 2002 14:59:01 -0000 1.12 --- test_hotshot.py 16 Aug 2002 02:27:15 -0000 1.13 *************** *** 54,60 **** def check_events(self, expected): events = self.get_events_wotime() - if not __debug__: - # Running under -O, so we don't get LINE events - expected = [ev for ev in expected if ev[0] != LINE] if events != expected: self.fail( --- 54,57 ---- From gvanrossum@users.sourceforge.net Fri Aug 16 03:31:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 19:31:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv16665 Modified Files: pep-0283.txt Log Message: Test for assignment to None are easily done in the compiler. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pep-0283.txt 15 Aug 2002 16:50:55 -0000 1.15 --- pep-0283.txt 16 Aug 2002 02:31:08 -0000 1.16 *************** *** 76,79 **** --- 76,81 ---- -1, 0 or 1. http://www.python.org/sf/472523 + - Warn for assignment to None (in various forms). + Planned features for 2.3 *************** *** 200,208 **** Not much enthusiasm I believe. - - Making None a keyword. Can't be done right away, but a warning - would be a first step. - http://mail.python.org/pipermail/python-dev/2002-April/023600.html - Ditto for 'as', which has been a pseudo-keyword long enough. - - PEP 286 Enhanced Argument Tuples von Loewis --- 202,205 ---- *************** *** 210,213 **** --- 207,213 ---- deep optimization hack (also makes better correctness guarantees though). + + - Make 'as' a keyword. It has been a pseudo-keyword long enough. + Too much effort to bother. From gvanrossum@users.sourceforge.net Fri Aug 16 03:48:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 19:48:13 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.261,2.262 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv20939 Modified Files: compile.c Log Message: Add warnings for arguments named None. All set. (I could add a warning for 'global None', but that's either accompanied by an assignment to None, which will trigger a warning, or not, in which case it's harmless. :-) Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.261 retrieving revision 2.262 diff -C2 -d -r2.261 -r2.262 *** compile.c 16 Aug 2002 02:24:56 -0000 2.261 --- compile.c 16 Aug 2002 02:48:11 -0000 2.262 *************** *** 5026,5029 **** --- 5026,5037 ---- int ret; + /* Warn about None, except inside a tuple (where the assignment + code already issues a warning). */ + if ((flag & DEF_PARAM) && !(flag & DEF_INTUPLE) && + *name == 'N' && strcmp(name, "None") == 0) + { + if (symtable_warn(st, "argument named None")) + return -1; + } if (_Py_Mangle(st->st_private, name, buffer, sizeof(buffer))) name = buffer; *************** *** 5311,5315 **** /* The next two functions parse the argument tuple. ! symtable_default_arg() checks for names in the default arguments, which are references in the defining scope. symtable_params() parses the parameter names, which are defined in the function's --- 5319,5323 ---- /* The next two functions parse the argument tuple. ! symtable_default_args() checks for names in the default arguments, which are references in the defining scope. symtable_params() parses the parameter names, which are defined in the function's From gvanrossum@users.sourceforge.net Fri Aug 16 04:38:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 20:38:13 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.470,1.471 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv871 Modified Files: NEWS Log Message: Mention warnings about defining None. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.470 retrieving revision 1.471 diff -C2 -d -r1.470 -r1.471 *** NEWS 15 Aug 2002 14:59:01 -0000 1.470 --- NEWS 16 Aug 2002 03:38:10 -0000 1.471 *************** *** 58,61 **** --- 58,64 ---- Core and builtins + - Use of 'None' as a variable, argument or attribute name now + issues a SyntaxWarning. In the future, None may become a keyword. + - SET_LINENO is gone. co_lnotab is now consulted to determine when to call the trace function. C code that accessed f_lineno should call From tim_one@users.sourceforge.net Fri Aug 16 04:40:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 Aug 2002 20:40:09 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.471,1.472 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv1138 Modified Files: NEWS Log Message: Newly-relaxed limits on random.randrange(). Also added some info about Karatsuba's better cache behavior with extremely large multiplicands. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.471 retrieving revision 1.472 diff -C2 -d -r1.471 -r1.472 *** NEWS 16 Aug 2002 03:38:10 -0000 1.471 --- NEWS 16 Aug 2002 03:40:07 -0000 1.472 *************** *** 94,102 **** Karatsuba multiplication has O(N**1.58) runtime (the exponent is log_base_2(3)) instead of the previous O(N**2). Measured results may ! be better or worse than that, depending on platform quirks. Note that ! this is a simple implementation, and there's no intent here to compete ! with, e.g., GMP. It gives a very nice speedup when it applies, but ! a package devoted to fast large-integer arithmetic should run circles ! around it. - u'%c' will now raise a ValueError in case the argument is an --- 94,104 ---- Karatsuba multiplication has O(N**1.58) runtime (the exponent is log_base_2(3)) instead of the previous O(N**2). Measured results may ! be better or worse than that, depending on platform quirks. Besides ! the O() improvement in raw instruction count, the Karatsuba algorithm ! appears to have much better cache behavior on extremely large integers ! (starting in the ballpark of a million bits). Note that this is a ! simple implementation, and there's no intent here to compete with, ! e.g., GMP. It gives a very nice speedup when it applies, but a package ! devoted to fast large-integer arithmetic should run circles around it. - u'%c' will now raise a ValueError in case the argument is an *************** *** 296,299 **** --- 298,306 ---- Library + + - random.randrange(-sys.maxint-1, sys.maxint) no longer raises + OverflowError. That is, it now accepts any combination of 'start' + and 'stop' arguments so long as each is in the range of Python's + bounded integers. - New "algorithms" module: heapq, implements a heap queue. Thanks to From tim_one@users.sourceforge.net Fri Aug 16 04:41:42 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 Aug 2002 20:41:42 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1464 Modified Files: random.py Log Message: 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.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** random.py 23 May 2002 23:58:17 -0000 1.34 --- random.py 16 Aug 2002 03:41:39 -0000 1.35 *************** *** 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", *************** *** 300,304 **** # 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: --- 301,305 ---- # 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: *************** *** 308,319 **** 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: --- 309,332 ---- 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 Fri Aug 16 04:47:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 Aug 2002 20:47:51 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.177,2.178 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3088 Modified Files: typeobject.c Log Message: Fix SF bug 595838 -- buffer in type_new() should not be static. Moved to inner scope, too. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.177 retrieving revision 2.178 diff -C2 -d -r2.177 -r2.178 *** typeobject.c 14 Aug 2002 17:26:30 -0000 2.177 --- typeobject.c 16 Aug 2002 03:47:49 -0000 2.178 *************** *** 1009,1013 **** PyObject *name, *bases, *dict; static char *kwlist[] = {"name", "bases", "dict", 0}; - static char buffer[256]; PyObject *slots, *tmp, *newslots; PyTypeObject *type, *base, *tmptype, *winner; --- 1009,1012 ---- *************** *** 1172,1175 **** --- 1171,1175 ---- for (i = j = 0; i < nslots; i++) { char *s; + char buffer[256]; tmp = PyTuple_GET_ITEM(slots, i); s = PyString_AS_STRING(tmp); From gvanrossum@users.sourceforge.net Fri Aug 16 08:04:58 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 16 Aug 2002 00:04:58 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.263,2.264 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10230 Modified Files: bltinmodule.c Log Message: A nice little speed-up for filter(): - Use PyObject_Call() instead of PyEval_CallObject(), saves several layers of calls and checks. - Pre-allocate the argument tuple rather than calling Py_BuildValue() each time round the loop. - For filter(None, seq), avoid an INCREF and a DECREF. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.263 retrieving revision 2.264 diff -C2 -d -r2.263 -r2.264 *** bltinmodule.c 14 Aug 2002 15:46:02 -0000 2.263 --- bltinmodule.c 16 Aug 2002 07:04:56 -0000 2.264 *************** *** 123,127 **** builtin_filter(PyObject *self, PyObject *args) { ! PyObject *func, *seq, *result, *it; int len; /* guess for result list size */ register int j; --- 123,127 ---- builtin_filter(PyObject *self, PyObject *args) { ! PyObject *func, *seq, *result, *it, *arg; int len; /* guess for result list size */ register int j; *************** *** 152,155 **** --- 152,160 ---- len = 8; /* arbitrary */ + /* Pre-allocate argument list tuple. */ + arg = PyTuple_New(1); + if (arg == NULL) + goto Fail_arg; + /* Get a result list. */ if (PyList_Check(seq) && seq->ob_refcnt == 1) { *************** *** 167,171 **** j = 0; for (;;) { ! PyObject *item, *good; int ok; --- 172,176 ---- j = 0; for (;;) { ! PyObject *item; int ok; *************** *** 178,199 **** if (func == Py_None) { ! good = item; ! Py_INCREF(good); } else { ! PyObject *arg = Py_BuildValue("(O)", item); ! if (arg == NULL) { ! Py_DECREF(item); ! goto Fail_result_it; ! } ! good = PyEval_CallObject(func, arg); ! Py_DECREF(arg); if (good == NULL) { Py_DECREF(item); goto Fail_result_it; } } - ok = PyObject_IsTrue(good); - Py_DECREF(good); if (ok) { if (j < len) --- 183,200 ---- if (func == Py_None) { ! ok = PyObject_IsTrue(item); } else { ! PyObject *good; ! PyTuple_SET_ITEM(arg, 0, item); ! good = PyObject_Call(func, arg, NULL); ! PyTuple_SET_ITEM(arg, 0, NULL); if (good == NULL) { Py_DECREF(item); goto Fail_result_it; } + ok = PyObject_IsTrue(good); + Py_DECREF(good); } if (ok) { if (j < len) *************** *** 217,220 **** --- 218,222 ---- Py_DECREF(it); + Py_DECREF(arg); return result; *************** *** 223,226 **** --- 225,230 ---- Fail_it: Py_DECREF(it); + Fail_arg: + Py_DECREF(arg); return NULL; } From jackjansen@users.sourceforge.net Fri Aug 16 10:07:44 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:07:44 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenGenerator.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv17727/bgen Modified Files: bgenGenerator.py Log Message: iUse PyDoc_STR() around docstrings. Index: bgenGenerator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** bgenGenerator.py 5 Aug 2002 21:15:22 -0000 1.12 --- bgenGenerator.py 16 Aug 2002 09:07:42 -0000 1.13 *************** *** 58,62 **** Output(self.condition) Output("{\"%s\", (PyCFunction)%s_%s, 1,", name, self.prefix, self.name) ! Output(" %s},", stringify(docstring)) if self.condition: Output("#endif") --- 58,62 ---- Output(self.condition) Output("{\"%s\", (PyCFunction)%s_%s, 1,", name, self.prefix, self.name) ! Output(" PyDoc_STR(%s)},", stringify(docstring)) if self.condition: Output("#endif") From jackjansen@users.sourceforge.net Fri Aug 16 10:09:45 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ae _AEmodule.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv18405/ae Modified Files: _AEmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _AEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/_AEmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _AEmodule.c 23 Apr 2002 22:46:01 -0000 1.11 --- _AEmodule.c 16 Aug 2002 09:09:13 -0000 1.12 *************** *** 760,821 **** static PyMethodDef AEDesc_methods[] = { {"AECoerceDesc", (PyCFunction)AEDesc_AECoerceDesc, 1, ! "(DescType toType) -> (AEDesc result)"}, {"AEDuplicateDesc", (PyCFunction)AEDesc_AEDuplicateDesc, 1, ! "() -> (AEDesc result)"}, {"AECountItems", (PyCFunction)AEDesc_AECountItems, 1, ! "() -> (long theCount)"}, {"AEPutPtr", (PyCFunction)AEDesc_AEPutPtr, 1, ! "(long index, DescType typeCode, Buffer dataPtr) -> None"}, {"AEPutDesc", (PyCFunction)AEDesc_AEPutDesc, 1, ! "(long index, AEDesc theAEDesc) -> None"}, {"AEGetNthPtr", (PyCFunction)AEDesc_AEGetNthPtr, 1, ! "(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)"}, {"AEGetNthDesc", (PyCFunction)AEDesc_AEGetNthDesc, 1, ! "(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)"}, {"AESizeOfNthItem", (PyCFunction)AEDesc_AESizeOfNthItem, 1, ! "(long index) -> (DescType typeCode, Size dataSize)"}, {"AEDeleteItem", (PyCFunction)AEDesc_AEDeleteItem, 1, ! "(long index) -> None"}, {"AEPutParamPtr", (PyCFunction)AEDesc_AEPutParamPtr, 1, ! "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"}, {"AEPutParamDesc", (PyCFunction)AEDesc_AEPutParamDesc, 1, ! "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"}, {"AEGetParamPtr", (PyCFunction)AEDesc_AEGetParamPtr, 1, ! "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"}, {"AEGetParamDesc", (PyCFunction)AEDesc_AEGetParamDesc, 1, ! "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"}, {"AESizeOfParam", (PyCFunction)AEDesc_AESizeOfParam, 1, ! "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"}, {"AEDeleteParam", (PyCFunction)AEDesc_AEDeleteParam, 1, ! "(AEKeyword theAEKeyword) -> None"}, {"AEGetAttributePtr", (PyCFunction)AEDesc_AEGetAttributePtr, 1, ! "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"}, {"AEGetAttributeDesc", (PyCFunction)AEDesc_AEGetAttributeDesc, 1, ! "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"}, {"AESizeOfAttribute", (PyCFunction)AEDesc_AESizeOfAttribute, 1, ! "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"}, {"AEPutAttributePtr", (PyCFunction)AEDesc_AEPutAttributePtr, 1, ! "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"}, {"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1, ! "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"}, #if TARGET_API_MAC_CARBON {"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1, ! "() -> (Size _rv)"}, #endif {"AESend", (PyCFunction)AEDesc_AESend, 1, ! "(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"}, {"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1, ! "() -> None"}, {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1, ! "() -> None"}, {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1, ! "(AppleEvent reply, EventHandler dispatcher) -> None"}, {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1, ! "() -> None"}, {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1, ! "() -> None"}, {"AEResolve", (PyCFunction)AEDesc_AEResolve, 1, ! "(short callbackFlags) -> (AEDesc theToken)"}, {NULL, NULL, 0} }; --- 760,821 ---- static PyMethodDef AEDesc_methods[] = { {"AECoerceDesc", (PyCFunction)AEDesc_AECoerceDesc, 1, ! PyDoc_STR("(DescType toType) -> (AEDesc result)")}, {"AEDuplicateDesc", (PyCFunction)AEDesc_AEDuplicateDesc, 1, ! PyDoc_STR("() -> (AEDesc result)")}, {"AECountItems", (PyCFunction)AEDesc_AECountItems, 1, ! PyDoc_STR("() -> (long theCount)")}, {"AEPutPtr", (PyCFunction)AEDesc_AEPutPtr, 1, ! PyDoc_STR("(long index, DescType typeCode, Buffer dataPtr) -> None")}, {"AEPutDesc", (PyCFunction)AEDesc_AEPutDesc, 1, ! PyDoc_STR("(long index, AEDesc theAEDesc) -> None")}, {"AEGetNthPtr", (PyCFunction)AEDesc_AEGetNthPtr, 1, ! PyDoc_STR("(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)")}, {"AEGetNthDesc", (PyCFunction)AEDesc_AEGetNthDesc, 1, ! PyDoc_STR("(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)")}, {"AESizeOfNthItem", (PyCFunction)AEDesc_AESizeOfNthItem, 1, ! PyDoc_STR("(long index) -> (DescType typeCode, Size dataSize)")}, {"AEDeleteItem", (PyCFunction)AEDesc_AEDeleteItem, 1, ! PyDoc_STR("(long index) -> None")}, {"AEPutParamPtr", (PyCFunction)AEDesc_AEPutParamPtr, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")}, {"AEPutParamDesc", (PyCFunction)AEDesc_AEPutParamDesc, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")}, {"AEGetParamPtr", (PyCFunction)AEDesc_AEGetParamPtr, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")}, {"AEGetParamDesc", (PyCFunction)AEDesc_AEGetParamDesc, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")}, {"AESizeOfParam", (PyCFunction)AEDesc_AESizeOfParam, 1, ! PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")}, {"AEDeleteParam", (PyCFunction)AEDesc_AEDeleteParam, 1, ! PyDoc_STR("(AEKeyword theAEKeyword) -> None")}, {"AEGetAttributePtr", (PyCFunction)AEDesc_AEGetAttributePtr, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)")}, {"AEGetAttributeDesc", (PyCFunction)AEDesc_AEGetAttributeDesc, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)")}, {"AESizeOfAttribute", (PyCFunction)AEDesc_AESizeOfAttribute, 1, ! PyDoc_STR("(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)")}, {"AEPutAttributePtr", (PyCFunction)AEDesc_AEPutAttributePtr, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None")}, {"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1, ! PyDoc_STR("(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None")}, #if TARGET_API_MAC_CARBON {"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1, ! PyDoc_STR("() -> (Size _rv)")}, #endif {"AESend", (PyCFunction)AEDesc_AESend, 1, ! PyDoc_STR("(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)")}, {"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1, ! PyDoc_STR("() -> None")}, {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1, ! PyDoc_STR("() -> None")}, {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1, ! PyDoc_STR("(AppleEvent reply, EventHandler dispatcher) -> None")}, {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1, ! PyDoc_STR("() -> None")}, {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1, ! PyDoc_STR("() -> None")}, {"AEResolve", (PyCFunction)AEDesc_AEResolve, 1, ! PyDoc_STR("(short callbackFlags) -> (AEDesc theToken)")}, {NULL, NULL, 0} }; *************** *** 1308,1349 **** static PyMethodDef AE_methods[] = { {"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1, ! "(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)"}, {"AECreateDesc", (PyCFunction)AE_AECreateDesc, 1, ! "(DescType typeCode, Buffer dataPtr) -> (AEDesc result)"}, {"AECreateList", (PyCFunction)AE_AECreateList, 1, ! "(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"}, {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1, ! "(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)"}, #if TARGET_API_MAC_CARBON {"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1, ! "(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)"}, #endif {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1, ! "(EventRecord theEventRecord) -> None"}, {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1, ! "() -> (AEInteractAllowed level)"}, {"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1, ! "(AEInteractAllowed level) -> None"}, {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1, ! "(long timeOutInTicks) -> None"}, {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1, ! "(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"}, {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1, ! "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"}, {"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1, ! "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"}, {"AEInstallSpecialHandler", (PyCFunction)AE_AEInstallSpecialHandler, 1, ! "(AEKeyword functionClass) -> None"}, {"AERemoveSpecialHandler", (PyCFunction)AE_AERemoveSpecialHandler, 1, ! "(AEKeyword functionClass) -> None"}, {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1, ! "(AEKeyword keyWord) -> (long result)"}, {"AEObjectInit", (PyCFunction)AE_AEObjectInit, 1, ! "() -> None"}, {"AEDisposeToken", (PyCFunction)AE_AEDisposeToken, 1, ! "() -> (AEDesc theToken)"}, {"AECallObjectAccessor", (PyCFunction)AE_AECallObjectAccessor, 1, ! "(DescType desiredClass, AEDesc containerToken, DescType containerClass, DescType keyForm, AEDesc keyData) -> (AEDesc token)"}, {NULL, NULL, 0} }; --- 1308,1349 ---- static PyMethodDef AE_methods[] = { {"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1, ! PyDoc_STR("(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)")}, {"AECreateDesc", (PyCFunction)AE_AECreateDesc, 1, ! PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc result)")}, {"AECreateList", (PyCFunction)AE_AECreateList, 1, ! PyDoc_STR("(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)")}, {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1, ! PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)")}, #if TARGET_API_MAC_CARBON {"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1, ! PyDoc_STR("(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)")}, #endif {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1, ! PyDoc_STR("(EventRecord theEventRecord) -> None")}, {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1, ! PyDoc_STR("() -> (AEInteractAllowed level)")}, {"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1, ! PyDoc_STR("(AEInteractAllowed level) -> None")}, {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1, ! PyDoc_STR("(long timeOutInTicks) -> None")}, {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1, ! PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None")}, {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1, ! PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None")}, {"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1, ! PyDoc_STR("(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)")}, {"AEInstallSpecialHandler", (PyCFunction)AE_AEInstallSpecialHandler, 1, ! PyDoc_STR("(AEKeyword functionClass) -> None")}, {"AERemoveSpecialHandler", (PyCFunction)AE_AERemoveSpecialHandler, 1, ! PyDoc_STR("(AEKeyword functionClass) -> None")}, {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1, ! PyDoc_STR("(AEKeyword keyWord) -> (long result)")}, {"AEObjectInit", (PyCFunction)AE_AEObjectInit, 1, ! PyDoc_STR("() -> None")}, {"AEDisposeToken", (PyCFunction)AE_AEDisposeToken, 1, ! PyDoc_STR("() -> (AEDesc theToken)")}, {"AECallObjectAccessor", (PyCFunction)AE_AECallObjectAccessor, 1, ! PyDoc_STR("(DescType desiredClass, AEDesc containerToken, DescType containerClass, DescType keyForm, AEDesc keyData) -> (AEDesc token)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/app _Appmodule.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv18405/app Modified Files: _Appmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Appmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Appmodule.c 23 Apr 2002 22:45:54 -0000 1.11 --- _Appmodule.c 16 Aug 2002 09:09:13 -0000 1.12 *************** *** 108,114 **** static PyMethodDef ThemeDrawingStateObj_methods[] = { {"SetThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_SetThemeDrawingState, 1, ! "(Boolean inDisposeNow) -> (OSStatus _rv)"}, {"DisposeThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_DisposeThemeDrawingState, 1, ! "() -> (OSStatus _rv)"}, {NULL, NULL, 0} }; --- 108,114 ---- static PyMethodDef ThemeDrawingStateObj_methods[] = { {"SetThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_SetThemeDrawingState, 1, ! PyDoc_STR("(Boolean inDisposeNow) -> (OSStatus _rv)")}, {"DisposeThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_DisposeThemeDrawingState, 1, ! PyDoc_STR("() -> (OSStatus _rv)")}, {NULL, NULL, 0} }; *************** *** 1647,1793 **** static PyMethodDef App_methods[] = { {"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1, ! "() -> None"}, {"UnregisterAppearanceClient", (PyCFunction)App_UnregisterAppearanceClient, 1, ! "() -> None"}, {"SetThemePen", (PyCFunction)App_SetThemePen, 1, ! "(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None"}, {"SetThemeBackground", (PyCFunction)App_SetThemeBackground, 1, ! "(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None"}, {"SetThemeTextColor", (PyCFunction)App_SetThemeTextColor, 1, ! "(ThemeTextColor inColor, SInt16 inDepth, Boolean inIsColorDevice) -> None"}, {"SetThemeWindowBackground", (PyCFunction)App_SetThemeWindowBackground, 1, ! "(WindowPtr inWindow, ThemeBrush inBrush, Boolean inUpdate) -> None"}, {"DrawThemeWindowHeader", (PyCFunction)App_DrawThemeWindowHeader, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeWindowListViewHeader", (PyCFunction)App_DrawThemeWindowListViewHeader, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemePlacard", (PyCFunction)App_DrawThemePlacard, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeEditTextFrame", (PyCFunction)App_DrawThemeEditTextFrame, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeListBoxFrame", (PyCFunction)App_DrawThemeListBoxFrame, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeFocusRect", (PyCFunction)App_DrawThemeFocusRect, 1, ! "(Rect inRect, Boolean inHasFocus) -> None"}, {"DrawThemePrimaryGroup", (PyCFunction)App_DrawThemePrimaryGroup, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeSecondaryGroup", (PyCFunction)App_DrawThemeSecondaryGroup, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeSeparator", (PyCFunction)App_DrawThemeSeparator, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeModelessDialogFrame", (PyCFunction)App_DrawThemeModelessDialogFrame, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"DrawThemeGenericWell", (PyCFunction)App_DrawThemeGenericWell, 1, ! "(Rect inRect, ThemeDrawState inState, Boolean inFillCenter) -> None"}, {"DrawThemeFocusRegion", (PyCFunction)App_DrawThemeFocusRegion, 1, ! "(Boolean inHasFocus) -> None"}, {"IsThemeInColor", (PyCFunction)App_IsThemeInColor, 1, ! "(SInt16 inDepth, Boolean inIsColorDevice) -> (Boolean _rv)"}, {"GetThemeAccentColors", (PyCFunction)App_GetThemeAccentColors, 1, ! "() -> (CTabHandle outColors)"}, {"DrawThemeMenuBarBackground", (PyCFunction)App_DrawThemeMenuBarBackground, 1, ! "(Rect inBounds, ThemeMenuBarState inState, UInt32 inAttributes) -> None"}, {"GetThemeMenuBarHeight", (PyCFunction)App_GetThemeMenuBarHeight, 1, ! "() -> (SInt16 outHeight)"}, {"DrawThemeMenuBackground", (PyCFunction)App_DrawThemeMenuBackground, 1, ! "(Rect inMenuRect, ThemeMenuType inMenuType) -> None"}, {"GetThemeMenuBackgroundRegion", (PyCFunction)App_GetThemeMenuBackgroundRegion, 1, ! "(Rect inMenuRect, ThemeMenuType menuType) -> None"}, {"DrawThemeMenuSeparator", (PyCFunction)App_DrawThemeMenuSeparator, 1, ! "(Rect inItemRect) -> None"}, {"GetThemeMenuSeparatorHeight", (PyCFunction)App_GetThemeMenuSeparatorHeight, 1, ! "() -> (SInt16 outHeight)"}, {"GetThemeMenuItemExtra", (PyCFunction)App_GetThemeMenuItemExtra, 1, ! "(ThemeMenuItemType inItemType) -> (SInt16 outHeight, SInt16 outWidth)"}, {"GetThemeMenuTitleExtra", (PyCFunction)App_GetThemeMenuTitleExtra, 1, ! "(Boolean inIsSquished) -> (SInt16 outWidth)"}, {"DrawThemeTabPane", (PyCFunction)App_DrawThemeTabPane, 1, ! "(Rect inRect, ThemeDrawState inState) -> None"}, {"GetThemeTabRegion", (PyCFunction)App_GetThemeTabRegion, 1, ! "(Rect inRect, ThemeTabStyle inStyle, ThemeTabDirection inDirection) -> None"}, {"SetThemeCursor", (PyCFunction)App_SetThemeCursor, 1, ! "(ThemeCursor inCursor) -> None"}, {"SetAnimatedThemeCursor", (PyCFunction)App_SetAnimatedThemeCursor, 1, ! "(ThemeCursor inCursor, UInt32 inAnimationStep) -> None"}, {"GetThemeScrollBarThumbStyle", (PyCFunction)App_GetThemeScrollBarThumbStyle, 1, ! "() -> (ThemeScrollBarThumbStyle outStyle)"}, {"GetThemeScrollBarArrowStyle", (PyCFunction)App_GetThemeScrollBarArrowStyle, 1, ! "() -> (ThemeScrollBarArrowStyle outStyle)"}, {"GetThemeCheckBoxStyle", (PyCFunction)App_GetThemeCheckBoxStyle, 1, ! "() -> (ThemeCheckBoxStyle outStyle)"}, {"UseThemeFont", (PyCFunction)App_UseThemeFont, 1, ! "(ThemeFontID inFontID, ScriptCode inScript) -> None"}, #if TARGET_API_MAC_CARBON {"DrawThemeTextBox", (PyCFunction)App_DrawThemeTextBox, 1, ! "(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Rect inBoundingBox, SInt16 inJust) -> None"}, #endif #if TARGET_API_MAC_CARBON {"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1, ! "(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)"}, #endif #if TARGET_API_MAC_CARBON {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1, ! "(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Point ioBounds) -> (Point ioBounds, SInt16 outBaseline)"}, #endif #if TARGET_API_MAC_CARBON {"GetThemeTextShadowOutset", (PyCFunction)App_GetThemeTextShadowOutset, 1, ! "(ThemeFontID inFontID, ThemeDrawState inState) -> (Rect outOutset)"}, #endif {"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1, ! "(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"}, {"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1, ! "(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"}, {"HitTestThemeScrollBarArrows", (PyCFunction)App_HitTestThemeScrollBarArrows, 1, ! "(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)"}, {"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1, ! "(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None"}, {"DrawThemeButton", (PyCFunction)App_DrawThemeButton, 1, ! "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo, ThemeButtonDrawInfo inPrevInfo, UInt32 inUserData) -> None"}, {"GetThemeButtonRegion", (PyCFunction)App_GetThemeButtonRegion, 1, ! "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo) -> None"}, {"GetThemeButtonContentBounds", (PyCFunction)App_GetThemeButtonContentBounds, 1, ! "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)"}, {"GetThemeButtonBackgroundBounds", (PyCFunction)App_GetThemeButtonBackgroundBounds, 1, ! "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)"}, {"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1, ! "(ThemeSoundKind kind) -> None"}, {"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1, ! "(ThemeDragSoundKind kind) -> None"}, {"EndThemeDragSound", (PyCFunction)App_EndThemeDragSound, 1, ! "() -> None"}, {"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1, ! "(Rect bounds, ThemeDrawState state) -> None"}, {"DrawThemeChasingArrows", (PyCFunction)App_DrawThemeChasingArrows, 1, ! "(Rect bounds, UInt32 index, ThemeDrawState state, UInt32 eraseData) -> None"}, {"DrawThemePopupArrow", (PyCFunction)App_DrawThemePopupArrow, 1, ! "(Rect bounds, ThemeArrowOrientation orientation, ThemePopupArrowSize size, ThemeDrawState state, UInt32 eraseData) -> None"}, {"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1, ! "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"}, {"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1, ! "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"}, {"GetThemeStandaloneGrowBoxBounds", (PyCFunction)App_GetThemeStandaloneGrowBoxBounds, 1, ! "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)"}, {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1, ! "() -> None"}, {"GetThemeDrawingState", (PyCFunction)App_GetThemeDrawingState, 1, ! "() -> (ThemeDrawingState outState)"}, {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1, ! "(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None"}, {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1, ! "(WindowPtr window, Boolean isActive, SInt16 depth, Boolean isColorDev) -> None"}, {"IsValidAppearanceFileType", (PyCFunction)App_IsValidAppearanceFileType, 1, ! "(OSType fileType) -> (Boolean _rv)"}, {"GetThemeBrushAsColor", (PyCFunction)App_GetThemeBrushAsColor, 1, ! "(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"}, {"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1, ! "(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"}, #if TARGET_API_MAC_CARBON {"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1, ! "(ThemeMetric inMetric) -> (SInt32 outMetric)"}, #endif {NULL, NULL, 0} --- 1647,1793 ---- static PyMethodDef App_methods[] = { {"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1, ! PyDoc_STR("() -> None")}, {"UnregisterAppearanceClient", (PyCFunction)App_UnregisterAppearanceClient, 1, ! PyDoc_STR("() -> None")}, {"SetThemePen", (PyCFunction)App_SetThemePen, 1, ! PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None")}, {"SetThemeBackground", (PyCFunction)App_SetThemeBackground, 1, ! PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None")}, {"SetThemeTextColor", (PyCFunction)App_SetThemeTextColor, 1, ! PyDoc_STR("(ThemeTextColor inColor, SInt16 inDepth, Boolean inIsColorDevice) -> None")}, {"SetThemeWindowBackground", (PyCFunction)App_SetThemeWindowBackground, 1, ! PyDoc_STR("(WindowPtr inWindow, ThemeBrush inBrush, Boolean inUpdate) -> None")}, {"DrawThemeWindowHeader", (PyCFunction)App_DrawThemeWindowHeader, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeWindowListViewHeader", (PyCFunction)App_DrawThemeWindowListViewHeader, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemePlacard", (PyCFunction)App_DrawThemePlacard, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeEditTextFrame", (PyCFunction)App_DrawThemeEditTextFrame, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeListBoxFrame", (PyCFunction)App_DrawThemeListBoxFrame, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeFocusRect", (PyCFunction)App_DrawThemeFocusRect, 1, ! PyDoc_STR("(Rect inRect, Boolean inHasFocus) -> None")}, {"DrawThemePrimaryGroup", (PyCFunction)App_DrawThemePrimaryGroup, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeSecondaryGroup", (PyCFunction)App_DrawThemeSecondaryGroup, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeSeparator", (PyCFunction)App_DrawThemeSeparator, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeModelessDialogFrame", (PyCFunction)App_DrawThemeModelessDialogFrame, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"DrawThemeGenericWell", (PyCFunction)App_DrawThemeGenericWell, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState, Boolean inFillCenter) -> None")}, {"DrawThemeFocusRegion", (PyCFunction)App_DrawThemeFocusRegion, 1, ! PyDoc_STR("(Boolean inHasFocus) -> None")}, {"IsThemeInColor", (PyCFunction)App_IsThemeInColor, 1, ! PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> (Boolean _rv)")}, {"GetThemeAccentColors", (PyCFunction)App_GetThemeAccentColors, 1, ! PyDoc_STR("() -> (CTabHandle outColors)")}, {"DrawThemeMenuBarBackground", (PyCFunction)App_DrawThemeMenuBarBackground, 1, ! PyDoc_STR("(Rect inBounds, ThemeMenuBarState inState, UInt32 inAttributes) -> None")}, {"GetThemeMenuBarHeight", (PyCFunction)App_GetThemeMenuBarHeight, 1, ! PyDoc_STR("() -> (SInt16 outHeight)")}, {"DrawThemeMenuBackground", (PyCFunction)App_DrawThemeMenuBackground, 1, ! PyDoc_STR("(Rect inMenuRect, ThemeMenuType inMenuType) -> None")}, {"GetThemeMenuBackgroundRegion", (PyCFunction)App_GetThemeMenuBackgroundRegion, 1, ! PyDoc_STR("(Rect inMenuRect, ThemeMenuType menuType) -> None")}, {"DrawThemeMenuSeparator", (PyCFunction)App_DrawThemeMenuSeparator, 1, ! PyDoc_STR("(Rect inItemRect) -> None")}, {"GetThemeMenuSeparatorHeight", (PyCFunction)App_GetThemeMenuSeparatorHeight, 1, ! PyDoc_STR("() -> (SInt16 outHeight)")}, {"GetThemeMenuItemExtra", (PyCFunction)App_GetThemeMenuItemExtra, 1, ! PyDoc_STR("(ThemeMenuItemType inItemType) -> (SInt16 outHeight, SInt16 outWidth)")}, {"GetThemeMenuTitleExtra", (PyCFunction)App_GetThemeMenuTitleExtra, 1, ! PyDoc_STR("(Boolean inIsSquished) -> (SInt16 outWidth)")}, {"DrawThemeTabPane", (PyCFunction)App_DrawThemeTabPane, 1, ! PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")}, {"GetThemeTabRegion", (PyCFunction)App_GetThemeTabRegion, 1, ! PyDoc_STR("(Rect inRect, ThemeTabStyle inStyle, ThemeTabDirection inDirection) -> None")}, {"SetThemeCursor", (PyCFunction)App_SetThemeCursor, 1, ! PyDoc_STR("(ThemeCursor inCursor) -> None")}, {"SetAnimatedThemeCursor", (PyCFunction)App_SetAnimatedThemeCursor, 1, ! PyDoc_STR("(ThemeCursor inCursor, UInt32 inAnimationStep) -> None")}, {"GetThemeScrollBarThumbStyle", (PyCFunction)App_GetThemeScrollBarThumbStyle, 1, ! PyDoc_STR("() -> (ThemeScrollBarThumbStyle outStyle)")}, {"GetThemeScrollBarArrowStyle", (PyCFunction)App_GetThemeScrollBarArrowStyle, 1, ! PyDoc_STR("() -> (ThemeScrollBarArrowStyle outStyle)")}, {"GetThemeCheckBoxStyle", (PyCFunction)App_GetThemeCheckBoxStyle, 1, ! PyDoc_STR("() -> (ThemeCheckBoxStyle outStyle)")}, {"UseThemeFont", (PyCFunction)App_UseThemeFont, 1, ! PyDoc_STR("(ThemeFontID inFontID, ScriptCode inScript) -> None")}, #if TARGET_API_MAC_CARBON {"DrawThemeTextBox", (PyCFunction)App_DrawThemeTextBox, 1, ! PyDoc_STR("(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Rect inBoundingBox, SInt16 inJust) -> None")}, #endif #if TARGET_API_MAC_CARBON {"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1, ! PyDoc_STR("(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)")}, #endif #if TARGET_API_MAC_CARBON {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1, ! PyDoc_STR("(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Point ioBounds) -> (Point ioBounds, SInt16 outBaseline)")}, #endif #if TARGET_API_MAC_CARBON {"GetThemeTextShadowOutset", (PyCFunction)App_GetThemeTextShadowOutset, 1, ! PyDoc_STR("(ThemeFontID inFontID, ThemeDrawState inState) -> (Rect outOutset)")}, #endif {"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1, ! PyDoc_STR("(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)")}, {"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1, ! PyDoc_STR("(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)")}, {"HitTestThemeScrollBarArrows", (PyCFunction)App_HitTestThemeScrollBarArrows, 1, ! PyDoc_STR("(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)")}, {"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1, ! PyDoc_STR("(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None")}, {"DrawThemeButton", (PyCFunction)App_DrawThemeButton, 1, ! PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo, ThemeButtonDrawInfo inPrevInfo, UInt32 inUserData) -> None")}, {"GetThemeButtonRegion", (PyCFunction)App_GetThemeButtonRegion, 1, ! PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo) -> None")}, {"GetThemeButtonContentBounds", (PyCFunction)App_GetThemeButtonContentBounds, 1, ! PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)")}, {"GetThemeButtonBackgroundBounds", (PyCFunction)App_GetThemeButtonBackgroundBounds, 1, ! PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)")}, {"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1, ! PyDoc_STR("(ThemeSoundKind kind) -> None")}, {"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1, ! PyDoc_STR("(ThemeDragSoundKind kind) -> None")}, {"EndThemeDragSound", (PyCFunction)App_EndThemeDragSound, 1, ! PyDoc_STR("() -> None")}, {"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1, ! PyDoc_STR("(Rect bounds, ThemeDrawState state) -> None")}, {"DrawThemeChasingArrows", (PyCFunction)App_DrawThemeChasingArrows, 1, ! PyDoc_STR("(Rect bounds, UInt32 index, ThemeDrawState state, UInt32 eraseData) -> None")}, {"DrawThemePopupArrow", (PyCFunction)App_DrawThemePopupArrow, 1, ! PyDoc_STR("(Rect bounds, ThemeArrowOrientation orientation, ThemePopupArrowSize size, ThemeDrawState state, UInt32 eraseData) -> None")}, {"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1, ! PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None")}, {"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1, ! PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None")}, {"GetThemeStandaloneGrowBoxBounds", (PyCFunction)App_GetThemeStandaloneGrowBoxBounds, 1, ! PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)")}, {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1, ! PyDoc_STR("() -> None")}, {"GetThemeDrawingState", (PyCFunction)App_GetThemeDrawingState, 1, ! PyDoc_STR("() -> (ThemeDrawingState outState)")}, {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1, ! PyDoc_STR("(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None")}, {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1, ! PyDoc_STR("(WindowPtr window, Boolean isActive, SInt16 depth, Boolean isColorDev) -> None")}, {"IsValidAppearanceFileType", (PyCFunction)App_IsValidAppearanceFileType, 1, ! PyDoc_STR("(OSType fileType) -> (Boolean _rv)")}, {"GetThemeBrushAsColor", (PyCFunction)App_GetThemeBrushAsColor, 1, ! PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)")}, {"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1, ! PyDoc_STR("(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)")}, #if TARGET_API_MAC_CARBON {"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1, ! PyDoc_STR("(ThemeMetric inMetric) -> (SInt32 outMetric)")}, #endif {NULL, NULL, 0} From jackjansen@users.sourceforge.net Fri Aug 16 10:09:48 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:48 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt _CarbonEvtmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory usw-pr-cvs1:/tmp/cvs-serv18405/carbonevt Modified Files: _CarbonEvtmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _CarbonEvtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/_CarbonEvtmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _CarbonEvtmodule.c 23 Apr 2002 22:42:28 -0000 1.9 --- _CarbonEvtmodule.c 16 Aug 2002 09:09:14 -0000 1.10 *************** *** 381,409 **** static PyMethodDef EventRef_methods[] = { {"RetainEvent", (PyCFunction)EventRef_RetainEvent, 1, ! "() -> (EventRef _rv)"}, {"GetEventRetainCount", (PyCFunction)EventRef_GetEventRetainCount, 1, ! "() -> (UInt32 _rv)"}, {"ReleaseEvent", (PyCFunction)EventRef_ReleaseEvent, 1, ! "() -> None"}, {"SetEventParameter", (PyCFunction)EventRef_SetEventParameter, 1, ! "(OSType inName, OSType inType, Buffer inDataPtr) -> None"}, {"GetEventClass", (PyCFunction)EventRef_GetEventClass, 1, ! "() -> (UInt32 _rv)"}, {"GetEventKind", (PyCFunction)EventRef_GetEventKind, 1, ! "() -> (UInt32 _rv)"}, {"GetEventTime", (PyCFunction)EventRef_GetEventTime, 1, ! "() -> (double _rv)"}, {"SetEventTime", (PyCFunction)EventRef_SetEventTime, 1, ! "(double inTime) -> None"}, {"IsUserCancelEventRef", (PyCFunction)EventRef_IsUserCancelEventRef, 1, ! "() -> (Boolean _rv)"}, {"ConvertEventRefToEventRecord", (PyCFunction)EventRef_ConvertEventRefToEventRecord, 1, ! "() -> (Boolean _rv, EventRecord outEvent)"}, {"IsEventInMask", (PyCFunction)EventRef_IsEventInMask, 1, ! "(UInt16 inMask) -> (Boolean _rv)"}, {"SendEventToEventTarget", (PyCFunction)EventRef_SendEventToEventTarget, 1, ! "(EventTargetRef inTarget) -> None"}, {"GetEventParameter", (PyCFunction)EventRef_GetEventParameter, 1, ! "(EventParamName eventName, EventParamType eventType) -> (String eventParamData)"}, {NULL, NULL, 0} }; --- 381,409 ---- static PyMethodDef EventRef_methods[] = { {"RetainEvent", (PyCFunction)EventRef_RetainEvent, 1, ! PyDoc_STR("() -> (EventRef _rv)")}, {"GetEventRetainCount", (PyCFunction)EventRef_GetEventRetainCount, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"ReleaseEvent", (PyCFunction)EventRef_ReleaseEvent, 1, ! PyDoc_STR("() -> None")}, {"SetEventParameter", (PyCFunction)EventRef_SetEventParameter, 1, ! PyDoc_STR("(OSType inName, OSType inType, Buffer inDataPtr) -> None")}, {"GetEventClass", (PyCFunction)EventRef_GetEventClass, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"GetEventKind", (PyCFunction)EventRef_GetEventKind, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"GetEventTime", (PyCFunction)EventRef_GetEventTime, 1, ! PyDoc_STR("() -> (double _rv)")}, {"SetEventTime", (PyCFunction)EventRef_SetEventTime, 1, ! PyDoc_STR("(double inTime) -> None")}, {"IsUserCancelEventRef", (PyCFunction)EventRef_IsUserCancelEventRef, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"ConvertEventRefToEventRecord", (PyCFunction)EventRef_ConvertEventRefToEventRecord, 1, ! PyDoc_STR("() -> (Boolean _rv, EventRecord outEvent)")}, {"IsEventInMask", (PyCFunction)EventRef_IsEventInMask, 1, ! PyDoc_STR("(UInt16 inMask) -> (Boolean _rv)")}, {"SendEventToEventTarget", (PyCFunction)EventRef_SendEventToEventTarget, 1, ! PyDoc_STR("(EventTargetRef inTarget) -> None")}, {"GetEventParameter", (PyCFunction)EventRef_GetEventParameter, 1, ! PyDoc_STR("(EventParamName eventName, EventParamType eventType) -> (String eventParamData)")}, {NULL, NULL, 0} }; *************** *** 578,592 **** static PyMethodDef EventQueueRef_methods[] = { {"PostEventToQueue", (PyCFunction)EventQueueRef_PostEventToQueue, 1, ! "(EventRef inEvent, SInt16 inPriority) -> None"}, {"FlushEventsMatchingListFromQueue", (PyCFunction)EventQueueRef_FlushEventsMatchingListFromQueue, 1, ! "(UInt32 inNumTypes, EventTypeSpec inList) -> None"}, {"FlushEventQueue", (PyCFunction)EventQueueRef_FlushEventQueue, 1, ! "() -> None"}, {"GetNumEventsInQueue", (PyCFunction)EventQueueRef_GetNumEventsInQueue, 1, ! "() -> (UInt32 _rv)"}, {"RemoveEventFromQueue", (PyCFunction)EventQueueRef_RemoveEventFromQueue, 1, ! "(EventRef inEvent) -> None"}, {"IsEventInQueue", (PyCFunction)EventQueueRef_IsEventInQueue, 1, ! "(EventRef inEvent) -> (Boolean _rv)"}, {NULL, NULL, 0} }; --- 578,592 ---- static PyMethodDef EventQueueRef_methods[] = { {"PostEventToQueue", (PyCFunction)EventQueueRef_PostEventToQueue, 1, ! PyDoc_STR("(EventRef inEvent, SInt16 inPriority) -> None")}, {"FlushEventsMatchingListFromQueue", (PyCFunction)EventQueueRef_FlushEventsMatchingListFromQueue, 1, ! PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList) -> None")}, {"FlushEventQueue", (PyCFunction)EventQueueRef_FlushEventQueue, 1, ! PyDoc_STR("() -> None")}, {"GetNumEventsInQueue", (PyCFunction)EventQueueRef_GetNumEventsInQueue, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"RemoveEventFromQueue", (PyCFunction)EventQueueRef_RemoveEventFromQueue, 1, ! PyDoc_STR("(EventRef inEvent) -> None")}, {"IsEventInQueue", (PyCFunction)EventQueueRef_IsEventInQueue, 1, ! PyDoc_STR("(EventRef inEvent) -> (Boolean _rv)")}, {NULL, NULL, 0} }; *************** *** 680,684 **** static PyMethodDef EventLoopRef_methods[] = { {"QuitEventLoop", (PyCFunction)EventLoopRef_QuitEventLoop, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 680,684 ---- static PyMethodDef EventLoopRef_methods[] = { {"QuitEventLoop", (PyCFunction)EventLoopRef_QuitEventLoop, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 788,794 **** static PyMethodDef EventLoopTimerRef_methods[] = { {"RemoveEventLoopTimer", (PyCFunction)EventLoopTimerRef_RemoveEventLoopTimer, 1, ! "() -> None"}, {"SetEventLoopTimerNextFireTime", (PyCFunction)EventLoopTimerRef_SetEventLoopTimerNextFireTime, 1, ! "(double inNextFire) -> None"}, {NULL, NULL, 0} }; --- 788,794 ---- static PyMethodDef EventLoopTimerRef_methods[] = { {"RemoveEventLoopTimer", (PyCFunction)EventLoopTimerRef_RemoveEventLoopTimer, 1, ! PyDoc_STR("() -> None")}, {"SetEventLoopTimerNextFireTime", (PyCFunction)EventLoopTimerRef_SetEventLoopTimerNextFireTime, 1, ! PyDoc_STR("(double inNextFire) -> None")}, {NULL, NULL, 0} }; *************** *** 941,949 **** static PyMethodDef EventHandlerRef_methods[] = { {"AddEventTypesToHandler", (PyCFunction)EventHandlerRef_AddEventTypesToHandler, 1, ! "(UInt32 inNumTypes, EventTypeSpec inList) -> None"}, {"RemoveEventTypesFromHandler", (PyCFunction)EventHandlerRef_RemoveEventTypesFromHandler, 1, ! "(UInt32 inNumTypes, EventTypeSpec inList) -> None"}, {"RemoveEventHandler", (PyCFunction)EventHandlerRef_RemoveEventHandler, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 941,949 ---- static PyMethodDef EventHandlerRef_methods[] = { {"AddEventTypesToHandler", (PyCFunction)EventHandlerRef_AddEventTypesToHandler, 1, ! PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList) -> None")}, {"RemoveEventTypesFromHandler", (PyCFunction)EventHandlerRef_RemoveEventTypesFromHandler, 1, ! PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList) -> None")}, {"RemoveEventHandler", (PyCFunction)EventHandlerRef_RemoveEventHandler, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 1040,1044 **** static PyMethodDef EventHandlerCallRef_methods[] = { {"CallNextEventHandler", (PyCFunction)EventHandlerCallRef_CallNextEventHandler, 1, ! "(EventRef inEvent) -> None"}, {NULL, NULL, 0} }; --- 1040,1044 ---- static PyMethodDef EventHandlerCallRef_methods[] = { {"CallNextEventHandler", (PyCFunction)EventHandlerCallRef_CallNextEventHandler, 1, ! PyDoc_STR("(EventRef inEvent) -> None")}, {NULL, NULL, 0} }; *************** *** 1155,1161 **** static PyMethodDef EventTargetRef_methods[] = { {"InstallStandardEventHandler", (PyCFunction)EventTargetRef_InstallStandardEventHandler, 1, ! "() -> None"}, {"InstallEventHandler", (PyCFunction)EventTargetRef_InstallEventHandler, 1, ! "(EventTypeSpec inSpec, Method callback) -> (EventHandlerRef outRef)"}, {NULL, NULL, 0} }; --- 1155,1161 ---- static PyMethodDef EventTargetRef_methods[] = { {"InstallStandardEventHandler", (PyCFunction)EventTargetRef_InstallStandardEventHandler, 1, ! PyDoc_STR("() -> None")}, {"InstallEventHandler", (PyCFunction)EventTargetRef_InstallEventHandler, 1, ! PyDoc_STR("(EventTypeSpec inSpec, Method callback) -> (EventHandlerRef outRef)")}, {NULL, NULL, 0} }; *************** *** 1249,1253 **** static PyMethodDef EventHotKeyRef_methods[] = { {"UnregisterEventHotKey", (PyCFunction)EventHotKeyRef_UnregisterEventHotKey, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 1249,1253 ---- static PyMethodDef EventHotKeyRef_methods[] = { {"UnregisterEventHotKey", (PyCFunction)EventHotKeyRef_UnregisterEventHotKey, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 1779,1841 **** static PyMethodDef CarbonEvents_methods[] = { {"GetCurrentEventLoop", (PyCFunction)CarbonEvents_GetCurrentEventLoop, 1, ! "() -> (EventLoopRef _rv)"}, {"GetMainEventLoop", (PyCFunction)CarbonEvents_GetMainEventLoop, 1, ! "() -> (EventLoopRef _rv)"}, {"RunCurrentEventLoop", (PyCFunction)CarbonEvents_RunCurrentEventLoop, 1, ! "(double inTimeout) -> None"}, {"ReceiveNextEvent", (PyCFunction)CarbonEvents_ReceiveNextEvent, 1, ! "(UInt32 inNumTypes, EventTypeSpec inList, double inTimeout, Boolean inPullEvent) -> (EventRef outEvent)"}, {"GetCurrentEventQueue", (PyCFunction)CarbonEvents_GetCurrentEventQueue, 1, ! "() -> (EventQueueRef _rv)"}, {"GetMainEventQueue", (PyCFunction)CarbonEvents_GetMainEventQueue, 1, ! "() -> (EventQueueRef _rv)"}, {"GetCurrentEventTime", (PyCFunction)CarbonEvents_GetCurrentEventTime, 1, ! "() -> (double _rv)"}, {"TrackMouseLocation", (PyCFunction)CarbonEvents_TrackMouseLocation, 1, ! "(GrafPtr inPort) -> (Point outPt, UInt16 outResult)"}, {"TrackMouseLocationWithOptions", (PyCFunction)CarbonEvents_TrackMouseLocationWithOptions, 1, ! "(GrafPtr inPort, OptionBits inOptions, double inTimeout) -> (Point outPt, UInt32 outModifiers, UInt16 outResult)"}, {"TrackMouseRegion", (PyCFunction)CarbonEvents_TrackMouseRegion, 1, ! "(GrafPtr inPort, RgnHandle inRegion, Boolean ioWasInRgn) -> (Boolean ioWasInRgn, UInt16 outResult)"}, {"GetLastUserEventTime", (PyCFunction)CarbonEvents_GetLastUserEventTime, 1, ! "() -> (double _rv)"}, {"GetWindowEventTarget", (PyCFunction)CarbonEvents_GetWindowEventTarget, 1, ! "(WindowPtr inWindow) -> (EventTargetRef _rv)"}, {"GetControlEventTarget", (PyCFunction)CarbonEvents_GetControlEventTarget, 1, ! "(ControlHandle inControl) -> (EventTargetRef _rv)"}, {"GetMenuEventTarget", (PyCFunction)CarbonEvents_GetMenuEventTarget, 1, ! "(MenuHandle inMenu) -> (EventTargetRef _rv)"}, {"GetApplicationEventTarget", (PyCFunction)CarbonEvents_GetApplicationEventTarget, 1, ! "() -> (EventTargetRef _rv)"}, {"GetUserFocusEventTarget", (PyCFunction)CarbonEvents_GetUserFocusEventTarget, 1, ! "() -> (EventTargetRef _rv)"}, {"GetEventDispatcherTarget", (PyCFunction)CarbonEvents_GetEventDispatcherTarget, 1, ! "() -> (EventTargetRef _rv)"}, {"QuitApplicationEventLoop", (PyCFunction)CarbonEvents_QuitApplicationEventLoop, 1, ! "() -> None"}, {"RunAppModalLoopForWindow", (PyCFunction)CarbonEvents_RunAppModalLoopForWindow, 1, ! "(WindowPtr inWindow) -> None"}, {"QuitAppModalLoopForWindow", (PyCFunction)CarbonEvents_QuitAppModalLoopForWindow, 1, ! "(WindowPtr inWindow) -> None"}, {"BeginAppModalStateForWindow", (PyCFunction)CarbonEvents_BeginAppModalStateForWindow, 1, ! "(WindowPtr inWindow) -> None"}, {"EndAppModalStateForWindow", (PyCFunction)CarbonEvents_EndAppModalStateForWindow, 1, ! "(WindowPtr inWindow) -> None"}, {"SetUserFocusWindow", (PyCFunction)CarbonEvents_SetUserFocusWindow, 1, ! "(WindowPtr inWindow) -> None"}, {"GetUserFocusWindow", (PyCFunction)CarbonEvents_GetUserFocusWindow, 1, ! "() -> (WindowPtr _rv)"}, {"SetWindowDefaultButton", (PyCFunction)CarbonEvents_SetWindowDefaultButton, 1, ! "(WindowPtr inWindow, ControlHandle inControl) -> None"}, {"SetWindowCancelButton", (PyCFunction)CarbonEvents_SetWindowCancelButton, 1, ! "(WindowPtr inWindow, ControlHandle inControl) -> None"}, {"GetWindowDefaultButton", (PyCFunction)CarbonEvents_GetWindowDefaultButton, 1, ! "(WindowPtr inWindow) -> (ControlHandle outControl)"}, {"GetWindowCancelButton", (PyCFunction)CarbonEvents_GetWindowCancelButton, 1, ! "(WindowPtr inWindow) -> (ControlHandle outControl)"}, {"RegisterEventHotKey", (PyCFunction)CarbonEvents_RegisterEventHotKey, 1, ! "(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) -> (EventHotKeyRef outRef)"}, {"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1, ! "() -> ()"}, {NULL, NULL, 0} }; --- 1779,1841 ---- static PyMethodDef CarbonEvents_methods[] = { {"GetCurrentEventLoop", (PyCFunction)CarbonEvents_GetCurrentEventLoop, 1, ! PyDoc_STR("() -> (EventLoopRef _rv)")}, {"GetMainEventLoop", (PyCFunction)CarbonEvents_GetMainEventLoop, 1, ! PyDoc_STR("() -> (EventLoopRef _rv)")}, {"RunCurrentEventLoop", (PyCFunction)CarbonEvents_RunCurrentEventLoop, 1, ! PyDoc_STR("(double inTimeout) -> None")}, {"ReceiveNextEvent", (PyCFunction)CarbonEvents_ReceiveNextEvent, 1, ! PyDoc_STR("(UInt32 inNumTypes, EventTypeSpec inList, double inTimeout, Boolean inPullEvent) -> (EventRef outEvent)")}, {"GetCurrentEventQueue", (PyCFunction)CarbonEvents_GetCurrentEventQueue, 1, ! PyDoc_STR("() -> (EventQueueRef _rv)")}, {"GetMainEventQueue", (PyCFunction)CarbonEvents_GetMainEventQueue, 1, ! PyDoc_STR("() -> (EventQueueRef _rv)")}, {"GetCurrentEventTime", (PyCFunction)CarbonEvents_GetCurrentEventTime, 1, ! PyDoc_STR("() -> (double _rv)")}, {"TrackMouseLocation", (PyCFunction)CarbonEvents_TrackMouseLocation, 1, ! PyDoc_STR("(GrafPtr inPort) -> (Point outPt, UInt16 outResult)")}, {"TrackMouseLocationWithOptions", (PyCFunction)CarbonEvents_TrackMouseLocationWithOptions, 1, ! PyDoc_STR("(GrafPtr inPort, OptionBits inOptions, double inTimeout) -> (Point outPt, UInt32 outModifiers, UInt16 outResult)")}, {"TrackMouseRegion", (PyCFunction)CarbonEvents_TrackMouseRegion, 1, ! PyDoc_STR("(GrafPtr inPort, RgnHandle inRegion, Boolean ioWasInRgn) -> (Boolean ioWasInRgn, UInt16 outResult)")}, {"GetLastUserEventTime", (PyCFunction)CarbonEvents_GetLastUserEventTime, 1, ! PyDoc_STR("() -> (double _rv)")}, {"GetWindowEventTarget", (PyCFunction)CarbonEvents_GetWindowEventTarget, 1, ! PyDoc_STR("(WindowPtr inWindow) -> (EventTargetRef _rv)")}, {"GetControlEventTarget", (PyCFunction)CarbonEvents_GetControlEventTarget, 1, ! PyDoc_STR("(ControlHandle inControl) -> (EventTargetRef _rv)")}, {"GetMenuEventTarget", (PyCFunction)CarbonEvents_GetMenuEventTarget, 1, ! PyDoc_STR("(MenuHandle inMenu) -> (EventTargetRef _rv)")}, {"GetApplicationEventTarget", (PyCFunction)CarbonEvents_GetApplicationEventTarget, 1, ! PyDoc_STR("() -> (EventTargetRef _rv)")}, {"GetUserFocusEventTarget", (PyCFunction)CarbonEvents_GetUserFocusEventTarget, 1, ! PyDoc_STR("() -> (EventTargetRef _rv)")}, {"GetEventDispatcherTarget", (PyCFunction)CarbonEvents_GetEventDispatcherTarget, 1, ! PyDoc_STR("() -> (EventTargetRef _rv)")}, {"QuitApplicationEventLoop", (PyCFunction)CarbonEvents_QuitApplicationEventLoop, 1, ! PyDoc_STR("() -> None")}, {"RunAppModalLoopForWindow", (PyCFunction)CarbonEvents_RunAppModalLoopForWindow, 1, ! PyDoc_STR("(WindowPtr inWindow) -> None")}, {"QuitAppModalLoopForWindow", (PyCFunction)CarbonEvents_QuitAppModalLoopForWindow, 1, ! PyDoc_STR("(WindowPtr inWindow) -> None")}, {"BeginAppModalStateForWindow", (PyCFunction)CarbonEvents_BeginAppModalStateForWindow, 1, ! PyDoc_STR("(WindowPtr inWindow) -> None")}, {"EndAppModalStateForWindow", (PyCFunction)CarbonEvents_EndAppModalStateForWindow, 1, ! PyDoc_STR("(WindowPtr inWindow) -> None")}, {"SetUserFocusWindow", (PyCFunction)CarbonEvents_SetUserFocusWindow, 1, ! PyDoc_STR("(WindowPtr inWindow) -> None")}, {"GetUserFocusWindow", (PyCFunction)CarbonEvents_GetUserFocusWindow, 1, ! PyDoc_STR("() -> (WindowPtr _rv)")}, {"SetWindowDefaultButton", (PyCFunction)CarbonEvents_SetWindowDefaultButton, 1, ! PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl) -> None")}, {"SetWindowCancelButton", (PyCFunction)CarbonEvents_SetWindowCancelButton, 1, ! PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl) -> None")}, {"GetWindowDefaultButton", (PyCFunction)CarbonEvents_GetWindowDefaultButton, 1, ! PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, {"GetWindowCancelButton", (PyCFunction)CarbonEvents_GetWindowCancelButton, 1, ! PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, {"RegisterEventHotKey", (PyCFunction)CarbonEvents_RegisterEventHotKey, 1, ! PyDoc_STR("(UInt32 inHotKeyCode, UInt32 inHotKeyModifiers, EventHotKeyID inHotKeyID, EventTargetRef inTarget, OptionBits inOptions) -> (EventHotKeyRef outRef)")}, {"RunApplicationEventLoop", (PyCFunction)CarbonEvents_RunApplicationEventLoop, 1, ! PyDoc_STR("() -> ()")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:53 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:53 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv18405/ctl Modified Files: _Ctlmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** _Ctlmodule.c 17 Jul 2002 16:30:34 -0000 1.18 --- _Ctlmodule.c 16 Aug 2002 09:09:19 -0000 1.19 *************** *** 3881,4543 **** static PyMethodDef CtlObj_methods[] = { {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1, ! "(ControlPartCode hiliteState) -> None"}, {"ShowControl", (PyCFunction)CtlObj_ShowControl, 1, ! "() -> None"}, {"HideControl", (PyCFunction)CtlObj_HideControl, 1, ! "() -> None"}, {"IsControlActive", (PyCFunction)CtlObj_IsControlActive, 1, ! "() -> (Boolean _rv)"}, {"IsControlVisible", (PyCFunction)CtlObj_IsControlVisible, 1, [...1738 lines suppressed...] #if TARGET_API_MAC_CARBON {"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1, ! PyDoc_STR("(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)")}, #endif #if TARGET_API_MAC_OSX {"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1, ! PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)")}, #endif {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1, ! PyDoc_STR("(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)")}, {"as_Control", (PyCFunction)Ctl_as_Control, 1, ! PyDoc_STR("(Handle h) -> (ControlHandle _rv)")}, #if TARGET_API_MAC_CARBON {"CreateTabsControl", (PyCFunction)Ctl_CreateTabsControl, 1, ! PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 size, UInt16 direction, ControlTabEntry tabArray) -> (ControlHandle outControl)")}, #endif {NULL, NULL, 0} From jackjansen@users.sourceforge.net Fri Aug 16 10:09:52 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg _CGmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory usw-pr-cvs1:/tmp/cvs-serv18405/cg Modified Files: _CGmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _CGmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/_CGmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _CGmodule.c 23 Apr 2002 22:45:33 -0000 1.6 --- _CGmodule.c 16 Aug 2002 09:09:19 -0000 1.7 *************** *** 1149,1267 **** static PyMethodDef CGContextRefObj_methods[] = { {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1, ! "() -> None"}, {"CGContextRestoreGState", (PyCFunction)CGContextRefObj_CGContextRestoreGState, 1, ! "() -> None"}, {"CGContextScaleCTM", (PyCFunction)CGContextRefObj_CGContextScaleCTM, 1, ! "(float sx, float sy) -> None"}, {"CGContextTranslateCTM", (PyCFunction)CGContextRefObj_CGContextTranslateCTM, 1, ! "(float tx, float ty) -> None"}, {"CGContextRotateCTM", (PyCFunction)CGContextRefObj_CGContextRotateCTM, 1, ! "(float angle) -> None"}, {"CGContextConcatCTM", (PyCFunction)CGContextRefObj_CGContextConcatCTM, 1, ! "(CGAffineTransform transform) -> None"}, {"CGContextGetCTM", (PyCFunction)CGContextRefObj_CGContextGetCTM, 1, ! "() -> (CGAffineTransform _rv)"}, {"CGContextSetLineWidth", (PyCFunction)CGContextRefObj_CGContextSetLineWidth, 1, ! "(float width) -> None"}, {"CGContextSetLineCap", (PyCFunction)CGContextRefObj_CGContextSetLineCap, 1, ! "(int cap) -> None"}, {"CGContextSetLineJoin", (PyCFunction)CGContextRefObj_CGContextSetLineJoin, 1, ! "(int join) -> None"}, {"CGContextSetMiterLimit", (PyCFunction)CGContextRefObj_CGContextSetMiterLimit, 1, ! "(float limit) -> None"}, {"CGContextSetFlatness", (PyCFunction)CGContextRefObj_CGContextSetFlatness, 1, ! "(float flatness) -> None"}, {"CGContextSetAlpha", (PyCFunction)CGContextRefObj_CGContextSetAlpha, 1, ! "(float alpha) -> None"}, {"CGContextBeginPath", (PyCFunction)CGContextRefObj_CGContextBeginPath, 1, ! "() -> None"}, {"CGContextMoveToPoint", (PyCFunction)CGContextRefObj_CGContextMoveToPoint, 1, ! "(float x, float y) -> None"}, {"CGContextAddLineToPoint", (PyCFunction)CGContextRefObj_CGContextAddLineToPoint, 1, ! "(float x, float y) -> None"}, {"CGContextAddCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddCurveToPoint, 1, ! "(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y) -> None"}, {"CGContextAddQuadCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddQuadCurveToPoint, 1, ! "(float cpx, float cpy, float x, float y) -> None"}, {"CGContextClosePath", (PyCFunction)CGContextRefObj_CGContextClosePath, 1, ! "() -> None"}, {"CGContextAddRect", (PyCFunction)CGContextRefObj_CGContextAddRect, 1, ! "(CGRect rect) -> None"}, {"CGContextAddArc", (PyCFunction)CGContextRefObj_CGContextAddArc, 1, ! "(float x, float y, float radius, float startAngle, float endAngle, int clockwise) -> None"}, {"CGContextAddArcToPoint", (PyCFunction)CGContextRefObj_CGContextAddArcToPoint, 1, ! "(float x1, float y1, float x2, float y2, float radius) -> None"}, {"CGContextIsPathEmpty", (PyCFunction)CGContextRefObj_CGContextIsPathEmpty, 1, ! "() -> (int _rv)"}, {"CGContextGetPathCurrentPoint", (PyCFunction)CGContextRefObj_CGContextGetPathCurrentPoint, 1, ! "() -> (CGPoint _rv)"}, {"CGContextGetPathBoundingBox", (PyCFunction)CGContextRefObj_CGContextGetPathBoundingBox, 1, ! "() -> (CGRect _rv)"}, {"CGContextDrawPath", (PyCFunction)CGContextRefObj_CGContextDrawPath, 1, ! "(int mode) -> None"}, {"CGContextFillPath", (PyCFunction)CGContextRefObj_CGContextFillPath, 1, ! "() -> None"}, {"CGContextEOFillPath", (PyCFunction)CGContextRefObj_CGContextEOFillPath, 1, ! "() -> None"}, {"CGContextStrokePath", (PyCFunction)CGContextRefObj_CGContextStrokePath, 1, ! "() -> None"}, {"CGContextFillRect", (PyCFunction)CGContextRefObj_CGContextFillRect, 1, ! "(CGRect rect) -> None"}, {"CGContextStrokeRect", (PyCFunction)CGContextRefObj_CGContextStrokeRect, 1, ! "(CGRect rect) -> None"}, {"CGContextStrokeRectWithWidth", (PyCFunction)CGContextRefObj_CGContextStrokeRectWithWidth, 1, ! "(CGRect rect, float width) -> None"}, {"CGContextClearRect", (PyCFunction)CGContextRefObj_CGContextClearRect, 1, ! "(CGRect rect) -> None"}, {"CGContextClip", (PyCFunction)CGContextRefObj_CGContextClip, 1, ! "() -> None"}, {"CGContextEOClip", (PyCFunction)CGContextRefObj_CGContextEOClip, 1, ! "() -> None"}, {"CGContextClipToRect", (PyCFunction)CGContextRefObj_CGContextClipToRect, 1, ! "(CGRect rect) -> None"}, {"CGContextSetGrayFillColor", (PyCFunction)CGContextRefObj_CGContextSetGrayFillColor, 1, ! "(float gray, float alpha) -> None"}, {"CGContextSetGrayStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetGrayStrokeColor, 1, ! "(float gray, float alpha) -> None"}, {"CGContextSetRGBFillColor", (PyCFunction)CGContextRefObj_CGContextSetRGBFillColor, 1, ! "(float r, float g, float b, float alpha) -> None"}, {"CGContextSetRGBStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetRGBStrokeColor, 1, ! "(float r, float g, float b, float alpha) -> None"}, {"CGContextSetCMYKFillColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKFillColor, 1, ! "(float c, float m, float y, float k, float alpha) -> None"}, {"CGContextSetCMYKStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKStrokeColor, 1, ! "(float c, float m, float y, float k, float alpha) -> None"}, {"CGContextSetCharacterSpacing", (PyCFunction)CGContextRefObj_CGContextSetCharacterSpacing, 1, ! "(float spacing) -> None"}, {"CGContextSetTextPosition", (PyCFunction)CGContextRefObj_CGContextSetTextPosition, 1, ! "(float x, float y) -> None"}, {"CGContextGetTextPosition", (PyCFunction)CGContextRefObj_CGContextGetTextPosition, 1, ! "() -> (CGPoint _rv)"}, {"CGContextSetTextMatrix", (PyCFunction)CGContextRefObj_CGContextSetTextMatrix, 1, ! "(CGAffineTransform transform) -> None"}, {"CGContextGetTextMatrix", (PyCFunction)CGContextRefObj_CGContextGetTextMatrix, 1, ! "() -> (CGAffineTransform _rv)"}, {"CGContextSetTextDrawingMode", (PyCFunction)CGContextRefObj_CGContextSetTextDrawingMode, 1, ! "(int mode) -> None"}, {"CGContextSetFontSize", (PyCFunction)CGContextRefObj_CGContextSetFontSize, 1, ! "(float size) -> None"}, {"CGContextSelectFont", (PyCFunction)CGContextRefObj_CGContextSelectFont, 1, ! "(char * name, float size, int textEncoding) -> None"}, {"CGContextShowText", (PyCFunction)CGContextRefObj_CGContextShowText, 1, ! "(Buffer cstring) -> None"}, {"CGContextShowTextAtPoint", (PyCFunction)CGContextRefObj_CGContextShowTextAtPoint, 1, ! "(float x, float y, Buffer cstring) -> None"}, {"CGContextEndPage", (PyCFunction)CGContextRefObj_CGContextEndPage, 1, ! "() -> None"}, {"CGContextFlush", (PyCFunction)CGContextRefObj_CGContextFlush, 1, ! "() -> None"}, {"CGContextSynchronize", (PyCFunction)CGContextRefObj_CGContextSynchronize, 1, ! "() -> None"}, {"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1, ! "(int shouldAntialias) -> None"}, {"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1, ! "(CGrafPtr port) -> None"}, {"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1, ! "(Rect portRect, RgnHandle region) -> None"}, {NULL, NULL, 0} }; --- 1149,1267 ---- static PyMethodDef CGContextRefObj_methods[] = { {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1, ! PyDoc_STR("() -> None")}, {"CGContextRestoreGState", (PyCFunction)CGContextRefObj_CGContextRestoreGState, 1, ! PyDoc_STR("() -> None")}, {"CGContextScaleCTM", (PyCFunction)CGContextRefObj_CGContextScaleCTM, 1, ! PyDoc_STR("(float sx, float sy) -> None")}, {"CGContextTranslateCTM", (PyCFunction)CGContextRefObj_CGContextTranslateCTM, 1, ! PyDoc_STR("(float tx, float ty) -> None")}, {"CGContextRotateCTM", (PyCFunction)CGContextRefObj_CGContextRotateCTM, 1, ! PyDoc_STR("(float angle) -> None")}, {"CGContextConcatCTM", (PyCFunction)CGContextRefObj_CGContextConcatCTM, 1, ! PyDoc_STR("(CGAffineTransform transform) -> None")}, {"CGContextGetCTM", (PyCFunction)CGContextRefObj_CGContextGetCTM, 1, ! PyDoc_STR("() -> (CGAffineTransform _rv)")}, {"CGContextSetLineWidth", (PyCFunction)CGContextRefObj_CGContextSetLineWidth, 1, ! PyDoc_STR("(float width) -> None")}, {"CGContextSetLineCap", (PyCFunction)CGContextRefObj_CGContextSetLineCap, 1, ! PyDoc_STR("(int cap) -> None")}, {"CGContextSetLineJoin", (PyCFunction)CGContextRefObj_CGContextSetLineJoin, 1, ! PyDoc_STR("(int join) -> None")}, {"CGContextSetMiterLimit", (PyCFunction)CGContextRefObj_CGContextSetMiterLimit, 1, ! PyDoc_STR("(float limit) -> None")}, {"CGContextSetFlatness", (PyCFunction)CGContextRefObj_CGContextSetFlatness, 1, ! PyDoc_STR("(float flatness) -> None")}, {"CGContextSetAlpha", (PyCFunction)CGContextRefObj_CGContextSetAlpha, 1, ! PyDoc_STR("(float alpha) -> None")}, {"CGContextBeginPath", (PyCFunction)CGContextRefObj_CGContextBeginPath, 1, ! PyDoc_STR("() -> None")}, {"CGContextMoveToPoint", (PyCFunction)CGContextRefObj_CGContextMoveToPoint, 1, ! PyDoc_STR("(float x, float y) -> None")}, {"CGContextAddLineToPoint", (PyCFunction)CGContextRefObj_CGContextAddLineToPoint, 1, ! PyDoc_STR("(float x, float y) -> None")}, {"CGContextAddCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddCurveToPoint, 1, ! PyDoc_STR("(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y) -> None")}, {"CGContextAddQuadCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddQuadCurveToPoint, 1, ! PyDoc_STR("(float cpx, float cpy, float x, float y) -> None")}, {"CGContextClosePath", (PyCFunction)CGContextRefObj_CGContextClosePath, 1, ! PyDoc_STR("() -> None")}, {"CGContextAddRect", (PyCFunction)CGContextRefObj_CGContextAddRect, 1, ! PyDoc_STR("(CGRect rect) -> None")}, {"CGContextAddArc", (PyCFunction)CGContextRefObj_CGContextAddArc, 1, ! PyDoc_STR("(float x, float y, float radius, float startAngle, float endAngle, int clockwise) -> None")}, {"CGContextAddArcToPoint", (PyCFunction)CGContextRefObj_CGContextAddArcToPoint, 1, ! PyDoc_STR("(float x1, float y1, float x2, float y2, float radius) -> None")}, {"CGContextIsPathEmpty", (PyCFunction)CGContextRefObj_CGContextIsPathEmpty, 1, ! PyDoc_STR("() -> (int _rv)")}, {"CGContextGetPathCurrentPoint", (PyCFunction)CGContextRefObj_CGContextGetPathCurrentPoint, 1, ! PyDoc_STR("() -> (CGPoint _rv)")}, {"CGContextGetPathBoundingBox", (PyCFunction)CGContextRefObj_CGContextGetPathBoundingBox, 1, ! PyDoc_STR("() -> (CGRect _rv)")}, {"CGContextDrawPath", (PyCFunction)CGContextRefObj_CGContextDrawPath, 1, ! PyDoc_STR("(int mode) -> None")}, {"CGContextFillPath", (PyCFunction)CGContextRefObj_CGContextFillPath, 1, ! PyDoc_STR("() -> None")}, {"CGContextEOFillPath", (PyCFunction)CGContextRefObj_CGContextEOFillPath, 1, ! PyDoc_STR("() -> None")}, {"CGContextStrokePath", (PyCFunction)CGContextRefObj_CGContextStrokePath, 1, ! PyDoc_STR("() -> None")}, {"CGContextFillRect", (PyCFunction)CGContextRefObj_CGContextFillRect, 1, ! PyDoc_STR("(CGRect rect) -> None")}, {"CGContextStrokeRect", (PyCFunction)CGContextRefObj_CGContextStrokeRect, 1, ! PyDoc_STR("(CGRect rect) -> None")}, {"CGContextStrokeRectWithWidth", (PyCFunction)CGContextRefObj_CGContextStrokeRectWithWidth, 1, ! PyDoc_STR("(CGRect rect, float width) -> None")}, {"CGContextClearRect", (PyCFunction)CGContextRefObj_CGContextClearRect, 1, ! PyDoc_STR("(CGRect rect) -> None")}, {"CGContextClip", (PyCFunction)CGContextRefObj_CGContextClip, 1, ! PyDoc_STR("() -> None")}, {"CGContextEOClip", (PyCFunction)CGContextRefObj_CGContextEOClip, 1, ! PyDoc_STR("() -> None")}, {"CGContextClipToRect", (PyCFunction)CGContextRefObj_CGContextClipToRect, 1, ! PyDoc_STR("(CGRect rect) -> None")}, {"CGContextSetGrayFillColor", (PyCFunction)CGContextRefObj_CGContextSetGrayFillColor, 1, ! PyDoc_STR("(float gray, float alpha) -> None")}, {"CGContextSetGrayStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetGrayStrokeColor, 1, ! PyDoc_STR("(float gray, float alpha) -> None")}, {"CGContextSetRGBFillColor", (PyCFunction)CGContextRefObj_CGContextSetRGBFillColor, 1, ! PyDoc_STR("(float r, float g, float b, float alpha) -> None")}, {"CGContextSetRGBStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetRGBStrokeColor, 1, ! PyDoc_STR("(float r, float g, float b, float alpha) -> None")}, {"CGContextSetCMYKFillColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKFillColor, 1, ! PyDoc_STR("(float c, float m, float y, float k, float alpha) -> None")}, {"CGContextSetCMYKStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKStrokeColor, 1, ! PyDoc_STR("(float c, float m, float y, float k, float alpha) -> None")}, {"CGContextSetCharacterSpacing", (PyCFunction)CGContextRefObj_CGContextSetCharacterSpacing, 1, ! PyDoc_STR("(float spacing) -> None")}, {"CGContextSetTextPosition", (PyCFunction)CGContextRefObj_CGContextSetTextPosition, 1, ! PyDoc_STR("(float x, float y) -> None")}, {"CGContextGetTextPosition", (PyCFunction)CGContextRefObj_CGContextGetTextPosition, 1, ! PyDoc_STR("() -> (CGPoint _rv)")}, {"CGContextSetTextMatrix", (PyCFunction)CGContextRefObj_CGContextSetTextMatrix, 1, ! PyDoc_STR("(CGAffineTransform transform) -> None")}, {"CGContextGetTextMatrix", (PyCFunction)CGContextRefObj_CGContextGetTextMatrix, 1, ! PyDoc_STR("() -> (CGAffineTransform _rv)")}, {"CGContextSetTextDrawingMode", (PyCFunction)CGContextRefObj_CGContextSetTextDrawingMode, 1, ! PyDoc_STR("(int mode) -> None")}, {"CGContextSetFontSize", (PyCFunction)CGContextRefObj_CGContextSetFontSize, 1, ! PyDoc_STR("(float size) -> None")}, {"CGContextSelectFont", (PyCFunction)CGContextRefObj_CGContextSelectFont, 1, ! PyDoc_STR("(char * name, float size, int textEncoding) -> None")}, {"CGContextShowText", (PyCFunction)CGContextRefObj_CGContextShowText, 1, ! PyDoc_STR("(Buffer cstring) -> None")}, {"CGContextShowTextAtPoint", (PyCFunction)CGContextRefObj_CGContextShowTextAtPoint, 1, ! PyDoc_STR("(float x, float y, Buffer cstring) -> None")}, {"CGContextEndPage", (PyCFunction)CGContextRefObj_CGContextEndPage, 1, ! PyDoc_STR("() -> None")}, {"CGContextFlush", (PyCFunction)CGContextRefObj_CGContextFlush, 1, ! PyDoc_STR("() -> None")}, {"CGContextSynchronize", (PyCFunction)CGContextRefObj_CGContextSynchronize, 1, ! PyDoc_STR("() -> None")}, {"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1, ! PyDoc_STR("(int shouldAntialias) -> None")}, {"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1, ! PyDoc_STR("(CGrafPtr port) -> None")}, {"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1, ! PyDoc_STR("(Rect portRect, RgnHandle region) -> None")}, {NULL, NULL, 0} }; *************** *** 1324,1328 **** static PyMethodDef CG_methods[] = { {"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1, ! "(CGrafPtr) -> CGContextRef"}, {NULL, NULL, 0} }; --- 1324,1328 ---- static PyMethodDef CG_methods[] = { {"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1, ! PyDoc_STR("(CGrafPtr) -> CGContextRef")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:54 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cm _Cmmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv18405/cm Modified Files: _Cmmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Cmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/_Cmmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Cmmodule.c 23 Apr 2002 22:45:25 -0000 1.9 --- _Cmmodule.c 16 Aug 2002 09:09:19 -0000 1.10 *************** *** 278,306 **** static PyMethodDef CmpInstObj_methods[] = { {"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1, ! "() -> None"}, {"GetComponentInstanceError", (PyCFunction)CmpInstObj_GetComponentInstanceError, 1, ! "() -> None"}, {"SetComponentInstanceError", (PyCFunction)CmpInstObj_SetComponentInstanceError, 1, ! "(OSErr theError) -> None"}, {"GetComponentInstanceStorage", (PyCFunction)CmpInstObj_GetComponentInstanceStorage, 1, ! "() -> (Handle _rv)"}, {"SetComponentInstanceStorage", (PyCFunction)CmpInstObj_SetComponentInstanceStorage, 1, ! "(Handle theStorage) -> None"}, #if !TARGET_API_MAC_CARBON {"GetComponentInstanceA5", (PyCFunction)CmpInstObj_GetComponentInstanceA5, 1, ! "() -> (long _rv)"}, #endif #if !TARGET_API_MAC_CARBON {"SetComponentInstanceA5", (PyCFunction)CmpInstObj_SetComponentInstanceA5, 1, ! "(long theA5) -> None"}, #endif {"ComponentFunctionImplemented", (PyCFunction)CmpInstObj_ComponentFunctionImplemented, 1, ! "(short ftnNumber) -> (long _rv)"}, {"GetComponentVersion", (PyCFunction)CmpInstObj_GetComponentVersion, 1, ! "() -> (long _rv)"}, {"ComponentSetTarget", (PyCFunction)CmpInstObj_ComponentSetTarget, 1, ! "(ComponentInstance target) -> (long _rv)"}, {NULL, NULL, 0} }; --- 278,306 ---- static PyMethodDef CmpInstObj_methods[] = { {"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1, ! PyDoc_STR("() -> None")}, {"GetComponentInstanceError", (PyCFunction)CmpInstObj_GetComponentInstanceError, 1, ! PyDoc_STR("() -> None")}, {"SetComponentInstanceError", (PyCFunction)CmpInstObj_SetComponentInstanceError, 1, ! PyDoc_STR("(OSErr theError) -> None")}, {"GetComponentInstanceStorage", (PyCFunction)CmpInstObj_GetComponentInstanceStorage, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {"SetComponentInstanceStorage", (PyCFunction)CmpInstObj_SetComponentInstanceStorage, 1, ! PyDoc_STR("(Handle theStorage) -> None")}, #if !TARGET_API_MAC_CARBON {"GetComponentInstanceA5", (PyCFunction)CmpInstObj_GetComponentInstanceA5, 1, ! PyDoc_STR("() -> (long _rv)")}, #endif #if !TARGET_API_MAC_CARBON {"SetComponentInstanceA5", (PyCFunction)CmpInstObj_SetComponentInstanceA5, 1, ! PyDoc_STR("(long theA5) -> None")}, #endif {"ComponentFunctionImplemented", (PyCFunction)CmpInstObj_ComponentFunctionImplemented, 1, ! PyDoc_STR("(short ftnNumber) -> (long _rv)")}, {"GetComponentVersion", (PyCFunction)CmpInstObj_GetComponentVersion, 1, ! PyDoc_STR("() -> (long _rv)")}, {"ComponentSetTarget", (PyCFunction)CmpInstObj_ComponentSetTarget, 1, ! PyDoc_STR("(ComponentInstance target) -> (long _rv)")}, {NULL, NULL, 0} }; *************** *** 670,702 **** static PyMethodDef CmpObj_methods[] = { {"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1, ! "() -> None"}, {"GetComponentInfo", (PyCFunction)CmpObj_GetComponentInfo, 1, ! "(Handle componentName, Handle componentInfo, Handle componentIcon) -> (ComponentDescription cd)"}, {"OpenComponent", (PyCFunction)CmpObj_OpenComponent, 1, ! "() -> (ComponentInstance _rv)"}, {"ResolveComponentAlias", (PyCFunction)CmpObj_ResolveComponentAlias, 1, ! "() -> (Component _rv)"}, {"GetComponentPublicIndString", (PyCFunction)CmpObj_GetComponentPublicIndString, 1, ! "(Str255 theString, short strListID, short index) -> None"}, {"GetComponentRefcon", (PyCFunction)CmpObj_GetComponentRefcon, 1, ! "() -> (long _rv)"}, {"SetComponentRefcon", (PyCFunction)CmpObj_SetComponentRefcon, 1, ! "(long theRefcon) -> None"}, {"OpenComponentResFile", (PyCFunction)CmpObj_OpenComponentResFile, 1, ! "() -> (short _rv)"}, {"GetComponentResource", (PyCFunction)CmpObj_GetComponentResource, 1, ! "(OSType resType, short resID) -> (Handle theResource)"}, {"GetComponentIndString", (PyCFunction)CmpObj_GetComponentIndString, 1, ! "(Str255 theString, short strListID, short index) -> None"}, {"CountComponentInstances", (PyCFunction)CmpObj_CountComponentInstances, 1, ! "() -> (long _rv)"}, {"SetDefaultComponent", (PyCFunction)CmpObj_SetDefaultComponent, 1, ! "(short flags) -> None"}, {"CaptureComponent", (PyCFunction)CmpObj_CaptureComponent, 1, ! "(Component capturingComponent) -> (Component _rv)"}, {"UncaptureComponent", (PyCFunction)CmpObj_UncaptureComponent, 1, ! "() -> None"}, {"GetComponentIconSuite", (PyCFunction)CmpObj_GetComponentIconSuite, 1, ! "() -> (Handle iconSuite)"}, {NULL, NULL, 0} }; --- 670,702 ---- static PyMethodDef CmpObj_methods[] = { {"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1, ! PyDoc_STR("() -> None")}, {"GetComponentInfo", (PyCFunction)CmpObj_GetComponentInfo, 1, ! PyDoc_STR("(Handle componentName, Handle componentInfo, Handle componentIcon) -> (ComponentDescription cd)")}, {"OpenComponent", (PyCFunction)CmpObj_OpenComponent, 1, ! PyDoc_STR("() -> (ComponentInstance _rv)")}, {"ResolveComponentAlias", (PyCFunction)CmpObj_ResolveComponentAlias, 1, ! PyDoc_STR("() -> (Component _rv)")}, {"GetComponentPublicIndString", (PyCFunction)CmpObj_GetComponentPublicIndString, 1, ! PyDoc_STR("(Str255 theString, short strListID, short index) -> None")}, {"GetComponentRefcon", (PyCFunction)CmpObj_GetComponentRefcon, 1, ! PyDoc_STR("() -> (long _rv)")}, {"SetComponentRefcon", (PyCFunction)CmpObj_SetComponentRefcon, 1, ! PyDoc_STR("(long theRefcon) -> None")}, {"OpenComponentResFile", (PyCFunction)CmpObj_OpenComponentResFile, 1, ! PyDoc_STR("() -> (short _rv)")}, {"GetComponentResource", (PyCFunction)CmpObj_GetComponentResource, 1, ! PyDoc_STR("(OSType resType, short resID) -> (Handle theResource)")}, {"GetComponentIndString", (PyCFunction)CmpObj_GetComponentIndString, 1, ! PyDoc_STR("(Str255 theString, short strListID, short index) -> None")}, {"CountComponentInstances", (PyCFunction)CmpObj_CountComponentInstances, 1, ! PyDoc_STR("() -> (long _rv)")}, {"SetDefaultComponent", (PyCFunction)CmpObj_SetDefaultComponent, 1, ! PyDoc_STR("(short flags) -> None")}, {"CaptureComponent", (PyCFunction)CmpObj_CaptureComponent, 1, ! PyDoc_STR("(Component capturingComponent) -> (Component _rv)")}, {"UncaptureComponent", (PyCFunction)CmpObj_UncaptureComponent, 1, ! PyDoc_STR("() -> None")}, {"GetComponentIconSuite", (PyCFunction)CmpObj_GetComponentIconSuite, 1, ! PyDoc_STR("() -> (Handle iconSuite)")}, {NULL, NULL, 0} }; *************** *** 871,887 **** static PyMethodDef Cm_methods[] = { {"RegisterComponentResource", (PyCFunction)Cm_RegisterComponentResource, 1, ! "(ComponentResourceHandle cr, short global) -> (Component _rv)"}, {"FindNextComponent", (PyCFunction)Cm_FindNextComponent, 1, ! "(Component aComponent, ComponentDescription looking) -> (Component _rv)"}, {"CountComponents", (PyCFunction)Cm_CountComponents, 1, ! "(ComponentDescription looking) -> (long _rv)"}, {"GetComponentListModSeed", (PyCFunction)Cm_GetComponentListModSeed, 1, ! "() -> (long _rv)"}, {"CloseComponentResFile", (PyCFunction)Cm_CloseComponentResFile, 1, ! "(short refnum) -> None"}, {"OpenDefaultComponent", (PyCFunction)Cm_OpenDefaultComponent, 1, ! "(OSType componentType, OSType componentSubType) -> (ComponentInstance _rv)"}, {"RegisterComponentResourceFile", (PyCFunction)Cm_RegisterComponentResourceFile, 1, ! "(short resRefNum, short global) -> (long _rv)"}, {NULL, NULL, 0} }; --- 871,887 ---- static PyMethodDef Cm_methods[] = { {"RegisterComponentResource", (PyCFunction)Cm_RegisterComponentResource, 1, ! PyDoc_STR("(ComponentResourceHandle cr, short global) -> (Component _rv)")}, {"FindNextComponent", (PyCFunction)Cm_FindNextComponent, 1, ! PyDoc_STR("(Component aComponent, ComponentDescription looking) -> (Component _rv)")}, {"CountComponents", (PyCFunction)Cm_CountComponents, 1, ! PyDoc_STR("(ComponentDescription looking) -> (long _rv)")}, {"GetComponentListModSeed", (PyCFunction)Cm_GetComponentListModSeed, 1, ! PyDoc_STR("() -> (long _rv)")}, {"CloseComponentResFile", (PyCFunction)Cm_CloseComponentResFile, 1, ! PyDoc_STR("(short refnum) -> None")}, {"OpenDefaultComponent", (PyCFunction)Cm_OpenDefaultComponent, 1, ! PyDoc_STR("(OSType componentType, OSType componentSubType) -> (ComponentInstance _rv)")}, {"RegisterComponentResourceFile", (PyCFunction)Cm_RegisterComponentResourceFile, 1, ! PyDoc_STR("(short resRefNum, short global) -> (long _rv)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:52 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory usw-pr-cvs1:/tmp/cvs-serv18405/cf Modified Files: _CFmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** _CFmodule.c 13 May 2002 21:21:38 -0000 1.15 --- _CFmodule.c 16 Aug 2002 09:09:16 -0000 1.16 *************** *** 361,387 **** static PyMethodDef CFTypeRefObj_methods[] = { {"CFGetTypeID", (PyCFunction)CFTypeRefObj_CFGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFRetain", (PyCFunction)CFTypeRefObj_CFRetain, 1, ! "() -> (CFTypeRef _rv)"}, {"CFRelease", (PyCFunction)CFTypeRefObj_CFRelease, 1, ! "() -> None"}, {"CFGetRetainCount", (PyCFunction)CFTypeRefObj_CFGetRetainCount, 1, ! "() -> (CFIndex _rv)"}, {"CFEqual", (PyCFunction)CFTypeRefObj_CFEqual, 1, ! "(CFTypeRef cf2) -> (Boolean _rv)"}, {"CFHash", (PyCFunction)CFTypeRefObj_CFHash, 1, ! "() -> (CFHashCode _rv)"}, {"CFCopyDescription", (PyCFunction)CFTypeRefObj_CFCopyDescription, 1, ! "() -> (CFStringRef _rv)"}, {"CFPropertyListCreateXMLData", (PyCFunction)CFTypeRefObj_CFPropertyListCreateXMLData, 1, ! "() -> (CFDataRef _rv)"}, {"CFPropertyListCreateDeepCopy", (PyCFunction)CFTypeRefObj_CFPropertyListCreateDeepCopy, 1, ! "(CFOptionFlags mutabilityOption) -> (CFTypeRef _rv)"}, {"CFShow", (PyCFunction)CFTypeRefObj_CFShow, 1, ! "() -> None"}, {"CFPropertyListCreateFromXMLData", (PyCFunction)CFTypeRefObj_CFPropertyListCreateFromXMLData, 1, ! "(CFOptionFlags mutabilityOption) -> (CFTypeRefObj)"}, {"toPython", (PyCFunction)CFTypeRefObj_toPython, 1, ! "() -> (python_object)"}, {NULL, NULL, 0} }; --- 361,387 ---- static PyMethodDef CFTypeRefObj_methods[] = { {"CFGetTypeID", (PyCFunction)CFTypeRefObj_CFGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFRetain", (PyCFunction)CFTypeRefObj_CFRetain, 1, ! PyDoc_STR("() -> (CFTypeRef _rv)")}, {"CFRelease", (PyCFunction)CFTypeRefObj_CFRelease, 1, ! PyDoc_STR("() -> None")}, {"CFGetRetainCount", (PyCFunction)CFTypeRefObj_CFGetRetainCount, 1, ! PyDoc_STR("() -> (CFIndex _rv)")}, {"CFEqual", (PyCFunction)CFTypeRefObj_CFEqual, 1, ! PyDoc_STR("(CFTypeRef cf2) -> (Boolean _rv)")}, {"CFHash", (PyCFunction)CFTypeRefObj_CFHash, 1, ! PyDoc_STR("() -> (CFHashCode _rv)")}, {"CFCopyDescription", (PyCFunction)CFTypeRefObj_CFCopyDescription, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFPropertyListCreateXMLData", (PyCFunction)CFTypeRefObj_CFPropertyListCreateXMLData, 1, ! PyDoc_STR("() -> (CFDataRef _rv)")}, {"CFPropertyListCreateDeepCopy", (PyCFunction)CFTypeRefObj_CFPropertyListCreateDeepCopy, 1, ! PyDoc_STR("(CFOptionFlags mutabilityOption) -> (CFTypeRef _rv)")}, {"CFShow", (PyCFunction)CFTypeRefObj_CFShow, 1, ! PyDoc_STR("() -> None")}, {"CFPropertyListCreateFromXMLData", (PyCFunction)CFTypeRefObj_CFPropertyListCreateFromXMLData, 1, ! PyDoc_STR("(CFOptionFlags mutabilityOption) -> (CFTypeRefObj)")}, {"toPython", (PyCFunction)CFTypeRefObj_toPython, 1, ! PyDoc_STR("() -> (python_object)")}, {NULL, NULL, 0} }; *************** *** 535,543 **** static PyMethodDef CFArrayRefObj_methods[] = { {"CFArrayCreateCopy", (PyCFunction)CFArrayRefObj_CFArrayCreateCopy, 1, ! "() -> (CFArrayRef _rv)"}, {"CFArrayGetCount", (PyCFunction)CFArrayRefObj_CFArrayGetCount, 1, ! "() -> (CFIndex _rv)"}, {"CFStringCreateByCombiningStrings", (PyCFunction)CFArrayRefObj_CFStringCreateByCombiningStrings, 1, ! "(CFStringRef separatorString) -> (CFStringRef _rv)"}, {NULL, NULL, 0} }; --- 535,543 ---- static PyMethodDef CFArrayRefObj_methods[] = { {"CFArrayCreateCopy", (PyCFunction)CFArrayRefObj_CFArrayCreateCopy, 1, ! PyDoc_STR("() -> (CFArrayRef _rv)")}, {"CFArrayGetCount", (PyCFunction)CFArrayRefObj_CFArrayGetCount, 1, ! PyDoc_STR("() -> (CFIndex _rv)")}, {"CFStringCreateByCombiningStrings", (PyCFunction)CFArrayRefObj_CFStringCreateByCombiningStrings, 1, ! PyDoc_STR("(CFStringRef separatorString) -> (CFStringRef _rv)")}, {NULL, NULL, 0} }; *************** *** 718,728 **** static PyMethodDef CFMutableArrayRefObj_methods[] = { {"CFArrayRemoveValueAtIndex", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveValueAtIndex, 1, ! "(CFIndex idx) -> None"}, {"CFArrayRemoveAllValues", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveAllValues, 1, ! "() -> None"}, {"CFArrayExchangeValuesAtIndices", (PyCFunction)CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices, 1, ! "(CFIndex idx1, CFIndex idx2) -> None"}, {"CFArrayAppendArray", (PyCFunction)CFMutableArrayRefObj_CFArrayAppendArray, 1, ! "(CFArrayRef otherArray, CFRange otherRange) -> None"}, {NULL, NULL, 0} }; --- 718,728 ---- static PyMethodDef CFMutableArrayRefObj_methods[] = { {"CFArrayRemoveValueAtIndex", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveValueAtIndex, 1, ! PyDoc_STR("(CFIndex idx) -> None")}, {"CFArrayRemoveAllValues", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveAllValues, 1, ! PyDoc_STR("() -> None")}, {"CFArrayExchangeValuesAtIndices", (PyCFunction)CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices, 1, ! PyDoc_STR("(CFIndex idx1, CFIndex idx2) -> None")}, {"CFArrayAppendArray", (PyCFunction)CFMutableArrayRefObj_CFArrayAppendArray, 1, ! PyDoc_STR("(CFArrayRef otherArray, CFRange otherRange) -> None")}, {NULL, NULL, 0} }; *************** *** 860,866 **** static PyMethodDef CFDictionaryRefObj_methods[] = { {"CFDictionaryCreateCopy", (PyCFunction)CFDictionaryRefObj_CFDictionaryCreateCopy, 1, ! "() -> (CFDictionaryRef _rv)"}, {"CFDictionaryGetCount", (PyCFunction)CFDictionaryRefObj_CFDictionaryGetCount, 1, ! "() -> (CFIndex _rv)"}, {NULL, NULL, 0} }; --- 860,866 ---- static PyMethodDef CFDictionaryRefObj_methods[] = { {"CFDictionaryCreateCopy", (PyCFunction)CFDictionaryRefObj_CFDictionaryCreateCopy, 1, ! PyDoc_STR("() -> (CFDictionaryRef _rv)")}, {"CFDictionaryGetCount", (PyCFunction)CFDictionaryRefObj_CFDictionaryGetCount, 1, ! PyDoc_STR("() -> (CFIndex _rv)")}, {NULL, NULL, 0} }; *************** *** 984,988 **** static PyMethodDef CFMutableDictionaryRefObj_methods[] = { {"CFDictionaryRemoveAllValues", (PyCFunction)CFMutableDictionaryRefObj_CFDictionaryRemoveAllValues, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 984,988 ---- static PyMethodDef CFMutableDictionaryRefObj_methods[] = { {"CFDictionaryRemoveAllValues", (PyCFunction)CFMutableDictionaryRefObj_CFDictionaryRemoveAllValues, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 1154,1164 **** static PyMethodDef CFDataRefObj_methods[] = { {"CFDataCreateCopy", (PyCFunction)CFDataRefObj_CFDataCreateCopy, 1, ! "() -> (CFDataRef _rv)"}, {"CFDataGetLength", (PyCFunction)CFDataRefObj_CFDataGetLength, 1, ! "() -> (CFIndex _rv)"}, {"CFStringCreateFromExternalRepresentation", (PyCFunction)CFDataRefObj_CFStringCreateFromExternalRepresentation, 1, ! "(CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFDataGetData", (PyCFunction)CFDataRefObj_CFDataGetData, 1, ! "() -> (string _rv)"}, {NULL, NULL, 0} }; --- 1154,1164 ---- static PyMethodDef CFDataRefObj_methods[] = { {"CFDataCreateCopy", (PyCFunction)CFDataRefObj_CFDataCreateCopy, 1, ! PyDoc_STR("() -> (CFDataRef _rv)")}, {"CFDataGetLength", (PyCFunction)CFDataRefObj_CFDataGetLength, 1, ! PyDoc_STR("() -> (CFIndex _rv)")}, {"CFStringCreateFromExternalRepresentation", (PyCFunction)CFDataRefObj_CFStringCreateFromExternalRepresentation, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFDataGetData", (PyCFunction)CFDataRefObj_CFDataGetData, 1, ! PyDoc_STR("() -> (string _rv)")}, {NULL, NULL, 0} }; *************** *** 1362,1374 **** static PyMethodDef CFMutableDataRefObj_methods[] = { {"CFDataSetLength", (PyCFunction)CFMutableDataRefObj_CFDataSetLength, 1, ! "(CFIndex length) -> None"}, {"CFDataIncreaseLength", (PyCFunction)CFMutableDataRefObj_CFDataIncreaseLength, 1, ! "(CFIndex extraLength) -> None"}, {"CFDataAppendBytes", (PyCFunction)CFMutableDataRefObj_CFDataAppendBytes, 1, ! "(Buffer bytes) -> None"}, {"CFDataReplaceBytes", (PyCFunction)CFMutableDataRefObj_CFDataReplaceBytes, 1, ! "(CFRange range, Buffer newBytes) -> None"}, {"CFDataDeleteBytes", (PyCFunction)CFMutableDataRefObj_CFDataDeleteBytes, 1, ! "(CFRange range) -> None"}, {NULL, NULL, 0} }; --- 1362,1374 ---- static PyMethodDef CFMutableDataRefObj_methods[] = { {"CFDataSetLength", (PyCFunction)CFMutableDataRefObj_CFDataSetLength, 1, ! PyDoc_STR("(CFIndex length) -> None")}, {"CFDataIncreaseLength", (PyCFunction)CFMutableDataRefObj_CFDataIncreaseLength, 1, ! PyDoc_STR("(CFIndex extraLength) -> None")}, {"CFDataAppendBytes", (PyCFunction)CFMutableDataRefObj_CFDataAppendBytes, 1, ! PyDoc_STR("(Buffer bytes) -> None")}, {"CFDataReplaceBytes", (PyCFunction)CFMutableDataRefObj_CFDataReplaceBytes, 1, ! PyDoc_STR("(CFRange range, Buffer newBytes) -> None")}, {"CFDataDeleteBytes", (PyCFunction)CFMutableDataRefObj_CFDataDeleteBytes, 1, ! PyDoc_STR("(CFRange range) -> None")}, {NULL, NULL, 0} }; *************** *** 2003,2059 **** static PyMethodDef CFStringRefObj_methods[] = { {"CFStringCreateWithSubstring", (PyCFunction)CFStringRefObj_CFStringCreateWithSubstring, 1, ! "(CFRange range) -> (CFStringRef _rv)"}, {"CFStringCreateCopy", (PyCFunction)CFStringRefObj_CFStringCreateCopy, 1, ! "() -> (CFStringRef _rv)"}, {"CFStringGetLength", (PyCFunction)CFStringRefObj_CFStringGetLength, 1, ! "() -> (CFIndex _rv)"}, {"CFStringGetBytes", (PyCFunction)CFStringRefObj_CFStringGetBytes, 1, ! "(CFRange range, CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, CFIndex maxBufLen) -> (CFIndex _rv, UInt8 buffer, CFIndex usedBufLen)"}, {"CFStringCreateExternalRepresentation", (PyCFunction)CFStringRefObj_CFStringCreateExternalRepresentation, 1, ! "(CFStringEncoding encoding, UInt8 lossByte) -> (CFDataRef _rv)"}, {"CFStringGetSmallestEncoding", (PyCFunction)CFStringRefObj_CFStringGetSmallestEncoding, 1, ! "() -> (CFStringEncoding _rv)"}, {"CFStringGetFastestEncoding", (PyCFunction)CFStringRefObj_CFStringGetFastestEncoding, 1, ! "() -> (CFStringEncoding _rv)"}, {"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1, ! "(CFStringRef theString2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"}, {"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1, ! "(CFStringRef theString2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"}, {"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1, ! "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)"}, {"CFStringCreateArrayWithFindResults", (PyCFunction)CFStringRefObj_CFStringCreateArrayWithFindResults, 1, ! "(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags compareOptions) -> (CFArrayRef _rv)"}, {"CFStringFind", (PyCFunction)CFStringRefObj_CFStringFind, 1, ! "(CFStringRef stringToFind, CFOptionFlags compareOptions) -> (CFRange _rv)"}, {"CFStringHasPrefix", (PyCFunction)CFStringRefObj_CFStringHasPrefix, 1, ! "(CFStringRef prefix) -> (Boolean _rv)"}, {"CFStringHasSuffix", (PyCFunction)CFStringRefObj_CFStringHasSuffix, 1, ! "(CFStringRef suffix) -> (Boolean _rv)"}, {"CFStringGetLineBounds", (PyCFunction)CFStringRefObj_CFStringGetLineBounds, 1, ! "(CFRange range) -> (CFIndex lineBeginIndex, CFIndex lineEndIndex, CFIndex contentsEndIndex)"}, {"CFStringCreateArrayBySeparatingStrings", (PyCFunction)CFStringRefObj_CFStringCreateArrayBySeparatingStrings, 1, ! "(CFStringRef separatorString) -> (CFArrayRef _rv)"}, {"CFStringGetIntValue", (PyCFunction)CFStringRefObj_CFStringGetIntValue, 1, ! "() -> (SInt32 _rv)"}, {"CFStringGetDoubleValue", (PyCFunction)CFStringRefObj_CFStringGetDoubleValue, 1, ! "() -> (double _rv)"}, {"CFStringConvertIANACharSetNameToEncoding", (PyCFunction)CFStringRefObj_CFStringConvertIANACharSetNameToEncoding, 1, ! "() -> (CFStringEncoding _rv)"}, {"CFShowStr", (PyCFunction)CFStringRefObj_CFShowStr, 1, ! "() -> None"}, {"CFURLCreateWithString", (PyCFunction)CFStringRefObj_CFURLCreateWithString, 1, ! "(CFURLRef baseURL) -> (CFURLRef _rv)"}, {"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1, ! "(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)"}, {"CFURLCreateWithFileSystemPathRelativeToBase", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase, 1, ! "(CFURLPathStyle pathStyle, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)"}, {"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1, ! "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"}, {"CFURLCreateStringByAddingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByAddingPercentEscapes, 1, ! "(CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1, ! "() -> (string _rv)"}, {"CFStringGetUnicode", (PyCFunction)CFStringRefObj_CFStringGetUnicode, 1, ! "() -> (unicode _rv)"}, {NULL, NULL, 0} }; --- 2003,2059 ---- static PyMethodDef CFStringRefObj_methods[] = { {"CFStringCreateWithSubstring", (PyCFunction)CFStringRefObj_CFStringCreateWithSubstring, 1, ! PyDoc_STR("(CFRange range) -> (CFStringRef _rv)")}, {"CFStringCreateCopy", (PyCFunction)CFStringRefObj_CFStringCreateCopy, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFStringGetLength", (PyCFunction)CFStringRefObj_CFStringGetLength, 1, ! PyDoc_STR("() -> (CFIndex _rv)")}, {"CFStringGetBytes", (PyCFunction)CFStringRefObj_CFStringGetBytes, 1, ! PyDoc_STR("(CFRange range, CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, CFIndex maxBufLen) -> (CFIndex _rv, UInt8 buffer, CFIndex usedBufLen)")}, {"CFStringCreateExternalRepresentation", (PyCFunction)CFStringRefObj_CFStringCreateExternalRepresentation, 1, ! PyDoc_STR("(CFStringEncoding encoding, UInt8 lossByte) -> (CFDataRef _rv)")}, {"CFStringGetSmallestEncoding", (PyCFunction)CFStringRefObj_CFStringGetSmallestEncoding, 1, ! PyDoc_STR("() -> (CFStringEncoding _rv)")}, {"CFStringGetFastestEncoding", (PyCFunction)CFStringRefObj_CFStringGetFastestEncoding, 1, ! PyDoc_STR("() -> (CFStringEncoding _rv)")}, {"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1, ! PyDoc_STR("(CFStringRef theString2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)")}, {"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1, ! PyDoc_STR("(CFStringRef theString2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)")}, {"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1, ! PyDoc_STR("(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)")}, {"CFStringCreateArrayWithFindResults", (PyCFunction)CFStringRefObj_CFStringCreateArrayWithFindResults, 1, ! PyDoc_STR("(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags compareOptions) -> (CFArrayRef _rv)")}, {"CFStringFind", (PyCFunction)CFStringRefObj_CFStringFind, 1, ! PyDoc_STR("(CFStringRef stringToFind, CFOptionFlags compareOptions) -> (CFRange _rv)")}, {"CFStringHasPrefix", (PyCFunction)CFStringRefObj_CFStringHasPrefix, 1, ! PyDoc_STR("(CFStringRef prefix) -> (Boolean _rv)")}, {"CFStringHasSuffix", (PyCFunction)CFStringRefObj_CFStringHasSuffix, 1, ! PyDoc_STR("(CFStringRef suffix) -> (Boolean _rv)")}, {"CFStringGetLineBounds", (PyCFunction)CFStringRefObj_CFStringGetLineBounds, 1, ! PyDoc_STR("(CFRange range) -> (CFIndex lineBeginIndex, CFIndex lineEndIndex, CFIndex contentsEndIndex)")}, {"CFStringCreateArrayBySeparatingStrings", (PyCFunction)CFStringRefObj_CFStringCreateArrayBySeparatingStrings, 1, ! PyDoc_STR("(CFStringRef separatorString) -> (CFArrayRef _rv)")}, {"CFStringGetIntValue", (PyCFunction)CFStringRefObj_CFStringGetIntValue, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"CFStringGetDoubleValue", (PyCFunction)CFStringRefObj_CFStringGetDoubleValue, 1, ! PyDoc_STR("() -> (double _rv)")}, {"CFStringConvertIANACharSetNameToEncoding", (PyCFunction)CFStringRefObj_CFStringConvertIANACharSetNameToEncoding, 1, ! PyDoc_STR("() -> (CFStringEncoding _rv)")}, {"CFShowStr", (PyCFunction)CFStringRefObj_CFShowStr, 1, ! PyDoc_STR("() -> None")}, {"CFURLCreateWithString", (PyCFunction)CFStringRefObj_CFURLCreateWithString, 1, ! PyDoc_STR("(CFURLRef baseURL) -> (CFURLRef _rv)")}, {"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1, ! PyDoc_STR("(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)")}, {"CFURLCreateWithFileSystemPathRelativeToBase", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase, 1, ! PyDoc_STR("(CFURLPathStyle pathStyle, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)")}, {"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1, ! PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")}, {"CFURLCreateStringByAddingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByAddingPercentEscapes, 1, ! PyDoc_STR("(CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1, ! PyDoc_STR("() -> (string _rv)")}, {"CFStringGetUnicode", (PyCFunction)CFStringRefObj_CFStringGetUnicode, 1, ! PyDoc_STR("() -> (unicode _rv)")}, {NULL, NULL, 0} }; *************** *** 2368,2392 **** static PyMethodDef CFMutableStringRefObj_methods[] = { {"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1, ! "(CFStringRef appendedString) -> None"}, {"CFStringAppendCharacters", (PyCFunction)CFMutableStringRefObj_CFStringAppendCharacters, 1, ! "(Buffer chars) -> None"}, {"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1, ! "(Str255 pStr, CFStringEncoding encoding) -> None"}, {"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1, ! "(char* cStr, CFStringEncoding encoding) -> None"}, {"CFStringInsert", (PyCFunction)CFMutableStringRefObj_CFStringInsert, 1, ! "(CFIndex idx, CFStringRef insertedStr) -> None"}, {"CFStringDelete", (PyCFunction)CFMutableStringRefObj_CFStringDelete, 1, ! "(CFRange range) -> None"}, {"CFStringReplace", (PyCFunction)CFMutableStringRefObj_CFStringReplace, 1, ! "(CFRange range, CFStringRef replacement) -> None"}, {"CFStringReplaceAll", (PyCFunction)CFMutableStringRefObj_CFStringReplaceAll, 1, ! "(CFStringRef replacement) -> None"}, {"CFStringPad", (PyCFunction)CFMutableStringRefObj_CFStringPad, 1, ! "(CFStringRef padString, CFIndex length, CFIndex indexIntoPad) -> None"}, {"CFStringTrim", (PyCFunction)CFMutableStringRefObj_CFStringTrim, 1, ! "(CFStringRef trimString) -> None"}, {"CFStringTrimWhitespace", (PyCFunction)CFMutableStringRefObj_CFStringTrimWhitespace, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 2368,2392 ---- static PyMethodDef CFMutableStringRefObj_methods[] = { {"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1, ! PyDoc_STR("(CFStringRef appendedString) -> None")}, {"CFStringAppendCharacters", (PyCFunction)CFMutableStringRefObj_CFStringAppendCharacters, 1, ! PyDoc_STR("(Buffer chars) -> None")}, {"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1, ! PyDoc_STR("(Str255 pStr, CFStringEncoding encoding) -> None")}, {"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1, ! PyDoc_STR("(char* cStr, CFStringEncoding encoding) -> None")}, {"CFStringInsert", (PyCFunction)CFMutableStringRefObj_CFStringInsert, 1, ! PyDoc_STR("(CFIndex idx, CFStringRef insertedStr) -> None")}, {"CFStringDelete", (PyCFunction)CFMutableStringRefObj_CFStringDelete, 1, ! PyDoc_STR("(CFRange range) -> None")}, {"CFStringReplace", (PyCFunction)CFMutableStringRefObj_CFStringReplace, 1, ! PyDoc_STR("(CFRange range, CFStringRef replacement) -> None")}, {"CFStringReplaceAll", (PyCFunction)CFMutableStringRefObj_CFStringReplaceAll, 1, ! PyDoc_STR("(CFStringRef replacement) -> None")}, {"CFStringPad", (PyCFunction)CFMutableStringRefObj_CFStringPad, 1, ! PyDoc_STR("(CFStringRef padString, CFIndex length, CFIndex indexIntoPad) -> None")}, {"CFStringTrim", (PyCFunction)CFMutableStringRefObj_CFStringTrim, 1, ! PyDoc_STR("(CFStringRef trimString) -> None")}, {"CFStringTrimWhitespace", (PyCFunction)CFMutableStringRefObj_CFStringTrimWhitespace, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 2933,2989 **** static PyMethodDef CFURLRefObj_methods[] = { {"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1, ! "(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)"}, {"CFURLGetFileSystemRepresentation", (PyCFunction)CFURLRefObj_CFURLGetFileSystemRepresentation, 1, ! "(Boolean resolveAgainstBase, CFIndex maxBufLen) -> (Boolean _rv, UInt8 buffer)"}, {"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1, ! "() -> (CFURLRef _rv)"}, {"CFURLGetString", (PyCFunction)CFURLRefObj_CFURLGetString, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLGetBaseURL", (PyCFunction)CFURLRefObj_CFURLGetBaseURL, 1, ! "() -> (CFURLRef _rv)"}, {"CFURLCanBeDecomposed", (PyCFunction)CFURLRefObj_CFURLCanBeDecomposed, 1, ! "() -> (Boolean _rv)"}, {"CFURLCopyScheme", (PyCFunction)CFURLRefObj_CFURLCopyScheme, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyNetLocation", (PyCFunction)CFURLRefObj_CFURLCopyNetLocation, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyPath", (PyCFunction)CFURLRefObj_CFURLCopyPath, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyStrictPath", (PyCFunction)CFURLRefObj_CFURLCopyStrictPath, 1, ! "() -> (CFStringRef _rv, Boolean isAbsolute)"}, {"CFURLCopyFileSystemPath", (PyCFunction)CFURLRefObj_CFURLCopyFileSystemPath, 1, ! "(CFURLPathStyle pathStyle) -> (CFStringRef _rv)"}, {"CFURLHasDirectoryPath", (PyCFunction)CFURLRefObj_CFURLHasDirectoryPath, 1, ! "() -> (Boolean _rv)"}, {"CFURLCopyResourceSpecifier", (PyCFunction)CFURLRefObj_CFURLCopyResourceSpecifier, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyHostName", (PyCFunction)CFURLRefObj_CFURLCopyHostName, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLGetPortNumber", (PyCFunction)CFURLRefObj_CFURLGetPortNumber, 1, ! "() -> (SInt32 _rv)"}, {"CFURLCopyUserName", (PyCFunction)CFURLRefObj_CFURLCopyUserName, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyPassword", (PyCFunction)CFURLRefObj_CFURLCopyPassword, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyParameterString", (PyCFunction)CFURLRefObj_CFURLCopyParameterString, 1, ! "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"}, {"CFURLCopyQueryString", (PyCFunction)CFURLRefObj_CFURLCopyQueryString, 1, ! "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"}, {"CFURLCopyFragment", (PyCFunction)CFURLRefObj_CFURLCopyFragment, 1, ! "(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"}, {"CFURLCopyLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCopyLastPathComponent, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCopyPathExtension", (PyCFunction)CFURLRefObj_CFURLCopyPathExtension, 1, ! "() -> (CFStringRef _rv)"}, {"CFURLCreateCopyAppendingPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathComponent, 1, ! "(CFStringRef pathComponent, Boolean isDirectory) -> (CFURLRef _rv)"}, {"CFURLCreateCopyDeletingLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent, 1, ! "() -> (CFURLRef _rv)"}, {"CFURLCreateCopyAppendingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathExtension, 1, ! "(CFStringRef extension) -> (CFURLRef _rv)"}, {"CFURLCreateCopyDeletingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingPathExtension, 1, ! "() -> (CFURLRef _rv)"}, {"CFURLGetFSRef", (PyCFunction)CFURLRefObj_CFURLGetFSRef, 1, ! "() -> (Boolean _rv, FSRef fsRef)"}, {NULL, NULL, 0} }; --- 2933,2989 ---- static PyMethodDef CFURLRefObj_methods[] = { {"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1, ! PyDoc_STR("(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)")}, {"CFURLGetFileSystemRepresentation", (PyCFunction)CFURLRefObj_CFURLGetFileSystemRepresentation, 1, ! PyDoc_STR("(Boolean resolveAgainstBase, CFIndex maxBufLen) -> (Boolean _rv, UInt8 buffer)")}, {"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1, ! PyDoc_STR("() -> (CFURLRef _rv)")}, {"CFURLGetString", (PyCFunction)CFURLRefObj_CFURLGetString, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLGetBaseURL", (PyCFunction)CFURLRefObj_CFURLGetBaseURL, 1, ! PyDoc_STR("() -> (CFURLRef _rv)")}, {"CFURLCanBeDecomposed", (PyCFunction)CFURLRefObj_CFURLCanBeDecomposed, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"CFURLCopyScheme", (PyCFunction)CFURLRefObj_CFURLCopyScheme, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyNetLocation", (PyCFunction)CFURLRefObj_CFURLCopyNetLocation, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyPath", (PyCFunction)CFURLRefObj_CFURLCopyPath, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyStrictPath", (PyCFunction)CFURLRefObj_CFURLCopyStrictPath, 1, ! PyDoc_STR("() -> (CFStringRef _rv, Boolean isAbsolute)")}, {"CFURLCopyFileSystemPath", (PyCFunction)CFURLRefObj_CFURLCopyFileSystemPath, 1, ! PyDoc_STR("(CFURLPathStyle pathStyle) -> (CFStringRef _rv)")}, {"CFURLHasDirectoryPath", (PyCFunction)CFURLRefObj_CFURLHasDirectoryPath, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"CFURLCopyResourceSpecifier", (PyCFunction)CFURLRefObj_CFURLCopyResourceSpecifier, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyHostName", (PyCFunction)CFURLRefObj_CFURLCopyHostName, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLGetPortNumber", (PyCFunction)CFURLRefObj_CFURLGetPortNumber, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"CFURLCopyUserName", (PyCFunction)CFURLRefObj_CFURLCopyUserName, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyPassword", (PyCFunction)CFURLRefObj_CFURLCopyPassword, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyParameterString", (PyCFunction)CFURLRefObj_CFURLCopyParameterString, 1, ! PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")}, {"CFURLCopyQueryString", (PyCFunction)CFURLRefObj_CFURLCopyQueryString, 1, ! PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")}, {"CFURLCopyFragment", (PyCFunction)CFURLRefObj_CFURLCopyFragment, 1, ! PyDoc_STR("(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)")}, {"CFURLCopyLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCopyLastPathComponent, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCopyPathExtension", (PyCFunction)CFURLRefObj_CFURLCopyPathExtension, 1, ! PyDoc_STR("() -> (CFStringRef _rv)")}, {"CFURLCreateCopyAppendingPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathComponent, 1, ! PyDoc_STR("(CFStringRef pathComponent, Boolean isDirectory) -> (CFURLRef _rv)")}, {"CFURLCreateCopyDeletingLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent, 1, ! PyDoc_STR("() -> (CFURLRef _rv)")}, {"CFURLCreateCopyAppendingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathExtension, 1, ! PyDoc_STR("(CFStringRef extension) -> (CFURLRef _rv)")}, {"CFURLCreateCopyDeletingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingPathExtension, 1, ! PyDoc_STR("() -> (CFURLRef _rv)")}, {"CFURLGetFSRef", (PyCFunction)CFURLRefObj_CFURLGetFSRef, 1, ! PyDoc_STR("() -> (Boolean _rv, FSRef fsRef)")}, {NULL, NULL, 0} }; *************** *** 4174,4288 **** static PyMethodDef CF_methods[] = { {"__CFRangeMake", (PyCFunction)CF___CFRangeMake, 1, ! "(CFIndex loc, CFIndex len) -> (CFRange _rv)"}, {"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFAllocatorGetPreferredSizeForSize", (PyCFunction)CF_CFAllocatorGetPreferredSizeForSize, 1, ! "(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)"}, {"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1, ! "(CFTypeID type_id) -> (CFStringRef _rv)"}, {"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFArrayCreateMutable", (PyCFunction)CF_CFArrayCreateMutable, 1, ! "(CFIndex capacity) -> (CFMutableArrayRef _rv)"}, {"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1, ! "(CFIndex capacity, CFArrayRef theArray) -> (CFMutableArrayRef _rv)"}, {"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFDataCreate", (PyCFunction)CF_CFDataCreate, 1, ! "(Buffer bytes) -> (CFDataRef _rv)"}, {"CFDataCreateWithBytesNoCopy", (PyCFunction)CF_CFDataCreateWithBytesNoCopy, 1, ! "(Buffer bytes) -> (CFDataRef _rv)"}, {"CFDataCreateMutable", (PyCFunction)CF_CFDataCreateMutable, 1, ! "(CFIndex capacity) -> (CFMutableDataRef _rv)"}, {"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1, ! "(CFIndex capacity, CFDataRef theData) -> (CFMutableDataRef _rv)"}, {"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFDictionaryCreateMutable", (PyCFunction)CF_CFDictionaryCreateMutable, 1, ! "(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"}, {"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1, ! "(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)"}, {"CFPreferencesCopyAppValue", (PyCFunction)CF_CFPreferencesCopyAppValue, 1, ! "(CFStringRef key, CFStringRef applicationID) -> (CFTypeRef _rv)"}, {"CFPreferencesGetAppBooleanValue", (PyCFunction)CF_CFPreferencesGetAppBooleanValue, 1, ! "(CFStringRef key, CFStringRef applicationID) -> (Boolean _rv, Boolean keyExistsAndHasValidFormat)"}, {"CFPreferencesGetAppIntegerValue", (PyCFunction)CF_CFPreferencesGetAppIntegerValue, 1, ! "(CFStringRef key, CFStringRef applicationID) -> (CFIndex _rv, Boolean keyExistsAndHasValidFormat)"}, {"CFPreferencesSetAppValue", (PyCFunction)CF_CFPreferencesSetAppValue, 1, ! "(CFStringRef key, CFTypeRef value, CFStringRef applicationID) -> None"}, {"CFPreferencesAddSuitePreferencesToApp", (PyCFunction)CF_CFPreferencesAddSuitePreferencesToApp, 1, ! "(CFStringRef applicationID, CFStringRef suiteID) -> None"}, {"CFPreferencesRemoveSuitePreferencesFromApp", (PyCFunction)CF_CFPreferencesRemoveSuitePreferencesFromApp, 1, ! "(CFStringRef applicationID, CFStringRef suiteID) -> None"}, {"CFPreferencesAppSynchronize", (PyCFunction)CF_CFPreferencesAppSynchronize, 1, ! "(CFStringRef applicationID) -> (Boolean _rv)"}, {"CFPreferencesCopyValue", (PyCFunction)CF_CFPreferencesCopyValue, 1, ! "(CFStringRef key, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFTypeRef _rv)"}, {"CFPreferencesCopyMultiple", (PyCFunction)CF_CFPreferencesCopyMultiple, 1, ! "(CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFDictionaryRef _rv)"}, {"CFPreferencesSetValue", (PyCFunction)CF_CFPreferencesSetValue, 1, ! "(CFStringRef key, CFTypeRef value, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None"}, {"CFPreferencesSetMultiple", (PyCFunction)CF_CFPreferencesSetMultiple, 1, ! "(CFDictionaryRef keysToSet, CFArrayRef keysToRemove, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None"}, {"CFPreferencesSynchronize", (PyCFunction)CF_CFPreferencesSynchronize, 1, ! "(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (Boolean _rv)"}, {"CFPreferencesCopyApplicationList", (PyCFunction)CF_CFPreferencesCopyApplicationList, 1, ! "(CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)"}, {"CFPreferencesCopyKeyList", (PyCFunction)CF_CFPreferencesCopyKeyList, 1, ! "(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)"}, {"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1, ! "(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1, ! "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringCreateWithCharacters", (PyCFunction)CF_CFStringCreateWithCharacters, 1, ! "(Buffer chars) -> (CFStringRef _rv)"}, {"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1, ! "(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1, ! "(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringCreateWithCharactersNoCopy", (PyCFunction)CF_CFStringCreateWithCharactersNoCopy, 1, ! "(Buffer chars) -> (CFStringRef _rv)"}, {"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1, ! "(CFIndex maxLength) -> (CFMutableStringRef _rv)"}, {"CFStringCreateMutableCopy", (PyCFunction)CF_CFStringCreateMutableCopy, 1, ! "(CFIndex maxLength, CFStringRef theString) -> (CFMutableStringRef _rv)"}, {"CFStringCreateWithBytes", (PyCFunction)CF_CFStringCreateWithBytes, 1, ! "(Buffer bytes, CFStringEncoding encoding, Boolean isExternalRepresentation) -> (CFStringRef _rv)"}, {"CFStringGetSystemEncoding", (PyCFunction)CF_CFStringGetSystemEncoding, 1, ! "() -> (CFStringEncoding _rv)"}, {"CFStringGetMaximumSizeForEncoding", (PyCFunction)CF_CFStringGetMaximumSizeForEncoding, 1, ! "(CFIndex length, CFStringEncoding encoding) -> (CFIndex _rv)"}, {"CFStringIsEncodingAvailable", (PyCFunction)CF_CFStringIsEncodingAvailable, 1, ! "(CFStringEncoding encoding) -> (Boolean _rv)"}, {"CFStringGetNameOfEncoding", (PyCFunction)CF_CFStringGetNameOfEncoding, 1, ! "(CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringConvertEncodingToNSStringEncoding", (PyCFunction)CF_CFStringConvertEncodingToNSStringEncoding, 1, ! "(CFStringEncoding encoding) -> (UInt32 _rv)"}, {"CFStringConvertNSStringEncodingToEncoding", (PyCFunction)CF_CFStringConvertNSStringEncodingToEncoding, 1, ! "(UInt32 encoding) -> (CFStringEncoding _rv)"}, {"CFStringConvertEncodingToWindowsCodepage", (PyCFunction)CF_CFStringConvertEncodingToWindowsCodepage, 1, ! "(CFStringEncoding encoding) -> (UInt32 _rv)"}, {"CFStringConvertWindowsCodepageToEncoding", (PyCFunction)CF_CFStringConvertWindowsCodepageToEncoding, 1, ! "(UInt32 codepage) -> (CFStringEncoding _rv)"}, {"CFStringConvertEncodingToIANACharSetName", (PyCFunction)CF_CFStringConvertEncodingToIANACharSetName, 1, ! "(CFStringEncoding encoding) -> (CFStringRef _rv)"}, {"CFStringGetMostCompatibleMacStringEncoding", (PyCFunction)CF_CFStringGetMostCompatibleMacStringEncoding, 1, ! "(CFStringEncoding encoding) -> (CFStringEncoding _rv)"}, {"__CFStringMakeConstantString", (PyCFunction)CF___CFStringMakeConstantString, 1, ! "(char* cStr) -> (CFStringRef _rv)"}, {"CFURLGetTypeID", (PyCFunction)CF_CFURLGetTypeID, 1, ! "() -> (CFTypeID _rv)"}, {"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1, ! "(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)"}, {"CFURLCreateFromFileSystemRepresentation", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentation, 1, ! "(Buffer buffer, Boolean isDirectory) -> (CFURLRef _rv)"}, {"CFURLCreateFromFileSystemRepresentationRelativeToBase", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentationRelativeToBase, 1, ! "(Buffer buffer, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)"}, {"CFURLCreateFromFSRef", (PyCFunction)CF_CFURLCreateFromFSRef, 1, ! "(FSRef fsRef) -> (CFURLRef _rv)"}, {"toCF", (PyCFunction)CF_toCF, 1, ! "(python_object) -> (CF_object)"}, {NULL, NULL, 0} }; --- 4174,4288 ---- static PyMethodDef CF_methods[] = { {"__CFRangeMake", (PyCFunction)CF___CFRangeMake, 1, ! PyDoc_STR("(CFIndex loc, CFIndex len) -> (CFRange _rv)")}, {"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFAllocatorGetPreferredSizeForSize", (PyCFunction)CF_CFAllocatorGetPreferredSizeForSize, 1, ! PyDoc_STR("(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)")}, {"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1, ! PyDoc_STR("(CFTypeID type_id) -> (CFStringRef _rv)")}, {"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFArrayCreateMutable", (PyCFunction)CF_CFArrayCreateMutable, 1, ! PyDoc_STR("(CFIndex capacity) -> (CFMutableArrayRef _rv)")}, {"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1, ! PyDoc_STR("(CFIndex capacity, CFArrayRef theArray) -> (CFMutableArrayRef _rv)")}, {"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFDataCreate", (PyCFunction)CF_CFDataCreate, 1, ! PyDoc_STR("(Buffer bytes) -> (CFDataRef _rv)")}, {"CFDataCreateWithBytesNoCopy", (PyCFunction)CF_CFDataCreateWithBytesNoCopy, 1, ! PyDoc_STR("(Buffer bytes) -> (CFDataRef _rv)")}, {"CFDataCreateMutable", (PyCFunction)CF_CFDataCreateMutable, 1, ! PyDoc_STR("(CFIndex capacity) -> (CFMutableDataRef _rv)")}, {"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1, ! PyDoc_STR("(CFIndex capacity, CFDataRef theData) -> (CFMutableDataRef _rv)")}, {"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFDictionaryCreateMutable", (PyCFunction)CF_CFDictionaryCreateMutable, 1, ! PyDoc_STR("(CFIndex capacity) -> (CFMutableDictionaryRef _rv)")}, {"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1, ! PyDoc_STR("(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)")}, {"CFPreferencesCopyAppValue", (PyCFunction)CF_CFPreferencesCopyAppValue, 1, ! PyDoc_STR("(CFStringRef key, CFStringRef applicationID) -> (CFTypeRef _rv)")}, {"CFPreferencesGetAppBooleanValue", (PyCFunction)CF_CFPreferencesGetAppBooleanValue, 1, ! PyDoc_STR("(CFStringRef key, CFStringRef applicationID) -> (Boolean _rv, Boolean keyExistsAndHasValidFormat)")}, {"CFPreferencesGetAppIntegerValue", (PyCFunction)CF_CFPreferencesGetAppIntegerValue, 1, ! PyDoc_STR("(CFStringRef key, CFStringRef applicationID) -> (CFIndex _rv, Boolean keyExistsAndHasValidFormat)")}, {"CFPreferencesSetAppValue", (PyCFunction)CF_CFPreferencesSetAppValue, 1, ! PyDoc_STR("(CFStringRef key, CFTypeRef value, CFStringRef applicationID) -> None")}, {"CFPreferencesAddSuitePreferencesToApp", (PyCFunction)CF_CFPreferencesAddSuitePreferencesToApp, 1, ! PyDoc_STR("(CFStringRef applicationID, CFStringRef suiteID) -> None")}, {"CFPreferencesRemoveSuitePreferencesFromApp", (PyCFunction)CF_CFPreferencesRemoveSuitePreferencesFromApp, 1, ! PyDoc_STR("(CFStringRef applicationID, CFStringRef suiteID) -> None")}, {"CFPreferencesAppSynchronize", (PyCFunction)CF_CFPreferencesAppSynchronize, 1, ! PyDoc_STR("(CFStringRef applicationID) -> (Boolean _rv)")}, {"CFPreferencesCopyValue", (PyCFunction)CF_CFPreferencesCopyValue, 1, ! PyDoc_STR("(CFStringRef key, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFTypeRef _rv)")}, {"CFPreferencesCopyMultiple", (PyCFunction)CF_CFPreferencesCopyMultiple, 1, ! PyDoc_STR("(CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFDictionaryRef _rv)")}, {"CFPreferencesSetValue", (PyCFunction)CF_CFPreferencesSetValue, 1, ! PyDoc_STR("(CFStringRef key, CFTypeRef value, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None")}, {"CFPreferencesSetMultiple", (PyCFunction)CF_CFPreferencesSetMultiple, 1, ! PyDoc_STR("(CFDictionaryRef keysToSet, CFArrayRef keysToRemove, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> None")}, {"CFPreferencesSynchronize", (PyCFunction)CF_CFPreferencesSynchronize, 1, ! PyDoc_STR("(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (Boolean _rv)")}, {"CFPreferencesCopyApplicationList", (PyCFunction)CF_CFPreferencesCopyApplicationList, 1, ! PyDoc_STR("(CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)")}, {"CFPreferencesCopyKeyList", (PyCFunction)CF_CFPreferencesCopyKeyList, 1, ! PyDoc_STR("(CFStringRef applicationID, CFStringRef userName, CFStringRef hostName) -> (CFArrayRef _rv)")}, {"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1, ! PyDoc_STR("(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1, ! PyDoc_STR("(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringCreateWithCharacters", (PyCFunction)CF_CFStringCreateWithCharacters, 1, ! PyDoc_STR("(Buffer chars) -> (CFStringRef _rv)")}, {"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1, ! PyDoc_STR("(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1, ! PyDoc_STR("(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringCreateWithCharactersNoCopy", (PyCFunction)CF_CFStringCreateWithCharactersNoCopy, 1, ! PyDoc_STR("(Buffer chars) -> (CFStringRef _rv)")}, {"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1, ! PyDoc_STR("(CFIndex maxLength) -> (CFMutableStringRef _rv)")}, {"CFStringCreateMutableCopy", (PyCFunction)CF_CFStringCreateMutableCopy, 1, ! PyDoc_STR("(CFIndex maxLength, CFStringRef theString) -> (CFMutableStringRef _rv)")}, {"CFStringCreateWithBytes", (PyCFunction)CF_CFStringCreateWithBytes, 1, ! PyDoc_STR("(Buffer bytes, CFStringEncoding encoding, Boolean isExternalRepresentation) -> (CFStringRef _rv)")}, {"CFStringGetSystemEncoding", (PyCFunction)CF_CFStringGetSystemEncoding, 1, ! PyDoc_STR("() -> (CFStringEncoding _rv)")}, {"CFStringGetMaximumSizeForEncoding", (PyCFunction)CF_CFStringGetMaximumSizeForEncoding, 1, ! PyDoc_STR("(CFIndex length, CFStringEncoding encoding) -> (CFIndex _rv)")}, {"CFStringIsEncodingAvailable", (PyCFunction)CF_CFStringIsEncodingAvailable, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (Boolean _rv)")}, {"CFStringGetNameOfEncoding", (PyCFunction)CF_CFStringGetNameOfEncoding, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringConvertEncodingToNSStringEncoding", (PyCFunction)CF_CFStringConvertEncodingToNSStringEncoding, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (UInt32 _rv)")}, {"CFStringConvertNSStringEncodingToEncoding", (PyCFunction)CF_CFStringConvertNSStringEncodingToEncoding, 1, ! PyDoc_STR("(UInt32 encoding) -> (CFStringEncoding _rv)")}, {"CFStringConvertEncodingToWindowsCodepage", (PyCFunction)CF_CFStringConvertEncodingToWindowsCodepage, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (UInt32 _rv)")}, {"CFStringConvertWindowsCodepageToEncoding", (PyCFunction)CF_CFStringConvertWindowsCodepageToEncoding, 1, ! PyDoc_STR("(UInt32 codepage) -> (CFStringEncoding _rv)")}, {"CFStringConvertEncodingToIANACharSetName", (PyCFunction)CF_CFStringConvertEncodingToIANACharSetName, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (CFStringRef _rv)")}, {"CFStringGetMostCompatibleMacStringEncoding", (PyCFunction)CF_CFStringGetMostCompatibleMacStringEncoding, 1, ! PyDoc_STR("(CFStringEncoding encoding) -> (CFStringEncoding _rv)")}, {"__CFStringMakeConstantString", (PyCFunction)CF___CFStringMakeConstantString, 1, ! PyDoc_STR("(char* cStr) -> (CFStringRef _rv)")}, {"CFURLGetTypeID", (PyCFunction)CF_CFURLGetTypeID, 1, ! PyDoc_STR("() -> (CFTypeID _rv)")}, {"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1, ! PyDoc_STR("(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)")}, {"CFURLCreateFromFileSystemRepresentation", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentation, 1, ! PyDoc_STR("(Buffer buffer, Boolean isDirectory) -> (CFURLRef _rv)")}, {"CFURLCreateFromFileSystemRepresentationRelativeToBase", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentationRelativeToBase, 1, ! PyDoc_STR("(Buffer buffer, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)")}, {"CFURLCreateFromFSRef", (PyCFunction)CF_CFURLCreateFromFSRef, 1, ! PyDoc_STR("(FSRef fsRef) -> (CFURLRef _rv)")}, {"toCF", (PyCFunction)CF_toCF, 1, ! PyDoc_STR("(python_object) -> (CF_object)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:57 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/dlg _Dlgmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv18405/dlg Modified Files: _Dlgmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Dlgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/_Dlgmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Dlgmodule.c 23 Apr 2002 22:45:03 -0000 1.10 --- _Dlgmodule.c 16 Aug 2002 09:09:20 -0000 1.11 *************** *** 883,965 **** static PyMethodDef DlgObj_methods[] = { {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, ! "() -> None"}, {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1, ! "(RgnHandle updateRgn) -> None"}, {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1, ! "(DialogItemIndex itemNo) -> None"}, {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1, ! "(DialogItemIndex itemNo) -> None"}, {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1, ! "(Point thePt) -> (DialogItemIndexZeroBased _rv)"}, {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1, ! "() -> None"}, {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1, ! "() -> None"}, {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1, ! "() -> None"}, {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1, ! "() -> None"}, {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1, ! "(DialogItemIndex itemNo) -> (DialogItemType itemType, Handle item, Rect box)"}, {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1, ! "(DialogItemIndex itemNo, DialogItemType itemType, Handle item, Rect box) -> None"}, {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1, ! "(DialogItemIndex itemNo, SInt16 strtSel, SInt16 endSel) -> None"}, {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1, ! "(Handle theHandle, DITLMethod method) -> None"}, {"CountDITL", (PyCFunction)DlgObj_CountDITL, 1, ! "() -> (DialogItemIndex _rv)"}, {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1, ! "(DialogItemIndex numberItems) -> None"}, #if TARGET_API_MAC_CARBON {"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1, ! "(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None"}, #endif #if TARGET_API_MAC_CARBON {"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1, ! "(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None"}, #endif {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1, ! "() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"}, {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1, ! "(DialogItemIndex newItem) -> None"}, {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1, ! "(DialogItemIndex newItem) -> None"}, {"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1, ! "(Boolean tracks) -> None"}, {"AutoSizeDialog", (PyCFunction)DlgObj_AutoSizeDialog, 1, ! "() -> None"}, {"GetDialogItemAsControl", (PyCFunction)DlgObj_GetDialogItemAsControl, 1, ! "(SInt16 inItemNo) -> (ControlHandle outControl)"}, {"MoveDialogItem", (PyCFunction)DlgObj_MoveDialogItem, 1, ! "(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None"}, {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1, ! "(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None"}, {"AppendDialogItemList", (PyCFunction)DlgObj_AppendDialogItemList, 1, ! "(SInt16 ditlID, DITLMethod method) -> None"}, {"SetDialogTimeout", (PyCFunction)DlgObj_SetDialogTimeout, 1, ! "(SInt16 inButtonToPress, UInt32 inSecondsToWait) -> None"}, {"GetDialogTimeout", (PyCFunction)DlgObj_GetDialogTimeout, 1, ! "() -> (SInt16 outButtonToPress, UInt32 outSecondsToWait, UInt32 outSecondsRemaining)"}, {"SetModalDialogEventMask", (PyCFunction)DlgObj_SetModalDialogEventMask, 1, ! "(EventMask inMask) -> None"}, {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1, ! "() -> (EventMask outMask)"}, {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, ! "() -> (WindowPtr _rv)"}, {"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1, ! "() -> (TEHandle _rv)"}, {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, ! "() -> (SInt16 _rv)"}, {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1, ! "() -> (SInt16 _rv)"}, {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1, ! "() -> (SInt16 _rv)"}, {"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1, ! "() -> None"}, {"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1, ! "() -> (CGrafPtr _rv)"}, {NULL, NULL, 0} }; --- 883,965 ---- static PyMethodDef DlgObj_methods[] = { {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, ! PyDoc_STR("() -> None")}, {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1, ! PyDoc_STR("(RgnHandle updateRgn) -> None")}, {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1, ! PyDoc_STR("(DialogItemIndex itemNo) -> None")}, {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1, ! PyDoc_STR("(DialogItemIndex itemNo) -> None")}, {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1, ! PyDoc_STR("(Point thePt) -> (DialogItemIndexZeroBased _rv)")}, {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1, ! PyDoc_STR("() -> None")}, {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1, ! PyDoc_STR("() -> None")}, {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1, ! PyDoc_STR("() -> None")}, {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1, ! PyDoc_STR("() -> None")}, {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1, ! PyDoc_STR("(DialogItemIndex itemNo) -> (DialogItemType itemType, Handle item, Rect box)")}, {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1, ! PyDoc_STR("(DialogItemIndex itemNo, DialogItemType itemType, Handle item, Rect box) -> None")}, {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1, ! PyDoc_STR("(DialogItemIndex itemNo, SInt16 strtSel, SInt16 endSel) -> None")}, {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1, ! PyDoc_STR("(Handle theHandle, DITLMethod method) -> None")}, {"CountDITL", (PyCFunction)DlgObj_CountDITL, 1, ! PyDoc_STR("() -> (DialogItemIndex _rv)")}, {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1, ! PyDoc_STR("(DialogItemIndex numberItems) -> None")}, #if TARGET_API_MAC_CARBON {"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1, ! PyDoc_STR("(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None")}, #endif #if TARGET_API_MAC_CARBON {"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1, ! PyDoc_STR("(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None")}, #endif {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1, ! PyDoc_STR("() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)")}, {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1, ! PyDoc_STR("(DialogItemIndex newItem) -> None")}, {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1, ! PyDoc_STR("(DialogItemIndex newItem) -> None")}, {"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1, ! PyDoc_STR("(Boolean tracks) -> None")}, {"AutoSizeDialog", (PyCFunction)DlgObj_AutoSizeDialog, 1, ! PyDoc_STR("() -> None")}, {"GetDialogItemAsControl", (PyCFunction)DlgObj_GetDialogItemAsControl, 1, ! PyDoc_STR("(SInt16 inItemNo) -> (ControlHandle outControl)")}, {"MoveDialogItem", (PyCFunction)DlgObj_MoveDialogItem, 1, ! PyDoc_STR("(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None")}, {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1, ! PyDoc_STR("(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None")}, {"AppendDialogItemList", (PyCFunction)DlgObj_AppendDialogItemList, 1, ! PyDoc_STR("(SInt16 ditlID, DITLMethod method) -> None")}, {"SetDialogTimeout", (PyCFunction)DlgObj_SetDialogTimeout, 1, ! PyDoc_STR("(SInt16 inButtonToPress, UInt32 inSecondsToWait) -> None")}, {"GetDialogTimeout", (PyCFunction)DlgObj_GetDialogTimeout, 1, ! PyDoc_STR("() -> (SInt16 outButtonToPress, UInt32 outSecondsToWait, UInt32 outSecondsRemaining)")}, {"SetModalDialogEventMask", (PyCFunction)DlgObj_SetModalDialogEventMask, 1, ! PyDoc_STR("(EventMask inMask) -> None")}, {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1, ! PyDoc_STR("() -> (EventMask outMask)")}, {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, ! PyDoc_STR("() -> (WindowPtr _rv)")}, {"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1, ! PyDoc_STR("() -> (TEHandle _rv)")}, {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1, ! PyDoc_STR("() -> None")}, {"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1, ! PyDoc_STR("() -> (CGrafPtr _rv)")}, {NULL, NULL, 0} }; *************** *** 1472,1517 **** static PyMethodDef Dlg_methods[] = { {"NewDialog", (PyCFunction)Dlg_NewDialog, 1, ! "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"}, {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1, ! "(SInt16 dialogID, WindowPtr behind) -> (DialogPtr _rv)"}, {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1, ! "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"}, {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1, ! "(PyObject* modalFilter) -> (DialogItemIndex itemHit)"}, {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1, ! "(EventRecord theEvent) -> (Boolean _rv)"}, {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1, ! "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)"}, {"Alert", (PyCFunction)Dlg_Alert, 1, ! "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, {"StopAlert", (PyCFunction)Dlg_StopAlert, 1, ! "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1, ! "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1, ! "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, {"ParamText", (PyCFunction)Dlg_ParamText, 1, ! "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"}, {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1, ! "(Handle item) -> (Str255 text)"}, {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1, ! "(Handle item, Str255 text) -> None"}, {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1, ! "() -> (SInt16 _rv)"}, {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1, ! "(SInt16 fontNum) -> None"}, {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1, ! "() -> None"}, #if TARGET_API_MAC_CARBON {"GetParamText", (PyCFunction)Dlg_GetParamText, 1, ! "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"}, #endif {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1, ! "(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)"}, {"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1, ! "(WindowPtr window) -> (DialogPtr _rv)"}, {"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1, ! NULL}, {NULL, NULL, 0} }; --- 1472,1517 ---- static PyMethodDef Dlg_methods[] = { {"NewDialog", (PyCFunction)Dlg_NewDialog, 1, ! PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)")}, {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1, ! PyDoc_STR("(SInt16 dialogID, WindowPtr behind) -> (DialogPtr _rv)")}, {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1, ! PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)")}, {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1, ! PyDoc_STR("(PyObject* modalFilter) -> (DialogItemIndex itemHit)")}, {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1, ! PyDoc_STR("(EventRecord theEvent) -> (Boolean _rv)")}, {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1, ! PyDoc_STR("(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)")}, {"Alert", (PyCFunction)Dlg_Alert, 1, ! PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")}, {"StopAlert", (PyCFunction)Dlg_StopAlert, 1, ! PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")}, {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1, ! PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")}, {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1, ! PyDoc_STR("(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)")}, {"ParamText", (PyCFunction)Dlg_ParamText, 1, ! PyDoc_STR("(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None")}, {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1, ! PyDoc_STR("(Handle item) -> (Str255 text)")}, {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1, ! PyDoc_STR("(Handle item, Str255 text) -> None")}, {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1, ! PyDoc_STR("(SInt16 fontNum) -> None")}, {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1, ! PyDoc_STR("() -> None")}, #if TARGET_API_MAC_CARBON {"GetParamText", (PyCFunction)Dlg_GetParamText, 1, ! PyDoc_STR("(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None")}, #endif {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1, ! PyDoc_STR("(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)")}, {"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1, ! PyDoc_STR("(WindowPtr window) -> (DialogPtr _rv)")}, {"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1, ! PyDoc_STR(NULL)}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/evt _Evtmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory usw-pr-cvs1:/tmp/cvs-serv18405/evt Modified Files: _Evtmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Evtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/_Evtmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _Evtmodule.c 24 Mar 2002 23:03:35 -0000 1.6 --- _Evtmodule.c 16 Aug 2002 09:09:26 -0000 1.7 *************** *** 593,683 **** static PyMethodDef Evt_methods[] = { {"GetMouse", (PyCFunction)Evt_GetMouse, 1, ! "() -> (Point mouseLoc)"}, {"Button", (PyCFunction)Evt_Button, 1, ! "() -> (Boolean _rv)"}, {"StillDown", (PyCFunction)Evt_StillDown, 1, ! "() -> (Boolean _rv)"}, {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1, ! "() -> (Boolean _rv)"}, {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1, ! "() -> (UInt32 _rv)"}, {"GetKeys", (PyCFunction)Evt_GetKeys, 1, ! "() -> (KeyMap theKeys)"}, {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1, ! "() -> (UInt32 _rv)"}, {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1, ! "(EventMask value) -> None"}, {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1, ! "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"}, {"EventAvail", (PyCFunction)Evt_EventAvail, 1, ! "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"}, {"PostEvent", (PyCFunction)Evt_PostEvent, 1, ! "(EventKind eventNum, UInt32 eventMsg) -> None"}, #if !TARGET_API_MAC_CARBON {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1, ! "(EventMask mask) -> (Boolean _rv, EventRecord theEvent)"}, #endif #if !TARGET_API_MAC_CARBON {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1, ! "(EventMask mask) -> (Boolean _rv, EventRecord theEvent)"}, #endif {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1, ! "(EventMask whichMask, EventMask stopMask) -> None"}, #if !TARGET_API_MAC_CARBON {"SystemClick", (PyCFunction)Evt_SystemClick, 1, ! "(EventRecord theEvent, WindowPtr theWindow) -> None"}, #endif #if !TARGET_API_MAC_CARBON {"SystemTask", (PyCFunction)Evt_SystemTask, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_CARBON {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1, ! "(EventRecord theEvent) -> (Boolean _rv)"}, #endif #if TARGET_API_MAC_CARBON {"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1, ! "() -> (Point globalMouse)"}, #endif #if TARGET_API_MAC_CARBON {"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1, ! "() -> (UInt32 _rv)"}, #endif #if TARGET_API_MAC_CARBON {"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1, ! "() -> (Boolean _rv)"}, #endif {"KeyScript", (PyCFunction)Evt_KeyScript, 1, ! "(short code) -> None"}, {"IsCmdChar", (PyCFunction)Evt_IsCmdChar, 1, ! "(EventRecord event, short test) -> (Boolean _rv)"}, {"LMGetKeyThresh", (PyCFunction)Evt_LMGetKeyThresh, 1, ! "() -> (SInt16 _rv)"}, {"LMSetKeyThresh", (PyCFunction)Evt_LMSetKeyThresh, 1, ! "(SInt16 value) -> None"}, {"LMGetKeyRepThresh", (PyCFunction)Evt_LMGetKeyRepThresh, 1, ! "() -> (SInt16 _rv)"}, {"LMSetKeyRepThresh", (PyCFunction)Evt_LMSetKeyRepThresh, 1, ! "(SInt16 value) -> None"}, {"LMGetKbdLast", (PyCFunction)Evt_LMGetKbdLast, 1, ! "() -> (UInt8 _rv)"}, {"LMSetKbdLast", (PyCFunction)Evt_LMSetKbdLast, 1, ! "(UInt8 value) -> None"}, {"LMGetKbdType", (PyCFunction)Evt_LMGetKbdType, 1, ! "() -> (UInt8 _rv)"}, {"LMSetKbdType", (PyCFunction)Evt_LMSetKbdType, 1, ! "(UInt8 value) -> None"}, {"TickCount", (PyCFunction)Evt_TickCount, 1, ! "() -> (UInt32 _rv)"}, {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1, ! "(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"}, {NULL, NULL, 0} }; --- 593,683 ---- static PyMethodDef Evt_methods[] = { {"GetMouse", (PyCFunction)Evt_GetMouse, 1, ! PyDoc_STR("() -> (Point mouseLoc)")}, {"Button", (PyCFunction)Evt_Button, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"StillDown", (PyCFunction)Evt_StillDown, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"GetKeys", (PyCFunction)Evt_GetKeys, 1, ! PyDoc_STR("() -> (KeyMap theKeys)")}, {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1, ! PyDoc_STR("(EventMask value) -> None")}, {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1, ! PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")}, {"EventAvail", (PyCFunction)Evt_EventAvail, 1, ! PyDoc_STR("(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)")}, {"PostEvent", (PyCFunction)Evt_PostEvent, 1, ! PyDoc_STR("(EventKind eventNum, UInt32 eventMsg) -> None")}, #if !TARGET_API_MAC_CARBON {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1, ! PyDoc_STR("(EventMask mask) -> (Boolean _rv, EventRecord theEvent)")}, #endif #if !TARGET_API_MAC_CARBON {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1, ! PyDoc_STR("(EventMask mask) -> (Boolean _rv, EventRecord theEvent)")}, #endif {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1, ! PyDoc_STR("(EventMask whichMask, EventMask stopMask) -> None")}, #if !TARGET_API_MAC_CARBON {"SystemClick", (PyCFunction)Evt_SystemClick, 1, ! PyDoc_STR("(EventRecord theEvent, WindowPtr theWindow) -> None")}, #endif #if !TARGET_API_MAC_CARBON {"SystemTask", (PyCFunction)Evt_SystemTask, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_CARBON {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1, ! PyDoc_STR("(EventRecord theEvent) -> (Boolean _rv)")}, #endif #if TARGET_API_MAC_CARBON {"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1, ! PyDoc_STR("() -> (Point globalMouse)")}, #endif #if TARGET_API_MAC_CARBON {"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, #endif #if TARGET_API_MAC_CARBON {"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #endif {"KeyScript", (PyCFunction)Evt_KeyScript, 1, ! PyDoc_STR("(short code) -> None")}, {"IsCmdChar", (PyCFunction)Evt_IsCmdChar, 1, ! PyDoc_STR("(EventRecord event, short test) -> (Boolean _rv)")}, {"LMGetKeyThresh", (PyCFunction)Evt_LMGetKeyThresh, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"LMSetKeyThresh", (PyCFunction)Evt_LMSetKeyThresh, 1, ! PyDoc_STR("(SInt16 value) -> None")}, {"LMGetKeyRepThresh", (PyCFunction)Evt_LMGetKeyRepThresh, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"LMSetKeyRepThresh", (PyCFunction)Evt_LMSetKeyRepThresh, 1, ! PyDoc_STR("(SInt16 value) -> None")}, {"LMGetKbdLast", (PyCFunction)Evt_LMGetKbdLast, 1, ! PyDoc_STR("() -> (UInt8 _rv)")}, {"LMSetKbdLast", (PyCFunction)Evt_LMSetKbdLast, 1, ! PyDoc_STR("(UInt8 value) -> None")}, {"LMGetKbdType", (PyCFunction)Evt_LMGetKbdType, 1, ! PyDoc_STR("() -> (UInt8 _rv)")}, {"LMSetKbdType", (PyCFunction)Evt_LMSetKbdType, 1, ! PyDoc_STR("(UInt8 value) -> None")}, {"TickCount", (PyCFunction)Evt_TickCount, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1, ! PyDoc_STR("(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/fm _Fmmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/fm In directory usw-pr-cvs1:/tmp/cvs-serv18405/fm Modified Files: _Fmmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Fmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/_Fmmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _Fmmodule.c 24 Mar 2002 23:03:30 -0000 1.6 --- _Fmmodule.c 16 Aug 2002 09:09:26 -0000 1.7 *************** *** 370,415 **** #if !TARGET_API_MAC_CARBON {"InitFonts", (PyCFunction)Fm_InitFonts, 1, ! "() -> None"}, #endif {"GetFontName", (PyCFunction)Fm_GetFontName, 1, ! "(short familyID) -> (Str255 name)"}, {"GetFNum", (PyCFunction)Fm_GetFNum, 1, ! "(Str255 name) -> (short familyID)"}, {"RealFont", (PyCFunction)Fm_RealFont, 1, ! "(short fontNum, short size) -> (Boolean _rv)"}, #if !TARGET_API_MAC_CARBON {"SetFontLock", (PyCFunction)Fm_SetFontLock, 1, ! "(Boolean lockFlag) -> None"}, #endif {"SetFScaleDisable", (PyCFunction)Fm_SetFScaleDisable, 1, ! "(Boolean fscaleDisable) -> None"}, {"FontMetrics", (PyCFunction)Fm_FontMetrics, 1, ! "() -> (FMetricRec theMetrics)"}, {"SetFractEnable", (PyCFunction)Fm_SetFractEnable, 1, ! "(Boolean fractEnable) -> None"}, {"GetDefFontSize", (PyCFunction)Fm_GetDefFontSize, 1, ! "() -> (short _rv)"}, {"IsOutline", (PyCFunction)Fm_IsOutline, 1, ! "(Point numer, Point denom) -> (Boolean _rv)"}, {"SetOutlinePreferred", (PyCFunction)Fm_SetOutlinePreferred, 1, ! "(Boolean outlinePreferred) -> None"}, {"GetOutlinePreferred", (PyCFunction)Fm_GetOutlinePreferred, 1, ! "() -> (Boolean _rv)"}, {"SetPreserveGlyph", (PyCFunction)Fm_SetPreserveGlyph, 1, ! "(Boolean preserveGlyph) -> None"}, {"GetPreserveGlyph", (PyCFunction)Fm_GetPreserveGlyph, 1, ! "() -> (Boolean _rv)"}, #if !TARGET_API_MAC_CARBON {"FlushFonts", (PyCFunction)Fm_FlushFonts, 1, ! "() -> None"}, #endif {"GetSysFont", (PyCFunction)Fm_GetSysFont, 1, ! "() -> (short _rv)"}, {"GetAppFont", (PyCFunction)Fm_GetAppFont, 1, ! "() -> (short _rv)"}, {"QDTextBounds", (PyCFunction)Fm_QDTextBounds, 1, ! "(Buffer inText) -> (Rect bounds)"}, {NULL, NULL, 0} }; --- 370,415 ---- #if !TARGET_API_MAC_CARBON {"InitFonts", (PyCFunction)Fm_InitFonts, 1, ! PyDoc_STR("() -> None")}, #endif {"GetFontName", (PyCFunction)Fm_GetFontName, 1, ! PyDoc_STR("(short familyID) -> (Str255 name)")}, {"GetFNum", (PyCFunction)Fm_GetFNum, 1, ! PyDoc_STR("(Str255 name) -> (short familyID)")}, {"RealFont", (PyCFunction)Fm_RealFont, 1, ! PyDoc_STR("(short fontNum, short size) -> (Boolean _rv)")}, #if !TARGET_API_MAC_CARBON {"SetFontLock", (PyCFunction)Fm_SetFontLock, 1, ! PyDoc_STR("(Boolean lockFlag) -> None")}, #endif {"SetFScaleDisable", (PyCFunction)Fm_SetFScaleDisable, 1, ! PyDoc_STR("(Boolean fscaleDisable) -> None")}, {"FontMetrics", (PyCFunction)Fm_FontMetrics, 1, ! PyDoc_STR("() -> (FMetricRec theMetrics)")}, {"SetFractEnable", (PyCFunction)Fm_SetFractEnable, 1, ! PyDoc_STR("(Boolean fractEnable) -> None")}, {"GetDefFontSize", (PyCFunction)Fm_GetDefFontSize, 1, ! PyDoc_STR("() -> (short _rv)")}, {"IsOutline", (PyCFunction)Fm_IsOutline, 1, ! PyDoc_STR("(Point numer, Point denom) -> (Boolean _rv)")}, {"SetOutlinePreferred", (PyCFunction)Fm_SetOutlinePreferred, 1, ! PyDoc_STR("(Boolean outlinePreferred) -> None")}, {"GetOutlinePreferred", (PyCFunction)Fm_GetOutlinePreferred, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"SetPreserveGlyph", (PyCFunction)Fm_SetPreserveGlyph, 1, ! PyDoc_STR("(Boolean preserveGlyph) -> None")}, {"GetPreserveGlyph", (PyCFunction)Fm_GetPreserveGlyph, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #if !TARGET_API_MAC_CARBON {"FlushFonts", (PyCFunction)Fm_FlushFonts, 1, ! PyDoc_STR("() -> None")}, #endif {"GetSysFont", (PyCFunction)Fm_GetSysFont, 1, ! PyDoc_STR("() -> (short _rv)")}, {"GetAppFont", (PyCFunction)Fm_GetAppFont, 1, ! PyDoc_STR("() -> (short _rv)")}, {"QDTextBounds", (PyCFunction)Fm_QDTextBounds, 1, ! PyDoc_STR("(Buffer inText) -> (Rect bounds)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag _Dragmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv18405/drag Modified Files: _Dragmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Dragmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/_Dragmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Dragmodule.c 23 Apr 2002 22:44:55 -0000 1.9 --- _Dragmodule.c 16 Aug 2002 09:09:25 -0000 1.10 *************** *** 685,741 **** static PyMethodDef DragObj_methods[] = { {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1, ! "() -> None"}, {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1, ! "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None"}, {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1, ! "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None"}, {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1, ! "(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None"}, {"ChangeDragBehaviors", (PyCFunction)DragObj_ChangeDragBehaviors, 1, ! "(DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None"}, {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1, ! "(EventRecord theEvent, RgnHandle theRegion) -> None"}, {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1, ! "() -> (UInt16 numItems)"}, {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1, ! "(UInt16 index) -> (ItemReference theItemRef)"}, {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1, ! "(ItemReference theItemRef) -> (UInt16 numFlavors)"}, {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1, ! "(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)"}, {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1, ! "(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)"}, {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1, ! "(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)"}, {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1, ! "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)"}, {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1, ! "(ItemReference theItemRef) -> (Rect itemBounds)"}, {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1, ! "(ItemReference theItemRef, Rect itemBounds) -> None"}, {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1, ! "() -> (AEDesc dropLocation)"}, {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1, ! "(AEDesc dropLocation) -> None"}, {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1, ! "() -> (DragAttributes flags)"}, {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1, ! "() -> (Point mouse, Point globalPinnedMouse)"}, {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1, ! "(Point globalPinnedMouse) -> None"}, {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1, ! "() -> (Point globalInitialMouse)"}, {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1, ! "() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)"}, {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1, ! "(RgnHandle hiliteFrame, Boolean inside) -> None"}, {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1, ! "() -> None"}, {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1, ! "(SInt16 dH, SInt16 dV) -> None"}, {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1, ! "() -> None"}, {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1, ! "(RgnHandle updateRgn) -> None"}, {NULL, NULL, 0} }; --- 685,741 ---- static PyMethodDef DragObj_methods[] = { {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1, ! PyDoc_STR("() -> None")}, {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1, ! PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None")}, {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1, ! PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None")}, {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1, ! PyDoc_STR("(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None")}, {"ChangeDragBehaviors", (PyCFunction)DragObj_ChangeDragBehaviors, 1, ! PyDoc_STR("(DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None")}, {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1, ! PyDoc_STR("(EventRecord theEvent, RgnHandle theRegion) -> None")}, {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1, ! PyDoc_STR("() -> (UInt16 numItems)")}, {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1, ! PyDoc_STR("(UInt16 index) -> (ItemReference theItemRef)")}, {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1, ! PyDoc_STR("(ItemReference theItemRef) -> (UInt16 numFlavors)")}, {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1, ! PyDoc_STR("(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)")}, {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1, ! PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)")}, {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1, ! PyDoc_STR("(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)")}, {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1, ! PyDoc_STR("(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)")}, {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1, ! PyDoc_STR("(ItemReference theItemRef) -> (Rect itemBounds)")}, {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1, ! PyDoc_STR("(ItemReference theItemRef, Rect itemBounds) -> None")}, {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1, ! PyDoc_STR("() -> (AEDesc dropLocation)")}, {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1, ! PyDoc_STR("(AEDesc dropLocation) -> None")}, {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1, ! PyDoc_STR("() -> (DragAttributes flags)")}, {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1, ! PyDoc_STR("() -> (Point mouse, Point globalPinnedMouse)")}, {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1, ! PyDoc_STR("(Point globalPinnedMouse) -> None")}, {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1, ! PyDoc_STR("() -> (Point globalInitialMouse)")}, {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1, ! PyDoc_STR("() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)")}, {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1, ! PyDoc_STR("(RgnHandle hiliteFrame, Boolean inside) -> None")}, {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1, ! PyDoc_STR("() -> None")}, {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1, ! PyDoc_STR("(SInt16 dH, SInt16 dV) -> None")}, {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1, ! PyDoc_STR("() -> None")}, {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1, ! PyDoc_STR("(RgnHandle updateRgn) -> None")}, {NULL, NULL, 0} }; *************** *** 960,980 **** static PyMethodDef Drag_methods[] = { {"NewDrag", (PyCFunction)Drag_NewDrag, 1, ! "() -> (DragRef theDrag)"}, {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1, ! "(WindowPtr window) -> (RGBColor color)"}, {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1, ! "(Point initialMouse) -> (Boolean _rv)"}, {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1, ! "(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None"}, {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1, ! "(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None"}, {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1, ! NULL}, {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1, ! NULL}, {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1, ! NULL}, {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1, ! NULL}, {NULL, NULL, 0} }; --- 960,980 ---- static PyMethodDef Drag_methods[] = { {"NewDrag", (PyCFunction)Drag_NewDrag, 1, ! PyDoc_STR("() -> (DragRef theDrag)")}, {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1, ! PyDoc_STR("(WindowPtr window) -> (RGBColor color)")}, {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1, ! PyDoc_STR("(Point initialMouse) -> (Boolean _rv)")}, {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1, ! PyDoc_STR("(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")}, {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1, ! PyDoc_STR("(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None")}, {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1, ! PyDoc_STR(NULL)}, {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1, ! PyDoc_STR(NULL)}, {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1, ! PyDoc_STR(NULL)}, {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1, ! PyDoc_STR(NULL)}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon _IBCarbon.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv18405/ibcarbon Modified Files: _IBCarbon.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _IBCarbon.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/_IBCarbon.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _IBCarbon.c 4 Aug 2002 21:59:37 -0000 1.2 --- _IBCarbon.c 16 Aug 2002 09:09:26 -0000 1.3 *************** *** 131,141 **** static PyMethodDef IBNibRefObj_methods[] = { {"CreateWindowFromNib", (PyCFunction)IBNibRefObj_CreateWindowFromNib, 1, ! "(CFStringRef inName) -> (WindowPtr outWindow)"}, {"CreateMenuFromNib", (PyCFunction)IBNibRefObj_CreateMenuFromNib, 1, ! "(CFStringRef inName) -> (MenuHandle outMenuRef)"}, {"CreateMenuBarFromNib", (PyCFunction)IBNibRefObj_CreateMenuBarFromNib, 1, ! "(CFStringRef inName) -> (Handle outMenuBar)"}, {"SetMenuBarFromNib", (PyCFunction)IBNibRefObj_SetMenuBarFromNib, 1, ! "(CFStringRef inName) -> None"}, {NULL, NULL, 0} }; --- 131,141 ---- static PyMethodDef IBNibRefObj_methods[] = { {"CreateWindowFromNib", (PyCFunction)IBNibRefObj_CreateWindowFromNib, 1, ! PyDoc_STR("(CFStringRef inName) -> (WindowPtr outWindow)")}, {"CreateMenuFromNib", (PyCFunction)IBNibRefObj_CreateMenuFromNib, 1, ! PyDoc_STR("(CFStringRef inName) -> (MenuHandle outMenuRef)")}, {"CreateMenuBarFromNib", (PyCFunction)IBNibRefObj_CreateMenuBarFromNib, 1, ! PyDoc_STR("(CFStringRef inName) -> (Handle outMenuBar)")}, {"SetMenuBarFromNib", (PyCFunction)IBNibRefObj_SetMenuBarFromNib, 1, ! PyDoc_STR("(CFStringRef inName) -> None")}, {NULL, NULL, 0} }; *************** *** 197,201 **** static PyMethodDef IBCarbon_methods[] = { {"CreateNibReference", (PyCFunction)IBCarbon_CreateNibReference, 1, ! "(CFStringRef inNibName) -> (IBNibRef outNibRef)"}, {NULL, NULL, 0} }; --- 197,201 ---- static PyMethodDef IBCarbon_methods[] = { {"CreateNibReference", (PyCFunction)IBCarbon_CreateNibReference, 1, ! PyDoc_STR("(CFStringRef inNibName) -> (IBNibRef outNibRef)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:58 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:58 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory usw-pr-cvs1:/tmp/cvs-serv18405/help Modified Files: _Helpmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Helpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/_Helpmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _Helpmodule.c 18 Dec 2001 15:37:39 -0000 1.5 --- _Helpmodule.c 16 Aug 2002 09:09:26 -0000 1.6 *************** *** 250,282 **** static PyMethodDef Help_methods[] = { {"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1, ! "() -> (MenuRef mh)"}, {"HMRemoveBalloon", (PyCFunction)Help_HMRemoveBalloon, 1, ! "() -> None"}, {"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1, ! "() -> (Boolean _rv)"}, {"HMGetBalloons", (PyCFunction)Help_HMGetBalloons, 1, ! "() -> (Boolean _rv)"}, {"HMSetBalloons", (PyCFunction)Help_HMSetBalloons, 1, ! "(Boolean flag) -> None"}, {"HMSetFont", (PyCFunction)Help_HMSetFont, 1, ! "(SInt16 font) -> None"}, {"HMSetFontSize", (PyCFunction)Help_HMSetFontSize, 1, ! "(UInt16 fontSize) -> None"}, {"HMGetFont", (PyCFunction)Help_HMGetFont, 1, ! "() -> (SInt16 font)"}, {"HMGetFontSize", (PyCFunction)Help_HMGetFontSize, 1, ! "() -> (UInt16 fontSize)"}, {"HMSetDialogResID", (PyCFunction)Help_HMSetDialogResID, 1, ! "(SInt16 resID) -> None"}, {"HMSetMenuResID", (PyCFunction)Help_HMSetMenuResID, 1, ! "(SInt16 menuID, SInt16 resID) -> None"}, {"HMScanTemplateItems", (PyCFunction)Help_HMScanTemplateItems, 1, ! "(SInt16 whichID, SInt16 whichResFile, ResType whichType) -> None"}, {"HMGetDialogResID", (PyCFunction)Help_HMGetDialogResID, 1, ! "() -> (SInt16 resID)"}, {"HMGetMenuResID", (PyCFunction)Help_HMGetMenuResID, 1, ! "(SInt16 menuID) -> (SInt16 resID)"}, {"HMGetBalloonWindow", (PyCFunction)Help_HMGetBalloonWindow, 1, ! "() -> (WindowPtr window)"}, {NULL, NULL, 0} }; --- 250,282 ---- static PyMethodDef Help_methods[] = { {"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1, ! PyDoc_STR("() -> (MenuRef mh)")}, {"HMRemoveBalloon", (PyCFunction)Help_HMRemoveBalloon, 1, ! PyDoc_STR("() -> None")}, {"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"HMGetBalloons", (PyCFunction)Help_HMGetBalloons, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"HMSetBalloons", (PyCFunction)Help_HMSetBalloons, 1, ! PyDoc_STR("(Boolean flag) -> None")}, {"HMSetFont", (PyCFunction)Help_HMSetFont, 1, ! PyDoc_STR("(SInt16 font) -> None")}, {"HMSetFontSize", (PyCFunction)Help_HMSetFontSize, 1, ! PyDoc_STR("(UInt16 fontSize) -> None")}, {"HMGetFont", (PyCFunction)Help_HMGetFont, 1, ! PyDoc_STR("() -> (SInt16 font)")}, {"HMGetFontSize", (PyCFunction)Help_HMGetFontSize, 1, ! PyDoc_STR("() -> (UInt16 fontSize)")}, {"HMSetDialogResID", (PyCFunction)Help_HMSetDialogResID, 1, ! PyDoc_STR("(SInt16 resID) -> None")}, {"HMSetMenuResID", (PyCFunction)Help_HMSetMenuResID, 1, ! PyDoc_STR("(SInt16 menuID, SInt16 resID) -> None")}, {"HMScanTemplateItems", (PyCFunction)Help_HMScanTemplateItems, 1, ! PyDoc_STR("(SInt16 whichID, SInt16 whichResFile, ResType whichType) -> None")}, {"HMGetDialogResID", (PyCFunction)Help_HMGetDialogResID, 1, ! PyDoc_STR("() -> (SInt16 resID)")}, {"HMGetMenuResID", (PyCFunction)Help_HMGetMenuResID, 1, ! PyDoc_STR("(SInt16 menuID) -> (SInt16 resID)")}, {"HMGetBalloonWindow", (PyCFunction)Help_HMGetBalloonWindow, 1, ! PyDoc_STR("() -> (WindowPtr window)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:10:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:10:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/icn _Icnmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory usw-pr-cvs1:/tmp/cvs-serv18405/icn Modified Files: _Icnmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Icnmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/_Icnmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _Icnmodule.c 24 Mar 2002 23:03:23 -0000 1.5 --- _Icnmodule.c 16 Aug 2002 09:09:27 -0000 1.6 *************** *** 1443,1581 **** static PyMethodDef Icn_methods[] = { {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1, ! "(SInt16 iconID) -> (CIconHandle _rv)"}, {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1, ! "(Rect theRect, CIconHandle theIcon) -> None"}, {"DisposeCIcon", (PyCFunction)Icn_DisposeCIcon, 1, ! "(CIconHandle theIcon) -> None"}, {"GetIcon", (PyCFunction)Icn_GetIcon, 1, ! "(SInt16 iconID) -> (Handle _rv)"}, {"PlotIcon", (PyCFunction)Icn_PlotIcon, 1, ! "(Rect theRect, Handle theIcon) -> None"}, {"PlotIconID", (PyCFunction)Icn_PlotIconID, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, SInt16 theResID) -> None"}, {"NewIconSuite", (PyCFunction)Icn_NewIconSuite, 1, ! "() -> (IconSuiteRef theIconSuite)"}, {"AddIconToSuite", (PyCFunction)Icn_AddIconToSuite, 1, ! "(Handle theIconData, IconSuiteRef theSuite, ResType theType) -> None"}, {"GetIconFromSuite", (PyCFunction)Icn_GetIconFromSuite, 1, ! "(IconSuiteRef theSuite, ResType theType) -> (Handle theIconData)"}, {"GetIconSuite", (PyCFunction)Icn_GetIconSuite, 1, ! "(SInt16 theResID, IconSelectorValue selector) -> (IconSuiteRef theIconSuite)"}, {"DisposeIconSuite", (PyCFunction)Icn_DisposeIconSuite, 1, ! "(IconSuiteRef theIconSuite, Boolean disposeData) -> None"}, {"PlotIconSuite", (PyCFunction)Icn_PlotIconSuite, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconSuiteRef theIconSuite) -> None"}, {"LoadIconCache", (PyCFunction)Icn_LoadIconCache, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconCacheRef theIconCache) -> None"}, {"GetLabel", (PyCFunction)Icn_GetLabel, 1, ! "(SInt16 labelNumber, Str255 labelString) -> (RGBColor labelColor)"}, {"PtInIconID", (PyCFunction)Icn_PtInIconID, 1, ! "(Point testPt, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)"}, {"PtInIconSuite", (PyCFunction)Icn_PtInIconSuite, 1, ! "(Point testPt, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)"}, {"RectInIconID", (PyCFunction)Icn_RectInIconID, 1, ! "(Rect testRect, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)"}, {"RectInIconSuite", (PyCFunction)Icn_RectInIconSuite, 1, ! "(Rect testRect, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)"}, {"IconIDToRgn", (PyCFunction)Icn_IconIDToRgn, 1, ! "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> None"}, {"IconSuiteToRgn", (PyCFunction)Icn_IconSuiteToRgn, 1, ! "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> None"}, {"SetSuiteLabel", (PyCFunction)Icn_SetSuiteLabel, 1, ! "(IconSuiteRef theSuite, SInt16 theLabel) -> None"}, {"GetSuiteLabel", (PyCFunction)Icn_GetSuiteLabel, 1, ! "(IconSuiteRef theSuite) -> (SInt16 _rv)"}, {"PlotIconHandle", (PyCFunction)Icn_PlotIconHandle, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon) -> None"}, {"PlotSICNHandle", (PyCFunction)Icn_PlotSICNHandle, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None"}, {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None"}, #if !TARGET_API_MAC_CARBON {"IconServicesTerminate", (PyCFunction)Icn_IconServicesTerminate, 1, ! "() -> None"}, #endif {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1, ! "(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"}, {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1, ! "(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)"}, {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1, ! "(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"}, {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1, ! "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"}, {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1, ! "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"}, {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1, ! "(IconRef theIconRef) -> (UInt16 owners)"}, {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1, ! "(IconRef theIconRef) -> None"}, {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1, ! "(IconRef theIconRef) -> None"}, {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1, ! "(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)"}, {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1, ! "(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)"}, {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1, ! "(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)"}, {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1, ! "(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)"}, {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1, ! "(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)"}, {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1, ! "(OSType creator, OSType iconType) -> None"}, {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1, ! "(IconRef theIconRef) -> None"}, {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1, ! "(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None"}, {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1, ! "(IconRef oldIconRef, IconRef newIconRef) -> None"}, {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1, ! "(IconRef theIconRef) -> None"}, {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1, ! "(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)"}, {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1, ! "(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)"}, {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1, ! "(IconRef theIconRef) -> (Boolean _rv)"}, {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1, ! "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None"}, {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1, ! "(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"}, {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1, ! "(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"}, {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1, ! "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None"}, {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1, ! "(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)"}, {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1, ! "(OSType creator, OSType iconType) -> None"}, {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1, ! "(SInt16 vRefNum) -> None"}, {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1, ! "(SInt16 vRefNum, Boolean enableCustomIcons) -> None"}, {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1, ! "(SInt16 vRefNum) -> (Boolean customIconsEnabled)"}, {"IsIconRefMaskEmpty", (PyCFunction)Icn_IsIconRefMaskEmpty, 1, ! "(IconRef iconRef) -> (Boolean _rv)"}, #if TARGET_API_MAC_CARBON {"GetIconRefVariant", (PyCFunction)Icn_GetIconRefVariant, 1, ! "(IconRef inIconRef, OSType inVariant) -> (IconRef _rv, IconTransformType outTransform)"}, #endif #if TARGET_API_MAC_CARBON {"RegisterIconRefFromIconFile", (PyCFunction)Icn_RegisterIconRefFromIconFile, 1, ! "(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)"}, #endif #if TARGET_API_MAC_CARBON {"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1, ! "(FSSpec iconFile) -> (IconFamilyHandle iconFamily)"}, #endif #if TARGET_API_MAC_CARBON {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1, ! "(IconFamilyHandle iconFamily, FSSpec iconFile) -> None"}, #endif {NULL, NULL, 0} --- 1443,1581 ---- static PyMethodDef Icn_methods[] = { {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1, ! PyDoc_STR("(SInt16 iconID) -> (CIconHandle _rv)")}, {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1, ! PyDoc_STR("(Rect theRect, CIconHandle theIcon) -> None")}, {"DisposeCIcon", (PyCFunction)Icn_DisposeCIcon, 1, ! PyDoc_STR("(CIconHandle theIcon) -> None")}, {"GetIcon", (PyCFunction)Icn_GetIcon, 1, ! PyDoc_STR("(SInt16 iconID) -> (Handle _rv)")}, {"PlotIcon", (PyCFunction)Icn_PlotIcon, 1, ! PyDoc_STR("(Rect theRect, Handle theIcon) -> None")}, {"PlotIconID", (PyCFunction)Icn_PlotIconID, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, SInt16 theResID) -> None")}, {"NewIconSuite", (PyCFunction)Icn_NewIconSuite, 1, ! PyDoc_STR("() -> (IconSuiteRef theIconSuite)")}, {"AddIconToSuite", (PyCFunction)Icn_AddIconToSuite, 1, ! PyDoc_STR("(Handle theIconData, IconSuiteRef theSuite, ResType theType) -> None")}, {"GetIconFromSuite", (PyCFunction)Icn_GetIconFromSuite, 1, ! PyDoc_STR("(IconSuiteRef theSuite, ResType theType) -> (Handle theIconData)")}, {"GetIconSuite", (PyCFunction)Icn_GetIconSuite, 1, ! PyDoc_STR("(SInt16 theResID, IconSelectorValue selector) -> (IconSuiteRef theIconSuite)")}, {"DisposeIconSuite", (PyCFunction)Icn_DisposeIconSuite, 1, ! PyDoc_STR("(IconSuiteRef theIconSuite, Boolean disposeData) -> None")}, {"PlotIconSuite", (PyCFunction)Icn_PlotIconSuite, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconSuiteRef theIconSuite) -> None")}, {"LoadIconCache", (PyCFunction)Icn_LoadIconCache, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconCacheRef theIconCache) -> None")}, {"GetLabel", (PyCFunction)Icn_GetLabel, 1, ! PyDoc_STR("(SInt16 labelNumber, Str255 labelString) -> (RGBColor labelColor)")}, {"PtInIconID", (PyCFunction)Icn_PtInIconID, 1, ! PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)")}, {"PtInIconSuite", (PyCFunction)Icn_PtInIconSuite, 1, ! PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)")}, {"RectInIconID", (PyCFunction)Icn_RectInIconID, 1, ! PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> (Boolean _rv)")}, {"RectInIconSuite", (PyCFunction)Icn_RectInIconSuite, 1, ! PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> (Boolean _rv)")}, {"IconIDToRgn", (PyCFunction)Icn_IconIDToRgn, 1, ! PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, SInt16 iconID) -> None")}, {"IconSuiteToRgn", (PyCFunction)Icn_IconSuiteToRgn, 1, ! PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconSuiteRef theIconSuite) -> None")}, {"SetSuiteLabel", (PyCFunction)Icn_SetSuiteLabel, 1, ! PyDoc_STR("(IconSuiteRef theSuite, SInt16 theLabel) -> None")}, {"GetSuiteLabel", (PyCFunction)Icn_GetSuiteLabel, 1, ! PyDoc_STR("(IconSuiteRef theSuite) -> (SInt16 _rv)")}, {"PlotIconHandle", (PyCFunction)Icn_PlotIconHandle, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theIcon) -> None")}, {"PlotSICNHandle", (PyCFunction)Icn_PlotSICNHandle, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None")}, {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None")}, #if !TARGET_API_MAC_CARBON {"IconServicesTerminate", (PyCFunction)Icn_IconServicesTerminate, 1, ! PyDoc_STR("() -> None")}, #endif {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1, ! PyDoc_STR("(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)")}, {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1, ! PyDoc_STR("(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)")}, {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1, ! PyDoc_STR("(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)")}, {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1, ! PyDoc_STR("(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None")}, {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1, ! PyDoc_STR("(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None")}, {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1, ! PyDoc_STR("(IconRef theIconRef) -> (UInt16 owners)")}, {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1, ! PyDoc_STR("(IconRef theIconRef) -> None")}, {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1, ! PyDoc_STR("(IconRef theIconRef) -> None")}, {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1, ! PyDoc_STR("(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)")}, {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1, ! PyDoc_STR("(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)")}, {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1, ! PyDoc_STR("(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)")}, {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1, ! PyDoc_STR("(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)")}, {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1, ! PyDoc_STR("(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)")}, {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1, ! PyDoc_STR("(OSType creator, OSType iconType) -> None")}, {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1, ! PyDoc_STR("(IconRef theIconRef) -> None")}, {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1, ! PyDoc_STR("(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None")}, {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1, ! PyDoc_STR("(IconRef oldIconRef, IconRef newIconRef) -> None")}, {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1, ! PyDoc_STR("(IconRef theIconRef) -> None")}, {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1, ! PyDoc_STR("(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)")}, {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1, ! PyDoc_STR("(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)")}, {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1, ! PyDoc_STR("(IconRef theIconRef) -> (Boolean _rv)")}, {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1, ! PyDoc_STR("(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None")}, {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1, ! PyDoc_STR("(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)")}, {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1, ! PyDoc_STR("(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)")}, {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1, ! PyDoc_STR("(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None")}, {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1, ! PyDoc_STR("(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)")}, {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1, ! PyDoc_STR("(OSType creator, OSType iconType) -> None")}, {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1, ! PyDoc_STR("(SInt16 vRefNum) -> None")}, {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1, ! PyDoc_STR("(SInt16 vRefNum, Boolean enableCustomIcons) -> None")}, {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1, ! PyDoc_STR("(SInt16 vRefNum) -> (Boolean customIconsEnabled)")}, {"IsIconRefMaskEmpty", (PyCFunction)Icn_IsIconRefMaskEmpty, 1, ! PyDoc_STR("(IconRef iconRef) -> (Boolean _rv)")}, #if TARGET_API_MAC_CARBON {"GetIconRefVariant", (PyCFunction)Icn_GetIconRefVariant, 1, ! PyDoc_STR("(IconRef inIconRef, OSType inVariant) -> (IconRef _rv, IconTransformType outTransform)")}, #endif #if TARGET_API_MAC_CARBON {"RegisterIconRefFromIconFile", (PyCFunction)Icn_RegisterIconRefFromIconFile, 1, ! PyDoc_STR("(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)")}, #endif #if TARGET_API_MAC_CARBON {"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1, ! PyDoc_STR("(FSSpec iconFile) -> (IconFamilyHandle iconFamily)")}, #endif #if TARGET_API_MAC_CARBON {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1, ! PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")}, #endif {NULL, NULL, 0} From jackjansen@users.sourceforge.net Fri Aug 16 10:10:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:10:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/list _Listmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv18405/list Modified Files: _Listmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Listmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/_Listmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Listmodule.c 23 Apr 2002 22:44:32 -0000 1.10 --- _Listmodule.c 16 Aug 2002 09:09:28 -0000 1.11 *************** *** 557,607 **** static PyMethodDef ListObj_methods[] = { {"LAddColumn", (PyCFunction)ListObj_LAddColumn, 1, ! "(short count, short colNum) -> (short _rv)"}, {"LAddRow", (PyCFunction)ListObj_LAddRow, 1, ! "(short count, short rowNum) -> (short _rv)"}, {"LDelColumn", (PyCFunction)ListObj_LDelColumn, 1, ! "(short count, short colNum) -> None"}, {"LDelRow", (PyCFunction)ListObj_LDelRow, 1, ! "(short count, short rowNum) -> None"}, {"LGetSelect", (PyCFunction)ListObj_LGetSelect, 1, ! "(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)"}, {"LLastClick", (PyCFunction)ListObj_LLastClick, 1, ! "() -> (Point _rv)"}, {"LNextCell", (PyCFunction)ListObj_LNextCell, 1, ! "(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)"}, {"LSize", (PyCFunction)ListObj_LSize, 1, ! "(short listWidth, short listHeight) -> None"}, {"LSetDrawingMode", (PyCFunction)ListObj_LSetDrawingMode, 1, ! "(Boolean drawIt) -> None"}, {"LScroll", (PyCFunction)ListObj_LScroll, 1, ! "(short dCols, short dRows) -> None"}, {"LAutoScroll", (PyCFunction)ListObj_LAutoScroll, 1, ! "() -> None"}, {"LUpdate", (PyCFunction)ListObj_LUpdate, 1, ! "(RgnHandle theRgn) -> None"}, {"LActivate", (PyCFunction)ListObj_LActivate, 1, ! "(Boolean act) -> None"}, {"LCellSize", (PyCFunction)ListObj_LCellSize, 1, ! "(Point cSize) -> None"}, {"LClick", (PyCFunction)ListObj_LClick, 1, ! "(Point pt, EventModifiers modifiers) -> (Boolean _rv)"}, {"LAddToCell", (PyCFunction)ListObj_LAddToCell, 1, ! "(Buffer dataPtr, Point theCell) -> None"}, {"LClrCell", (PyCFunction)ListObj_LClrCell, 1, ! "(Point theCell) -> None"}, {"LGetCell", (PyCFunction)ListObj_LGetCell, 1, ! "(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)"}, {"LRect", (PyCFunction)ListObj_LRect, 1, ! "(Point theCell) -> (Rect cellRect)"}, {"LSetCell", (PyCFunction)ListObj_LSetCell, 1, ! "(Buffer dataPtr, Point theCell) -> None"}, {"LSetSelect", (PyCFunction)ListObj_LSetSelect, 1, ! "(Boolean setIt, Point theCell) -> None"}, {"LDraw", (PyCFunction)ListObj_LDraw, 1, ! "(Point theCell) -> None"}, {"LGetCellDataLocation", (PyCFunction)ListObj_LGetCellDataLocation, 1, ! "(Point theCell) -> (short offset, short len)"}, {"as_Resource", (PyCFunction)ListObj_as_Resource, 1, ! "() -> (Handle _rv)"}, {NULL, NULL, 0} }; --- 557,607 ---- static PyMethodDef ListObj_methods[] = { {"LAddColumn", (PyCFunction)ListObj_LAddColumn, 1, ! PyDoc_STR("(short count, short colNum) -> (short _rv)")}, {"LAddRow", (PyCFunction)ListObj_LAddRow, 1, ! PyDoc_STR("(short count, short rowNum) -> (short _rv)")}, {"LDelColumn", (PyCFunction)ListObj_LDelColumn, 1, ! PyDoc_STR("(short count, short colNum) -> None")}, {"LDelRow", (PyCFunction)ListObj_LDelRow, 1, ! PyDoc_STR("(short count, short rowNum) -> None")}, {"LGetSelect", (PyCFunction)ListObj_LGetSelect, 1, ! PyDoc_STR("(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)")}, {"LLastClick", (PyCFunction)ListObj_LLastClick, 1, ! PyDoc_STR("() -> (Point _rv)")}, {"LNextCell", (PyCFunction)ListObj_LNextCell, 1, ! PyDoc_STR("(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)")}, {"LSize", (PyCFunction)ListObj_LSize, 1, ! PyDoc_STR("(short listWidth, short listHeight) -> None")}, {"LSetDrawingMode", (PyCFunction)ListObj_LSetDrawingMode, 1, ! PyDoc_STR("(Boolean drawIt) -> None")}, {"LScroll", (PyCFunction)ListObj_LScroll, 1, ! PyDoc_STR("(short dCols, short dRows) -> None")}, {"LAutoScroll", (PyCFunction)ListObj_LAutoScroll, 1, ! PyDoc_STR("() -> None")}, {"LUpdate", (PyCFunction)ListObj_LUpdate, 1, ! PyDoc_STR("(RgnHandle theRgn) -> None")}, {"LActivate", (PyCFunction)ListObj_LActivate, 1, ! PyDoc_STR("(Boolean act) -> None")}, {"LCellSize", (PyCFunction)ListObj_LCellSize, 1, ! PyDoc_STR("(Point cSize) -> None")}, {"LClick", (PyCFunction)ListObj_LClick, 1, ! PyDoc_STR("(Point pt, EventModifiers modifiers) -> (Boolean _rv)")}, {"LAddToCell", (PyCFunction)ListObj_LAddToCell, 1, ! PyDoc_STR("(Buffer dataPtr, Point theCell) -> None")}, {"LClrCell", (PyCFunction)ListObj_LClrCell, 1, ! PyDoc_STR("(Point theCell) -> None")}, {"LGetCell", (PyCFunction)ListObj_LGetCell, 1, ! PyDoc_STR("(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)")}, {"LRect", (PyCFunction)ListObj_LRect, 1, ! PyDoc_STR("(Point theCell) -> (Rect cellRect)")}, {"LSetCell", (PyCFunction)ListObj_LSetCell, 1, ! PyDoc_STR("(Buffer dataPtr, Point theCell) -> None")}, {"LSetSelect", (PyCFunction)ListObj_LSetSelect, 1, ! PyDoc_STR("(Boolean setIt, Point theCell) -> None")}, {"LDraw", (PyCFunction)ListObj_LDraw, 1, ! PyDoc_STR("(Point theCell) -> None")}, {"LGetCellDataLocation", (PyCFunction)ListObj_LGetCellDataLocation, 1, ! PyDoc_STR("(Point theCell) -> (short offset, short len)")}, {"as_Resource", (PyCFunction)ListObj_as_Resource, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {NULL, NULL, 0} }; *************** *** 1083,1129 **** static PyMethodDef List_methods[] = { {"CreateCustomList", (PyCFunction)List_CreateCustomList, 1, ! "(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)"}, {"LNew", (PyCFunction)List_LNew, 1, ! "(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)"}, {"GetListPort", (PyCFunction)List_GetListPort, 1, ! "(ListHandle list) -> (CGrafPtr _rv)"}, {"GetListVerticalScrollBar", (PyCFunction)List_GetListVerticalScrollBar, 1, ! "(ListHandle list) -> (ControlHandle _rv)"}, {"GetListHorizontalScrollBar", (PyCFunction)List_GetListHorizontalScrollBar, 1, ! "(ListHandle list) -> (ControlHandle _rv)"}, {"GetListActive", (PyCFunction)List_GetListActive, 1, ! "(ListHandle list) -> (Boolean _rv)"}, {"GetListClickTime", (PyCFunction)List_GetListClickTime, 1, ! "(ListHandle list) -> (SInt32 _rv)"}, {"GetListRefCon", (PyCFunction)List_GetListRefCon, 1, ! "(ListHandle list) -> (SInt32 _rv)"}, {"GetListDefinition", (PyCFunction)List_GetListDefinition, 1, ! "(ListHandle list) -> (Handle _rv)"}, {"GetListUserHandle", (PyCFunction)List_GetListUserHandle, 1, ! "(ListHandle list) -> (Handle _rv)"}, {"GetListDataHandle", (PyCFunction)List_GetListDataHandle, 1, ! "(ListHandle list) -> (DataHandle _rv)"}, {"GetListFlags", (PyCFunction)List_GetListFlags, 1, ! "(ListHandle list) -> (OptionBits _rv)"}, {"GetListSelectionFlags", (PyCFunction)List_GetListSelectionFlags, 1, ! "(ListHandle list) -> (OptionBits _rv)"}, {"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1, ! "(ListHandle list, Rect view) -> None"}, {"SetListPort", (PyCFunction)List_SetListPort, 1, ! "(ListHandle list, CGrafPtr port) -> None"}, {"SetListCellIndent", (PyCFunction)List_SetListCellIndent, 1, ! "(ListHandle list, Point indent) -> None"}, {"SetListClickTime", (PyCFunction)List_SetListClickTime, 1, ! "(ListHandle list, SInt32 time) -> None"}, {"SetListRefCon", (PyCFunction)List_SetListRefCon, 1, ! "(ListHandle list, SInt32 refCon) -> None"}, {"SetListUserHandle", (PyCFunction)List_SetListUserHandle, 1, ! "(ListHandle list, Handle userHandle) -> None"}, {"SetListFlags", (PyCFunction)List_SetListFlags, 1, ! "(ListHandle list, OptionBits listFlags) -> None"}, {"SetListSelectionFlags", (PyCFunction)List_SetListSelectionFlags, 1, ! "(ListHandle list, OptionBits selectionFlags) -> None"}, {"as_List", (PyCFunction)List_as_List, 1, ! "(Resource)->List.\nReturns List object (which is not auto-freed!)"}, {NULL, NULL, 0} }; --- 1083,1129 ---- static PyMethodDef List_methods[] = { {"CreateCustomList", (PyCFunction)List_CreateCustomList, 1, ! PyDoc_STR("(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)")}, {"LNew", (PyCFunction)List_LNew, 1, ! PyDoc_STR("(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)")}, {"GetListPort", (PyCFunction)List_GetListPort, 1, ! PyDoc_STR("(ListHandle list) -> (CGrafPtr _rv)")}, {"GetListVerticalScrollBar", (PyCFunction)List_GetListVerticalScrollBar, 1, ! PyDoc_STR("(ListHandle list) -> (ControlHandle _rv)")}, {"GetListHorizontalScrollBar", (PyCFunction)List_GetListHorizontalScrollBar, 1, ! PyDoc_STR("(ListHandle list) -> (ControlHandle _rv)")}, {"GetListActive", (PyCFunction)List_GetListActive, 1, ! PyDoc_STR("(ListHandle list) -> (Boolean _rv)")}, {"GetListClickTime", (PyCFunction)List_GetListClickTime, 1, ! PyDoc_STR("(ListHandle list) -> (SInt32 _rv)")}, {"GetListRefCon", (PyCFunction)List_GetListRefCon, 1, ! PyDoc_STR("(ListHandle list) -> (SInt32 _rv)")}, {"GetListDefinition", (PyCFunction)List_GetListDefinition, 1, ! PyDoc_STR("(ListHandle list) -> (Handle _rv)")}, {"GetListUserHandle", (PyCFunction)List_GetListUserHandle, 1, ! PyDoc_STR("(ListHandle list) -> (Handle _rv)")}, {"GetListDataHandle", (PyCFunction)List_GetListDataHandle, 1, ! PyDoc_STR("(ListHandle list) -> (DataHandle _rv)")}, {"GetListFlags", (PyCFunction)List_GetListFlags, 1, ! PyDoc_STR("(ListHandle list) -> (OptionBits _rv)")}, {"GetListSelectionFlags", (PyCFunction)List_GetListSelectionFlags, 1, ! PyDoc_STR("(ListHandle list) -> (OptionBits _rv)")}, {"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1, ! PyDoc_STR("(ListHandle list, Rect view) -> None")}, {"SetListPort", (PyCFunction)List_SetListPort, 1, ! PyDoc_STR("(ListHandle list, CGrafPtr port) -> None")}, {"SetListCellIndent", (PyCFunction)List_SetListCellIndent, 1, ! PyDoc_STR("(ListHandle list, Point indent) -> None")}, {"SetListClickTime", (PyCFunction)List_SetListClickTime, 1, ! PyDoc_STR("(ListHandle list, SInt32 time) -> None")}, {"SetListRefCon", (PyCFunction)List_SetListRefCon, 1, ! PyDoc_STR("(ListHandle list, SInt32 refCon) -> None")}, {"SetListUserHandle", (PyCFunction)List_SetListUserHandle, 1, ! PyDoc_STR("(ListHandle list, Handle userHandle) -> None")}, {"SetListFlags", (PyCFunction)List_SetListFlags, 1, ! PyDoc_STR("(ListHandle list, OptionBits listFlags) -> None")}, {"SetListSelectionFlags", (PyCFunction)List_SetListSelectionFlags, 1, ! PyDoc_STR("(ListHandle list, OptionBits selectionFlags) -> None")}, {"as_List", (PyCFunction)List_as_List, 1, ! PyDoc_STR("(Resource)->List.\nReturns List object (which is not auto-freed!)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/te _TEmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv18405/te Modified Files: _TEmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _TEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/_TEmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _TEmodule.c 23 Apr 2002 22:42:57 -0000 1.9 --- _TEmodule.c 16 Aug 2002 09:09:31 -0000 1.10 *************** *** 775,851 **** static PyMethodDef TEObj_methods[] = { {"TESetText", (PyCFunction)TEObj_TESetText, 1, ! "(Buffer text) -> None"}, {"TEGetText", (PyCFunction)TEObj_TEGetText, 1, ! "() -> (CharsHandle _rv)"}, {"TEIdle", (PyCFunction)TEObj_TEIdle, 1, ! "() -> None"}, {"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1, ! "(long selStart, long selEnd) -> None"}, {"TEActivate", (PyCFunction)TEObj_TEActivate, 1, ! "() -> None"}, {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1, ! "() -> None"}, {"TEKey", (PyCFunction)TEObj_TEKey, 1, ! "(CharParameter key) -> None"}, {"TECut", (PyCFunction)TEObj_TECut, 1, ! "() -> None"}, {"TECopy", (PyCFunction)TEObj_TECopy, 1, ! "() -> None"}, {"TEPaste", (PyCFunction)TEObj_TEPaste, 1, ! "() -> None"}, {"TEDelete", (PyCFunction)TEObj_TEDelete, 1, ! "() -> None"}, {"TEInsert", (PyCFunction)TEObj_TEInsert, 1, ! "(Buffer text) -> None"}, {"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1, ! "(short just) -> None"}, {"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1, ! "(Rect rUpdate) -> None"}, {"TEScroll", (PyCFunction)TEObj_TEScroll, 1, ! "(short dh, short dv) -> None"}, {"TESelView", (PyCFunction)TEObj_TESelView, 1, ! "() -> None"}, {"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1, ! "(short dh, short dv) -> None"}, {"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1, ! "(Boolean fAuto) -> None"}, {"TECalText", (PyCFunction)TEObj_TECalText, 1, ! "() -> None"}, {"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1, ! "(Point pt) -> (short _rv)"}, {"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1, ! "(short offset) -> (Point _rv)"}, {"TEClick", (PyCFunction)TEObj_TEClick, 1, ! "(Point pt, Boolean fExtend) -> None"}, {"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1, ! "(TEStyleHandle theHandle) -> None"}, {"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1, ! "() -> (TEStyleHandle _rv)"}, {"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1, ! "(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)"}, {"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1, ! "() -> None"}, {"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1, ! "(short mode, TextStyle newStyle, Boolean fRedraw) -> None"}, {"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1, ! "(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None"}, {"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1, ! "() -> (StScrpHandle _rv)"}, {"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1, ! "(Buffer text, StScrpHandle hST) -> None"}, {"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1, ! "(long endLine, long startLine) -> (long _rv)"}, {"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1, ! "(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)"}, {"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1, ! "(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None"}, {"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1, ! "(long rangeStart, long rangeEnd) -> (long _rv)"}, {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1, ! "(short feature, short action) -> (short _rv)"}, {"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1, ! "(RgnHandle region) -> None"}, {"as_Resource", (PyCFunction)TEObj_as_Resource, 1, ! "() -> (Handle _rv)"}, {NULL, NULL, 0} }; --- 775,851 ---- static PyMethodDef TEObj_methods[] = { {"TESetText", (PyCFunction)TEObj_TESetText, 1, ! PyDoc_STR("(Buffer text) -> None")}, {"TEGetText", (PyCFunction)TEObj_TEGetText, 1, ! PyDoc_STR("() -> (CharsHandle _rv)")}, {"TEIdle", (PyCFunction)TEObj_TEIdle, 1, ! PyDoc_STR("() -> None")}, {"TESetSelect", (PyCFunction)TEObj_TESetSelect, 1, ! PyDoc_STR("(long selStart, long selEnd) -> None")}, {"TEActivate", (PyCFunction)TEObj_TEActivate, 1, ! PyDoc_STR("() -> None")}, {"TEDeactivate", (PyCFunction)TEObj_TEDeactivate, 1, ! PyDoc_STR("() -> None")}, {"TEKey", (PyCFunction)TEObj_TEKey, 1, ! PyDoc_STR("(CharParameter key) -> None")}, {"TECut", (PyCFunction)TEObj_TECut, 1, ! PyDoc_STR("() -> None")}, {"TECopy", (PyCFunction)TEObj_TECopy, 1, ! PyDoc_STR("() -> None")}, {"TEPaste", (PyCFunction)TEObj_TEPaste, 1, ! PyDoc_STR("() -> None")}, {"TEDelete", (PyCFunction)TEObj_TEDelete, 1, ! PyDoc_STR("() -> None")}, {"TEInsert", (PyCFunction)TEObj_TEInsert, 1, ! PyDoc_STR("(Buffer text) -> None")}, {"TESetAlignment", (PyCFunction)TEObj_TESetAlignment, 1, ! PyDoc_STR("(short just) -> None")}, {"TEUpdate", (PyCFunction)TEObj_TEUpdate, 1, ! PyDoc_STR("(Rect rUpdate) -> None")}, {"TEScroll", (PyCFunction)TEObj_TEScroll, 1, ! PyDoc_STR("(short dh, short dv) -> None")}, {"TESelView", (PyCFunction)TEObj_TESelView, 1, ! PyDoc_STR("() -> None")}, {"TEPinScroll", (PyCFunction)TEObj_TEPinScroll, 1, ! PyDoc_STR("(short dh, short dv) -> None")}, {"TEAutoView", (PyCFunction)TEObj_TEAutoView, 1, ! PyDoc_STR("(Boolean fAuto) -> None")}, {"TECalText", (PyCFunction)TEObj_TECalText, 1, ! PyDoc_STR("() -> None")}, {"TEGetOffset", (PyCFunction)TEObj_TEGetOffset, 1, ! PyDoc_STR("(Point pt) -> (short _rv)")}, {"TEGetPoint", (PyCFunction)TEObj_TEGetPoint, 1, ! PyDoc_STR("(short offset) -> (Point _rv)")}, {"TEClick", (PyCFunction)TEObj_TEClick, 1, ! PyDoc_STR("(Point pt, Boolean fExtend) -> None")}, {"TESetStyleHandle", (PyCFunction)TEObj_TESetStyleHandle, 1, ! PyDoc_STR("(TEStyleHandle theHandle) -> None")}, {"TEGetStyleHandle", (PyCFunction)TEObj_TEGetStyleHandle, 1, ! PyDoc_STR("() -> (TEStyleHandle _rv)")}, {"TEGetStyle", (PyCFunction)TEObj_TEGetStyle, 1, ! PyDoc_STR("(short offset) -> (TextStyle theStyle, short lineHeight, short fontAscent)")}, {"TEStylePaste", (PyCFunction)TEObj_TEStylePaste, 1, ! PyDoc_STR("() -> None")}, {"TESetStyle", (PyCFunction)TEObj_TESetStyle, 1, ! PyDoc_STR("(short mode, TextStyle newStyle, Boolean fRedraw) -> None")}, {"TEReplaceStyle", (PyCFunction)TEObj_TEReplaceStyle, 1, ! PyDoc_STR("(short mode, TextStyle oldStyle, TextStyle newStyle, Boolean fRedraw) -> None")}, {"TEGetStyleScrapHandle", (PyCFunction)TEObj_TEGetStyleScrapHandle, 1, ! PyDoc_STR("() -> (StScrpHandle _rv)")}, {"TEStyleInsert", (PyCFunction)TEObj_TEStyleInsert, 1, ! PyDoc_STR("(Buffer text, StScrpHandle hST) -> None")}, {"TEGetHeight", (PyCFunction)TEObj_TEGetHeight, 1, ! PyDoc_STR("(long endLine, long startLine) -> (long _rv)")}, {"TEContinuousStyle", (PyCFunction)TEObj_TEContinuousStyle, 1, ! PyDoc_STR("(short mode, TextStyle aStyle) -> (Boolean _rv, short mode, TextStyle aStyle)")}, {"TEUseStyleScrap", (PyCFunction)TEObj_TEUseStyleScrap, 1, ! PyDoc_STR("(long rangeStart, long rangeEnd, StScrpHandle newStyles, Boolean fRedraw) -> None")}, {"TENumStyles", (PyCFunction)TEObj_TENumStyles, 1, ! PyDoc_STR("(long rangeStart, long rangeEnd) -> (long _rv)")}, {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1, ! PyDoc_STR("(short feature, short action) -> (short _rv)")}, {"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1, ! PyDoc_STR("(RgnHandle region) -> None")}, {"as_Resource", (PyCFunction)TEObj_as_Resource, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {NULL, NULL, 0} }; *************** *** 1156,1190 **** static PyMethodDef TE_methods[] = { {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1, ! "() -> (Handle _rv)"}, {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1, ! "() -> (long _rv)"}, {"TENew", (PyCFunction)TE_TENew, 1, ! "(Rect destRect, Rect viewRect) -> (TEHandle _rv)"}, {"TETextBox", (PyCFunction)TE_TETextBox, 1, ! "(Buffer text, Rect box, short just) -> None"}, {"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1, ! "(Rect destRect, Rect viewRect) -> (TEHandle _rv)"}, {"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1, ! "(long length) -> None"}, {"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1, ! "() -> None"}, {"TEToScrap", (PyCFunction)TE_TEToScrap, 1, ! "() -> None"}, #if TARGET_API_MAC_CARBON {"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1, ! "() -> (Handle _rv)"}, #endif #if TARGET_API_MAC_CARBON {"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1, ! "(Handle value) -> None"}, #endif {"LMGetWordRedraw", (PyCFunction)TE_LMGetWordRedraw, 1, ! "() -> (UInt8 _rv)"}, {"LMSetWordRedraw", (PyCFunction)TE_LMSetWordRedraw, 1, ! "(UInt8 value) -> None"}, {"as_TE", (PyCFunction)TE_as_TE, 1, ! "(Handle h) -> (TEHandle _rv)"}, {NULL, NULL, 0} }; --- 1156,1190 ---- static PyMethodDef TE_methods[] = { {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1, ! PyDoc_STR("() -> (long _rv)")}, {"TENew", (PyCFunction)TE_TENew, 1, ! PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")}, {"TETextBox", (PyCFunction)TE_TETextBox, 1, ! PyDoc_STR("(Buffer text, Rect box, short just) -> None")}, {"TEStyleNew", (PyCFunction)TE_TEStyleNew, 1, ! PyDoc_STR("(Rect destRect, Rect viewRect) -> (TEHandle _rv)")}, {"TESetScrapLength", (PyCFunction)TE_TESetScrapLength, 1, ! PyDoc_STR("(long length) -> None")}, {"TEFromScrap", (PyCFunction)TE_TEFromScrap, 1, ! PyDoc_STR("() -> None")}, {"TEToScrap", (PyCFunction)TE_TEToScrap, 1, ! PyDoc_STR("() -> None")}, #if TARGET_API_MAC_CARBON {"TEGetScrapHandle", (PyCFunction)TE_TEGetScrapHandle, 1, ! PyDoc_STR("() -> (Handle _rv)")}, #endif #if TARGET_API_MAC_CARBON {"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1, ! PyDoc_STR("(Handle value) -> None")}, #endif {"LMGetWordRedraw", (PyCFunction)TE_LMGetWordRedraw, 1, ! PyDoc_STR("() -> (UInt8 _rv)")}, {"LMSetWordRedraw", (PyCFunction)TE_LMSetWordRedraw, 1, ! PyDoc_STR("(UInt8 value) -> None")}, {"as_TE", (PyCFunction)TE_as_TE, 1, ! PyDoc_STR("(Handle h) -> (TEHandle _rv)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qt _Qtmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv18405/qt Modified Files: _Qtmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Qtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/_Qtmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Qtmodule.c 23 Apr 2002 22:43:44 -0000 1.8 --- _Qtmodule.c 16 Aug 2002 09:09:30 -0000 1.9 *************** *** 997,1091 **** static PyMethodDef MovieCtlObj_methods[] = { {"MCSetMovie", (PyCFunction)MovieCtlObj_MCSetMovie, 1, ! "(Movie theMovie, WindowPtr movieWindow, Point where) -> (ComponentResult _rv)"}, {"MCGetIndMovie", (PyCFunction)MovieCtlObj_MCGetIndMovie, 1, ! "(short index) -> (Movie _rv)"}, {"MCRemoveAllMovies", (PyCFunction)MovieCtlObj_MCRemoveAllMovies, 1, ! "() -> (ComponentResult _rv)"}, {"MCRemoveAMovie", (PyCFunction)MovieCtlObj_MCRemoveAMovie, 1, ! "(Movie m) -> (ComponentResult _rv)"}, {"MCRemoveMovie", (PyCFunction)MovieCtlObj_MCRemoveMovie, 1, [...1719 lines suppressed...] {"NewTimeBase", (PyCFunction)Qt_NewTimeBase, 1, ! PyDoc_STR("() -> (TimeBase _rv)")}, {"ConvertTime", (PyCFunction)Qt_ConvertTime, 1, ! PyDoc_STR("(TimeBase newBase) -> (TimeRecord theTime)")}, {"ConvertTimeScale", (PyCFunction)Qt_ConvertTimeScale, 1, ! PyDoc_STR("(TimeScale newScale) -> (TimeRecord theTime)")}, {"AddTime", (PyCFunction)Qt_AddTime, 1, ! PyDoc_STR("(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)")}, {"SubtractTime", (PyCFunction)Qt_SubtractTime, 1, ! PyDoc_STR("(TimeRecord dst, TimeRecord src) -> (TimeRecord dst)")}, {"MusicMediaGetIndexedTunePlayer", (PyCFunction)Qt_MusicMediaGetIndexedTunePlayer, 1, ! PyDoc_STR("(ComponentInstance ti, long sampleDescIndex) -> (ComponentResult _rv, ComponentInstance tp)")}, {"AlignWindow", (PyCFunction)Qt_AlignWindow, 1, ! PyDoc_STR("(WindowPtr wp, Boolean front) -> None")}, {"DragAlignedWindow", (PyCFunction)Qt_DragAlignedWindow, 1, ! PyDoc_STR("(WindowPtr wp, Point startPt, Rect boundsRect) -> None")}, {"MoviesTask", (PyCFunction)Qt_MoviesTask, 1, ! PyDoc_STR("(long maxMilliSecToUse) -> None")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qdoffs _Qdoffsmodule.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv18405/qdoffs Modified Files: _Qdoffsmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Qdoffsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/_Qdoffsmodule.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** _Qdoffsmodule.c 23 Apr 2002 22:43:50 -0000 1.8 --- _Qdoffsmodule.c 16 Aug 2002 09:09:30 -0000 1.9 *************** *** 124,132 **** static PyMethodDef GWorldObj_methods[] = { {"GetGWorldDevice", (PyCFunction)GWorldObj_GetGWorldDevice, 1, ! "() -> (GDHandle _rv)"}, {"GetGWorldPixMap", (PyCFunction)GWorldObj_GetGWorldPixMap, 1, ! "() -> (PixMapHandle _rv)"}, {"as_GrafPtr", (PyCFunction)GWorldObj_as_GrafPtr, 1, ! "() -> (GrafPtr _rv)"}, {NULL, NULL, 0} }; --- 124,132 ---- static PyMethodDef GWorldObj_methods[] = { {"GetGWorldDevice", (PyCFunction)GWorldObj_GetGWorldDevice, 1, ! PyDoc_STR("() -> (GDHandle _rv)")}, {"GetGWorldPixMap", (PyCFunction)GWorldObj_GetGWorldPixMap, 1, ! PyDoc_STR("() -> (PixMapHandle _rv)")}, {"as_GrafPtr", (PyCFunction)GWorldObj_as_GrafPtr, 1, ! PyDoc_STR("() -> (GrafPtr _rv)")}, {NULL, NULL, 0} }; *************** *** 605,653 **** static PyMethodDef Qdoffs_methods[] = { {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1, ! "(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)"}, {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1, ! "(PixMapHandle pm) -> (Boolean _rv)"}, {"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1, ! "(PixMapHandle pm) -> None"}, {"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1, ! "(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)"}, {"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1, ! "() -> (CGrafPtr port, GDHandle gdh)"}, {"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1, ! "(CGrafPtr port, GDHandle gdh) -> None"}, {"CTabChanged", (PyCFunction)Qdoffs_CTabChanged, 1, ! "(CTabHandle ctab) -> None"}, {"PixPatChanged", (PyCFunction)Qdoffs_PixPatChanged, 1, ! "(PixPatHandle ppat) -> None"}, {"PortChanged", (PyCFunction)Qdoffs_PortChanged, 1, ! "(GrafPtr port) -> None"}, {"GDeviceChanged", (PyCFunction)Qdoffs_GDeviceChanged, 1, ! "(GDHandle gdh) -> None"}, {"AllowPurgePixels", (PyCFunction)Qdoffs_AllowPurgePixels, 1, ! "(PixMapHandle pm) -> None"}, {"NoPurgePixels", (PyCFunction)Qdoffs_NoPurgePixels, 1, ! "(PixMapHandle pm) -> None"}, {"GetPixelsState", (PyCFunction)Qdoffs_GetPixelsState, 1, ! "(PixMapHandle pm) -> (GWorldFlags _rv)"}, {"SetPixelsState", (PyCFunction)Qdoffs_SetPixelsState, 1, ! "(PixMapHandle pm, GWorldFlags state) -> None"}, {"GetPixRowBytes", (PyCFunction)Qdoffs_GetPixRowBytes, 1, ! "(PixMapHandle pm) -> (long _rv)"}, {"NewScreenBuffer", (PyCFunction)Qdoffs_NewScreenBuffer, 1, ! "(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)"}, {"DisposeScreenBuffer", (PyCFunction)Qdoffs_DisposeScreenBuffer, 1, ! "(PixMapHandle offscreenPixMap) -> None"}, {"QDDone", (PyCFunction)Qdoffs_QDDone, 1, ! "(GrafPtr port) -> (Boolean _rv)"}, {"OffscreenVersion", (PyCFunction)Qdoffs_OffscreenVersion, 1, ! "() -> (long _rv)"}, {"NewTempScreenBuffer", (PyCFunction)Qdoffs_NewTempScreenBuffer, 1, ! "(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)"}, {"PixMap32Bit", (PyCFunction)Qdoffs_PixMap32Bit, 1, ! "(PixMapHandle pmHandle) -> (Boolean _rv)"}, {"GetPixMapBytes", (PyCFunction)Qdoffs_GetPixMapBytes, 1, ! "(pixmap, int start, int size) -> string. Return bytes from the pixmap"}, {"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1, ! "(pixmap, int start, string data). Store bytes into the pixmap"}, {NULL, NULL, 0} }; --- 605,653 ---- static PyMethodDef Qdoffs_methods[] = { {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1, ! PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")}, {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1, ! PyDoc_STR("(PixMapHandle pm) -> (Boolean _rv)")}, {"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1, ! PyDoc_STR("(PixMapHandle pm) -> None")}, {"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1, ! PyDoc_STR("(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)")}, {"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1, ! PyDoc_STR("() -> (CGrafPtr port, GDHandle gdh)")}, {"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1, ! PyDoc_STR("(CGrafPtr port, GDHandle gdh) -> None")}, {"CTabChanged", (PyCFunction)Qdoffs_CTabChanged, 1, ! PyDoc_STR("(CTabHandle ctab) -> None")}, {"PixPatChanged", (PyCFunction)Qdoffs_PixPatChanged, 1, ! PyDoc_STR("(PixPatHandle ppat) -> None")}, {"PortChanged", (PyCFunction)Qdoffs_PortChanged, 1, ! PyDoc_STR("(GrafPtr port) -> None")}, {"GDeviceChanged", (PyCFunction)Qdoffs_GDeviceChanged, 1, ! PyDoc_STR("(GDHandle gdh) -> None")}, {"AllowPurgePixels", (PyCFunction)Qdoffs_AllowPurgePixels, 1, ! PyDoc_STR("(PixMapHandle pm) -> None")}, {"NoPurgePixels", (PyCFunction)Qdoffs_NoPurgePixels, 1, ! PyDoc_STR("(PixMapHandle pm) -> None")}, {"GetPixelsState", (PyCFunction)Qdoffs_GetPixelsState, 1, ! PyDoc_STR("(PixMapHandle pm) -> (GWorldFlags _rv)")}, {"SetPixelsState", (PyCFunction)Qdoffs_SetPixelsState, 1, ! PyDoc_STR("(PixMapHandle pm, GWorldFlags state) -> None")}, {"GetPixRowBytes", (PyCFunction)Qdoffs_GetPixRowBytes, 1, ! PyDoc_STR("(PixMapHandle pm) -> (long _rv)")}, {"NewScreenBuffer", (PyCFunction)Qdoffs_NewScreenBuffer, 1, ! PyDoc_STR("(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)")}, {"DisposeScreenBuffer", (PyCFunction)Qdoffs_DisposeScreenBuffer, 1, ! PyDoc_STR("(PixMapHandle offscreenPixMap) -> None")}, {"QDDone", (PyCFunction)Qdoffs_QDDone, 1, ! PyDoc_STR("(GrafPtr port) -> (Boolean _rv)")}, {"OffscreenVersion", (PyCFunction)Qdoffs_OffscreenVersion, 1, ! PyDoc_STR("() -> (long _rv)")}, {"NewTempScreenBuffer", (PyCFunction)Qdoffs_NewTempScreenBuffer, 1, ! PyDoc_STR("(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)")}, {"PixMap32Bit", (PyCFunction)Qdoffs_PixMap32Bit, 1, ! PyDoc_STR("(PixMapHandle pmHandle) -> (Boolean _rv)")}, {"GetPixMapBytes", (PyCFunction)Qdoffs_GetPixMapBytes, 1, ! PyDoc_STR("(pixmap, int start, int size) -> string. Return bytes from the pixmap")}, {"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1, ! PyDoc_STR("(pixmap, int start, string data). Store bytes into the pixmap")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd _Qdmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv18405/qd Modified Files: _Qdmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/_Qdmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Qdmodule.c 17 Jul 2002 16:30:35 -0000 1.10 --- _Qdmodule.c 16 Aug 2002 09:09:29 -0000 1.11 *************** *** 471,477 **** static PyMethodDef BMObj_methods[] = { {"getdata", (PyCFunction)BMObj_getdata, 1, ! "(int start, int size) -> string. Return bytes from the bitmap"}, {"putdata", (PyCFunction)BMObj_putdata, 1, ! "(int start, string data). Store bytes into the bitmap"}, {NULL, NULL, 0} }; --- 471,477 ---- static PyMethodDef BMObj_methods[] = { {"getdata", (PyCFunction)BMObj_getdata, 1, [...1312 lines suppressed...] {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1, ! PyDoc_STR("(RgnHandle rgn) -> None")}, {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1, ! PyDoc_STR("(RgnHandle rgn) -> None")}, {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1, ! PyDoc_STR("(RgnHandle rgn) -> None")}, {"FillRgn", (PyCFunction)Qd_FillRgn, 1, ! PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")}, {"GetPixel", (PyCFunction)Qd_GetPixel, 1, ! PyDoc_STR("(short h, short v) -> (Boolean _rv)")}, {"PtInRect", (PyCFunction)Qd_PtInRect, 1, ! PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")}, {"DrawText", (PyCFunction)Qd_DrawText, 1, ! PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")}, {"BitMap", (PyCFunction)Qd_BitMap, 1, ! PyDoc_STR("Take (string, int, Rect) argument and create BitMap")}, {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1, ! PyDoc_STR("Take string BitMap and turn into BitMap object")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:31 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu _Menumodule.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv18405/menu Modified Files: _Menumodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Menumodule.c 23 Apr 2002 22:44:26 -0000 1.11 --- _Menumodule.c 16 Aug 2002 09:09:28 -0000 1.12 *************** *** 2598,3001 **** static PyMethodDef MenuObj_methods[] = { {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1, ! "() -> None"}, {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, ! "() -> None"}, #if !TARGET_API_MAC_CARBON {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1, ! "() -> (short _rv)"}, #endif [...1088 lines suppressed...] #if TARGET_API_MAC_CARBON {"SetMenuCommandMark", (PyCFunction)Menu_SetMenuCommandMark, 1, ! PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None")}, #endif #if TARGET_API_MAC_CARBON {"GetMenuCommandMark", (PyCFunction)Menu_GetMenuCommandMark, 1, ! PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)")}, #endif #if TARGET_API_MAC_CARBON {"GetMenuCommandPropertySize", (PyCFunction)Menu_GetMenuCommandPropertySize, 1, ! PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")}, #endif #if TARGET_API_MAC_CARBON {"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1, ! PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, #endif {NULL, NULL, 0} From jackjansen@users.sourceforge.net Fri Aug 16 10:09:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/snd _Sndmodule.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv18405/snd Modified Files: _Sndmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Sndmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/_Sndmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Sndmodule.c 17 Jul 2002 16:30:35 -0000 1.9 --- _Sndmodule.c 16 Aug 2002 09:09:30 -0000 1.10 *************** *** 272,301 **** static PyMethodDef SndCh_methods[] = { {"SndDoCommand", (PyCFunction)SndCh_SndDoCommand, 1, ! "(SndCommand cmd, Boolean noWait) -> None"}, {"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1, ! "(SndCommand cmd) -> None"}, {"SndPlay", (PyCFunction)SndCh_SndPlay, 1, ! "(SndListHandle sndHandle, Boolean async) -> None"}, #if !TARGET_API_MAC_CARBON {"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1, ! "(short fRefNum, short resNum, long bufferSize, Boolean async) -> None"}, #endif #if !TARGET_API_MAC_CARBON {"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_CARBON {"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1, ! "(Boolean quietNow) -> None"}, #endif {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1, ! "(short theLength) -> (SCStatus theStatus)"}, {"SndGetInfo", (PyCFunction)SndCh_SndGetInfo, 1, ! "(OSType selector, void * infoPtr) -> None"}, {"SndSetInfo", (PyCFunction)SndCh_SndSetInfo, 1, ! "(OSType selector, void * infoPtr) -> None"}, {NULL, NULL, 0} }; --- 272,301 ---- static PyMethodDef SndCh_methods[] = { {"SndDoCommand", (PyCFunction)SndCh_SndDoCommand, 1, ! PyDoc_STR("(SndCommand cmd, Boolean noWait) -> None")}, {"SndDoImmediate", (PyCFunction)SndCh_SndDoImmediate, 1, ! PyDoc_STR("(SndCommand cmd) -> None")}, {"SndPlay", (PyCFunction)SndCh_SndPlay, 1, ! PyDoc_STR("(SndListHandle sndHandle, Boolean async) -> None")}, #if !TARGET_API_MAC_CARBON {"SndStartFilePlay", (PyCFunction)SndCh_SndStartFilePlay, 1, ! PyDoc_STR("(short fRefNum, short resNum, long bufferSize, Boolean async) -> None")}, #endif #if !TARGET_API_MAC_CARBON {"SndPauseFilePlay", (PyCFunction)SndCh_SndPauseFilePlay, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_CARBON {"SndStopFilePlay", (PyCFunction)SndCh_SndStopFilePlay, 1, ! PyDoc_STR("(Boolean quietNow) -> None")}, #endif {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1, ! PyDoc_STR("(short theLength) -> (SCStatus theStatus)")}, {"SndGetInfo", (PyCFunction)SndCh_SndGetInfo, 1, ! PyDoc_STR("(OSType selector, void * infoPtr) -> None")}, {"SndSetInfo", (PyCFunction)SndCh_SndSetInfo, 1, ! PyDoc_STR("(OSType selector, void * infoPtr) -> None")}, {NULL, NULL, 0} }; *************** *** 1293,1399 **** static PyMethodDef Snd_methods[] = { {"SPB", (PyCFunction)Snd_SPB, 1, ! NULL}, {"SysBeep", (PyCFunction)Snd_SysBeep, 1, ! "(short duration) -> None"}, {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1, ! "(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)"}, #if !TARGET_API_MAC_CARBON {"SndControl", (PyCFunction)Snd_SndControl, 1, ! "(short id) -> (SndCommand cmd)"}, #endif {"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1, ! "() -> (NumVersion _rv)"}, {"SndManagerStatus", (PyCFunction)Snd_SndManagerStatus, 1, ! "(short theLength) -> (SMStatus theStatus)"}, {"SndGetSysBeepState", (PyCFunction)Snd_SndGetSysBeepState, 1, ! "() -> (short sysBeepState)"}, {"SndSetSysBeepState", (PyCFunction)Snd_SndSetSysBeepState, 1, ! "(short sysBeepState) -> None"}, #if !TARGET_API_MAC_CARBON {"MACEVersion", (PyCFunction)Snd_MACEVersion, 1, ! "() -> (NumVersion _rv)"}, #endif #if !TARGET_API_MAC_CARBON {"Comp3to1", (PyCFunction)Snd_Comp3to1, 1, ! "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, #endif #if !TARGET_API_MAC_CARBON {"Exp1to3", (PyCFunction)Snd_Exp1to3, 1, ! "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, #endif #if !TARGET_API_MAC_CARBON {"Comp6to1", (PyCFunction)Snd_Comp6to1, 1, ! "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, #endif #if !TARGET_API_MAC_CARBON {"Exp1to6", (PyCFunction)Snd_Exp1to6, 1, ! "(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)"}, #endif {"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1, ! "() -> (long level)"}, {"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1, ! "(long level) -> None"}, {"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1, ! "() -> (long level)"}, {"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1, ! "(long level) -> None"}, {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1, ! "(SndListHandle sndHandle) -> (long offset)"}, {"GetCompressionInfo", (PyCFunction)Snd_GetCompressionInfo, 1, ! "(short compressionID, OSType format, short numChannels, short sampleSize) -> (CompressionInfo cp)"}, {"SetSoundPreference", (PyCFunction)Snd_SetSoundPreference, 1, ! "(OSType theType, Handle settings) -> (Str255 name)"}, {"GetSoundPreference", (PyCFunction)Snd_GetSoundPreference, 1, ! "(OSType theType, Handle settings) -> (Str255 name)"}, {"GetCompressionName", (PyCFunction)Snd_GetCompressionName, 1, ! "(OSType compressionType) -> (Str255 compressionName)"}, {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1, ! "() -> (NumVersion _rv)"}, {"SndRecord", (PyCFunction)Snd_SndRecord, 1, ! "(Point corner, OSType quality) -> (SndListHandle sndHandle)"}, #if !TARGET_API_MAC_CARBON {"SndRecordToFile", (PyCFunction)Snd_SndRecordToFile, 1, ! "(Point corner, OSType quality, short fRefNum) -> None"}, #endif {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1, ! "(short deviceRefNum, Str255 deviceName) -> None"}, {"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1, ! "(short deviceRefNum) -> None"}, {"SPBGetIndexedDevice", (PyCFunction)Snd_SPBGetIndexedDevice, 1, ! "(short count) -> (Str255 deviceName, Handle deviceIconHandle)"}, {"SPBOpenDevice", (PyCFunction)Snd_SPBOpenDevice, 1, ! "(Str255 deviceName, short permission) -> (long inRefNum)"}, {"SPBCloseDevice", (PyCFunction)Snd_SPBCloseDevice, 1, ! "(long inRefNum) -> None"}, {"SPBRecord", (PyCFunction)Snd_SPBRecord, 1, ! "(SPBPtr inParamPtr, Boolean asynchFlag) -> None"}, #if !TARGET_API_MAC_CARBON {"SPBRecordToFile", (PyCFunction)Snd_SPBRecordToFile, 1, ! "(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag) -> None"}, #endif {"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1, ! "(long inRefNum) -> None"}, {"SPBResumeRecording", (PyCFunction)Snd_SPBResumeRecording, 1, ! "(long inRefNum) -> None"}, {"SPBStopRecording", (PyCFunction)Snd_SPBStopRecording, 1, ! "(long inRefNum) -> None"}, {"SPBGetRecordingStatus", (PyCFunction)Snd_SPBGetRecordingStatus, 1, ! "(long inRefNum) -> (short recordingStatus, short meterLevel, unsigned long totalSamplesToRecord, unsigned long numberOfSamplesRecorded, unsigned long totalMsecsToRecord, unsigned long numberOfMsecsRecorded)"}, {"SPBGetDeviceInfo", (PyCFunction)Snd_SPBGetDeviceInfo, 1, ! "(long inRefNum, OSType infoType, void * infoData) -> None"}, {"SPBSetDeviceInfo", (PyCFunction)Snd_SPBSetDeviceInfo, 1, ! "(long inRefNum, OSType infoType, void * infoData) -> None"}, {"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1, ! "(long inRefNum) -> (long milliseconds)"}, {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1, ! "(long inRefNum) -> (long byteCount)"}, {NULL, NULL, 0} }; --- 1293,1399 ---- static PyMethodDef Snd_methods[] = { {"SPB", (PyCFunction)Snd_SPB, 1, ! PyDoc_STR(NULL)}, {"SysBeep", (PyCFunction)Snd_SysBeep, 1, ! PyDoc_STR("(short duration) -> None")}, {"SndNewChannel", (PyCFunction)Snd_SndNewChannel, 1, ! PyDoc_STR("(short synth, long init, PyObject* userRoutine) -> (SndChannelPtr chan)")}, #if !TARGET_API_MAC_CARBON {"SndControl", (PyCFunction)Snd_SndControl, 1, ! PyDoc_STR("(short id) -> (SndCommand cmd)")}, #endif {"SndSoundManagerVersion", (PyCFunction)Snd_SndSoundManagerVersion, 1, ! PyDoc_STR("() -> (NumVersion _rv)")}, {"SndManagerStatus", (PyCFunction)Snd_SndManagerStatus, 1, ! PyDoc_STR("(short theLength) -> (SMStatus theStatus)")}, {"SndGetSysBeepState", (PyCFunction)Snd_SndGetSysBeepState, 1, ! PyDoc_STR("() -> (short sysBeepState)")}, {"SndSetSysBeepState", (PyCFunction)Snd_SndSetSysBeepState, 1, ! PyDoc_STR("(short sysBeepState) -> None")}, #if !TARGET_API_MAC_CARBON {"MACEVersion", (PyCFunction)Snd_MACEVersion, 1, ! PyDoc_STR("() -> (NumVersion _rv)")}, #endif #if !TARGET_API_MAC_CARBON {"Comp3to1", (PyCFunction)Snd_Comp3to1, 1, ! PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")}, #endif #if !TARGET_API_MAC_CARBON {"Exp1to3", (PyCFunction)Snd_Exp1to3, 1, ! PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")}, #endif #if !TARGET_API_MAC_CARBON {"Comp6to1", (PyCFunction)Snd_Comp6to1, 1, ! PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")}, #endif #if !TARGET_API_MAC_CARBON {"Exp1to6", (PyCFunction)Snd_Exp1to6, 1, ! PyDoc_STR("(Buffer buffer, StateBlock state, unsigned long numChannels, unsigned long whichChannel) -> (Buffer buffer, StateBlock state)")}, #endif {"GetSysBeepVolume", (PyCFunction)Snd_GetSysBeepVolume, 1, ! PyDoc_STR("() -> (long level)")}, {"SetSysBeepVolume", (PyCFunction)Snd_SetSysBeepVolume, 1, ! PyDoc_STR("(long level) -> None")}, {"GetDefaultOutputVolume", (PyCFunction)Snd_GetDefaultOutputVolume, 1, ! PyDoc_STR("() -> (long level)")}, {"SetDefaultOutputVolume", (PyCFunction)Snd_SetDefaultOutputVolume, 1, ! PyDoc_STR("(long level) -> None")}, {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1, ! PyDoc_STR("(SndListHandle sndHandle) -> (long offset)")}, {"GetCompressionInfo", (PyCFunction)Snd_GetCompressionInfo, 1, ! PyDoc_STR("(short compressionID, OSType format, short numChannels, short sampleSize) -> (CompressionInfo cp)")}, {"SetSoundPreference", (PyCFunction)Snd_SetSoundPreference, 1, ! PyDoc_STR("(OSType theType, Handle settings) -> (Str255 name)")}, {"GetSoundPreference", (PyCFunction)Snd_GetSoundPreference, 1, ! PyDoc_STR("(OSType theType, Handle settings) -> (Str255 name)")}, {"GetCompressionName", (PyCFunction)Snd_GetCompressionName, 1, ! PyDoc_STR("(OSType compressionType) -> (Str255 compressionName)")}, {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1, ! PyDoc_STR("() -> (NumVersion _rv)")}, {"SndRecord", (PyCFunction)Snd_SndRecord, 1, ! PyDoc_STR("(Point corner, OSType quality) -> (SndListHandle sndHandle)")}, #if !TARGET_API_MAC_CARBON {"SndRecordToFile", (PyCFunction)Snd_SndRecordToFile, 1, ! PyDoc_STR("(Point corner, OSType quality, short fRefNum) -> None")}, #endif {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1, ! PyDoc_STR("(short deviceRefNum, Str255 deviceName) -> None")}, {"SPBSignOutDevice", (PyCFunction)Snd_SPBSignOutDevice, 1, ! PyDoc_STR("(short deviceRefNum) -> None")}, {"SPBGetIndexedDevice", (PyCFunction)Snd_SPBGetIndexedDevice, 1, ! PyDoc_STR("(short count) -> (Str255 deviceName, Handle deviceIconHandle)")}, {"SPBOpenDevice", (PyCFunction)Snd_SPBOpenDevice, 1, ! PyDoc_STR("(Str255 deviceName, short permission) -> (long inRefNum)")}, {"SPBCloseDevice", (PyCFunction)Snd_SPBCloseDevice, 1, ! PyDoc_STR("(long inRefNum) -> None")}, {"SPBRecord", (PyCFunction)Snd_SPBRecord, 1, ! PyDoc_STR("(SPBPtr inParamPtr, Boolean asynchFlag) -> None")}, #if !TARGET_API_MAC_CARBON {"SPBRecordToFile", (PyCFunction)Snd_SPBRecordToFile, 1, ! PyDoc_STR("(short fRefNum, SPBPtr inParamPtr, Boolean asynchFlag) -> None")}, #endif {"SPBPauseRecording", (PyCFunction)Snd_SPBPauseRecording, 1, ! PyDoc_STR("(long inRefNum) -> None")}, {"SPBResumeRecording", (PyCFunction)Snd_SPBResumeRecording, 1, ! PyDoc_STR("(long inRefNum) -> None")}, {"SPBStopRecording", (PyCFunction)Snd_SPBStopRecording, 1, ! PyDoc_STR("(long inRefNum) -> None")}, {"SPBGetRecordingStatus", (PyCFunction)Snd_SPBGetRecordingStatus, 1, ! PyDoc_STR("(long inRefNum) -> (short recordingStatus, short meterLevel, unsigned long totalSamplesToRecord, unsigned long numberOfSamplesRecorded, unsigned long totalMsecsToRecord, unsigned long numberOfMsecsRecorded)")}, {"SPBGetDeviceInfo", (PyCFunction)Snd_SPBGetDeviceInfo, 1, ! PyDoc_STR("(long inRefNum, OSType infoType, void * infoData) -> None")}, {"SPBSetDeviceInfo", (PyCFunction)Snd_SPBSetDeviceInfo, 1, ! PyDoc_STR("(long inRefNum, OSType infoType, void * infoData) -> None")}, {"SPBMillisecondsToBytes", (PyCFunction)Snd_SPBMillisecondsToBytes, 1, ! PyDoc_STR("(long inRefNum) -> (long milliseconds)")}, {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1, ! PyDoc_STR("(long inRefNum) -> (long byteCount)")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:32 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/res _Resmodule.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv18405/res Modified Files: _Resmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _Resmodule.c 23 Apr 2002 22:43:14 -0000 1.12 --- _Resmodule.c 16 Aug 2002 09:09:30 -0000 1.13 *************** *** 502,549 **** static PyMethodDef ResObj_methods[] = { {"HomeResFile", (PyCFunction)ResObj_HomeResFile, 1, ! "() -> (short _rv)"}, {"MacLoadResource", (PyCFunction)ResObj_MacLoadResource, 1, ! "() -> None"}, {"ReleaseResource", (PyCFunction)ResObj_ReleaseResource, 1, ! "() -> None"}, {"DetachResource", (PyCFunction)ResObj_DetachResource, 1, ! "() -> None"}, {"GetResAttrs", (PyCFunction)ResObj_GetResAttrs, 1, ! "() -> (short _rv)"}, {"GetResInfo", (PyCFunction)ResObj_GetResInfo, 1, ! "() -> (short theID, ResType theType, Str255 name)"}, {"SetResInfo", (PyCFunction)ResObj_SetResInfo, 1, ! "(short theID, Str255 name) -> None"}, {"AddResource", (PyCFunction)ResObj_AddResource, 1, ! "(ResType theType, short theID, Str255 name) -> None"}, {"GetResourceSizeOnDisk", (PyCFunction)ResObj_GetResourceSizeOnDisk, 1, ! "() -> (long _rv)"}, {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1, ! "() -> (long _rv)"}, #if TARGET_API_MAC_OS8 {"RsrcMapEntry", (PyCFunction)ResObj_RsrcMapEntry, 1, ! "() -> (long _rv)"}, #endif {"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1, ! "(short attrs) -> None"}, {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1, ! "() -> None"}, {"RemoveResource", (PyCFunction)ResObj_RemoveResource, 1, ! "() -> None"}, {"WriteResource", (PyCFunction)ResObj_WriteResource, 1, ! "() -> None"}, {"SetResourceSize", (PyCFunction)ResObj_SetResourceSize, 1, ! "(long newSize) -> None"}, {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1, ! "() -> (Handle _rv)"}, {"as_Control", (PyCFunction)ResObj_as_Control, 1, ! "Return this resource/handle as a Control"}, {"as_Menu", (PyCFunction)ResObj_as_Menu, 1, ! "Return this resource/handle as a Menu"}, {"LoadResource", (PyCFunction)ResObj_LoadResource, 1, ! "() -> None"}, {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1, ! "(int)->int. Automatically DisposeHandle the object on Python object cleanup"}, {NULL, NULL, 0} }; --- 502,549 ---- static PyMethodDef ResObj_methods[] = { {"HomeResFile", (PyCFunction)ResObj_HomeResFile, 1, ! PyDoc_STR("() -> (short _rv)")}, {"MacLoadResource", (PyCFunction)ResObj_MacLoadResource, 1, ! PyDoc_STR("() -> None")}, {"ReleaseResource", (PyCFunction)ResObj_ReleaseResource, 1, ! PyDoc_STR("() -> None")}, {"DetachResource", (PyCFunction)ResObj_DetachResource, 1, ! PyDoc_STR("() -> None")}, {"GetResAttrs", (PyCFunction)ResObj_GetResAttrs, 1, ! PyDoc_STR("() -> (short _rv)")}, {"GetResInfo", (PyCFunction)ResObj_GetResInfo, 1, ! PyDoc_STR("() -> (short theID, ResType theType, Str255 name)")}, {"SetResInfo", (PyCFunction)ResObj_SetResInfo, 1, ! PyDoc_STR("(short theID, Str255 name) -> None")}, {"AddResource", (PyCFunction)ResObj_AddResource, 1, ! PyDoc_STR("(ResType theType, short theID, Str255 name) -> None")}, {"GetResourceSizeOnDisk", (PyCFunction)ResObj_GetResourceSizeOnDisk, 1, ! PyDoc_STR("() -> (long _rv)")}, {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1, ! PyDoc_STR("() -> (long _rv)")}, #if TARGET_API_MAC_OS8 {"RsrcMapEntry", (PyCFunction)ResObj_RsrcMapEntry, 1, ! PyDoc_STR("() -> (long _rv)")}, #endif {"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1, ! PyDoc_STR("(short attrs) -> None")}, {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1, ! PyDoc_STR("() -> None")}, {"RemoveResource", (PyCFunction)ResObj_RemoveResource, 1, ! PyDoc_STR("() -> None")}, {"WriteResource", (PyCFunction)ResObj_WriteResource, 1, ! PyDoc_STR("() -> None")}, {"SetResourceSize", (PyCFunction)ResObj_SetResourceSize, 1, ! PyDoc_STR("(long newSize) -> None")}, {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {"as_Control", (PyCFunction)ResObj_as_Control, 1, ! PyDoc_STR("Return this resource/handle as a Control")}, {"as_Menu", (PyCFunction)ResObj_as_Menu, 1, ! PyDoc_STR("Return this resource/handle as a Menu")}, {"LoadResource", (PyCFunction)ResObj_LoadResource, 1, ! PyDoc_STR("() -> None")}, {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1, ! PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")}, {NULL, NULL, 0} }; *************** *** 1721,1852 **** #if TARGET_API_MAC_OS8 {"InitResources", (PyCFunction)Res_InitResources, 1, ! "() -> (short _rv)"}, #endif #if TARGET_API_MAC_OS8 {"RsrcZoneInit", (PyCFunction)Res_RsrcZoneInit, 1, ! "() -> None"}, #endif {"CloseResFile", (PyCFunction)Res_CloseResFile, 1, ! "(short refNum) -> None"}, {"ResError", (PyCFunction)Res_ResError, 1, ! "() -> None"}, {"CurResFile", (PyCFunction)Res_CurResFile, 1, ! "() -> (short _rv)"}, #if TARGET_API_MAC_OS8 {"CreateResFile", (PyCFunction)Res_CreateResFile, 1, ! "(Str255 fileName) -> None"}, #endif #if TARGET_API_MAC_OS8 {"OpenResFile", (PyCFunction)Res_OpenResFile, 1, ! "(Str255 fileName) -> (short _rv)"}, #endif {"UseResFile", (PyCFunction)Res_UseResFile, 1, ! "(short refNum) -> None"}, {"CountTypes", (PyCFunction)Res_CountTypes, 1, ! "() -> (short _rv)"}, {"Count1Types", (PyCFunction)Res_Count1Types, 1, ! "() -> (short _rv)"}, {"GetIndType", (PyCFunction)Res_GetIndType, 1, ! "(short index) -> (ResType theType)"}, {"Get1IndType", (PyCFunction)Res_Get1IndType, 1, ! "(short index) -> (ResType theType)"}, {"SetResLoad", (PyCFunction)Res_SetResLoad, 1, ! "(Boolean load) -> None"}, {"CountResources", (PyCFunction)Res_CountResources, 1, ! "(ResType theType) -> (short _rv)"}, {"Count1Resources", (PyCFunction)Res_Count1Resources, 1, ! "(ResType theType) -> (short _rv)"}, {"GetIndResource", (PyCFunction)Res_GetIndResource, 1, ! "(ResType theType, short index) -> (Handle _rv)"}, {"Get1IndResource", (PyCFunction)Res_Get1IndResource, 1, ! "(ResType theType, short index) -> (Handle _rv)"}, {"GetResource", (PyCFunction)Res_GetResource, 1, ! "(ResType theType, short theID) -> (Handle _rv)"}, {"Get1Resource", (PyCFunction)Res_Get1Resource, 1, ! "(ResType theType, short theID) -> (Handle _rv)"}, {"GetNamedResource", (PyCFunction)Res_GetNamedResource, 1, ! "(ResType theType, Str255 name) -> (Handle _rv)"}, {"Get1NamedResource", (PyCFunction)Res_Get1NamedResource, 1, ! "(ResType theType, Str255 name) -> (Handle _rv)"}, {"UniqueID", (PyCFunction)Res_UniqueID, 1, ! "(ResType theType) -> (short _rv)"}, {"Unique1ID", (PyCFunction)Res_Unique1ID, 1, ! "(ResType theType) -> (short _rv)"}, {"UpdateResFile", (PyCFunction)Res_UpdateResFile, 1, ! "(short refNum) -> None"}, {"SetResPurge", (PyCFunction)Res_SetResPurge, 1, ! "(Boolean install) -> None"}, {"GetResFileAttrs", (PyCFunction)Res_GetResFileAttrs, 1, ! "(short refNum) -> (short _rv)"}, {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1, ! "(short refNum, short attrs) -> None"}, {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1, ! "(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)"}, #if TARGET_API_MAC_OS8 {"RGetResource", (PyCFunction)Res_RGetResource, 1, ! "(ResType theType, short theID) -> (Handle _rv)"}, #endif {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1, ! "(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)"}, {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1, ! "(short vRefNum, long dirID, Str255 fileName) -> None"}, {"FSpOpenResFile", (PyCFunction)Res_FSpOpenResFile, 1, ! "(FSSpec spec, SignedByte permission) -> (short _rv)"}, {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1, ! "(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None"}, #if TARGET_API_MAC_CARBON {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1, ! "(SInt16 refNum, RsrcChainLocation where) -> None"}, #endif #if TARGET_API_MAC_CARBON {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1, ! "(SInt16 refNum) -> None"}, #endif #if TARGET_API_MAC_CARBON {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1, ! "(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"}, #endif #if TARGET_API_MAC_CARBON {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1, ! "(FSSpec spec, SignedByte permission) -> (SInt16 refNum)"}, #endif #if TARGET_API_MAC_CARBON {"GetTopResourceFile", (PyCFunction)Res_GetTopResourceFile, 1, ! "() -> (SInt16 refNum)"}, #endif #if TARGET_API_MAC_CARBON {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1, ! "(SInt16 curRefNum) -> (SInt16 nextRefNum)"}, #endif {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1, ! "(FSRef ref, SignedByte permission) -> (short _rv)"}, {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1, ! "(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)"}, {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1, ! "(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"}, #if TARGET_API_MAC_CARBON {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1, ! "(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)"}, #endif #if TARGET_API_MAC_CARBON {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1, ! "(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)"}, #endif {"Resource", (PyCFunction)Res_Resource, 1, ! "Convert a string to a resource object.\n\nThe created resource object is actually just a handle,\napply AddResource() to write it to a resource file.\nSee also the Handle() docstring.\n"}, {"Handle", (PyCFunction)Res_Handle, 1, ! "Convert a string to a Handle object.\n\nResource() and Handle() are very similar, but objects created with Handle() are\nby default automatically DisposeHandle()d upon object cleanup. Use AutoDispose()\nto change this.\n"}, {NULL, NULL, 0} }; --- 1721,1852 ---- #if TARGET_API_MAC_OS8 {"InitResources", (PyCFunction)Res_InitResources, 1, ! PyDoc_STR("() -> (short _rv)")}, #endif #if TARGET_API_MAC_OS8 {"RsrcZoneInit", (PyCFunction)Res_RsrcZoneInit, 1, ! PyDoc_STR("() -> None")}, #endif {"CloseResFile", (PyCFunction)Res_CloseResFile, 1, ! PyDoc_STR("(short refNum) -> None")}, {"ResError", (PyCFunction)Res_ResError, 1, ! PyDoc_STR("() -> None")}, {"CurResFile", (PyCFunction)Res_CurResFile, 1, ! PyDoc_STR("() -> (short _rv)")}, #if TARGET_API_MAC_OS8 {"CreateResFile", (PyCFunction)Res_CreateResFile, 1, ! PyDoc_STR("(Str255 fileName) -> None")}, #endif #if TARGET_API_MAC_OS8 {"OpenResFile", (PyCFunction)Res_OpenResFile, 1, ! PyDoc_STR("(Str255 fileName) -> (short _rv)")}, #endif {"UseResFile", (PyCFunction)Res_UseResFile, 1, ! PyDoc_STR("(short refNum) -> None")}, {"CountTypes", (PyCFunction)Res_CountTypes, 1, ! PyDoc_STR("() -> (short _rv)")}, {"Count1Types", (PyCFunction)Res_Count1Types, 1, ! PyDoc_STR("() -> (short _rv)")}, {"GetIndType", (PyCFunction)Res_GetIndType, 1, ! PyDoc_STR("(short index) -> (ResType theType)")}, {"Get1IndType", (PyCFunction)Res_Get1IndType, 1, ! PyDoc_STR("(short index) -> (ResType theType)")}, {"SetResLoad", (PyCFunction)Res_SetResLoad, 1, ! PyDoc_STR("(Boolean load) -> None")}, {"CountResources", (PyCFunction)Res_CountResources, 1, ! PyDoc_STR("(ResType theType) -> (short _rv)")}, {"Count1Resources", (PyCFunction)Res_Count1Resources, 1, ! PyDoc_STR("(ResType theType) -> (short _rv)")}, {"GetIndResource", (PyCFunction)Res_GetIndResource, 1, ! PyDoc_STR("(ResType theType, short index) -> (Handle _rv)")}, {"Get1IndResource", (PyCFunction)Res_Get1IndResource, 1, ! PyDoc_STR("(ResType theType, short index) -> (Handle _rv)")}, {"GetResource", (PyCFunction)Res_GetResource, 1, ! PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")}, {"Get1Resource", (PyCFunction)Res_Get1Resource, 1, ! PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")}, {"GetNamedResource", (PyCFunction)Res_GetNamedResource, 1, ! PyDoc_STR("(ResType theType, Str255 name) -> (Handle _rv)")}, {"Get1NamedResource", (PyCFunction)Res_Get1NamedResource, 1, ! PyDoc_STR("(ResType theType, Str255 name) -> (Handle _rv)")}, {"UniqueID", (PyCFunction)Res_UniqueID, 1, ! PyDoc_STR("(ResType theType) -> (short _rv)")}, {"Unique1ID", (PyCFunction)Res_Unique1ID, 1, ! PyDoc_STR("(ResType theType) -> (short _rv)")}, {"UpdateResFile", (PyCFunction)Res_UpdateResFile, 1, ! PyDoc_STR("(short refNum) -> None")}, {"SetResPurge", (PyCFunction)Res_SetResPurge, 1, ! PyDoc_STR("(Boolean install) -> None")}, {"GetResFileAttrs", (PyCFunction)Res_GetResFileAttrs, 1, ! PyDoc_STR("(short refNum) -> (short _rv)")}, {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1, ! PyDoc_STR("(short refNum, short attrs) -> None")}, {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1, ! PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")}, #if TARGET_API_MAC_OS8 {"RGetResource", (PyCFunction)Res_RGetResource, 1, ! PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")}, #endif {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1, ! PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)")}, {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1, ! PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> None")}, {"FSpOpenResFile", (PyCFunction)Res_FSpOpenResFile, 1, ! PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")}, {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1, ! PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")}, #if TARGET_API_MAC_CARBON {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1, ! PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")}, #endif #if TARGET_API_MAC_CARBON {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1, ! PyDoc_STR("(SInt16 refNum) -> None")}, #endif #if TARGET_API_MAC_CARBON {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1, ! PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")}, #endif #if TARGET_API_MAC_CARBON {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1, ! PyDoc_STR("(FSSpec spec, SignedByte permission) -> (SInt16 refNum)")}, #endif #if TARGET_API_MAC_CARBON {"GetTopResourceFile", (PyCFunction)Res_GetTopResourceFile, 1, ! PyDoc_STR("() -> (SInt16 refNum)")}, #endif #if TARGET_API_MAC_CARBON {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1, ! PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")}, #endif {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1, ! PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")}, {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1, ! PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")}, {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1, ! PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")}, #if TARGET_API_MAC_CARBON {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1, ! PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")}, #endif #if TARGET_API_MAC_CARBON {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1, ! PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")}, #endif {"Resource", (PyCFunction)Res_Resource, 1, ! PyDoc_STR("Convert a string to a resource object.\n\nThe created resource object is actually just a handle,\napply AddResource() to write it to a resource file.\nSee also the Handle() docstring.\n")}, {"Handle", (PyCFunction)Res_Handle, 1, ! PyDoc_STR("Convert a string to a Handle object.\n\nResource() and Handle() are very similar, but objects created with Handle() are\nby default automatically DisposeHandle()d upon object cleanup. Use AutoDispose()\nto change this.\n")}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 16 10:09:33 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 16 Aug 2002 02:09:33 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/win _Winmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv18405/win Modified Files: _Winmodule.c Log Message: Regenerated with PyDoc_STR() around docstrings. Index: _Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/_Winmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Winmodule.c 5 Jun 2002 17:41:03 -0000 1.10 --- _Winmodule.c 16 Aug 2002 09:09:31 -0000 1.11 *************** *** 2567,2927 **** static PyMethodDef WinObj_methods[] = { {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, ! "() -> (UInt32 outCount)"}, {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, ! "() -> None"}, #if !TARGET_API_MAC_OS8 {"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1, ! "() -> (ItemCount _rv)"}, #endif #if !TARGET_API_MAC_OS8 {"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_OS8 {"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_OS8 {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1, ! "() -> None"}, #endif {"GetWindowWidgetHilite", (PyCFunction)WinObj_GetWindowWidgetHilite, 1, ! "() -> (WindowDefPartCode outHilite)"}, {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1, ! "() -> (WindowClass outClass)"}, {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, ! "() -> (WindowAttributes outAttributes)"}, #if !TARGET_API_MAC_OS8 {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1, ! "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1, ! "(WindowClass inWindowClass) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1, ! "(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1, ! "() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)"}, #endif #if !TARGET_API_MAC_CARBON {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, ! "(WCTabHandle newColorTable) -> None"}, #endif {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1, ! "(RGBColor color) -> None"}, {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1, ! "() -> (RGBColor color)"}, {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1, ! "(PixPatHandle outPixPat) -> None"}, {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1, ! "(PixPatHandle pixPat) -> None"}, #if !TARGET_API_MAC_OS8 {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1, ! "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1, ! "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, #endif {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, ! "() -> None"}, #if !TARGET_API_MAC_CARBON {"SaveOld", (PyCFunction)WinObj_SaveOld, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_CARBON {"DrawNew", (PyCFunction)WinObj_DrawNew, 1, ! "(Boolean update) -> None"}, #endif {"PaintOne", (PyCFunction)WinObj_PaintOne, 1, ! "(RgnHandle clobberedRgn) -> None"}, {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1, ! "(RgnHandle clobberedRgn) -> None"}, {"CalcVis", (PyCFunction)WinObj_CalcVis, 1, ! "() -> None"}, {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1, ! "(RgnHandle clobberedRgn) -> None"}, {"BringToFront", (PyCFunction)WinObj_BringToFront, 1, ! "() -> None"}, {"SendBehind", (PyCFunction)WinObj_SendBehind, 1, ! "(WindowPtr behindWindow) -> None"}, {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1, ! "() -> None"}, #if !TARGET_API_MAC_OS8 {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1, ! "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, #endif #if !TARGET_API_MAC_OS8 {"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1, ! "(CFStringRef inTitle) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1, ! "() -> (CFStringRef outTitle)"}, #endif #if !TARGET_API_MAC_CARBON {"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1, ! "() -> (Boolean _rv)"}, #endif {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1, ! "(Boolean fHilite) -> None"}, {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1, ! "(long data) -> None"}, {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1, ! "() -> (long _rv)"}, {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1, ! "(PicHandle pic) -> None"}, {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1, ! "() -> (PicHandle _rv)"}, {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1, ! "() -> (short _rv)"}, {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1, ! "() -> (UInt32 outFeatures)"}, {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, ! "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"}, {"GetWindowStructureWidths", (PyCFunction)WinObj_GetWindowStructureWidths, 1, ! "() -> (Rect outRect)"}, {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1, ! "() -> None"}, {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1, ! "() -> None"}, {"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1, ! "(RgnHandle region) -> None"}, {"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1, ! "(Rect bounds) -> None"}, {"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1, ! "(RgnHandle region) -> None"}, {"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1, ! "(Rect bounds) -> None"}, {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1, ! "() -> None"}, {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1, ! "(Str255 title) -> None"}, {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1, ! "() -> (Str255 title)"}, #if !TARGET_API_MAC_OS8 {"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1, ! "(CFStringRef inString) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"CopyWindowTitleAsCFString", (PyCFunction)WinObj_CopyWindowTitleAsCFString, 1, ! "() -> (CFStringRef outString)"}, #endif {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1, ! "(FSSpec inFile) -> None"}, {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1, ! "() -> (FSSpec outFile)"}, {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1, ! "(AliasHandle alias) -> None"}, {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1, ! "() -> (AliasHandle alias)"}, {"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1, ! "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"}, {"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1, ! "() -> (IconRef outIcon)"}, {"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1, ! "(IconRef icon) -> None"}, {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1, ! "() -> None"}, {"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1, ! "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"}, {"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1, ! "(DragReference theDrag) -> None"}, {"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1, ! "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"}, {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1, ! "(Point startPt) -> None"}, {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1, ! "() -> (Boolean _rv)"}, {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1, ! "(Boolean modified) -> None"}, {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1, ! "(EventRecord event) -> (Boolean _rv)"}, {"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1, ! "(MenuHandle menu) -> (SInt32 outMenuResult)"}, {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1, ! "(Boolean hilited) -> None"}, {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, ! "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"}, #if TARGET_API_MAC_OSX {"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1, ! "(WindowPtr parentWindow, WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"}, #endif {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, ! "(short hGlobal, short vGlobal, Boolean front) -> None"}, {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1, ! "(short w, short h, Boolean fUpdate) -> None"}, {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1, ! "(Point startPt, Rect bBox) -> (long _rv)"}, {"DragWindow", (PyCFunction)WinObj_DragWindow, 1, ! "(Point startPt, Rect boundsRect) -> None"}, {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, ! "(WindowPartCode partCode, Boolean front) -> None"}, {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, ! "() -> (Boolean _rv)"}, {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, ! "() -> (Boolean _rv)"}, {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, ! "(Boolean collapse) -> None"}, {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1, ! "(WindowRegionCode regionCode) -> (Rect globalBounds)"}, {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1, ! "(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)"}, {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, ! "(WindowRegionCode regionCode, Rect globalBounds) -> None"}, {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1, ! "(WindowPtr parentWindow, WindowPositionMethod method) -> None"}, {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1, ! "(short hGlobal, short vGlobal) -> None"}, {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, ! "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"}, {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, ! "(WindowPartCode partCode) -> (Point ioIdealSize)"}, {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, ! "() -> (Rect userState)"}, {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, ! "(Rect userState) -> None"}, #if !TARGET_API_MAC_OS8 {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1, ! "(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)"}, #endif #if !TARGET_API_MAC_OS8 {"ConstrainWindowToScreen", (PyCFunction)WinObj_ConstrainWindowToScreen, 1, ! "(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)"}, #endif {"HideWindow", (PyCFunction)WinObj_HideWindow, 1, ! "() -> None"}, {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1, ! "() -> None"}, {"ShowHide", (PyCFunction)WinObj_ShowHide, 1, ! "(Boolean showFlag) -> None"}, {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1, ! "() -> (Boolean _rv)"}, #if !TARGET_API_MAC_OS8 {"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1, ! "(WindowPtr inParentWindow) -> None"}, #endif #if !TARGET_API_MAC_OS8 {"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_OS8 {"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1, ! "() -> (WindowPtr outParentWindow)"}, #endif #if !TARGET_API_MAC_OS8 {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1, ! "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"}, #endif #if !TARGET_API_MAC_OS8 {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1, ! "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"}, #endif {"TrackBox", (PyCFunction)WinObj_TrackBox, 1, ! "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"}, {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1, ! "(Point thePt) -> (Boolean _rv)"}, #if !TARGET_API_MAC_CARBON {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1, ! "() -> (Boolean _rv, AuxWinHandle awHndl)"}, #endif #if !TARGET_API_MAC_CARBON {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, ! "() -> (Boolean _rv)"}, #endif #if !TARGET_API_MAC_CARBON {"GetWindowSpareFlag", (PyCFunction)WinObj_GetWindowSpareFlag, 1, ! "() -> (Boolean _rv)"}, #endif {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, ! "() -> (CGrafPtr _rv)"}, {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, ! "() -> (short _rv)"}, {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1, ! "() -> (Boolean _rv)"}, #if !TARGET_API_MAC_OS8 {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1, ! "() -> (Boolean _rv)"}, #endif {"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1, ! "() -> (WindowPtr _rv)"}, {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1, ! "() -> (Rect rect)"}, {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1, ! "() -> (Rect rect)"}, {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1, ! "(short kind) -> None"}, {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1, ! "(Rect rect) -> None"}, {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1, ! "(Rect rect) -> None"}, {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, ! "() -> None"}, {"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1, ! "() -> (Rect bounds)"}, {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1, ! "() -> (Boolean _rv)"}, #if !TARGET_API_MAC_CARBON {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1, ! "() -> (Boolean _rv)"}, #endif {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1, ! "(RgnHandle r) -> None"}, {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1, ! "(RgnHandle r) -> None"}, {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1, ! "(RgnHandle r) -> None"}, #if !TARGET_API_MAC_CARBON {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1, ! "() -> (short _rv)"}, #endif {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1, ! "() -> (WindowPtr _rv)"}, #if !TARGET_API_MAC_CARBON {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1, ! "() -> None"}, #endif {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1, ! "(short hGlobal, short vGlobal, Boolean front) -> None"}, {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 2567,2927 ---- static PyMethodDef WinObj_methods[] = { {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, ! PyDoc_STR("() -> (UInt32 outCount)")}, {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, ! PyDoc_STR("() -> None")}, #if !TARGET_API_MAC_OS8 {"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1, ! PyDoc_STR("() -> (ItemCount _rv)")}, #endif #if !TARGET_API_MAC_OS8 {"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_OS8 {"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_OS8 {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1, ! PyDoc_STR("() -> None")}, #endif {"GetWindowWidgetHilite", (PyCFunction)WinObj_GetWindowWidgetHilite, 1, ! PyDoc_STR("() -> (WindowDefPartCode outHilite)")}, {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1, ! PyDoc_STR("() -> (WindowClass outClass)")}, {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, ! PyDoc_STR("() -> (WindowAttributes outAttributes)")}, #if !TARGET_API_MAC_OS8 {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1, ! PyDoc_STR("(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1, ! PyDoc_STR("(WindowClass inWindowClass) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1, ! PyDoc_STR("(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1, ! PyDoc_STR("() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)")}, #endif #if !TARGET_API_MAC_CARBON {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, ! PyDoc_STR("(WCTabHandle newColorTable) -> None")}, #endif {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1, ! PyDoc_STR("(RGBColor color) -> None")}, {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1, ! PyDoc_STR("() -> (RGBColor color)")}, {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1, ! PyDoc_STR("(PixPatHandle outPixPat) -> None")}, {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1, ! PyDoc_STR("(PixPatHandle pixPat) -> None")}, #if !TARGET_API_MAC_OS8 {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1, ! PyDoc_STR("(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1, ! PyDoc_STR("(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None")}, #endif {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, ! PyDoc_STR("() -> None")}, #if !TARGET_API_MAC_CARBON {"SaveOld", (PyCFunction)WinObj_SaveOld, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_CARBON {"DrawNew", (PyCFunction)WinObj_DrawNew, 1, ! PyDoc_STR("(Boolean update) -> None")}, #endif {"PaintOne", (PyCFunction)WinObj_PaintOne, 1, ! PyDoc_STR("(RgnHandle clobberedRgn) -> None")}, {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1, ! PyDoc_STR("(RgnHandle clobberedRgn) -> None")}, {"CalcVis", (PyCFunction)WinObj_CalcVis, 1, ! PyDoc_STR("() -> None")}, {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1, ! PyDoc_STR("(RgnHandle clobberedRgn) -> None")}, {"BringToFront", (PyCFunction)WinObj_BringToFront, 1, ! PyDoc_STR("() -> None")}, {"SendBehind", (PyCFunction)WinObj_SendBehind, 1, ! PyDoc_STR("(WindowPtr behindWindow) -> None")}, {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1, ! PyDoc_STR("() -> None")}, #if !TARGET_API_MAC_OS8 {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1, ! PyDoc_STR("(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)")}, #endif #if !TARGET_API_MAC_OS8 {"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1, ! PyDoc_STR("(CFStringRef inTitle) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1, ! PyDoc_STR("() -> (CFStringRef outTitle)")}, #endif #if !TARGET_API_MAC_CARBON {"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #endif {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1, ! PyDoc_STR("(Boolean fHilite) -> None")}, {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1, ! PyDoc_STR("(long data) -> None")}, {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1, ! PyDoc_STR("() -> (long _rv)")}, {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1, ! PyDoc_STR("(PicHandle pic) -> None")}, {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1, ! PyDoc_STR("() -> (PicHandle _rv)")}, {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1, ! PyDoc_STR("() -> (short _rv)")}, {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1, ! PyDoc_STR("() -> (UInt32 outFeatures)")}, {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, ! PyDoc_STR("(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None")}, {"GetWindowStructureWidths", (PyCFunction)WinObj_GetWindowStructureWidths, 1, ! PyDoc_STR("() -> (Rect outRect)")}, {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1, ! PyDoc_STR("() -> None")}, {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1, ! PyDoc_STR("() -> None")}, {"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1, ! PyDoc_STR("(RgnHandle region) -> None")}, {"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1, ! PyDoc_STR("(Rect bounds) -> None")}, {"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1, ! PyDoc_STR("(RgnHandle region) -> None")}, {"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1, ! PyDoc_STR("(Rect bounds) -> None")}, {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1, ! PyDoc_STR("() -> None")}, {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1, ! PyDoc_STR("(Str255 title) -> None")}, {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1, ! PyDoc_STR("() -> (Str255 title)")}, #if !TARGET_API_MAC_OS8 {"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1, ! PyDoc_STR("(CFStringRef inString) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"CopyWindowTitleAsCFString", (PyCFunction)WinObj_CopyWindowTitleAsCFString, 1, ! PyDoc_STR("() -> (CFStringRef outString)")}, #endif {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1, ! PyDoc_STR("(FSSpec inFile) -> None")}, {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1, ! PyDoc_STR("() -> (FSSpec outFile)")}, {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1, ! PyDoc_STR("(AliasHandle alias) -> None")}, {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1, ! PyDoc_STR("() -> (AliasHandle alias)")}, {"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1, ! PyDoc_STR("(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None")}, {"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1, ! PyDoc_STR("() -> (IconRef outIcon)")}, {"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1, ! PyDoc_STR("(IconRef icon) -> None")}, {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1, ! PyDoc_STR("() -> None")}, {"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1, ! PyDoc_STR("(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)")}, {"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1, ! PyDoc_STR("(DragReference theDrag) -> None")}, {"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1, ! PyDoc_STR("(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None")}, {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1, ! PyDoc_STR("(Point startPt) -> None")}, {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1, ! PyDoc_STR("(Boolean modified) -> None")}, {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1, ! PyDoc_STR("(EventRecord event) -> (Boolean _rv)")}, {"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1, ! PyDoc_STR("(MenuHandle menu) -> (SInt32 outMenuResult)")}, {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1, ! PyDoc_STR("(Boolean hilited) -> None")}, {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, ! PyDoc_STR("(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None")}, #if TARGET_API_MAC_OSX {"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1, ! PyDoc_STR("(WindowPtr parentWindow, WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None")}, #endif {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, ! PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")}, {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1, ! PyDoc_STR("(short w, short h, Boolean fUpdate) -> None")}, {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1, ! PyDoc_STR("(Point startPt, Rect bBox) -> (long _rv)")}, {"DragWindow", (PyCFunction)WinObj_DragWindow, 1, ! PyDoc_STR("(Point startPt, Rect boundsRect) -> None")}, {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, ! PyDoc_STR("(WindowPartCode partCode, Boolean front) -> None")}, {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, ! PyDoc_STR("(Boolean collapse) -> None")}, {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1, ! PyDoc_STR("(WindowRegionCode regionCode) -> (Rect globalBounds)")}, {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1, ! PyDoc_STR("(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)")}, {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, ! PyDoc_STR("(WindowRegionCode regionCode, Rect globalBounds) -> None")}, {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1, ! PyDoc_STR("(WindowPtr parentWindow, WindowPositionMethod method) -> None")}, {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1, ! PyDoc_STR("(short hGlobal, short vGlobal) -> None")}, {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, ! PyDoc_STR("() -> (Boolean _rv, Point idealSize, Rect idealStandardState)")}, {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, ! PyDoc_STR("(WindowPartCode partCode) -> (Point ioIdealSize)")}, {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, ! PyDoc_STR("() -> (Rect userState)")}, {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, ! PyDoc_STR("(Rect userState) -> None")}, #if !TARGET_API_MAC_OS8 {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1, ! PyDoc_STR("(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)")}, #endif #if !TARGET_API_MAC_OS8 {"ConstrainWindowToScreen", (PyCFunction)WinObj_ConstrainWindowToScreen, 1, ! PyDoc_STR("(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)")}, #endif {"HideWindow", (PyCFunction)WinObj_HideWindow, 1, ! PyDoc_STR("() -> None")}, {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1, ! PyDoc_STR("() -> None")}, {"ShowHide", (PyCFunction)WinObj_ShowHide, 1, ! PyDoc_STR("(Boolean showFlag) -> None")}, {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #if !TARGET_API_MAC_OS8 {"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1, ! PyDoc_STR("(WindowPtr inParentWindow) -> None")}, #endif #if !TARGET_API_MAC_OS8 {"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_OS8 {"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1, ! PyDoc_STR("() -> (WindowPtr outParentWindow)")}, #endif #if !TARGET_API_MAC_OS8 {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1, ! PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")}, #endif #if !TARGET_API_MAC_OS8 {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1, ! PyDoc_STR("(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")}, #endif {"TrackBox", (PyCFunction)WinObj_TrackBox, 1, ! PyDoc_STR("(Point thePt, WindowPartCode partCode) -> (Boolean _rv)")}, {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1, ! PyDoc_STR("(Point thePt) -> (Boolean _rv)")}, #if !TARGET_API_MAC_CARBON {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1, ! PyDoc_STR("() -> (Boolean _rv, AuxWinHandle awHndl)")}, #endif #if !TARGET_API_MAC_CARBON {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #endif #if !TARGET_API_MAC_CARBON {"GetWindowSpareFlag", (PyCFunction)WinObj_GetWindowSpareFlag, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #endif {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, ! PyDoc_STR("() -> (CGrafPtr _rv)")}, {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, ! PyDoc_STR("() -> (short _rv)")}, {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #if !TARGET_API_MAC_OS8 {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #endif {"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1, ! PyDoc_STR("() -> (WindowPtr _rv)")}, {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1, ! PyDoc_STR("() -> (Rect rect)")}, {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1, ! PyDoc_STR("() -> (Rect rect)")}, {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1, ! PyDoc_STR("(short kind) -> None")}, {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1, ! PyDoc_STR("(Rect rect) -> None")}, {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1, ! PyDoc_STR("(Rect rect) -> None")}, {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, ! PyDoc_STR("() -> None")}, {"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1, ! PyDoc_STR("() -> (Rect bounds)")}, {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #if !TARGET_API_MAC_CARBON {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #endif {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1, ! PyDoc_STR("(RgnHandle r) -> None")}, {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1, ! PyDoc_STR("(RgnHandle r) -> None")}, {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1, ! PyDoc_STR("(RgnHandle r) -> None")}, #if !TARGET_API_MAC_CARBON {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1, ! PyDoc_STR("() -> (short _rv)")}, #endif {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1, ! PyDoc_STR("() -> (WindowPtr _rv)")}, #if !TARGET_API_MAC_CARBON {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1, ! PyDoc_STR("() -> None")}, #endif {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1, ! PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")}, {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 3659,3774 **** static PyMethodDef Win_methods[] = { {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1, ! "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, {"NewWindow", (PyCFunction)Win_NewWindow, 1, ! "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, {"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1, ! "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, {"NewCWindow", (PyCFunction)Win_NewCWindow, 1, ! "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1, ! "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"}, {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1, ! "(SInt16 resID) -> (WindowPtr outWindow)"}, {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1, ! "() -> None"}, {"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1, ! "() -> None"}, {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1, ! "() -> (Boolean _rv)"}, #if !TARGET_API_MAC_CARBON {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, ! "(PixPatHandle deskPixPat) -> None"}, #endif {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, ! "() -> (Boolean _rv, EventRecord theEvent)"}, {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1, ! "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"}, {"FrontWindow", (PyCFunction)Win_FrontWindow, 1, ! "() -> (WindowPtr _rv)"}, {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, ! "() -> (WindowPtr _rv)"}, #if !TARGET_API_MAC_OS8 {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1, ! "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, #endif #if !TARGET_API_MAC_OS8 {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1, ! "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"}, #endif #if !TARGET_API_MAC_OS8 {"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1, ! "(OptionBits inOptions) -> (MenuHandle outMenu)"}, #endif #if !TARGET_API_MAC_CARBON {"InitWindows", (PyCFunction)Win_InitWindows, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_CARBON {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1, ! "() -> (GrafPtr wPort)"}, #endif #if !TARGET_API_MAC_CARBON {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1, ! "() -> (CGrafPtr wMgrCPort)"}, #endif #if !TARGET_API_MAC_CARBON {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_CARBON {"InvalRect", (PyCFunction)Win_InvalRect, 1, ! "(Rect badRect) -> None"}, #endif #if !TARGET_API_MAC_CARBON {"InvalRgn", (PyCFunction)Win_InvalRgn, 1, ! "(RgnHandle badRgn) -> None"}, #endif #if !TARGET_API_MAC_CARBON {"ValidRect", (PyCFunction)Win_ValidRect, 1, ! "(Rect goodRect) -> None"}, #endif #if !TARGET_API_MAC_CARBON {"ValidRgn", (PyCFunction)Win_ValidRgn, 1, ! "(RgnHandle goodRgn) -> None"}, #endif {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, ! "(Boolean collapse) -> None"}, #if !TARGET_API_MAC_OS8 {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1, ! "(GDHandle inDevice) -> (Rect availableRect)"}, #endif #if !TARGET_API_MAC_OS8 {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1, ! "() -> None"}, #endif #if !TARGET_API_MAC_OS8 {"EnableScreenUpdates", (PyCFunction)Win_EnableScreenUpdates, 1, ! "() -> None"}, #endif {"PinRect", (PyCFunction)Win_PinRect, 1, ! "(Rect theRect, Point thePt) -> (long _rv)"}, {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, ! "() -> (RgnHandle _rv)"}, {"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1, ! "(CGrafPtr port) -> (WindowPtr _rv)"}, {"WhichWindow", (PyCFunction)Win_WhichWindow, 1, ! "Resolve an integer WindowPtr address to a Window object"}, {"FindWindow", (PyCFunction)Win_FindWindow, 1, ! "(Point thePoint) -> (short _rv, WindowPtr theWindow)"}, {NULL, NULL, 0} }; --- 3659,3774 ---- static PyMethodDef Win_methods[] = { {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1, ! PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")}, {"NewWindow", (PyCFunction)Win_NewWindow, 1, ! PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)")}, {"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1, ! PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")}, {"NewCWindow", (PyCFunction)Win_NewCWindow, 1, ! PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)")}, {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1, ! PyDoc_STR("(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)")}, {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1, ! PyDoc_STR("(SInt16 resID) -> (WindowPtr outWindow)")}, {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1, ! PyDoc_STR("() -> None")}, {"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1, ! PyDoc_STR("() -> None")}, {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, #if !TARGET_API_MAC_CARBON {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, ! PyDoc_STR("(PixPatHandle deskPixPat) -> None")}, #endif {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, ! PyDoc_STR("() -> (Boolean _rv, EventRecord theEvent)")}, {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1, ! PyDoc_STR("(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)")}, {"FrontWindow", (PyCFunction)Win_FrontWindow, 1, ! PyDoc_STR("() -> (WindowPtr _rv)")}, {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, ! PyDoc_STR("() -> (WindowPtr _rv)")}, #if !TARGET_API_MAC_OS8 {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1, ! PyDoc_STR("(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)")}, #endif #if !TARGET_API_MAC_OS8 {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1, ! PyDoc_STR("(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)")}, #endif #if !TARGET_API_MAC_OS8 {"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1, ! PyDoc_STR("(OptionBits inOptions) -> (MenuHandle outMenu)")}, #endif #if !TARGET_API_MAC_CARBON {"InitWindows", (PyCFunction)Win_InitWindows, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_CARBON {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1, ! PyDoc_STR("() -> (GrafPtr wPort)")}, #endif #if !TARGET_API_MAC_CARBON {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1, ! PyDoc_STR("() -> (CGrafPtr wMgrCPort)")}, #endif #if !TARGET_API_MAC_CARBON {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_CARBON {"InvalRect", (PyCFunction)Win_InvalRect, 1, ! PyDoc_STR("(Rect badRect) -> None")}, #endif #if !TARGET_API_MAC_CARBON {"InvalRgn", (PyCFunction)Win_InvalRgn, 1, ! PyDoc_STR("(RgnHandle badRgn) -> None")}, #endif #if !TARGET_API_MAC_CARBON {"ValidRect", (PyCFunction)Win_ValidRect, 1, ! PyDoc_STR("(Rect goodRect) -> None")}, #endif #if !TARGET_API_MAC_CARBON {"ValidRgn", (PyCFunction)Win_ValidRgn, 1, ! PyDoc_STR("(RgnHandle goodRgn) -> None")}, #endif {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, ! PyDoc_STR("(Boolean collapse) -> None")}, #if !TARGET_API_MAC_OS8 {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1, ! PyDoc_STR("(GDHandle inDevice) -> (Rect availableRect)")}, #endif #if !TARGET_API_MAC_OS8 {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1, ! PyDoc_STR("() -> None")}, #endif #if !TARGET_API_MAC_OS8 {"EnableScreenUpdates", (PyCFunction)Win_EnableScreenUpdates, 1, ! PyDoc_STR("() -> None")}, #endif {"PinRect", (PyCFunction)Win_PinRect, 1, ! PyDoc_STR("(Rect theRect, Point thePt) -> (long _rv)")}, {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, ! PyDoc_STR("() -> (RgnHandle _rv)")}, {"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1, ! PyDoc_STR("(CGrafPtr port) -> (WindowPtr _rv)")}, {"WhichWindow", (PyCFunction)Win_WhichWindow, 1, ! PyDoc_STR("Resolve an integer WindowPtr address to a Window object")}, {"FindWindow", (PyCFunction)Win_FindWindow, 1, ! PyDoc_STR("(Point thePoint) -> (short _rv, WindowPtr theWindow)")}, {NULL, NULL, 0} }; From gvanrossum@users.sourceforge.net Fri Aug 16 17:14:03 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 16 Aug 2002 09:14:03 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.324,2.325 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31581 Modified Files: ceval.c Log Message: Streamline the fast track for CFunction calls a bit more: there was nothing special done if keyword arguments were present, so test for that earlier and fall through to the normal case if there are any. This ought to slow down CFunction calls with keyword args, but I don't care; it's a tiny (1%) improvement for pystone. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.324 retrieving revision 2.325 diff -C2 -d -r2.324 -r2.325 *** ceval.c 15 Aug 2002 14:59:02 -0000 2.324 --- ceval.c 16 Aug 2002 16:14:00 -0000 2.325 *************** *** 1976,1985 **** callable object. */ ! if (PyCFunction_Check(func)) { int flags = PyCFunction_GET_FLAGS(func); ! if (nk != 0 || (flags & METH_KEYWORDS)) ! x = do_call(func, &stack_pointer, ! na, nk); ! else if (flags == METH_VARARGS) { PyObject *callargs; callargs = load_args(&stack_pointer, na); --- 1976,1982 ---- callable object. */ ! if (PyCFunction_Check(func) && nk == 0) { int flags = PyCFunction_GET_FLAGS(func); ! if (flags & (METH_VARARGS | METH_KEYWORDS)) { PyObject *callargs; callargs = load_args(&stack_pointer, na); From gvanrossum@users.sourceforge.net Fri Aug 16 18:01:10 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 16 Aug 2002 10:01:10 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.72,2.73 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13045/Modules Modified Files: pyexpat.c Log Message: Squash a few calls to the hideously expensive PyObject_CallObject(o,a) -- replace then with slightly faster PyObject_Call(o,a,NULL). (The difference is that the latter requires a to be a tuple; the former allows other values and wraps them in a tuple if necessary; it involves two more levels of C function calls to accomplish all that.) Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.72 retrieving revision 2.73 diff -C2 -d -r2.72 -r2.73 *** pyexpat.c 4 Aug 2002 08:24:49 -0000 2.72 --- pyexpat.c 16 Aug 2002 17:01:07 -0000 2.73 *************** *** 830,834 **** PyTuple_SET_ITEM(arg, 0, bytes); ! if ((str = PyObject_CallObject(meth, arg)) == NULL) goto finally; --- 830,834 ---- PyTuple_SET_ITEM(arg, 0, bytes); ! if ((str = PyObject_Call(meth, arg, NULL)) == NULL) goto finally; From gvanrossum@users.sourceforge.net Fri Aug 16 18:01:12 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 16 Aug 2002 10:01:12 -0700 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.64,2.65 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv13045/Parser Modified Files: tokenizer.c Log Message: Squash a few calls to the hideously expensive PyObject_CallObject(o,a) -- replace then with slightly faster PyObject_Call(o,a,NULL). (The difference is that the latter requires a to be a tuple; the former allows other values and wraps them in a tuple if necessary; it involves two more levels of C function calls to accomplish all that.) Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -d -r2.64 -r2.65 *** tokenizer.c 15 Aug 2002 01:20:16 -0000 2.64 --- tokenizer.c 16 Aug 2002 17:01:09 -0000 2.65 *************** *** 328,337 **** /* In a non-Unicode built, this should never be called. */ Py_FatalError("fp_readl should not be called in this build."); ! return NULL; #else PyObject* utf8; PyObject* buf = tok->decoding_buffer; if (buf == NULL) { ! buf = PyObject_CallObject(tok->decoding_readline, NULL); if (buf == NULL) return error_ret(tok); --- 328,341 ---- /* In a non-Unicode built, this should never be called. */ Py_FatalError("fp_readl should not be called in this build."); ! return NULL; /* Keep compiler happy (not reachable) */ #else PyObject* utf8; PyObject* buf = tok->decoding_buffer; if (buf == NULL) { ! PyObject *args = PyTuple_New(0); ! if (args == NULL) ! return error_ret(tok); ! buf = PyObject_Call(tok->decoding_readline, args, NULL); ! Py_DECREF(args); if (buf == NULL) return error_ret(tok); *************** *** 465,469 **** PyObject* buf = tok->decoding_buffer; if (buf == NULL) { ! buf = PyObject_CallObject(tok->decoding_readline, NULL); if (buf == NULL) { error_ret(tok); --- 469,480 ---- PyObject* buf = tok->decoding_buffer; if (buf == NULL) { ! PyObject *args = PyTuple_New(0); ! if (args == NULL) { ! error_ret(tok); ! return 1; ! } ! buf = PyObject_Call(tok->decoding_readline, ! args, NULL); ! Py_DECREF(args); if (buf == NULL) { error_ret(tok); From gvanrossum@users.sourceforge.net Fri Aug 16 18:01:11 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 16 Aug 2002 10:01:11 -0700 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.104,2.105 iterobject.c,1.12,1.13 typeobject.c,2.178,2.179 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13045/Objects Modified Files: abstract.c iterobject.c typeobject.c Log Message: Squash a few calls to the hideously expensive PyObject_CallObject(o,a) -- replace then with slightly faster PyObject_Call(o,a,NULL). (The difference is that the latter requires a to be a tuple; the former allows other values and wraps them in a tuple if necessary; it involves two more levels of C function calls to accomplish all that.) Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.104 retrieving revision 2.105 diff -C2 -d -r2.104 -r2.105 *** abstract.c 28 Jul 2002 10:23:27 -0000 2.104 --- abstract.c 16 Aug 2002 17:01:08 -0000 2.105 *************** *** 1728,1732 **** args = a; } ! retval = PyObject_CallObject(callable, args); Py_DECREF(args); --- 1728,1732 ---- args = a; } ! retval = PyObject_Call(callable, args, NULL); Py_DECREF(args); *************** *** 1775,1779 **** } ! retval = PyObject_CallObject(func, args); Py_DECREF(args); --- 1775,1779 ---- } ! retval = PyObject_Call(func, args, NULL); Py_DECREF(args); Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iterobject.c 9 Aug 2002 01:30:17 -0000 1.12 --- iterobject.c 16 Aug 2002 17:01:08 -0000 1.13 *************** *** 164,168 **** { if (it->it_callable != NULL) { ! PyObject *result = PyObject_CallObject(it->it_callable, NULL); if (result != NULL) { int ok; --- 164,173 ---- { if (it->it_callable != NULL) { ! PyObject *args = PyTuple_New(0); ! PyObject *result; ! if (args == NULL) ! return NULL; ! result = PyObject_Call(it->it_callable, args, NULL); ! Py_DECREF(args); if (result != NULL) { int ok; Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.178 retrieving revision 2.179 diff -C2 -d -r2.178 -r2.179 *** typeobject.c 16 Aug 2002 03:47:49 -0000 2.178 --- typeobject.c 16 Aug 2002 17:01:08 -0000 2.179 *************** *** 3258,3262 **** slot_nb_nonzero(PyObject *self) { ! PyObject *func, *res; static PyObject *nonzero_str, *len_str; --- 3258,3262 ---- slot_nb_nonzero(PyObject *self) { ! PyObject *func, *res, *args; static PyObject *nonzero_str, *len_str; *************** *** 3273,3277 **** } } ! res = PyObject_CallObject(func, NULL); Py_DECREF(func); if (res == NULL) --- 3273,3281 ---- } } ! args = res = PyTuple_New(0); ! if (args != NULL) { ! res = PyObject_Call(func, args, NULL); ! Py_DECREF(args); ! } Py_DECREF(func); if (res == NULL) *************** *** 3652,3658 **** func = lookup_method(self, "__iter__", &iter_str); if (func != NULL) { ! res = PyObject_CallObject(func, NULL); ! Py_DECREF(func); ! return res; } PyErr_Clear(); --- 3656,3667 ---- func = lookup_method(self, "__iter__", &iter_str); if (func != NULL) { ! PyObject *args; ! args = res = PyTuple_New(0); ! if (args != NULL) { ! res = PyObject_Call(func, args, NULL); ! Py_DECREF(args); ! } ! Py_DECREF(func); ! return res; } PyErr_Clear(); From jhylton@users.sourceforge.net Fri Aug 16 18:47:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 16 Aug 2002 10:47:29 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.325,2.326 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31919 Modified Files: ceval.c Log Message: Move body of CALL_FUNCTION opcode into helper function. This makes the code much easier to ready, because it is at a sane indentation level. On my box this shows a 1-2% speedup, which means nothing, except that I'm not going to worry about the performance effects of the change. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.325 retrieving revision 2.326 diff -C2 -d -r2.325 -r2.326 *** ceval.c 16 Aug 2002 16:14:00 -0000 2.325 --- ceval.c 16 Aug 2002 17:47:26 -0000 2.326 *************** *** 34,37 **** --- 34,38 ---- /* Forward declarations */ static PyObject *eval_frame(PyFrameObject *); + static PyObject *call_function(PyObject ***, int); static PyObject *fast_function(PyObject *, PyObject ***, int, int, int); static PyObject *fast_cfunction(PyObject *, PyObject ***, int); *************** *** 1965,2022 **** case CALL_FUNCTION: ! { ! int na = oparg & 0xff; ! int nk = (oparg>>8) & 0xff; ! int n = na + 2 * nk; ! PyObject **pfunc = stack_pointer - n - 1; ! PyObject *func = *pfunc; ! ! /* Always dispatch PyCFunction first, because ! these are presumed to be the most frequent ! callable object. ! */ ! if (PyCFunction_Check(func) && nk == 0) { ! int flags = PyCFunction_GET_FLAGS(func); ! if (flags & (METH_VARARGS | METH_KEYWORDS)) { ! PyObject *callargs; ! callargs = load_args(&stack_pointer, na); ! x = PyCFunction_Call(func, callargs, NULL); ! Py_XDECREF(callargs); ! } else ! x = fast_cfunction(func, ! &stack_pointer, na); ! } else { ! if (PyMethod_Check(func) ! && PyMethod_GET_SELF(func) != NULL) { ! /* optimize access to bound methods */ ! PyObject *self = PyMethod_GET_SELF(func); ! Py_INCREF(self); ! func = PyMethod_GET_FUNCTION(func); ! Py_INCREF(func); ! Py_DECREF(*pfunc); ! *pfunc = self; ! na++; ! n++; ! } else ! Py_INCREF(func); ! if (PyFunction_Check(func)) { ! x = fast_function(func, &stack_pointer, ! n, na, nk); ! } else { ! x = do_call(func, &stack_pointer, ! na, nk); ! } ! Py_DECREF(func); ! } ! ! while (stack_pointer > pfunc) { ! w = POP(); ! Py_DECREF(w); ! } ! PUSH(x); ! if (x != NULL) ! continue; ! break; ! } case CALL_FUNCTION_VAR: --- 1966,1974 ---- case CALL_FUNCTION: ! x = call_function(&stack_pointer, oparg); ! PUSH(x); ! if (x != NULL) ! continue; ! break; case CALL_FUNCTION_VAR: *************** *** 3194,3197 **** --- 3146,3199 ---- #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) + + static PyObject * + call_function(PyObject ***pp_stack, int oparg) + { + int na = oparg & 0xff; + int nk = (oparg>>8) & 0xff; + int n = na + 2 * nk; + PyObject **pfunc = (*pp_stack) - n - 1; + PyObject *func = *pfunc; + PyObject *x, *w; + + /* Always dispatch PyCFunction first, because + these are presumed to be the most frequent + callable object. + */ + if (PyCFunction_Check(func) && nk == 0) { + int flags = PyCFunction_GET_FLAGS(func); + if (flags & (METH_VARARGS | METH_KEYWORDS)) { + PyObject *callargs; + callargs = load_args(pp_stack, na); + x = PyCFunction_Call(func, callargs, NULL); + Py_XDECREF(callargs); + } else + x = fast_cfunction(func, pp_stack, na); + } else { + if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { + /* optimize access to bound methods */ + PyObject *self = PyMethod_GET_SELF(func); + Py_INCREF(self); + func = PyMethod_GET_FUNCTION(func); + Py_INCREF(func); + Py_DECREF(*pfunc); + *pfunc = self; + na++; + n++; + } else + Py_INCREF(func); + if (PyFunction_Check(func)) + x = fast_function(func, pp_stack, n, na, nk); + else + x = do_call(func, pp_stack, na, nk); + Py_DECREF(func); + } + + while ((*pp_stack) > pfunc) { + w = EXT_POP(*pp_stack); + Py_DECREF(w); + } + return x; + } /* The two fast_xxx() functions optimize calls for which no argument From gvanrossum@users.sourceforge.net Fri Aug 16 19:32:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 16 Aug 2002 11:32:56 -0700 Subject: [Python-checkins] python/dist/src PLAN.txt,1.18,NONE Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv14128 Removed Files: PLAN.txt Log Message: Remove the outdated PLAN.txt file. --- PLAN.txt DELETED --- From jhylton@users.sourceforge.net Fri Aug 16 19:36:14 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 16 Aug 2002 11:36:14 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.326,2.327 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15213 Modified Files: ceval.c Log Message: Inline fast_cfunction() in new call_function(). Also, don't handle METH_OLDARGS on the fast path. All the interesting builtins have been converted to use METH_NOARGS, METH_O, or METH_VARARGS. Result is another 1-2% speedup. If I can cobble together 10 of these, it might make a difference. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.326 retrieving revision 2.327 diff -C2 -d -r2.326 -r2.327 *** ceval.c 16 Aug 2002 17:47:26 -0000 2.326 --- ceval.c 16 Aug 2002 18:36:11 -0000 2.327 *************** *** 36,40 **** static PyObject *call_function(PyObject ***, int); static PyObject *fast_function(PyObject *, PyObject ***, int, int, int); - static PyObject *fast_cfunction(PyObject *, PyObject ***, int); static PyObject *do_call(PyObject *, PyObject ***, int, int); static PyObject *ext_do_call(PyObject *, PyObject ***, int, int, int); --- 36,39 ---- *************** *** 3147,3150 **** --- 3146,3164 ---- #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) + void + err_args(PyObject *func, int flags, int nargs) + { + if (flags & METH_NOARGS) + PyErr_Format(PyExc_TypeError, + "%.200s() takes 1 argument (%d given)", + ((PyCFunctionObject *)func)->m_ml->ml_name, + nargs); + else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%d given)", + ((PyCFunctionObject *)func)->m_ml->ml_name, + nargs); + } + static PyObject * call_function(PyObject ***pp_stack, int oparg) *************** *** 3163,3173 **** if (PyCFunction_Check(func) && nk == 0) { int flags = PyCFunction_GET_FLAGS(func); ! if (flags & (METH_VARARGS | METH_KEYWORDS)) { PyObject *callargs; callargs = load_args(pp_stack, na); x = PyCFunction_Call(func, callargs, NULL); Py_XDECREF(callargs); ! } else ! x = fast_cfunction(func, pp_stack, na); } else { if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { --- 3177,3201 ---- if (PyCFunction_Check(func) && nk == 0) { int flags = PyCFunction_GET_FLAGS(func); ! if (flags & (METH_NOARGS | METH_O)) { ! PyCFunction meth = PyCFunction_GET_FUNCTION(func); ! PyObject *self = PyCFunction_GET_SELF(func); ! if (flags & METH_NOARGS && na == 0) ! x = (*meth)(self, NULL); ! else if (flags & METH_O && na == 1) { ! PyObject *arg = EXT_POP(*pp_stack); ! x = (*meth)(self, arg); ! Py_DECREF(arg); ! } ! else { ! err_args(func, flags, na); ! x = NULL; ! } ! } ! else { PyObject *callargs; callargs = load_args(pp_stack, na); x = PyCFunction_Call(func, callargs, NULL); Py_XDECREF(callargs); ! } } else { if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { *************** *** 3197,3253 **** } ! /* The two fast_xxx() functions optimize calls for which no argument tuple is necessary; the objects are passed directly from the stack. - fast_cfunction() is called for METH_OLDARGS functions. - fast_function() is for functions with no special argument handling. */ - - static PyObject * - fast_cfunction(PyObject *func, PyObject ***pp_stack, int na) - { - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - - switch (flags) { - case METH_OLDARGS: - if (na == 0) - return (*meth)(self, NULL); - else if (na == 1) { - PyObject *arg = EXT_POP(*pp_stack); - PyObject *result = (*meth)(self, arg); - Py_DECREF(arg); - return result; - } else { - PyObject *args = load_args(pp_stack, na); - PyObject *result = (*meth)(self, args); - Py_DECREF(args); - return result; - } - case METH_NOARGS: - if (na == 0) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%d given)", - ((PyCFunctionObject*)func)->m_ml->ml_name, na); - return NULL; - case METH_O: - if (na == 1) { - PyObject *arg = EXT_POP(*pp_stack); - PyObject *result = (*meth)(self, arg); - Py_DECREF(arg); - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%d given)", - ((PyCFunctionObject*)func)->m_ml->ml_name, na); - return NULL; - default: - fprintf(stderr, "%.200s() flags = %d\n", - ((PyCFunctionObject*)func)->m_ml->ml_name, flags); - PyErr_BadInternalCall(); - return NULL; - } - } static PyObject * --- 3225,3231 ---- } ! /* The fast_function() function optimize calls for which no argument tuple is necessary; the objects are passed directly from the stack. */ static PyObject * From nnorwitz@users.sourceforge.net Fri Aug 16 20:29:01 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 16 Aug 2002 12:29:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31027/Lib/test Modified Files: test_tempfile.py Log Message: Drop the number of test files to 100 for all the tests Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_tempfile.py 14 Aug 2002 14:52:02 -0000 1.5 --- test_tempfile.py 16 Aug 2002 19:28:59 -0000 1.6 *************** *** 19,22 **** --- 19,26 ---- has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) + # TEST_FILES may need to be tweaked for systems depending on the maximum + # number of files that can be opened at one time (see ulimit -n) + TEST_FILES = 100 + # This is organized as one test for each chunk of code in tempfile.py, # in order of their appearance in the file. Testing which requires *************** *** 157,161 **** dict = {} r = self.r ! for i in xrange(100): s = r.next() self.nameCheck(s, '', '', '') --- 161,165 ---- dict = {} r = self.r ! for i in xrange(TEST_FILES): s = r.next() self.nameCheck(s, '', '', '') *************** *** 291,295 **** def test_basic_many(self): """_mkstemp_inner can create many files (stochastic)""" ! extant = range(1000) for i in extant: extant[i] = self.do_create(pre="aa") --- 295,299 ---- def test_basic_many(self): """_mkstemp_inner can create many files (stochastic)""" ! extant = range(TEST_FILES) for i in extant: extant[i] = self.do_create(pre="aa") *************** *** 495,499 **** def test_basic_many(self): """mkdtemp can create many directories (stochastic)""" ! extant = range(1000) try: for i in extant: --- 499,503 ---- def test_basic_many(self): """mkdtemp can create many directories (stochastic)""" ! extant = range(TEST_FILES) try: for i in extant: *************** *** 583,587 **** def test_many(self): """mktemp can choose many usable file names (stochastic)""" ! extant = range(1000) for i in extant: extant[i] = self.do_create(pre="aa") --- 587,591 ---- def test_many(self): """mktemp can choose many usable file names (stochastic)""" ! extant = range(TEST_FILES) for i in extant: extant[i] = self.do_create(pre="aa") From jhylton@users.sourceforge.net Fri Aug 16 21:19:55 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 16 Aug 2002 13:19:55 -0700 Subject: [Python-checkins] python/dist/src/Python future.c,2.12.2.2,2.12.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13783 Modified Files: Tag: ast-branch future.c Log Message: Rewrite future to use the AST. Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.12.2.2 retrieving revision 2.12.2.3 diff -C2 -d -r2.12.2.2 -r2.12.2.3 *** future.c 9 Jul 2002 13:22:01 -0000 2.12.2.2 --- future.c 16 Aug 2002 20:19:53 -0000 2.12.2.3 *************** *** 11,38 **** #define FUTURE_IMPORT_STAR "future statement does not support import *" - /* FUTURE_POSSIBLE() is provided to accomodate doc strings, which is - the only statement that can occur before a future statement. - */ - #define FUTURE_POSSIBLE(FF) ((FF)->ff_last_lineno == -1) - static int ! future_check_features(PyFutureFeatures *ff, node *n, char *filename) { int i; ! char *feature; ! node *ch; ! REQ(n, import_stmt); /* must by from __future__ import ... */ ! for (i = 3; i < NCH(n); i += 2) { ! ch = CHILD(n, i); ! if (TYPE(ch) == STAR) { ! PyErr_SetString(PyExc_SyntaxError, ! FUTURE_IMPORT_STAR); ! PyErr_SyntaxLocation(filename, ch->n_lineno); ! return -1; ! } ! REQ(ch, import_as_name); ! feature = STR(CHILD(ch, 0)); if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { continue; --- 11,28 ---- #define FUTURE_IMPORT_STAR "future statement does not support import *" static int ! future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename) { int i; ! const char *feature; ! asdl_seq *names; ! assert(s->kind == ImportFrom_kind); ! names = s->v.ImportFrom.names; ! for (i = 0; i < asdl_seq_LEN(names); i++) { ! feature = PyString_AsString(asdl_seq_get(names, i)); ! if (!feature) ! return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { continue; *************** *** 44,247 **** PyErr_SetString(PyExc_SyntaxError, "not a chance"); ! PyErr_SyntaxLocation(filename, CHILD(ch, 0)->n_lineno); ! return -1; } else { PyErr_Format(PyExc_SyntaxError, UNDEFINED_FUTURE_FEATURE, feature); ! PyErr_SyntaxLocation(filename, CHILD(ch, 0)->n_lineno); ! return -1; } } ! return 0; ! } ! ! static void ! future_error(node *n, char *filename) ! { ! PyErr_SetString(PyExc_SyntaxError, ! "from __future__ imports must occur at the " ! "beginning of the file"); ! PyErr_SyntaxLocation(filename, n->n_lineno); } ! /* Relevant portions of the grammar: ! ! single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE ! file_input: (NEWLINE | stmt)* ENDMARKER ! stmt: simple_stmt | compound_stmt ! simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE ! small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt ! | import_stmt | global_stmt | exec_stmt | assert_stmt ! import_stmt: 'import' dotted_as_name (',' dotted_as_name)* ! | 'from' dotted_name 'import' ('*' | import_as_name (',' import_as_name)*) ! import_as_name: NAME [NAME NAME] ! dotted_as_name: dotted_name [NAME NAME] ! dotted_name: NAME ('.' NAME)* ! */ ! ! /* future_parse() finds future statements at the beginnning of a ! module. The function calls itself recursively, rather than ! factoring out logic for different kinds of statements into ! different routines. ! ! Return values: ! -1 indicates an error occurred, e.g. unknown feature name ! 0 indicates no feature was found ! 1 indicates a feature was found ! */ ! ! static int ! future_parse(PyFutureFeatures *ff, node *n, char *filename) { ! int i, r; ! loop: ! switch (TYPE(n)) { ! case single_input: ! if (TYPE(CHILD(n, 0)) == simple_stmt) { ! n = CHILD(n, 0); ! goto loop; ! } ! return 0; ! case file_input: ! /* Check each statement in the file, starting with the ! first, and continuing until the first statement ! that isn't a future statement. */ - for (i = 0; i < NCH(n); i++) { - node *ch = CHILD(n, i); - if (TYPE(ch) == stmt) { - r = future_parse(ff, ch, filename); - /* Need to check both conditions below - to accomodate doc strings, which - causes r < 0. - */ - if (r < 1 && !FUTURE_POSSIBLE(ff)) - return r; - } - } - return 0; ! case simple_stmt: ! if (NCH(n) == 2) { ! REQ(CHILD(n, 0), small_stmt); ! n = CHILD(n, 0); ! goto loop; ! } else { ! /* Deal with the special case of a series of ! small statements on a single line. If a ! future statement follows some other ! statement, the SyntaxError is raised here. ! In all other cases, the symtable pass ! raises the exception. ! */ ! int found = 0, end_of_future = 0; ! ! for (i = 0; i < NCH(n); i += 2) { ! if (TYPE(CHILD(n, i)) == small_stmt) { ! r = future_parse(ff, CHILD(n, i), ! filename); ! if (r < 1) ! end_of_future = 1; ! else { ! found = 1; ! if (end_of_future) { ! future_error(n, ! filename); ! return -1; ! } ! } ! } } - - /* If we found one and only one, then the - current lineno is legal. - */ - if (found) - ff->ff_last_lineno = n->n_lineno + 1; else - ff->ff_last_lineno = n->n_lineno; - - if (end_of_future && found) return 1; - else - return 0; - } - - case stmt: - if (TYPE(CHILD(n, 0)) == simple_stmt) { - n = CHILD(n, 0); - goto loop; - } else if (TYPE(CHILD(n, 0)) == expr_stmt) { - n = CHILD(n, 0); - goto loop; - } else { - REQ(CHILD(n, 0), compound_stmt); - ff->ff_last_lineno = n->n_lineno; - return 0; } ! ! case small_stmt: ! n = CHILD(n, 0); ! goto loop; ! ! case import_stmt: { ! node *name; ! ! if (STR(CHILD(n, 0))[0] != 'f') { /* from */ ! ff->ff_last_lineno = n->n_lineno; ! return 0; ! } ! name = CHILD(n, 1); ! if (strcmp(STR(CHILD(name, 0)), "__future__") != 0) ! return 0; ! if (future_check_features(ff, n, filename) < 0) ! return -1; ! ff->ff_last_lineno = n->n_lineno + 1; ! return 1; ! } ! ! /* The cases below -- all of them! -- are necessary to find ! and skip doc strings. */ ! case expr_stmt: ! case testlist: ! case test: ! case and_test: ! case not_test: ! case comparison: ! case expr: ! case xor_expr: ! case and_expr: ! case shift_expr: ! case arith_expr: ! case term: ! case factor: ! case power: ! if (NCH(n) == 1) { ! n = CHILD(n, 0); ! goto loop; ! } ! break; ! ! case atom: ! if (TYPE(CHILD(n, 0)) == STRING ! && ff->ff_found_docstring == 0) { ! ff->ff_found_docstring = 1; ! return 0; } ! ff->ff_last_lineno = n->n_lineno; ! return 0; ! ! default: ! ff->ff_last_lineno = n->n_lineno; ! return 0; } ! return 0; } PyFutureFeatures * ! PyNode_Future(node *n, char *filename) { PyFutureFeatures *ff; --- 34,94 ---- PyErr_SetString(PyExc_SyntaxError, "not a chance"); ! PyErr_SyntaxLocation(filename, s->lineno); ! return 0; } else { PyErr_Format(PyExc_SyntaxError, UNDEFINED_FUTURE_FEATURE, feature); ! PyErr_SyntaxLocation(filename, s->lineno); ! return 0; } } ! return 1; } ! int ! future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename) { ! int i; ! static PyObject *future; ! if (!future) { ! future = PyString_InternFromString("__future__"); ! if (!future) ! return 0; ! } ! if (mod->kind != Module_kind) /* XXX */ ! return 1; ! for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { ! stmt_ty s = asdl_seq_get(mod->v.Module.body, i); ! /* The tests below will return from this function unless it is ! still possible to find a future statement. The only things ! that can precede a future statement are another future ! statement and a doc string. */ ! if (s->kind == ImportFrom_kind) { ! if (s->v.ImportFrom.module == future) { ! if (!future_check_features(ff, s, filename)) ! return 0; } else return 1; } ! else if (s->kind == Expr_kind) { ! expr_ty e = s->v.Expr.value; ! if (e->kind != Str_kind) ! return 1; } ! else ! return 1; } ! return 1; } + PyFutureFeatures * ! PyFuture_FromAST(mod_ty mod, const char *filename) { PyFutureFeatures *ff; *************** *** 254,258 **** ff->ff_features = 0; ! if (future_parse(ff, n, filename) < 0) { PyMem_Free((void *)ff); return NULL; --- 101,105 ---- ff->ff_features = 0; ! if (!future_parse(ff, mod, filename)) { PyMem_Free((void *)ff); return NULL; From jhylton@users.sourceforge.net Fri Aug 16 21:27:19 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 16 Aug 2002 13:27:19 -0700 Subject: [Python-checkins] python/dist/src/Python import.c,2.208.2.1,2.208.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv16629 Modified Files: Tag: ast-branch import.c Log Message: Convert to PyAST_Compile(). Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.208.2.1 retrieving revision 2.208.2.2 diff -C2 -d -r2.208.2.1 -r2.208.2.2 *** import.c 9 Jul 2002 13:22:01 -0000 2.208.2.1 --- import.c 16 Aug 2002 20:27:17 -0000 2.208.2.2 *************** *** 4,9 **** #include "Python.h" ! #include "node.h" ! #include "token.h" #include "errcode.h" #include "marshal.h" --- 4,9 ---- #include "Python.h" ! #include "Python-ast.h" ! #include "pythonrun.h" #include "errcode.h" #include "marshal.h" *************** *** 653,667 **** static PyCodeObject * ! parse_source_module(char *pathname, FILE *fp) { ! PyCodeObject *co; ! node *n; ! ! n = PyParser_SimpleParseFile(fp, pathname, Py_file_input); ! if (n == NULL) ! return NULL; ! co = PyNode_Compile(n, pathname); ! PyNode_Free(n); return co; } --- 653,664 ---- static PyCodeObject * ! parse_source_module(const char *pathname, FILE *fp) { ! PyCodeObject *co = NULL; ! mod_ty mod; + mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0); + if (mod) + co = PyAST_Compile(mod, pathname, NULL); return co; } From nnorwitz@users.sourceforge.net Fri Aug 16 23:23:36 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 16 Aug 2002 15:23:36 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets set.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv20464 Modified Files: set.py Log Message: Some cleanup, remove unused variable, use correct parameter Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** set.py 15 Aug 2002 20:42:15 -0000 1.5 --- set.py 16 Aug 2002 22:23:34 -0000 1.6 *************** *** 338,342 **** self._binary_sanity_check(other) data = self._data - value = True for elt in other: if elt in data: --- 338,341 ---- *************** *** 423,427 **** def __init__(self, set): ! self._set = _set def __hash__(self): --- 422,426 ---- def __init__(self, set): ! self._set = set def __hash__(self): From nnorwitz@users.sourceforge.net Sat Aug 17 00:20:41 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 16 Aug 2002 16:20:41 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.179,2.180 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6576/Objects Modified Files: stringobject.c Log Message: Get this to compile again if Py_USING_UNICODE is not defined. com_error() is static in Python/compile.c. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.179 retrieving revision 2.180 diff -C2 -d -r2.179 -r2.180 *** stringobject.c 14 Aug 2002 18:38:27 -0000 2.179 --- stringobject.c 16 Aug 2002 23:20:39 -0000 2.180 *************** *** 620,624 **** case 'N': if (unicode) { ! com_error(com, PyExc_ValueError, "Unicode escapes not legal " "when Unicode disabled"); --- 620,624 ---- case 'N': if (unicode) { ! PyErr_SetString(PyExc_ValueError, "Unicode escapes not legal " "when Unicode disabled"); From gvanrossum@users.sourceforge.net Sat Aug 17 12:31:05 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 17 Aug 2002 04:31:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test tf_inherit_check.py,NONE,1.1.2.1 test_tempfile.py,1.6,1.6.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14163 Modified Files: Tag: tempfile_branch test_tempfile.py Added Files: Tag: tempfile_branch tf_inherit_check.py Log Message: Patch by Zack W to make test_noinherit() more robust. --- NEW FILE: tf_inherit_check.py --- # Helper script for test_tempfile.py. argv[2] is the number of a file # descriptor which should _not_ be open. Check this by attempting to # write to it -- if we succeed, something is wrong. import sys import os verbose = (sys.argv[1] == 'v') try: fd = int(sys.argv[2]) try: os.write(fd, "blat") except os.error: # Success -- could not write to fd. sys.exit(0) else: if verbose: sys.stderr.write("fd %d is open in child" % fd) sys.exit(1) except StandardError: if verbose: raise sys.exit(1) Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** test_tempfile.py 16 Aug 2002 19:28:59 -0000 1.6 --- test_tempfile.py 17 Aug 2002 11:31:02 -0000 1.6.2.1 *************** *** 18,21 **** --- 18,22 ---- has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) + has_spawnl = hasattr(os, 'spawnl') # TEST_FILES may need to be tweaked for systems depending on the maximum *************** *** 324,360 **** def test_noinherit(self): """_mkstemp_inner file handles are not inherited by child processes""" ! # FIXME: Find a way to test this on Windows. ! if os.name != 'posix': return # ugh, can't use TestSkipped. ! file = self.do_create() ! # We have to exec something, so that FD_CLOEXEC will take ! # effect. The sanest thing to try is /bin/sh; we can easily ! # instruct it to attempt to write to the fd and report success ! # or failure. Unfortunately, sh syntax does not permit use of ! # fds numerically larger than 9; abandon this test if so. ! if file.fd > 9: ! raise test_support.TestSkipped, 'cannot test with fd %d' % file.fd ! pid = os.fork() ! if pid: ! status = os.wait()[1] ! self.failUnless(os.WIFEXITED(status), ! "child process did not exit (status %d)" % status) ! # We want the child to have exited _un_successfully, indicating ! # failure to write to the closed fd. ! self.failUnless(os.WEXITSTATUS(status) != 0, ! "child process exited successfully") ! else: ! try: ! # Throw away stderr. ! nul = os.open('/dev/null', os.O_RDWR) ! os.dup2(nul, 2) ! os.execv('/bin/sh', ['sh', '-c', 'echo blat >&%d' % file.fd]) ! except: ! os._exit(0) def test_textmode(self): --- 325,355 ---- def test_noinherit(self): """_mkstemp_inner file handles are not inherited by child processes""" ! if not has_spawnl: return # ugh, can't use TestSkipped. ! if test_support.verbose: ! v="v" ! else: ! v="q" ! file = self.do_create() ! fd = "%d" % file.fd ! try: ! me = __file__ ! except NameError: ! me = sys.argv[0] ! # We have to exec something, so that FD_CLOEXEC will take ! # effect. The core of this test is therefore in ! # tf_inherit_check.py, which see. ! tester = os.path.join(os.path.dirname(os.path.abspath(me)), ! "tf_inherit_check.py") ! retval = os.spawnl(os.P_WAIT, sys.executable, ! sys.executable, tester, v, fd) ! self.failIf(retval < 0, ! "child process caught fatal signal %d" % -retval) ! self.failIf(retval > 0, "child process reports failure") def test_textmode(self): From gvanrossum@users.sourceforge.net Sat Aug 17 12:41:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 17 Aug 2002 04:41:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test tf_inherit_check.py,1.1,1.2 test_tempfile.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15933 Modified Files: test_tempfile.py Added Files: tf_inherit_check.py Log Message: Patch by Zack W to make test_noinherit() more robust: spawn a Python subprocess that does the right checks. This now works on Windows as well. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_tempfile.py 16 Aug 2002 19:28:59 -0000 1.6 --- test_tempfile.py 17 Aug 2002 11:41:01 -0000 1.7 *************** *** 18,21 **** --- 18,22 ---- has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) + has_spawnl = hasattr(os, 'spawnl') # TEST_FILES may need to be tweaked for systems depending on the maximum *************** *** 324,360 **** def test_noinherit(self): """_mkstemp_inner file handles are not inherited by child processes""" ! # FIXME: Find a way to test this on Windows. ! if os.name != 'posix': return # ugh, can't use TestSkipped. ! file = self.do_create() ! # We have to exec something, so that FD_CLOEXEC will take ! # effect. The sanest thing to try is /bin/sh; we can easily ! # instruct it to attempt to write to the fd and report success ! # or failure. Unfortunately, sh syntax does not permit use of ! # fds numerically larger than 9; abandon this test if so. ! if file.fd > 9: ! raise test_support.TestSkipped, 'cannot test with fd %d' % file.fd ! pid = os.fork() ! if pid: ! status = os.wait()[1] ! self.failUnless(os.WIFEXITED(status), ! "child process did not exit (status %d)" % status) ! # We want the child to have exited _un_successfully, indicating ! # failure to write to the closed fd. ! self.failUnless(os.WEXITSTATUS(status) != 0, ! "child process exited successfully") ! else: ! try: ! # Throw away stderr. ! nul = os.open('/dev/null', os.O_RDWR) ! os.dup2(nul, 2) ! os.execv('/bin/sh', ['sh', '-c', 'echo blat >&%d' % file.fd]) ! except: ! os._exit(0) def test_textmode(self): --- 325,355 ---- def test_noinherit(self): """_mkstemp_inner file handles are not inherited by child processes""" ! if not has_spawnl: return # ugh, can't use TestSkipped. ! if test_support.verbose: ! v="v" ! else: ! v="q" ! file = self.do_create() ! fd = "%d" % file.fd ! try: ! me = __file__ ! except NameError: ! me = sys.argv[0] ! # We have to exec something, so that FD_CLOEXEC will take ! # effect. The core of this test is therefore in ! # tf_inherit_check.py, which see. ! tester = os.path.join(os.path.dirname(os.path.abspath(me)), ! "tf_inherit_check.py") ! retval = os.spawnl(os.P_WAIT, sys.executable, ! sys.executable, tester, v, fd) ! self.failIf(retval < 0, ! "child process caught fatal signal %d" % -retval) ! self.failIf(retval > 0, "child process reports failure") def test_textmode(self): From gvanrossum@users.sourceforge.net Sat Aug 17 13:20:53 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 17 Aug 2002 05:20:53 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets set.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv23432 Modified Files: set.py Log Message: Default sort_repr to True, per Tim's recommendation. Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** set.py 16 Aug 2002 22:23:34 -0000 1.6 --- set.py 17 Aug 2002 12:20:50 -0000 1.7 *************** *** 52,61 **** # Constructor ! def __init__(self, seq=None, sort_repr=False): """Construct a set, optionally initializing it from a sequence. ! If the optional keyword argument sort_repr is True, the set's ! elements are displayed in sorted order. This slows down ! conversion to string, but simplifies comparison during testing. """ self._sort_repr = sort_repr --- 52,64 ---- # Constructor ! def __init__(self, seq=None, sort_repr=True): """Construct a set, optionally initializing it from a sequence. ! Unless the optional keyword argument sort_repr is False, the ! set's elements are displayed in sorted order. This slows down ! string conversions, but is generally more user-friendly. The ! option to turn off this behavior is provided so that you can ! create sets whose elements are not ordered; for example, ! complex numbers. """ self._sort_repr = sort_repr *************** *** 279,288 **** _hashcode = None ! def __init__(self, seq, sort_repr=0): """Construct an immutable set from a sequence. ! If the optional keyword argument sort_repr is True, the set's ! elements are displayed in sorted order. This slows down ! conversion to string, but simplifies comparison during testing. """ # Override the constructor to make 'seq' a required argument --- 282,294 ---- _hashcode = None ! def __init__(self, seq, sort_repr=True): """Construct an immutable set from a sequence. ! Unless the optional keyword argument sort_repr is False, the ! set's elements are displayed in sorted order. This slows down ! string conversions, but is generally more user-friendly. The ! option to turn off this behavior is provided so that you can ! create sets whose elements are not ordered; for example, ! complex numbers. """ # Override the constructor to make 'seq' a required argument *************** *** 445,461 **** # Unit set ! green = Set((0,), 1) assert `green` == "Set([0])", "Unit set: %s" % `green` # 3-element set ! blue = Set([0, 1, 2], 1) assert `blue` == "Set([0, 1, 2])", "3-element set: %s" % `blue` # 2-element set with other values ! black = Set([0, 5], 1) assert `black` == "Set([0, 5])", "2-element set: %s" % `black` # All elements from all sets ! white = Set([0, 1, 2, 5], 1) assert `white` == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` --- 451,467 ---- # Unit set ! green = Set((0,)) assert `green` == "Set([0])", "Unit set: %s" % `green` # 3-element set ! blue = Set([0, 1, 2]) assert `blue` == "Set([0, 1, 2])", "3-element set: %s" % `blue` # 2-element set with other values ! black = Set([0, 5]) assert `black` == "Set([0, 5])", "2-element set: %s" % `black` # All elements from all sets ! white = Set([0, 1, 2, 5]) assert `white` == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` From gvanrossum@users.sourceforge.net Sat Aug 17 15:50:26 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 17 Aug 2002 07:50:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17942/test Modified Files: test_tempfile.py Log Message: Get rid of _once(); inlining it takes less code. :-) Also, don't call gettempdir() in the default expression for the 'dir' argument to various functions; use 'dir=None' for the default and insert 'if dir is None: dir = gettemptir()' in the bodies. That way the work done by gettempdir is postponed until needed. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_tempfile.py 17 Aug 2002 11:41:01 -0000 1.7 --- test_tempfile.py 17 Aug 2002 14:50:24 -0000 1.8 *************** *** 85,149 **** - class test__once(TC): - """Test the internal function _once.""" - - def setUp(self): - tempfile.once_var = None - self.already_called = 0 - - def tearDown(self): - del tempfile.once_var - - def callMeOnce(self): - self.failIf(self.already_called, "callMeOnce called twice") - self.already_called = 1 - return 24 - - def do_once(self): - tempfile._once('once_var', self.callMeOnce) - - def test_once_initializes(self): - """_once initializes its argument""" - - self.do_once() - - self.assertEqual(tempfile.once_var, 24, - "once_var=%d, not 24" % tempfile.once_var) - self.assertEqual(self.already_called, 1, - "already_called=%d, not 1" % self.already_called) - - def test_once_means_once(self): - """_once calls the callback just once""" - - self.do_once() - self.do_once() - self.do_once() - self.do_once() - - def test_once_namespace_safe(self): - """_once does not modify anything but its argument""" - - env_copy = tempfile.__dict__.copy() - - self.do_once() - - env = tempfile.__dict__ - - a = env.keys() - a.sort() - b = env_copy.keys() - b.sort() - - self.failIf(len(a) != len(b)) - for i in xrange(len(a)): - self.failIf(a[i] != b[i]) - - key = a[i] - if key != 'once_var': - self.failIf(env[key] != env_copy[key]) - - test_classes.append(test__once) - - class test__RandomNameSequence(TC): """Test the internal iterator object _RandomNameSequence.""" --- 85,88 ---- From gvanrossum@users.sourceforge.net Sat Aug 17 15:50:26 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 17 Aug 2002 07:50:26 -0700 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17942 Modified Files: tempfile.py Log Message: Get rid of _once(); inlining it takes less code. :-) Also, don't call gettempdir() in the default expression for the 'dir' argument to various functions; use 'dir=None' for the default and insert 'if dir is None: dir = gettemptir()' in the bodies. That way the work done by gettempdir is postponed until needed. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** tempfile.py 14 Aug 2002 15:41:26 -0000 1.49 --- tempfile.py 17 Aug 2002 14:50:24 -0000 1.50 *************** *** 81,111 **** _once_lock = _allocate_lock() - def _once(var, initializer): - """Wrapper to execute an initialization operation just once, - even if multiple threads reach the same point at the same time. - - var is the name (as a string) of the variable to be entered into - the current global namespace. - - initializer is a callable which will return the appropriate initial - value for variable. It will be called only if variable is not - present in the global namespace, or its current value is None. - - Do not call _once from inside an initializer routine, it will deadlock. - """ - - vars = globals() - # Check first outside the lock. - if vars.get(var) is not None: - return - try: - _once_lock.acquire() - # Check again inside the lock. - if vars.get(var) is not None: - return - vars[var] = initializer() - finally: - _once_lock.release() - class _RandomNameSequence: """An instance of _RandomNameSequence generates an endless --- 81,84 ---- *************** *** 179,184 **** def _get_default_tempdir(): """Calculate the default directory to use for temporary files. ! This routine should be called through '_once' (see above) as we ! do not want multiple threads attempting this calculation simultaneously. We determine whether or not a candidate temp dir is usable by --- 152,156 ---- def _get_default_tempdir(): """Calculate the default directory to use for temporary files. ! This routine should be called exactly once. We determine whether or not a candidate temp dir is usable by *************** *** 213,220 **** ("No usable temporary directory found in %s" % dirlist)) def _get_candidate_names(): """Common setup sequence for all user-callable interfaces.""" ! _once('_name_sequence', _RandomNameSequence) return _name_sequence --- 185,201 ---- ("No usable temporary directory found in %s" % dirlist)) + _name_sequence = None + def _get_candidate_names(): """Common setup sequence for all user-callable interfaces.""" ! global _name_sequence ! if _name_sequence is None: ! _once_lock.acquire() ! try: ! if _name_sequence is None: ! _name_sequence = _RandomNameSequence() ! finally: ! _once_lock.release() return _name_sequence *************** *** 246,255 **** return template def gettempdir(): """Accessor for tempdir.tempdir.""" ! _once('tempdir', _get_default_tempdir) return tempdir ! def mkstemp(suffix="", prefix=template, dir=gettempdir(), text=False): """mkstemp([suffix, [prefix, [dir, [text]]]]) User-callable function to create and return a unique temporary --- 227,245 ---- return template + tempdir = None + def gettempdir(): """Accessor for tempdir.tempdir.""" ! global tempdir ! if tempdir is None: ! _once_lock.acquire() ! try: ! if tempdir is None: ! tempdir = _get_default_tempdir() ! finally: ! _once_lock.release() return tempdir ! def mkstemp(suffix="", prefix=template, dir=None, text=False): """mkstemp([suffix, [prefix, [dir, [text]]]]) User-callable function to create and return a unique temporary *************** *** 278,281 **** --- 268,274 ---- """ + if dir is None: + dir = gettempdir() + if text: flags = _text_openflags *************** *** 286,290 **** ! def mkdtemp(suffix="", prefix=template, dir=gettempdir()): """mkdtemp([suffix, [prefix, [dir]]]) User-callable function to create and return a unique temporary --- 279,283 ---- ! def mkdtemp(suffix="", prefix=template, dir=None): """mkdtemp([suffix, [prefix, [dir]]]) User-callable function to create and return a unique temporary *************** *** 300,303 **** --- 293,299 ---- """ + if dir is None: + dir = gettempdir() + names = _get_candidate_names() *************** *** 315,319 **** raise IOError, (_errno.EEXIST, "No usable temporary directory name found") ! def mktemp(suffix="", prefix=template, dir=gettempdir()): """mktemp([suffix, [prefix, [dir]]]) User-callable function to return a unique temporary file name. The --- 311,315 ---- raise IOError, (_errno.EEXIST, "No usable temporary directory name found") ! def mktemp(suffix="", prefix=template, dir=None): """mktemp([suffix, [prefix, [dir]]]) User-callable function to return a unique temporary file name. The *************** *** 333,336 **** --- 329,335 ---- RuntimeWarning, stacklevel=2) + if dir is None: + dir = gettempdir() + names = _get_candidate_names() for seq in xrange(TMP_MAX): *************** *** 384,388 **** def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", ! prefix=template, dir=gettempdir()): """Create and return a temporary file. Arguments: --- 383,387 ---- def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", ! prefix=template, dir=None): """Create and return a temporary file. Arguments: *************** *** 397,400 **** --- 396,402 ---- """ + if dir is None: + dir = gettempdir() + if 'b' in mode: flags = _bin_openflags *************** *** 418,422 **** else: def TemporaryFile(mode='w+b', bufsize=-1, suffix="", ! prefix=template, dir=gettempdir()): """Create and return a temporary file. Arguments: --- 420,424 ---- else: def TemporaryFile(mode='w+b', bufsize=-1, suffix="", ! prefix=template, dir=None): """Create and return a temporary file. Arguments: *************** *** 429,432 **** --- 431,437 ---- exist when it is closed. """ + + if dir is None: + dir = gettempdir() if 'b' in mode: From aimacintyre@users.sourceforge.net Sun Aug 18 07:26:35 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 17 Aug 2002 23:26:35 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory usw-pr-cvs1:/tmp/cvs-serv13740 Modified Files: Makefile Log Message: Build process updates: - the security fixes to tempfile have lead to test_tempfile wanting to create 100 temporary files. as the EMX default is only 40, the number of file handles has been bumped (up to 250). - changes to pgen have required restructuring its build support. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 10 Jun 2002 08:04:29 -0000 1.4 --- Makefile 18 Aug 2002 06:26:33 -0000 1.5 *************** *** 1,3 **** ! #####################==================----------------ˇˇˇˇˇˇˇˇˇˇˇˇˇ # # Top-Level Makefile for Building Python 2.3 for OS/2 using GCC/EMX --- 1,3 ---- ! #####################==================---------------- # # Top-Level Makefile for Building Python 2.3 for OS/2 using GCC/EMX *************** *** 22,26 **** # make test (optional) # ! #####################==================----------------ˇˇˇˇˇˇˇˇˇˇˇˇˇ # === Compilation mode: debug or release === --- 22,26 ---- # make test (optional) # ! #####################==================---------------- # === Compilation mode: debug or release === *************** *** 72,75 **** --- 72,77 ---- IMPLIB= emximp EXPLIB= emxexp + EXEOPT= emxbind + # adjust C compiler settings based on build options *************** *** 113,116 **** --- 115,122 ---- endif + # EMX's default number of file handles is 40, which is sometimes insufficient + # (the tempfile regression test tries to create 100 temporary files) + NFILES=250 + # Source file paths SRCPATH=.;../../Python;../../Parser;../../Objects;../../Include;../../Modules *************** *** 236,248 **** # Source files - SRC.PGEN= $(addprefix ../../Parser/, \ - pgenmain.c \ - pgen.c \ - printgrammar.c \ - grammar.c \ - bitset.c \ - firstsets.c) - OBJ.PGEN= $(addprefix $(OUT),$(notdir $(SRC.PGEN:.c=$O))) - SRC.OS2EMX= config.c dlfcn.c getpathp.c SRC.MAIN= $(addprefix $(TOP), \ --- 242,245 ---- *************** *** 254,258 **** Modules/posixmodule.c \ Modules/threadmodule.c) ! SRC.PARSER= $(addprefix $(TOP), \ Parser/acceler.c \ Parser/grammar1.c \ --- 251,255 ---- Modules/posixmodule.c \ Modules/threadmodule.c) ! SRC.PARSE1= $(addprefix $(TOP), \ Parser/acceler.c \ Parser/grammar1.c \ *************** *** 261,268 **** Parser/parser.c \ Parser/parsetok.c \ - Parser/tokenizer.c \ Parser/bitset.c \ ! Parser/metagrammar.c \ Parser/myreadline.c) SRC.PYTHON= $(addprefix $(TOP), \ Python/bltinmodule.c \ --- 258,268 ---- Parser/parser.c \ Parser/parsetok.c \ Parser/bitset.c \ ! Parser/metagrammar.c) ! SRC.PARSE2= $(addprefix $(TOP), \ ! Parser/tokenizer.c \ Parser/myreadline.c) + SRC.PARSER= $(SRC.PARSE1) \ + $(SRC.PARSE2) SRC.PYTHON= $(addprefix $(TOP), \ Python/bltinmodule.c \ *************** *** 339,342 **** --- 339,357 ---- OBJ.LIB= $(addprefix $(OUT),$(notdir $(SRC.LIB:.c=$O))) + SRC.PGEN= $(SRC.PARSE1) \ + $(addprefix $(TOP), \ + Objects/obmalloc.c) \ + $(addprefix $(TOP), \ + Python/mysnprintf.c) \ + $(addprefix $(TOP), \ + Parser/tokenizer_pgen.c \ + Parser/pgenmain.c \ + Parser/pgen.c \ + Parser/printgrammar.c \ + Parser/grammar.c \ + Parser/firstsets.c) \ + + OBJ.PGEN= $(addprefix $(OUT),$(notdir $(SRC.PGEN:.c=$O))) + SRC.EXE= $(TOP)Modules/python.c SRC.PMEXE= pythonpm.c *************** *** 357,361 **** _locale \ math \ - new \ parser \ pwd \ --- 372,375 ---- *************** *** 472,480 **** $(PYTHON.EXE): $(SRC.EXE) $(PYTHON.EXEIMP) $(OUT)python.def $(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.EXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)python.def $(PYTHONPM.EXE): $(SRC.PMEXE) $(PYTHON.EXEIMP) $(OUT)pythonpm.def $(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.PMEXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)pythonpm.def ! $(PGEN.EXE): $(OBJ.PGEN) $(PYTHON.LIB) $(OUT)pgen.def # Explicit building instructions for those external modules that require --- 486,496 ---- $(PYTHON.EXE): $(SRC.EXE) $(PYTHON.EXEIMP) $(OUT)python.def $(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.EXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)python.def + $(EXEOPT) -aq $(PYTHON.EXE) -h$(NFILES) $(PYTHONPM.EXE): $(SRC.PMEXE) $(PYTHON.EXEIMP) $(OUT)pythonpm.def $(CC) -Zmt $(LDMODE.EXE) -Zcrtdll -Wall $(INCLUDE) -L. -lgcc -o $@ $(SRC.PMEXE) $(PYTHON.EXEIMP) $(LIBS) $(OUT)pythonpm.def + $(EXEOPT) -aq $(PYTHONPM.EXE) -h$(NFILES) ! $(PGEN.EXE): $(OBJ.PGEN) $(OUT)pgen.def # Explicit building instructions for those external modules that require *************** *** 632,636 **** # the test target test: ! ./python -tt ../../lib/test/regrtest.py -l -u "network" -include $(OUTBASE)python.dep --- 648,652 ---- # the test target test: ! ./python -E -tt ../../lib/test/regrtest.py -l -u "network" -include $(OUTBASE)python.dep From aimacintyre@users.sourceforge.net Sun Aug 18 07:28:23 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 17 Aug 2002 23:28:23 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx README.os2emx,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory usw-pr-cvs1:/tmp/cvs-serv13992 Modified Files: README.os2emx Log Message: make port notes current Index: README.os2emx =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/README.os2emx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.os2emx 17 Feb 2002 05:23:30 -0000 1.1 --- README.os2emx 18 Aug 2002 06:28:21 -0000 1.2 *************** *** 6,12 **** This release of the port incorporates the following changes from the ! December 24, 2001 release of the Python 2.2 port: - based on the Python v2.3 final release source. --- 6,19 ---- This release of the port incorporates the following changes from the ! April 14, 2002 release of the Python 2.2.1 port: - based on the Python v2.3 final release source. + - now setting higher number of file handles (250). + - defaults to building with PyMalloc enabled (Python 2.3 default). + - the port is now maintained in the Python CVS repository. + + Python 2.3 incorporates several changes which have resolved the + longstanding problems the EMX port has had with test_longexp (used + to be "YOU HAVE BEEN WARNED" item 1). *************** *** 67,74 **** - v2.1.1 on August 5, 2001; - v2.1.1 on August 12, 2001 (cleanup release); ! - v2.1.1 (updated DLL) on August 14, 2001. ! - v2.2b2 on December 8, 2001 (not uploaded to archive sites) ! - v2.2c1 on December 16, 2001 (not uploaded to archive sites) ! - v2.2 on December 24, 2001 It is possible to have these earlier ports still usable after installing --- 74,83 ---- - v2.1.1 on August 5, 2001; - v2.1.1 on August 12, 2001 (cleanup release); ! - v2.1.1 (updated DLL) on August 14, 2001; ! - v2.2b2 on December 8, 2001 (not uploaded to archive sites); ! - v2.2c1 on December 16, 2001 (not uploaded to archive sites); ! - v2.2 on December 24, 2001; ! - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); ! - v2.2.1 on April 14, 2002. It is possible to have these earlier ports still usable after installing *************** *** 92,96 **** - GNU GDBM (Kai Uwe Rommel's port available from Hobbes or LEO, v1.7.3) - zlib (Hung-Chi Chu's port available from Hobbes or LEO, v1.1.3) ! - expat (from ftp://ftp.jclark.com/pub/xml/, v1.2) - GNU MP (Peter Meerwald's port available from LEO, v2.0.2) - GNU UFC (Kai Uwe Rommel's port available from LEO, v2.0.4) --- 101,105 ---- - GNU GDBM (Kai Uwe Rommel's port available from Hobbes or LEO, v1.7.3) - zlib (Hung-Chi Chu's port available from Hobbes or LEO, v1.1.3) ! - expat (distributed with Python, v1.95.2) - GNU MP (Peter Meerwald's port available from LEO, v2.0.2) - GNU UFC (Kai Uwe Rommel's port available from LEO, v2.0.4) *************** *** 114,118 **** Python23.dll is created as a normal OMF DLL, with an OMF import library and module definition file. There is also an a.out (.a) import ! library to support linking the DLL to a.out executables. This port has been built with complete support for multithreading. --- 123,128 ---- Python23.dll is created as a normal OMF DLL, with an OMF import library and module definition file. There is also an a.out (.a) import ! library to support linking the DLL to a.out executables. The DLL ! requires the EMX runtime DLLs. This port has been built with complete support for multithreading. *************** *** 279,322 **** I know about a number of nasties in this port. ! 1. EMX's malloc() and/or the underlying OS/2 VM system aren't particularly ! comfortable with Python's use of heap memory. The test_longexp regression ! test exhausts the available swap space on a machine with 64MB of RAM with ! 150MB of available swap space. ! ! Using a crudely instrumented wrapper around malloc()/realloc()/free(), the ! heap memory usage of the expression at the core of the test ! (eval('[' + '2,' * NUMREPS + ']')) is as follows (approximately): ! NUMREPS = 1 => 300k ! NUMREPS = 10000 => 22MB ! NUMREPS = 20500 => 59MB ! ! I don't even have enough memory to try for NUMREPS = 25000 :-(, let alone ! the NUMREPS = 65580 in test_longexp! I do have a report that the test ! succeeds in the presence of sufficient memory (~200MB RAM). ! ! During the course of running the test routine, the Python parser ! allocates lots of 21 byte memory chunks, each of which is actually ! a 64 byte allocation. There are a smaller number of 3 byte allocations ! which consume 12 bytes each. Consequently, more than 3 times as much ! memory is allocated than is actually used. ! ! The Python Object Allocator code (PyMalloc) was introduced in Python 2.1 ! for Python's core to be able to wrap the malloc() system to deal with ! problems with "unfriendly" malloc() behaviour, such as this. Unfortunately ! for the OS/2 port, it is only supported for the allocation of memory for ! objects, whereas my research into this problem indicates it is the parser ! which is source of this particular malloc() frenzy. ! ! I have attempted using PyMalloc to manage all of Python's memory ! allocation. While this works fine (modulo the socket regression test ! failing in the absence of a socket.pyc), it is a significant performance ! hit - the time to run the regression test blows out from ~3.5 minutes to ! ~5.75 minutes on my system. ! ! I therefore don't plan to pursue this any further for the time being. ! ! Be aware that certain types of expressions could well bring your system ! to its knees as a result of this issue. I have modified the longexp test ! to report failure to highlight this. 2. Eberhard Mattes, author of EMX, writes in his documentation that fork() --- 289,293 ---- I know about a number of nasties in this port. ! {1. Issue resolved...} 2. Eberhard Mattes, author of EMX, writes in his documentation that fork() *************** *** 529,532 **** --- 500,520 ---- [2001/12/08] - 2.2 Final + [2002/03/31] - 2.2.1 Release Candidate 2 + + [2002/04/14] - 2.2.1 Final + + [2002/8/18] + + 26. now explicitly set the number of file handles available to a + Python process to 250. EMX default is 40, which is insufficient for the + recently checked in security improvments to the tempfile regression + test (test_tempfile) which tries to create 100 temporary files. + + This setting can be overridden via the EMXOPT environment variable: + set EMXOPT=-h250 + is equivalent to the setting currently used. The emxbind utility (if you + have it installed) can also be used to permanently change the setting in + python.exe - please refer to the EMX documentation for more information. + ... probably other issues that I've not encountered, or don't remember :-( *************** *** 568,570 **** Web: http://www.andymac.org/ ! 24 December, 2001. --- 556,558 ---- Web: http://www.andymac.org/ ! 18 August, 2001. From aimacintyre@users.sourceforge.net Sun Aug 18 07:31:03 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 17 Aug 2002 23:31:03 -0700 Subject: [Python-checkins] python/dist/src/PC/os2vacpp makefile,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2vacpp In directory usw-pr-cvs1:/tmp/cvs-serv14360 Modified Files: makefile Log Message: Prep for 2.3: - update DLL version number - add files required for 2.3 (no changes to modules though) - restructure build of pgen.exe NOTE: As I don't have the VACPP compiler, these changes are untested. Apart from slightly re-ordering some file lists, and matching file name casing, I believe these changes are the minimum necessary to build 2.3 with VACPP. Index: makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** makefile 14 Jun 2002 20:41:15 -0000 1.7 --- makefile 18 Aug 2002 06:31:01 -0000 1.8 *************** *** 7,14 **** # version 4.0 of the NMAKE tool that comes with that package. # ! # The output of the build is a largish Python15.DLL containing the # essential modules of Python and a small Python.exe program to start # the interpreter. When embedding Python within another program, only ! # Python15.DLL is needed. # # These two binaries can be statically linked with the VisualAge C/C++ --- 7,14 ---- # version 4.0 of the NMAKE tool that comes with that package. # ! # The output of the build is a largish Python23.DLL containing the # essential modules of Python and a small Python.exe program to start # the interpreter. When embedding Python within another program, only ! # Python23.DLL is needed. # # These two binaries can be statically linked with the VisualAge C/C++ *************** *** 134,150 **** $(PATHOBJ)\Acceler.obj \ $(PATHOBJ)\Grammar1.obj \ ! $(PATHOBJ)\MyReadline.obj \ $(PATHOBJ)\Node.obj \ $(PATHOBJ)\Parser.obj \ $(PATHOBJ)\ParseTok.obj \ ! $(PATHOBJ)\Tokenizer.obj # Python Object Types OBJECTS = \ $(PATHOBJ)\Abstract.obj \ $(PATHOBJ)\ClassObject.obj \ $(PATHOBJ)\CObject.obj \ $(PATHOBJ)\ComplexObject.obj \ $(PATHOBJ)\DictObject.obj \ $(PATHOBJ)\FileObject.obj \ $(PATHOBJ)\FloatObject.obj \ --- 134,158 ---- $(PATHOBJ)\Acceler.obj \ $(PATHOBJ)\Grammar1.obj \ ! $(PATHOBJ)\ListNode.obj \ $(PATHOBJ)\Node.obj \ $(PATHOBJ)\Parser.obj \ $(PATHOBJ)\ParseTok.obj \ ! $(PATHOBJ)\BitSet.obj \ ! $(PATHOBJ)\MetaGrammar.obj \ ! $(PATHOBJ)\Tokenizer.obj \ ! $(PATHOBJ)\MyReadline.obj # Python Object Types OBJECTS = \ $(PATHOBJ)\Abstract.obj \ + $(PATHOBJ)\BoolObject.obj \ + $(PATHOBJ)\BufferObject.obj \ + $(PATHOBJ)\CellObject.obj \ $(PATHOBJ)\ClassObject.obj \ $(PATHOBJ)\CObject.obj \ $(PATHOBJ)\ComplexObject.obj \ + $(PATHOBJ)\DescrObject.obj \ $(PATHOBJ)\DictObject.obj \ + $(PATHOBJ)\EnumObject.obj \ $(PATHOBJ)\FileObject.obj \ $(PATHOBJ)\FloatObject.obj \ *************** *** 152,155 **** --- 160,164 ---- $(PATHOBJ)\FuncObject.obj \ $(PATHOBJ)\IntObject.obj \ + $(PATHOBJ)\IterObject.obj \ $(PATHOBJ)\ListObject.obj \ $(PATHOBJ)\LongObject.obj \ *************** *** 160,171 **** $(PATHOBJ)\SliceObject.obj \ $(PATHOBJ)\StringObject.obj \ $(PATHOBJ)\TupleObject.obj \ $(PATHOBJ)\TypeObject.obj \ ! $(PATHOBJ)\unicodeobject.obj \ ! $(PATHOBJ)\unicodectype.obj \ ! $(PATHOBJ)\cellobject.obj \ ! $(PATHOBJ)\descrobject.obj \ ! $(PATHOBJ)\weakrefobject.obj \ ! $(PATHOBJ)\structseq.obj # Extension Modules (Built-In or as Separate DLLs) --- 169,178 ---- $(PATHOBJ)\SliceObject.obj \ $(PATHOBJ)\StringObject.obj \ + $(PATHOBJ)\StructSeq.obj \ $(PATHOBJ)\TupleObject.obj \ $(PATHOBJ)\TypeObject.obj \ ! $(PATHOBJ)\UnicodeObject.obj \ ! $(PATHOBJ)\UnicodeCType.obj \ ! $(PATHOBJ)\WeakrefObject.obj # Extension Modules (Built-In or as Separate DLLs) *************** *** 177,180 **** --- 184,188 ---- $(PATHOBJ)\cStringIO.obj \ $(PATHOBJ)\ErrnoModule.obj \ + $(PATHOBJ)\GCModule.obj \ $(PATHOBJ)\GetBuildInfo.obj \ $(PATHOBJ)\GetPathP.obj \ *************** *** 197,214 **** $(PATHOBJ)\TimeModule.obj \ $(PATHOBJ)\ThreadModule.obj \ ! $(PATHOBJ)\YUVConvert.obj \ ! $(PATHOBJ)\bufferobject.obj \ ! $(PATHOBJ)\gcmodule.obj # Standalone Parser Generator Program (Shares Some of Python's Modules) PGEN = \ - $(PATHOBJ)\PGenMain.obj \ $(PATHOBJ)\PGen.obj \ $(PATHOBJ)\PrintGrammar.obj \ - $(PATHOBJ)\ListNode.obj \ $(PATHOBJ)\Grammar.obj \ ! $(PATHOBJ)\BitSet.obj \ ! $(PATHOBJ)\FirstSets.obj \ ! $(PATHOBJ)\MetaGrammar.obj ################## --- 205,219 ---- $(PATHOBJ)\TimeModule.obj \ $(PATHOBJ)\ThreadModule.obj \ ! $(PATHOBJ)\YUVConvert.obj # Standalone Parser Generator Program (Shares Some of Python's Modules) PGEN = \ $(PATHOBJ)\PGen.obj \ + $(PATHOBJ)\PGenMain.obj \ + $(PATHOBJ)\MySNPrintf.obj \ + $(PATHOBJ)\Tokenizer_Pgen.obj \ $(PATHOBJ)\PrintGrammar.obj \ $(PATHOBJ)\Grammar.obj \ ! $(PATHOBJ)\FirstSets.obj ################## *************** *** 224,228 **** # /Gd = Dynamically Load Runtime # /Ms = Use _System Calling Convention (vs _Optlink) ! # (to allow non-VAC++ code to call into Python22.dll) _OPT = /O /Gl --- 229,233 ---- # /Gd = Dynamically Load Runtime # /Ms = Use _System Calling Convention (vs _Optlink) ! # (to allow non-VAC++ code to call into Python23.dll) _OPT = /O /Gl *************** *** 259,264 **** # Primary Target(s) ################### ! All: obj noise PyCore.lib Python22.lib PGen.exe \ ! Python.exe PythonPM.exe Python22.dll # _tkinter.dll Modules: $(MODULES) --- 264,269 ---- # Primary Target(s) ################### ! All: obj noise PyCore.lib Python23.lib PGen.exe \ ! Python.exe PythonPM.exe Python23.dll # _tkinter.dll Modules: $(MODULES) *************** *** 280,284 **** # Python Extension DLL: Tcl/Tk Interface ! #_tkinter.dll: $(PATHOBJ)\_tkinter.obj Python22.lib _tkinter.def # @ Echo Linking $@ As DLL # @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) --- 285,289 ---- # Python Extension DLL: Tcl/Tk Interface ! #_tkinter.dll: $(PATHOBJ)\_tkinter.obj Python23.lib _tkinter.def # @ Echo Linking $@ As DLL # @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) *************** *** 293,297 **** @ ! ILIB $@ /NOLOGO /NOBACKUP -+$? ; >>$(ERRS) ! Python22.dll: $(PATHOBJ)\Compile.obj PyCore.lib Python.def @ Echo Linking $@ As DLL @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) --- 298,302 ---- @ ! ILIB $@ /NOLOGO /NOBACKUP -+$? ; >>$(ERRS) ! Python23.dll: $(PATHOBJ)\Compile.obj PyCore.lib Python.def @ Echo Linking $@ As DLL @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) *************** *** 304,320 **** @ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS) ! # Import Library for Using the Python22.dll ! Python22.lib: Python.def @ Echo Making $@ @ IMPLIB /NOLOGO /NOIGNORE $@ $** >>$(ERRS) @ ILIB /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP $@; >>$(ERRS) ! # Small Command-Line Program to Start Interpreter in Python22.dll ! Python.exe: $(PATHOBJ)\Python.obj Python22.lib @ Echo Linking $@ As EXE @ $(CC) $(CFLAGS) $(_EXE) /B"/PM:VIO /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) ! # Small PM-GUI Program to Start Interpreter in Python22.dll ! PythonPM.exe: $(PATHOBJ)\Python.obj Python22.lib @ Echo Linking $@ As EXE @ $(CC) $(CFLAGS) $(_EXE) /B"/PM:PM /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) --- 309,325 ---- @ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS) ! # Import Library for Using the Python23.dll ! Python23.lib: Python.def @ Echo Making $@ @ IMPLIB /NOLOGO /NOIGNORE $@ $** >>$(ERRS) @ ILIB /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP $@; >>$(ERRS) ! # Small Command-Line Program to Start Interpreter in Python23.dll ! Python.exe: $(PATHOBJ)\Python.obj Python23.lib @ Echo Linking $@ As EXE @ $(CC) $(CFLAGS) $(_EXE) /B"/PM:VIO /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) ! # Small PM-GUI Program to Start Interpreter in Python23.dll ! PythonPM.exe: $(PATHOBJ)\Python.obj Python23.lib @ Echo Linking $@ As EXE @ $(CC) $(CFLAGS) $(_EXE) /B"/PM:PM /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS) *************** *** 336,346 **** # Remove All Targets, Including Final Binaries distclean: clean ! -- Del /Q PyCore.lib Python22.lib >NUL 2>&1 ! -- Del /Q Python22.dll Python.exe PGen.exe >NUL 2>&1 ! release: Python.exe Python22.dll Python22.lib -- @Echo Y | copy /U Python.exe D:\EXEs ! -- @Echo Y | copy /U Python22.dll D:\DLLs ! -- @Echo Y | copy /U Python22.lib E:\Tau\Lib -- @Echo Y | copy /U _tkinter.dll D:\Python --- 341,351 ---- # Remove All Targets, Including Final Binaries distclean: clean ! -- Del /Q PyCore.lib Python23.lib >NUL 2>&1 ! -- Del /Q Python23.dll Python.exe PGen.exe >NUL 2>&1 ! release: Python.exe Python23.dll Python23.lib -- @Echo Y | copy /U Python.exe D:\EXEs ! -- @Echo Y | copy /U Python23.dll D:\DLLs ! -- @Echo Y | copy /U Python23.lib E:\Tau\Lib -- @Echo Y | copy /U _tkinter.dll D:\Python From aimacintyre@users.sourceforge.net Sun Aug 18 07:32:48 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 17 Aug 2002 23:32:48 -0700 Subject: [Python-checkins] python/dist/src/PC/os2vacpp readme.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2vacpp In directory usw-pr-cvs1:/tmp/cvs-serv14678 Modified Files: readme.txt Log Message: update contact info Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/readme.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** readme.txt 28 Sep 1998 22:02:40 -0000 1.2 --- readme.txt 18 Aug 2002 06:32:46 -0000 1.3 *************** *** 107,114 **** -- Contact Info ! If you have questions, suggestions or problems specifically with ! the OS/2 VAC++ port of Python, please contact me at: ! Jeff Rush . ! I support no other platform but OS/2 (and eventually AmigaDOS). --- 107,119 ---- -- Contact Info ! Jeff Rush is no longer supporting the VACPP port :-( ! I don't have the VACPP compiler, so can't reliably maintain this port. ! Anyone with VACPP who can contribute patches to keep this port buildable ! should upload them to the Python Patch Manager at Sourceforge and ! assign them to me for review/checkin. ! ! Andrew MacIntyre ! aimacintyre at users.sourceforge.net ! August 18, 2002. From aimacintyre@users.sourceforge.net Sun Aug 18 07:47:22 2002 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sat, 17 Aug 2002 23:47:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16703 Modified Files: test_tempfile.py Log Message: OS/2 EMX behaves like Windows where file permissions are concerned Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_tempfile.py 17 Aug 2002 14:50:24 -0000 1.8 --- test_tempfile.py 18 Aug 2002 06:47:19 -0000 1.9 *************** *** 255,259 **** mode = stat.S_IMODE(os.stat(file.name).st_mode) expected = 0600 ! if sys.platform in ('win32',): # There's no distinction among 'user', 'group' and 'world'; # replicate the 'user' bits. --- 255,259 ---- mode = stat.S_IMODE(os.stat(file.name).st_mode) expected = 0600 ! if sys.platform in ('win32', 'os2emx'): # There's no distinction among 'user', 'group' and 'world'; # replicate the 'user' bits. *************** *** 459,463 **** mode = stat.S_IMODE(os.stat(dir).st_mode) expected = 0700 ! if sys.platform in ('win32',): # There's no distinction among 'user', 'group' and 'world'; # replicate the 'user' bits. --- 459,463 ---- mode = stat.S_IMODE(os.stat(dir).st_mode) expected = 0700 ! if sys.platform in ('win32', 'os2emx'): # There's no distinction among 'user', 'group' and 'world'; # replicate the 'user' bits. From rhettinger@users.sourceforge.net Sun Aug 18 21:08:58 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 18 Aug 2002 13:08:58 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.149,1.150 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20991 Modified Files: urllib.py Log Message: Modify splituser() method to allow an @ in the userinfo field. Jeremy reported that this is not allowed by RFC 2396; however, other tools support unescaped @'s so we should also. Apply SF patch 596581 closing bug 581529. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** urllib.py 9 Aug 2002 16:37:33 -0000 1.149 --- urllib.py 18 Aug 2002 20:08:56 -0000 1.150 *************** *** 969,973 **** if _userprog is None: import re ! _userprog = re.compile('^([^@]*)@(.*)$') match = _userprog.match(host) --- 969,973 ---- if _userprog is None: import re ! _userprog = re.compile('^(.*)@(.*)$') match = _userprog.match(host) From rhettinger@users.sourceforge.net Sun Aug 18 21:10:11 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 18 Aug 2002 13:10:11 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.135.6.3,1.135.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22148 Modified Files: Tag: release22-maint urllib.py Log Message: Modify splituser() method to allow an @ in the userinfo field. Jeremy reported that this is not allowed by RFC 2396; however, other tools support unescaped @'s so we should also. Apply SF patch 596581 closing bug 581529. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.135.6.3 retrieving revision 1.135.6.4 diff -C2 -d -r1.135.6.3 -r1.135.6.4 *** urllib.py 18 Apr 2002 02:19:19 -0000 1.135.6.3 --- urllib.py 18 Aug 2002 20:10:08 -0000 1.135.6.4 *************** *** 955,959 **** if _userprog is None: import re ! _userprog = re.compile('^([^@]*)@(.*)$') match = _userprog.match(host) --- 955,959 ---- if _userprog is None: import re ! _userprog = re.compile('^(.*)@(.*)$') match = _userprog.match(host) From jackjansen@users.sourceforge.net Sun Aug 18 22:57:11 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 18 Aug 2002 14:57:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib buildtools.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15345 Modified Files: buildtools.py Log Message: Refuse to run if the last bit of the destination path contains a # character. This is a silly workaround for a rather serious bug in MacOSX: if you take a long filename and convert it to an FSSpec the fsspec gets a magic cooky (containing a #, indeed). If you then massage the extension of this fsspec and convert back to a pathname you may end up referring to the same file. This could destroy your sourcefile. The problem only occcurs in MacPython-OS9, not MacPython-OSX (I think). Closes bug #505562. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** buildtools.py 5 Aug 2002 22:06:29 -0000 1.16 --- buildtools.py 18 Aug 2002 21:57:09 -0000 1.17 *************** *** 75,79 **** progress.label("Compiling...") progress.inc(0) ! # Read the source and compile it # (there's no point overwriting the destination if it has a syntax error) --- 75,82 ---- progress.label("Compiling...") progress.inc(0) ! # check for the script name being longer than 32 chars. This may trigger a bug ! # on OSX that can destroy your sourcefile. ! if '#' in os.path.split(filename)[1]: ! raise BuildError, "BuildApplet could destroy your sourcefile on OSX, please rename: %s" % filename # Read the source and compile it # (there's no point overwriting the destination if it has a syntax error) From rhettinger@users.sourceforge.net Sun Aug 18 23:22:16 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 18 Aug 2002 15:22:16 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.195,1.196 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23754 Modified Files: ACKS Log Message: Add Steve Purcell for unittest.py Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.195 retrieving revision 1.196 diff -C2 -d -r1.195 -r1.196 *** ACKS 14 Aug 2002 18:52:54 -0000 1.195 --- ACKS 18 Aug 2002 22:22:14 -0000 1.196 *************** *** 379,382 **** --- 379,383 ---- Paul Prescod Donovan Preston + Steve Purcell Brian Quinlan Burton Radons From tim_one@users.sourceforge.net Mon Aug 19 01:43:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 18 Aug 2002 17:43:08 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.32,1.337.2.4.2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25402/22/Misc Modified Files: Tag: release22-maint NEWS Log Message: SF bug 595919: popenN return only text mode pipes popen2() and popen3() created text-mode pipes even when binary mode was asked for. This was specific to Windows. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.32 retrieving revision 1.337.2.4.2.33 diff -C2 -d -r1.337.2.4.2.32 -r1.337.2.4.2.33 *** NEWS 9 Aug 2002 15:57:52 -0000 1.337.2.4.2.32 --- NEWS 19 Aug 2002 00:43:06 -0000 1.337.2.4.2.33 *************** *** 68,71 **** --- 68,75 ---- Windows + - SF bug 595919: popenN return only text mode pipes + popen2() and popen3() created text-mode pipes even when binary mode + was asked for. This was specific to Windows. + - Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause of that has been fixed in the installer (disabled Wise's "delete in- From tim_one@users.sourceforge.net Mon Aug 19 01:43:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 18 Aug 2002 17:43:08 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.216.4.6,2.216.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25402/22/Modules Modified Files: Tag: release22-maint posixmodule.c Log Message: SF bug 595919: popenN return only text mode pipes popen2() and popen3() created text-mode pipes even when binary mode was asked for. This was specific to Windows. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.216.4.6 retrieving revision 2.216.4.7 diff -C2 -d -r2.216.4.6 -r2.216.4.7 *** posixmodule.c 30 Jul 2002 01:18:38 -0000 2.216.4.6 --- posixmodule.c 19 Aug 2002 00:43:06 -0000 2.216.4.7 *************** *** 2791,2795 **** PyObject *p1, *p2; ! if (mode && _O_TEXT) { m1 = "r"; m2 = "w"; --- 2791,2795 ---- PyObject *p1, *p2; ! if (mode & _O_TEXT) { m1 = "r"; m2 = "w"; *************** *** 2823,2827 **** PyObject *p1, *p2, *p3; ! if (mode && _O_TEXT) { m1 = "r"; m2 = "w"; --- 2823,2827 ---- PyObject *p1, *p2, *p3; ! if (mode & _O_TEXT) { m1 = "r"; m2 = "w"; From tim_one@users.sourceforge.net Mon Aug 19 01:42:31 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 18 Aug 2002 17:42:31 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.251,2.252 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25161/python/modules Modified Files: posixmodule.c Log Message: SF bug 595919: popenN return only text mode pipes popen2() and popen3() created text-mode pipes even when binary mode was asked for. This was specific to Windows. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.251 retrieving revision 2.252 diff -C2 -d -r2.251 -r2.252 *** posixmodule.c 2 Aug 2002 02:27:13 -0000 2.251 --- posixmodule.c 19 Aug 2002 00:42:29 -0000 2.252 *************** *** 3477,3481 **** PyObject *p1, *p2; ! if (mode && _O_TEXT) { m1 = "r"; m2 = "w"; --- 3477,3481 ---- PyObject *p1, *p2; ! if (mode & _O_TEXT) { m1 = "r"; m2 = "w"; *************** *** 3509,3513 **** PyObject *p1, *p2, *p3; ! if (mode && _O_TEXT) { m1 = "r"; m2 = "w"; --- 3509,3513 ---- PyObject *p1, *p2, *p3; ! if (mode & _O_TEXT) { m1 = "r"; m2 = "w"; From tim_one@users.sourceforge.net Mon Aug 19 02:20:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 18 Aug 2002 18:20:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_base64,1.1.2.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv31956/22/Lib/test/output Removed Files: Tag: release22-maint test_base64 Log Message: A trip down memory lane. Barry checked in this test with 2.3-style imports of test_support. That causes multiple copies of test_support to get loaded, and the one used by test_base64.py didn't see the proper value of verbose=False, so spewed output. That in turn apparenly caused Barry to check in an expected-results output file, but a unitttest-based test should never have one of those. I noticed this because, on Windows, the final unittest output line contains the number of seconds needed to run the test, and that varied on *some* runs when I tried it, causing bogus test failures. Anyway, this gets rid of the expected-output file again, and changes the imports to work with 2.2's way of doing this. --- test_base64 DELETED --- From tim_one@users.sourceforge.net Mon Aug 19 02:20:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 18 Aug 2002 18:20:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_base64.py,1.4.2.1,1.4.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31956/22/Lib/test Modified Files: Tag: release22-maint test_base64.py Log Message: A trip down memory lane. Barry checked in this test with 2.3-style imports of test_support. That causes multiple copies of test_support to get loaded, and the one used by test_base64.py didn't see the proper value of verbose=False, so spewed output. That in turn apparenly caused Barry to check in an expected-results output file, but a unitttest-based test should never have one of those. I noticed this because, on Windows, the final unittest output line contains the number of seconds needed to run the test, and that varied on *some* runs when I tried it, causing bogus test failures. Anyway, this gets rid of the expected-output file again, and changes the imports to work with 2.2's way of doing this. Index: test_base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_base64.py,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** test_base64.py 15 Aug 2002 22:18:11 -0000 1.4.2.1 --- test_base64.py 19 Aug 2002 01:20:09 -0000 1.4.2.2 *************** *** 1,4 **** import unittest ! from test import test_support import base64 from binascii import Error as binascii_error --- 1,4 ---- import unittest ! import test_support import base64 from binascii import Error as binascii_error From rhettinger@users.sourceforge.net Mon Aug 19 04:19:11 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 18 Aug 2002 20:19:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboperator.tex,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23917/Doc/Lib Modified Files: liboperator.tex Log Message: Added __pow__(a,b) to the operator module. Completes the pattern of all operators having a counterpart in the operator module. Closes SF bug #577513. Index: liboperator.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboperator.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** liboperator.tex 20 Oct 2001 04:24:09 -0000 1.21 --- liboperator.tex 19 Aug 2002 03:19:09 -0000 1.22 *************** *** 132,135 **** --- 132,140 ---- \end{funcdesc} + \begin{funcdesc}{pow}{a, b} + \funcline{__pow__}{a, b} + Return \var{a} \code{**} \var{b}, for \var{a} and \var{b} numbers. + \end{funcdesc} + \begin{funcdesc}{rshift}{a, b} \funcline{__rshift__}{a, b} *************** *** 311,314 **** --- 316,321 ---- \lineiii{Bitwise Or}{\code{\var{a} | \var{b}}} {\code{or_(\var{a}, \var{b})}} + \lineiii{Exponentiation}{\code{\var{a} ** \var{b}}} + {\code{pow(\var{a}, \var{b})}} \lineiii{Indexed Assignment}{\code{\var{o}[\var{k}] = \var{v}}} {\code{setitem(\var{o}, \var{k}, \var{v})}} From rhettinger@users.sourceforge.net Mon Aug 19 04:19:11 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 18 Aug 2002 20:19:11 -0700 Subject: [Python-checkins] python/dist/src/Modules operator.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23917/Modules Modified Files: operator.c Log Message: Added __pow__(a,b) to the operator module. Completes the pattern of all operators having a counterpart in the operator module. Closes SF bug #577513. Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** operator.c 13 Aug 2002 22:20:41 -0000 2.23 --- operator.c 19 Aug 2002 03:19:09 -0000 2.24 *************** *** 103,106 **** --- 103,115 ---- static PyObject* + op_pow(PyObject *s, PyObject *a) + { + PyObject *a1, *a2; + if (PyArg_ParseTuple(a,"OO:pow",&a1,&a2)) + return PyNumber_Power(a1, a2, Py_None); + return NULL; + } + + static PyObject* op_getslice(PyObject *s, PyObject *a) { *************** *** 200,203 **** --- 209,213 ---- spam2(delitem,__delitem__, "delitem(a, b) -- Same as del a[b].") + spam2(pow,__pow__, "pow(a, b) -- Same as a**b.") spam2(getslice,__getslice__, "getslice(a, b, c) -- Same as a[b:c].") From rhettinger@users.sourceforge.net Mon Aug 19 04:19:11 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 18 Aug 2002 20:19:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_operator.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23917/Lib/test Modified Files: test_operator.py Log Message: Added __pow__(a,b) to the operator module. Completes the pattern of all operators having a counterpart in the operator module. Closes SF bug #577513. Index: test_operator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operator.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_operator.py 23 Jul 2002 19:03:58 -0000 1.9 --- test_operator.py 19 Aug 2002 03:19:09 -0000 1.10 *************** *** 162,165 **** --- 162,171 ---- self.failUnless(operator.pos(-0) == 0) + def test_pow(self): + self.failUnless(operator.pow(3,5) == 3**5) + self.failUnless(operator.__pow__(3,5) == 3**5) + self.assertRaises(TypeError, operator.pow, 1) + self.assertRaises(TypeError, operator.pow, 1, 2, 3) + def test_repeat(self): a = range(3) From jackjansen@users.sourceforge.net Mon Aug 19 14:17:41 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 19 Aug 2002 06:17:41 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.196,1.197 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15643/Misc Modified Files: ACKS Log Message: Merged the MacPython thanks list into the general acknowledgements. There's really no point in a separate list of thank-you notes. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.196 retrieving revision 1.197 diff -C2 -d -r1.196 -r1.197 *** ACKS 18 Aug 2002 22:22:14 -0000 1.196 --- ACKS 19 Aug 2002 13:17:39 -0000 1.197 *************** *** 29,32 **** --- 29,34 ---- Greg Ball Luigi Ballabio + Michael J. Barber + Chris Barker Cesar Eduardo Barros Des Barry *************** *** 38,41 **** --- 40,44 ---- David Beazley Neal Becker + Bill Bedford Reimer Behrends Thomas Bellman *************** *** 50,53 **** --- 53,57 ---- Martin Bless Pablo Bleyer + Erik van Blokland Finn Bock Paul Boddie *************** *** 60,64 **** --- 64,70 ---- Terrence Brannon Dave Brennan + Tom Bridgman Gary S. Brown + Daniel Brotsky Oleg Broytmann Dave Brueck *************** *** 123,126 **** --- 129,133 ---- Jaromir Dolecek Cesar Douady + Dean Draayer Fred L. Drake, Jr. John DuBois *************** *** 153,156 **** --- 160,164 ---- Sebastian Fernandez Vincent Fiack + Russell Finn Nils Fischbeck Hernán Martínez Foffani *************** *** 164,167 **** --- 172,176 ---- Lele Gaifax Raymund Galvin + Nitin Ganatra Fred Gansevles Lars Marius Garshol *************** *** 234,237 **** --- 243,247 ---- Greg Humphreys Jeremy Hylton + Tony Ingraldi John Interrante Ben Jackson *************** *** 251,256 **** --- 261,268 ---- John Jorgensen Andreas Jung + Tattoo Mabonzo K. Bob Kahn Tamito Kajiyama + Jacob Kaplan-Moss Lou Kates Randall Kern *************** *** 281,284 **** --- 293,297 ---- Chris Lawrence Christopher Lee + Luc Lefebvre Kip Lehman Marc-Andre Lemburg *************** *** 292,295 **** --- 305,309 ---- Martin von Löwis Anne Lord + Tom Loredo Jason Lowe Tony Lownds *************** *** 352,364 **** --- 366,382 ---- Kevin O'Connor Tim O'Malley + Pascal Oberndoerfer Denis S. Otkidach Piet van Oostrum Jason Orendorff Douglas Orr + Russel Owen Todd R. Palmer + Alexandre Parenteau Dan Parisien Harri Pasanen Randy Pausch Ondrej Palkovsky + M. Papillon Marcel van der Peijl Samuele Pedroni *************** *** 445,448 **** --- 463,467 ---- George Sipe Kragen Sitaker + Christopher Smith Gregory P. Smith Rafal Smotrzyk *************** *** 452,456 **** --- 471,477 ---- Per Spilling Noah Spurrier + Oliver Steele Greg Stein + Chris Stern Dan Stromberg Nathan Sullivan *************** *** 506,509 **** --- 527,531 ---- Bob Watson Henrik Weber + Corran Webster Zack Weinberg Edward Welbourne *************** *** 525,528 **** --- 547,551 ---- Dan Wolfe Richard Wolff + Gordon Worley Thomas Wouters Doug Wyatt From jackjansen@users.sourceforge.net Mon Aug 19 14:17:42 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 19 Aug 2002 06:17:42 -0700 Subject: [Python-checkins] python/dist/src/Mac ReadMe,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Mac In directory usw-pr-cvs1:/tmp/cvs-serv15643/Mac Modified Files: ReadMe Log Message: Merged the MacPython thanks list into the general acknowledgements. There's really no point in a separate list of thank-you notes. Index: ReadMe =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/ReadMe,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ReadMe 23 Apr 2002 19:50:53 -0000 1.44 --- ReadMe 19 Aug 2002 13:17:39 -0000 1.45 *************** *** 205,218 **** ------- ! Thanks go to the whole Python community with Guido in the lead, of ! course. Mac-specific thanks go to the pythonmac-sig, Just van Rossum, ! Corran Webster, Tony Ingraldi, Erik van Blokland, Bill Bedford, Chris ! Stern, Gordon Worley, Oliver Steele, M. Papillon, Steven Majewski, David ! Goodger, Chris Barker, Luc Lefebvre, Tattoo Mabonzo K., Russell Finn, ! Tom Bridgman, Russel Owen, Pascal Oberndoerfer, Dean Draayer, ! Alexandre Parenteau, Donovan Preston, Daniel Brotsky, Jason Harper, ! Nitin Ganatra, Jacob Kaplan-Moss, Michael J. Barber, Tom Loredo, ! Christopher Smith, ! and all the other people who provided feedback, code or both! MacPython includes waste, a TextEdit replacement which is (c) 1998 --- 205,210 ---- ------- ! As of Python 2.3 the MacPython thanks list has been merged into the ! general acknowledgements, see :Misc:ACKS. MacPython includes waste, a TextEdit replacement which is (c) 1998 From rhettinger@users.sourceforge.net Mon Aug 19 15:25:05 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 19 Aug 2002 07:25:05 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.472,1.473 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9755 Modified Files: NEWS Log Message: Fix spelling errors and note the addition of operator.pow() Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.472 retrieving revision 1.473 diff -C2 -d -r1.472 -r1.473 *** NEWS 16 Aug 2002 03:40:07 -0000 1.472 --- NEWS 19 Aug 2002 14:25:03 -0000 1.473 *************** *** 7,11 **** - Assignment to __class__ is disallowed if either the old and the new class is a statically allocated type object (such as defined by an ! extenson module). This prevents anomalies like 2.__class__ = bool. - New-style object creation and deallocation have been sped up --- 7,11 ---- - Assignment to __class__ is disallowed if either the old and the new class is a statically allocated type object (such as defined by an ! extension module). This prevents anomalies like 2.__class__ = bool. - New-style object creation and deallocation have been sped up *************** *** 160,164 **** - Ctrl+C handling on Windows has been made more consistent with other platforms. KeyboardInterrupt can now reliably be caught, ! and Ctrl+C at an interative prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will interrupt time.sleep() in the main thread, and any child processes --- 160,164 ---- - Ctrl+C handling on Windows has been made more consistent with other platforms. KeyboardInterrupt can now reliably be caught, ! and Ctrl+C at an interactive prompt no longer terminates the process under NT/2k/XP (it never did under Win9x). Ctrl+C will interrupt time.sleep() in the main thread, and any child processes *************** *** 299,302 **** --- 299,304 ---- Library + - Added operator.pow(a,b) which is equivalent to a**b. + - random.randrange(-sys.maxint-1, sys.maxint) no longer raises OverflowError. That is, it now accepts any combination of 'start' *************** *** 1760,1764 **** possible, though not likely, that a decision is made not to release this code as part of 2.2 final, if any serious backwards ! incompapatibilities are found during alpha testing that cannot be repaired. --- 1762,1766 ---- possible, though not likely, that a decision is made not to release this code as part of 2.2 final, if any serious backwards ! incompatibilities are found during alpha testing that cannot be repaired. *************** *** 1910,1914 **** - The constants ascii_letters, ascii_lowercase. and ascii_uppercase ! were added to the string module. These a locale-indenpendent constants, unlike letters, lowercase, and uppercase. These are now use in appropriate locations in the standard library. --- 1912,1916 ---- - The constants ascii_letters, ascii_lowercase. and ascii_uppercase ! were added to the string module. These a locale-independent constants, unlike letters, lowercase, and uppercase. These are now use in appropriate locations in the standard library. *************** *** 1957,1965 **** - New test_mutants.py runs dict comparisons where the key and value ! comparison operators mutute the dicts randomly during comparison. This rapidly causes Python to crash under earlier releases (not for the faint of heart: it can also cause Win9x to freeze or reboot!). ! - New test_pprint.py verfies that pprint.isrecursive() and pprint.isreadable() return sensible results. Also verifies that simple cases produce correct output. --- 1959,1967 ---- - New test_mutants.py runs dict comparisons where the key and value ! comparison operators mutate the dicts randomly during comparison. This rapidly causes Python to crash under earlier releases (not for the faint of heart: it can also cause Win9x to freeze or reboot!). ! - New test_pprint.py verifies that pprint.isrecursive() and pprint.isreadable() return sensible results. Also verifies that simple cases produce correct output. *************** *** 2403,2407 **** ImportError if none found. ! The same rules have been implented on other platforms with case- insensitive but case-preserving filesystems too (including Cygwin, and several flavors of Macintosh operating systems). --- 2405,2409 ---- ImportError if none found. ! The same rules have been implemented on other platforms with case- insensitive but case-preserving filesystems too (including Cygwin, and several flavors of Macintosh operating systems). From gvanrossum@users.sourceforge.net Mon Aug 19 17:10:58 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:10:58 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets test_set.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv18059 Modified Files: test_set.py Log Message: Don't pass a sort_repr argument to the constructor -- it's gone. Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/test_set.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_set.py 15 Aug 2002 20:47:31 -0000 1.5 --- test_set.py 19 Aug 2002 16:10:54 -0000 1.6 *************** *** 80,85 **** self.case = "empty set" self.values = [] ! self.set = Set(self.values, 1) ! self.dup = Set(self.values, 1) self.length = 0 self.repr = "Set([])" --- 80,85 ---- self.case = "empty set" self.values = [] ! self.set = Set(self.values) ! self.dup = Set(self.values) self.length = 0 self.repr = "Set([])" *************** *** 91,96 **** self.case = "unit set (number)" self.values = [3] ! self.set = Set(self.values, 1) ! self.dup = Set(self.values, 1) self.length = 1 self.repr = "Set([3])" --- 91,96 ---- self.case = "unit set (number)" self.values = [3] ! self.set = Set(self.values) ! self.dup = Set(self.values) self.length = 1 self.repr = "Set([3])" *************** *** 108,113 **** self.case = "unit set (tuple)" self.values = [(0, "zero")] ! self.set = Set(self.values, 1) ! self.dup = Set(self.values, 1) self.length = 1 self.repr = "Set([(0, 'zero')])" --- 108,113 ---- self.case = "unit set (tuple)" self.values = [(0, "zero")] ! self.set = Set(self.values) ! self.dup = Set(self.values) self.length = 1 self.repr = "Set([(0, 'zero')])" *************** *** 125,130 **** self.case = "triple set" self.values = [0, "zero", operator.add] ! self.set = Set(self.values, 1) ! self.dup = Set(self.values, 1) self.length = 3 self.repr = None --- 125,130 ---- self.case = "triple set" self.values = [0, "zero", operator.add] ! self.set = Set(self.values) ! self.dup = Set(self.values) self.length = 3 self.repr = None From gvanrossum@users.sourceforge.net Mon Aug 19 17:02:39 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:02:39 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14654 Modified Files: descrobject.c Log Message: Simple but important optimization for descr_check(): instead of the expensive and overly general PyObject_IsInstance(), call PyObject_TypeCheck() which is a macro that often avoids a call, and if it does make a call, calls the much more efficient PyType_IsSubtype(). This saved 6% on a benchmark for slot lookups. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** descrobject.c 13 Aug 2002 22:19:13 -0000 2.28 --- descrobject.c 19 Aug 2002 16:02:33 -0000 2.29 *************** *** 66,70 **** return 1; } ! if (!PyObject_IsInstance(obj, (PyObject *)(descr->d_type))) { PyErr_Format(PyExc_TypeError, "descriptor '%s' for '%s' objects " --- 66,70 ---- return 1; } ! if (!PyObject_TypeCheck(obj, descr->d_type)) { PyErr_Format(PyExc_TypeError, "descriptor '%s' for '%s' objects " From gvanrossum@users.sourceforge.net Mon Aug 19 17:13:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:13:38 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets set.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv18972 Modified Files: set.py Log Message: Get rid of sort_repr altogether. Instead, for the test suite there's an internal routine _repr() that takes an optional 'sorted' argument. Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** set.py 17 Aug 2002 12:20:50 -0000 1.7 --- set.py 19 Aug 2002 16:13:31 -0000 1.8 *************** *** 50,66 **** """Common base class for mutable and immutable sets.""" ! # Constructor ! def __init__(self, seq=None, sort_repr=True): ! """Construct a set, optionally initializing it from a sequence. ! Unless the optional keyword argument sort_repr is False, the ! set's elements are displayed in sorted order. This slows down ! string conversions, but is generally more user-friendly. The ! option to turn off this behavior is provided so that you can ! create sets whose elements are not ordered; for example, ! complex numbers. ! """ ! self._sort_repr = sort_repr self._data = {} if seq is not None: --- 50,59 ---- """Common base class for mutable and immutable sets.""" ! __slots__ = ['_data'] ! # Constructor ! def __init__(self, seq=None): ! """Construct a set, optionally initializing it from a sequence.""" self._data = {} if seq is not None: *************** *** 87,98 **** This looks like 'Set([])'. """ ! elements = self._data.keys() ! if self._sort_repr: ! elements.sort() ! return '%s(%r)' % (self.__class__.__name__, elements) # __str__ is the same as __repr__ __str__ = __repr__ def __iter__(self): """Return an iterator over the elements or a set. --- 80,94 ---- This looks like 'Set([])'. """ ! return self._repr() # __str__ is the same as __repr__ __str__ = __repr__ + def _repr(self, sorted=False): + elements = self._data.keys() + if sorted: + elements.sort() + return '%s(%r)' % (self.__class__.__name__, elements) + def __iter__(self): """Return an iterator over the elements or a set. *************** *** 133,137 **** def copy(self): """Return a shallow copy of a set.""" ! return self.__class__(self, sort_repr=self._sort_repr) __copy__ = copy # For the copy module --- 129,133 ---- def copy(self): """Return a shallow copy of a set.""" ! return self.__class__(self) __copy__ = copy # For the copy module *************** *** 145,149 **** # itself. from copy import deepcopy ! result = self.__class__([], self._sort_repr) memo[id(self)] = result data = result._data --- 141,145 ---- # itself. from copy import deepcopy ! result = self.__class__([]) memo[id(self)] = result data = result._data *************** *** 161,165 **** """ self._binary_sanity_check(other) ! result = self.__class__(self._data, self._sort_repr) result._data.update(other._data) return result --- 157,161 ---- """ self._binary_sanity_check(other) ! result = self.__class__(self._data) result._data.update(other._data) return result *************** *** 177,181 **** else: little, big = other, self ! result = self.__class__([], self._sort_repr) data = result._data value = True --- 173,177 ---- else: little, big = other, self ! result = self.__class__([]) data = result._data value = True *************** *** 193,197 **** """ self._binary_sanity_check(other) ! result = self.__class__([], self._sort_repr) data = result._data value = True --- 189,193 ---- """ self._binary_sanity_check(other) ! result = self.__class__([]) data = result._data value = True *************** *** 212,216 **** """ self._binary_sanity_check(other) ! result = self.__class__([], self._sort_repr) data = result._data value = True --- 208,212 ---- """ self._binary_sanity_check(other) ! result = self.__class__([]) data = result._data value = True *************** *** 278,297 **** """Immutable set class.""" ! # BaseSet + hashing ! ! _hashcode = None ! def __init__(self, seq, sort_repr=True): ! """Construct an immutable set from a sequence. ! Unless the optional keyword argument sort_repr is False, the ! set's elements are displayed in sorted order. This slows down ! string conversions, but is generally more user-friendly. The ! option to turn off this behavior is provided so that you can ! create sets whose elements are not ordered; for example, ! complex numbers. ! """ # Override the constructor to make 'seq' a required argument ! BaseSet.__init__(self, seq, sort_repr) def __hash__(self): --- 274,286 ---- """Immutable set class.""" ! __slots__ = ['_hash'] ! # BaseSet + hashing ! def __init__(self, seq): ! """Construct an immutable set from a sequence.""" # Override the constructor to make 'seq' a required argument ! BaseSet.__init__(self, seq) ! self._hashcode = None def __hash__(self): *************** *** 304,307 **** --- 293,298 ---- """ Mutable set class.""" + __slots__ = [] + # BaseSet + operations requiring mutability; no hashing *************** *** 456,468 **** # 3-element set blue = Set([0, 1, 2]) ! assert `blue` == "Set([0, 1, 2])", "3-element set: %s" % `blue` # 2-element set with other values black = Set([0, 5]) ! assert `black` == "Set([0, 5])", "2-element set: %s" % `black` # All elements from all sets white = Set([0, 1, 2, 5]) ! assert `white` == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` # Add element to empty set --- 447,459 ---- # 3-element set blue = Set([0, 1, 2]) ! assert blue._repr(True) == "Set([0, 1, 2])", "3-element set: %s" % `blue` # 2-element set with other values black = Set([0, 5]) ! assert black._repr(True) == "Set([0, 5])", "2-element set: %s" % `black` # All elements from all sets white = Set([0, 1, 2, 5]) ! assert white._repr(True) == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` # Add element to empty set From gvanrossum@users.sourceforge.net Mon Aug 19 17:19:16 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:19:16 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21071 Added Files: sets.py Log Message: Set classes and their unit tests, from sandbox. --- NEW FILE: sets.py --- """Classes to represent arbitrary sets (including sets of sets). This module implements sets using dictionaries whose values are ignored. The usual operations (union, intersection, deletion, etc.) are provided as both methods and operators. The following classes are provided: BaseSet -- All the operations common to both mutable and immutable sets. This is an abstract class, not meant to be directly instantiated. Set -- Mutable sets, subclass of BaseSet; not hashable. ImmutableSet -- Immutable sets, subclass of BaseSet; hashable. An iterable argument is mandatory to create an ImmutableSet. _TemporarilyImmutableSet -- Not a subclass of BaseSet: just a wrapper around a Set, hashable, giving the same hash value as the immutable set equivalent would have. Do not use this class directly. Only hashable objects can be added to a Set. In particular, you cannot really add a Set as an element to another Set; if you try, what is actuallly added is an ImmutableSet built from it (it compares equal to the one you tried adding). When you ask if `x in y' where x is a Set and y is a Set or ImmutableSet, x is wrapped into a _TemporarilyImmutableSet z, and what's tested is actually `z in y'. """ # Code history: # # - Greg V. Wilson wrote the first version, using a different approach # to the mutable/immutable problem, and inheriting from dict. # # - Alex Martelli modified Greg's version to implement the current # Set/ImmutableSet approach, and make the data an attribute. # # - Guido van Rossum rewrote much of the code, made some API changes, # and cleaned up the docstrings. __all__ = ['BaseSet', 'Set', 'ImmutableSet'] class BaseSet(object): """Common base class for mutable and immutable sets.""" __slots__ = ['_data'] # Constructor def __init__(self, seq=None): """Construct a set, optionally initializing it from a sequence.""" self._data = {} if seq is not None: # I don't know a faster way to do this in pure Python. # Custom code written in C only did it 65% faster, # preallocating the dict to len(seq); without # preallocation it was only 25% faster. So the speed of # this Python code is respectable. Just copying True into # a local variable is responsible for a 7-8% speedup. data = self._data value = True for key in seq: data[key] = value # Standard protocols: __len__, __repr__, __str__, __iter__ def __len__(self): """Return the number of elements of a set.""" return len(self._data) def __repr__(self): """Return string representation of a set. This looks like 'Set([])'. """ return self._repr() # __str__ is the same as __repr__ __str__ = __repr__ def _repr(self, sorted=False): elements = self._data.keys() if sorted: elements.sort() return '%s(%r)' % (self.__class__.__name__, elements) def __iter__(self): """Return an iterator over the elements or a set. This is the keys iterator for the underlying dict. """ return self._data.iterkeys() # Comparisons. Ordering is determined by the ordering of the # underlying dicts (which is consistent though unpredictable). def __lt__(self, other): self._binary_sanity_check(other) return self._data < other._data def __le__(self, other): self._binary_sanity_check(other) return self._data <= other._data def __eq__(self, other): self._binary_sanity_check(other) return self._data == other._data def __ne__(self, other): self._binary_sanity_check(other) return self._data != other._data def __gt__(self, other): self._binary_sanity_check(other) return self._data > other._data def __ge__(self, other): self._binary_sanity_check(other) return self._data >= other._data # Copying operations def copy(self): """Return a shallow copy of a set.""" return self.__class__(self) __copy__ = copy # For the copy module def __deepcopy__(self, memo): """Return a deep copy of a set; used by copy module.""" # This pre-creates the result and inserts it in the memo # early, in case the deep copy recurses into another reference # to this same set. A set can't be an element of itself, but # it can certainly contain an object that has a reference to # itself. from copy import deepcopy result = self.__class__([]) memo[id(self)] = result data = result._data value = True for elt in self: data[deepcopy(elt, memo)] = value return result # Standard set operations: union, intersection, both differences def union(self, other): """Return the union of two sets as a new set. (I.e. all elements that are in either set.) """ self._binary_sanity_check(other) result = self.__class__(self._data) result._data.update(other._data) return result __or__ = union def intersection(self, other): """Return the intersection of two sets as a new set. (I.e. all elements that are in both sets.) """ self._binary_sanity_check(other) if len(self) <= len(other): little, big = self, other else: little, big = other, self result = self.__class__([]) data = result._data value = True for elt in little: if elt in big: data[elt] = value return result __and__ = intersection def symmetric_difference(self, other): """Return the symmetric difference of two sets as a new set. (I.e. all elements that are in exactly one of the sets.) """ self._binary_sanity_check(other) result = self.__class__([]) data = result._data value = True for elt in self: if elt not in other: data[elt] = value for elt in other: if elt not in self: data[elt] = value return result __xor__ = symmetric_difference def difference(self, other): """Return the difference of two sets as a new Set. (I.e. all elements that are in this set and not in the other.) """ self._binary_sanity_check(other) result = self.__class__([]) data = result._data value = True for elt in self: if elt not in other: data[elt] = value return result __sub__ = difference # Membership test def __contains__(self, element): """Report whether an element is a member of a set. (Called in response to the expression `element in self'.) """ try: transform = element._as_temporarily_immutable except AttributeError: pass else: element = transform() return element in self._data # Subset and superset test def issubset(self, other): """Report whether another set contains this set.""" self._binary_sanity_check(other) for elt in self: if elt not in other: return False return True def issuperset(self, other): """Report whether this set contains another set.""" self._binary_sanity_check(other) for elt in other: if elt not in self: return False return True # Assorted helpers def _binary_sanity_check(self, other): # Check that the other argument to a binary operation is also # a set, raising a TypeError otherwise. if not isinstance(other, BaseSet): raise TypeError, "Binary operation only permitted between sets" def _compute_hash(self): # Calculate hash code for a set by xor'ing the hash codes of # the elements. This algorithm ensures that the hash code # does not depend on the order in which elements are added to # the code. This is not called __hash__ because a BaseSet # should not be hashable; only an ImmutableSet is hashable. result = 0 for elt in self: result ^= hash(elt) return result class ImmutableSet(BaseSet): """Immutable set class.""" __slots__ = ['_hash'] # BaseSet + hashing def __init__(self, seq): """Construct an immutable set from a sequence.""" # Override the constructor to make 'seq' a required argument BaseSet.__init__(self, seq) self._hashcode = None def __hash__(self): if self._hashcode is None: self._hashcode = self._compute_hash() return self._hashcode class Set(BaseSet): """ Mutable set class.""" __slots__ = [] # BaseSet + operations requiring mutability; no hashing # In-place union, intersection, differences def union_update(self, other): """Update a set with the union of itself and another.""" self._binary_sanity_check(other) self._data.update(other._data) return self __ior__ = union_update def intersection_update(self, other): """Update a set with the intersection of itself and another.""" self._binary_sanity_check(other) for elt in self._data.keys(): if elt not in other: del self._data[elt] return self __iand__ = intersection_update def symmetric_difference_update(self, other): """Update a set with the symmetric difference of itself and another.""" self._binary_sanity_check(other) data = self._data value = True for elt in other: if elt in data: del data[elt] else: data[elt] = value return self __ixor__ = symmetric_difference_update def difference_update(self, other): """Remove all elements of another set from this set.""" self._binary_sanity_check(other) data = self._data for elt in other: if elt in data: del data[elt] return self __isub__ = difference_update # Python dict-like mass mutations: update, clear def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for elt in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value def clear(self): """Remove all elements from this set.""" self._data.clear() # Single-element mutations: add, remove, discard def add(self, element): """Add an element to a set. This has no effect if the element is already present. """ try: transform = element._as_immutable except AttributeError: pass else: element = transform() self._data[element] = True def remove(self, element): """Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError. """ try: transform = element._as_temporarily_immutable except AttributeError: pass else: element = transform() del self._data[element] def discard(self, element): """Remove an element from a set if it is a member. If the element is not a member, do nothing. """ try: del self._data[element] except KeyError: pass def popitem(self): """Remove and return a randomly-chosen set element.""" return self._data.popitem()[0] def _as_immutable(self): # Return a copy of self as an immutable set return ImmutableSet(self) def _as_temporarily_immutable(self): # Return self wrapped in a temporarily immutable set return _TemporarilyImmutableSet(self) class _TemporarilyImmutableSet(object): # Wrap a mutable set as if it was temporarily immutable. # This only supplies hashing and equality comparisons. _hashcode = None def __init__(self, set): self._set = set def __hash__(self): if self._hashcode is None: self._hashcode = self._set._compute_hash() return self._hashcode def __eq__(self, other): return self._set == other def __ne__(self, other): return self._set != other # Rudimentary self-tests def _test(): # Empty set red = Set() assert `red` == "Set([])", "Empty set: %s" % `red` # Unit set green = Set((0,)) assert `green` == "Set([0])", "Unit set: %s" % `green` # 3-element set blue = Set([0, 1, 2]) assert blue._repr(True) == "Set([0, 1, 2])", "3-element set: %s" % `blue` # 2-element set with other values black = Set([0, 5]) assert black._repr(True) == "Set([0, 5])", "2-element set: %s" % `black` # All elements from all sets white = Set([0, 1, 2, 5]) assert white._repr(True) == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` # Add element to empty set red.add(9) assert `red` == "Set([9])", "Add to empty set: %s" % `red` # Remove element from unit set red.remove(9) assert `red` == "Set([])", "Remove from unit set: %s" % `red` # Remove element from empty set try: red.remove(0) assert 0, "Remove element from empty set: %s" % `red` except LookupError: pass # Length assert len(red) == 0, "Length of empty set" assert len(green) == 1, "Length of unit set" assert len(blue) == 3, "Length of 3-element set" # Compare assert green == Set([0]), "Equality failed" assert green != Set([1]), "Inequality failed" # Union assert blue | red == blue, "Union non-empty with empty" assert red | blue == blue, "Union empty with non-empty" assert green | blue == blue, "Union non-empty with non-empty" assert blue | black == white, "Enclosing union" # Intersection assert blue & red == red, "Intersect non-empty with empty" assert red & blue == red, "Intersect empty with non-empty" assert green & blue == green, "Intersect non-empty with non-empty" assert blue & black == green, "Enclosing intersection" # Symmetric difference assert red ^ green == green, "Empty symdiff non-empty" assert green ^ blue == Set([1, 2]), "Non-empty symdiff" assert white ^ white == red, "Self symdiff" # Difference assert red - green == red, "Empty - non-empty" assert blue - red == blue, "Non-empty - empty" assert white - black == Set([1, 2]), "Non-empty - non-empty" # In-place union orange = Set([]) orange |= Set([1]) assert orange == Set([1]), "In-place union" # In-place intersection orange = Set([1, 2]) orange &= Set([2]) assert orange == Set([2]), "In-place intersection" # In-place difference orange = Set([1, 2, 3]) orange -= Set([2, 4]) assert orange == Set([1, 3]), "In-place difference" # In-place symmetric difference orange = Set([1, 2, 3]) orange ^= Set([3, 4]) assert orange == Set([1, 2, 4]), "In-place symmetric difference" print "All tests passed" if __name__ == "__main__": _test() From gvanrossum@users.sourceforge.net Mon Aug 19 17:19:18 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:19:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21071/test Added Files: test_sets.py Log Message: Set classes and their unit tests, from sandbox. --- NEW FILE: test_sets.py --- #!/usr/bin/env python import unittest, operator, copy from sets import Set, ImmutableSet from test import test_support empty_set = Set() #============================================================================== class TestBasicOps(unittest.TestCase): def test_repr(self): if self.repr is not None: assert `self.set` == self.repr, "Wrong representation for " + self.case def test_length(self): assert len(self.set) == self.length, "Wrong length for " + self.case def test_self_equality(self): assert self.set == self.set, "Self-equality failed for " + self.case def test_equivalent_equality(self): assert self.set == self.dup, "Equivalent equality failed for " + self.case def test_copy(self): assert self.set.copy() == self.dup, "Copy and comparison failed for " + self.case def test_self_union(self): result = self.set | self.set assert result == self.dup, "Self-union failed for " + self.case def test_empty_union(self): result = self.set | empty_set assert result == self.dup, "Union with empty failed for " + self.case def test_union_empty(self): result = empty_set | self.set assert result == self.dup, "Union with empty failed for " + self.case def test_self_intersection(self): result = self.set & self.set assert result == self.dup, "Self-intersection failed for " + self.case def test_empty_intersection(self): result = self.set & empty_set assert result == empty_set, "Intersection with empty failed for " + self.case def test_intersection_empty(self): result = empty_set & self.set assert result == empty_set, "Intersection with empty failed for " + self.case def test_self_symmetric_difference(self): result = self.set ^ self.set assert result == empty_set, "Self-symdiff failed for " + self.case def checkempty_symmetric_difference(self): result = self.set ^ empty_set assert result == self.set, "Symdiff with empty failed for " + self.case def test_self_difference(self): result = self.set - self.set assert result == empty_set, "Self-difference failed for " + self.case def test_empty_difference(self): result = self.set - empty_set assert result == self.dup, "Difference with empty failed for " + self.case def test_empty_difference_rev(self): result = empty_set - self.set assert result == empty_set, "Difference from empty failed for " + self.case def test_iteration(self): for v in self.set: assert v in self.values, "Missing item in iteration for " + self.case #------------------------------------------------------------------------------ class TestBasicOpsEmpty(TestBasicOps): def setUp(self): self.case = "empty set" self.values = [] self.set = Set(self.values) self.dup = Set(self.values) self.length = 0 self.repr = "Set([])" #------------------------------------------------------------------------------ class TestBasicOpsSingleton(TestBasicOps): def setUp(self): self.case = "unit set (number)" self.values = [3] self.set = Set(self.values) self.dup = Set(self.values) self.length = 1 self.repr = "Set([3])" def test_in(self): assert 3 in self.set, "Valueship for unit set" def test_not_in(self): assert 2 not in self.set, "Non-valueship for unit set" #------------------------------------------------------------------------------ class TestBasicOpsTuple(TestBasicOps): def setUp(self): self.case = "unit set (tuple)" self.values = [(0, "zero")] self.set = Set(self.values) self.dup = Set(self.values) self.length = 1 self.repr = "Set([(0, 'zero')])" def test_in(self): assert (0, "zero") in self.set, "Valueship for tuple set" def test_not_in(self): assert 9 not in self.set, "Non-valueship for tuple set" #------------------------------------------------------------------------------ class TestBasicOpsTriple(TestBasicOps): def setUp(self): self.case = "triple set" self.values = [0, "zero", operator.add] self.set = Set(self.values) self.dup = Set(self.values) self.length = 3 self.repr = None #============================================================================== class TestBinaryOps(unittest.TestCase): def setUp(self): self.set = Set((2, 4, 6)) def test_union_subset(self): result = self.set | Set([2]) assert result == Set((2, 4, 6)), "Subset union" def test_union_superset(self): result = self.set | Set([2, 4, 6, 8]) assert result == Set([2, 4, 6, 8]), "Superset union" def test_union_overlap(self): result = self.set | Set([3, 4, 5]) assert result == Set([2, 3, 4, 5, 6]), "Overlapping union" def test_union_non_overlap(self): result = self.set | Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping union" def test_intersection_subset(self): result = self.set & Set((2, 4)) assert result == Set((2, 4)), "Subset intersection" def test_intersection_superset(self): result = self.set & Set([2, 4, 6, 8]) assert result == Set([2, 4, 6]), "Superset intersection" def test_intersection_overlap(self): result = self.set & Set([3, 4, 5]) assert result == Set([4]), "Overlapping intersection" def test_intersection_non_overlap(self): result = self.set & Set([8]) assert result == empty_set, "Non-overlapping intersection" def test_sym_difference_subset(self): result = self.set ^ Set((2, 4)) assert result == Set([6]), "Subset symmetric difference" def test_sym_difference_superset(self): result = self.set ^ Set((2, 4, 6, 8)) assert result == Set([8]), "Superset symmetric difference" def test_sym_difference_overlap(self): result = self.set ^ Set((3, 4, 5)) assert result == Set([2, 3, 5, 6]), "Overlapping symmetric difference" def test_sym_difference_non_overlap(self): result = self.set ^ Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" #============================================================================== class TestUpdateOps(unittest.TestCase): def setUp(self): self.set = Set((2, 4, 6)) def test_union_subset(self): self.set |= Set([2]) assert self.set == Set((2, 4, 6)), "Subset union" def test_union_superset(self): self.set |= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6, 8]), "Superset union" def test_union_overlap(self): self.set |= Set([3, 4, 5]) assert self.set == Set([2, 3, 4, 5, 6]), "Overlapping union" def test_union_non_overlap(self): self.set |= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping union" def test_intersection_subset(self): self.set &= Set((2, 4)) assert self.set == Set((2, 4)), "Subset intersection" def test_intersection_superset(self): self.set &= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6]), "Superset intersection" def test_intersection_overlap(self): self.set &= Set([3, 4, 5]) assert self.set == Set([4]), "Overlapping intersection" def test_intersection_non_overlap(self): self.set &= Set([8]) assert self.set == empty_set, "Non-overlapping intersection" def test_sym_difference_subset(self): self.set ^= Set((2, 4)) assert self.set == Set([6]), "Subset symmetric difference" def test_sym_difference_superset(self): self.set ^= Set((2, 4, 6, 8)) assert self.set == Set([8]), "Superset symmetric difference" def test_sym_difference_overlap(self): self.set ^= Set((3, 4, 5)) assert self.set == Set([2, 3, 5, 6]), "Overlapping symmetric difference" def test_sym_difference_non_overlap(self): self.set ^= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" #============================================================================== class TestMutate(unittest.TestCase): def setUp(self): self.values = ["a", "b", "c"] self.set = Set(self.values) def test_add_present(self): self.set.add("c") assert self.set == Set(("a", "b", "c")), "Adding present element" def test_add_absent(self): self.set.add("d") assert self.set == Set(("a", "b", "c", "d")), "Adding missing element" def test_add_until_full(self): tmp = Set() expected_len = 0 for v in self.values: tmp.add(v) expected_len += 1 assert len(tmp) == expected_len, "Adding values one by one to temporary" assert tmp == self.set, "Adding values one by one" def test_remove_present(self): self.set.remove("b") assert self.set == Set(("a", "c")), "Removing present element" def test_remove_absent(self): try: self.set.remove("d") assert 0, "Removing missing element" except LookupError: pass def test_remove_until_empty(self): expected_len = len(self.set) for v in self.values: self.set.remove(v) expected_len -= 1 assert len(self.set) == expected_len, "Removing values one by one" def test_discard_present(self): self.set.discard("c") assert self.set == Set(("a", "b")), "Discarding present element" def test_discard_absent(self): self.set.discard("d") assert self.set == Set(("a", "b", "c")), "Discarding missing element" def test_clear(self): self.set.clear() assert len(self.set) == 0, "Clearing set" def test_popitem(self): popped = {} while self.set: popped[self.set.popitem()] = None assert len(popped) == len(self.values), "Popping items" for v in self.values: assert v in popped, "Popping items" def test_update_empty_tuple(self): self.set.update(()) assert self.set == Set(self.values), "Updating with empty tuple" def test_update_unit_tuple_overlap(self): self.set.update(("a",)) assert self.set == Set(self.values), "Updating with overlapping unit tuple" def test_update_unit_tuple_non_overlap(self): self.set.update(("a", "z")) assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" #============================================================================== class TestSubsets(unittest.TestCase): def test_issubset(self): result = self.left.issubset(self.right) if "<" in self.cases: assert result, "subset: " + self.name else: assert not result, "non-subset: " + self.name #------------------------------------------------------------------------------ class TestSubsetEqualEmpty(TestSubsets): def setUp(self): self.left = Set() self.right = Set() self.name = "both empty" self.cases = "<>" #------------------------------------------------------------------------------ class TestSubsetEqualNonEmpty(TestSubsets): def setUp(self): self.left = Set([1, 2]) self.right = Set([1, 2]) self.name = "equal pair" self.cases = "<>" #------------------------------------------------------------------------------ class TestSubsetEmptyNonEmpty(TestSubsets): def setUp(self): self.left = Set() self.right = Set([1, 2]) self.name = "one empty, one non-empty" self.cases = "<" #------------------------------------------------------------------------------ class TestSubsetPartial(TestSubsets): def setUp(self): self.left = Set([1]) self.right = Set([1, 2]) self.name = "one a non-empty subset of other" self.cases = "<" #------------------------------------------------------------------------------ class TestSubsetNonOverlap(TestSubsets): def setUp(self): self.left = Set([1]) self.right = Set([2]) self.name = "neither empty, neither contains" self.cases = "" #============================================================================== class TestOnlySetsInBinaryOps(unittest.TestCase): def test_cmp(self): try: self.other < self.set assert 0, "Comparison with non-set on left" except TypeError: pass try: self.set >= self.other assert 0, "Comparison with non-set on right" except TypeError: pass def test_union_update(self): try: self.set |= self.other assert 0, "Union update with non-set" except TypeError: pass def test_union(self): try: self.other | self.set assert 0, "Union with non-set on left" except TypeError: pass try: self.set | self.other assert 0, "Union with non-set on right" except TypeError: pass def test_intersection_update(self): try: self.set &= self.other assert 0, "Intersection update with non-set" except TypeError: pass def test_intersection(self): try: self.other & self.set assert 0, "Intersection with non-set on left" except TypeError: pass try: self.set & self.other assert 0, "Intersection with non-set on right" except TypeError: pass def test_sym_difference_update(self): try: self.set ^= self.other assert 0, "Symmetric difference update with non-set" except TypeError: pass def test_sym_difference(self): try: self.other ^ self.set assert 0, "Symmetric difference with non-set on left" except TypeError: pass try: self.set ^ self.other assert 0, "Symmetric difference with non-set on right" except TypeError: pass def test_difference_update(self): try: self.set -= self.other assert 0, "Symmetric difference update with non-set" except TypeError: pass def test_difference(self): try: self.other - self.set assert 0, "Symmetric difference with non-set on left" except TypeError: pass try: self.set - self.other assert 0, "Symmetric difference with non-set on right" except TypeError: pass #------------------------------------------------------------------------------ class TestOnlySetsNumeric(TestOnlySetsInBinaryOps): def setUp(self): self.set = Set((1, 2, 3)) self.other = 19 #------------------------------------------------------------------------------ class TestOnlySetsDict(TestOnlySetsInBinaryOps): def setUp(self): self.set = Set((1, 2, 3)) self.other = {1:2, 3:4} #------------------------------------------------------------------------------ class TestOnlySetsOperator(TestOnlySetsInBinaryOps): def setUp(self): self.set = Set((1, 2, 3)) self.other = operator.add #============================================================================== class TestCopying(unittest.TestCase): def test_copy(self): dup = self.set.copy() dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() assert len(dup_list) == len(set_list), "Unequal lengths after copy" for i in range(len(dup_list)): assert dup_list[i] is set_list[i], "Non-identical items after copy" def test_deep_copy(self): dup = copy.deepcopy(self.set) ##print type(dup), `dup` dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() assert len(dup_list) == len(set_list), "Unequal lengths after deep copy" for i in range(len(dup_list)): assert dup_list[i] == set_list[i], "Unequal items after deep copy" #------------------------------------------------------------------------------ class TestCopyingEmpty(TestCopying): def setUp(self): self.set = Set() #------------------------------------------------------------------------------ class TestCopyingSingleton(TestCopying): def setUp(self): self.set = Set(["hello"]) #------------------------------------------------------------------------------ class TestCopyingTriple(TestCopying): def setUp(self): self.set = Set(["zero", 0, None]) #------------------------------------------------------------------------------ class TestCopyingTuple(TestCopying): def setUp(self): self.set = Set([(1, 2)]) #------------------------------------------------------------------------------ class TestCopyingNested(TestCopying): def setUp(self): self.set = Set([((1, 2), (3, 4))]) #============================================================================== def makeAllTests(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestBasicOpsEmpty)) suite.addTest(unittest.makeSuite(TestBasicOpsSingleton)) suite.addTest(unittest.makeSuite(TestBasicOpsTuple)) suite.addTest(unittest.makeSuite(TestBasicOpsTriple)) suite.addTest(unittest.makeSuite(TestBinaryOps)) suite.addTest(unittest.makeSuite(TestUpdateOps)) suite.addTest(unittest.makeSuite(TestMutate)) suite.addTest(unittest.makeSuite(TestSubsetEqualEmpty)) suite.addTest(unittest.makeSuite(TestSubsetEqualNonEmpty)) suite.addTest(unittest.makeSuite(TestSubsetEmptyNonEmpty)) suite.addTest(unittest.makeSuite(TestSubsetPartial)) suite.addTest(unittest.makeSuite(TestSubsetNonOverlap)) suite.addTest(unittest.makeSuite(TestOnlySetsNumeric)) suite.addTest(unittest.makeSuite(TestOnlySetsDict)) suite.addTest(unittest.makeSuite(TestOnlySetsOperator)) suite.addTest(unittest.makeSuite(TestCopyingEmpty)) suite.addTest(unittest.makeSuite(TestCopyingSingleton)) suite.addTest(unittest.makeSuite(TestCopyingTriple)) suite.addTest(unittest.makeSuite(TestCopyingTuple)) suite.addTest(unittest.makeSuite(TestCopyingNested)) return suite #------------------------------------------------------------------------------ def test_main(): suite = makeAllTests() test_support.run_suite(suite) if __name__ == "__main__": test_main() From gvanrossum@users.sourceforge.net Mon Aug 19 17:30:00 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:30:00 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25283 Modified Files: sets.py Log Message: Fix typo in __slots__ of ImmutableSet. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sets.py 19 Aug 2002 16:19:13 -0000 1.1 --- sets.py 19 Aug 2002 16:29:58 -0000 1.2 *************** *** 274,278 **** """Immutable set class.""" ! __slots__ = ['_hash'] # BaseSet + hashing --- 274,278 ---- """Immutable set class.""" ! __slots__ = ['_hashcode'] # BaseSet + hashing From gvanrossum@users.sourceforge.net Mon Aug 19 17:30:44 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:30:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/sets set.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv25571 Modified Files: set.py Log Message: Fix typo in __slots__ of ImmutableSet. (Hopefully this is the last change to the sandbox; I'm concentrating on the standard library version now.) Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** set.py 19 Aug 2002 16:13:31 -0000 1.8 --- set.py 19 Aug 2002 16:30:41 -0000 1.9 *************** *** 274,278 **** """Immutable set class.""" ! __slots__ = ['_hash'] # BaseSet + hashing --- 274,278 ---- """Immutable set class.""" ! __slots__ = ['_hashcode'] # BaseSet + hashing From gvanrossum@users.sourceforge.net Mon Aug 19 17:25:48 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:25:48 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.473,1.474 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23805 Modified Files: NEWS Log Message: News about sets. (There's no documentation; if someone wants to convert the doc strings to LaTeX, be my guest.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.473 retrieving revision 1.474 diff -C2 -d -r1.473 -r1.474 *** NEWS 19 Aug 2002 14:25:03 -0000 1.473 --- NEWS 19 Aug 2002 16:25:46 -0000 1.474 *************** *** 299,302 **** --- 299,309 ---- Library + - 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 + also a class ImmutableSet which is useful when you need sets of sets + or when you need to use sets as dict keys, and a class BaseSet which + is the base class of the two. (This is not documented yet, but + help(sets) gives a wealth of information.) + - Added operator.pow(a,b) which is equivalent to a**b. From mwh@users.sourceforge.net Mon Aug 19 17:54:10 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:54:10 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.64,2.65 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32166 Modified Files: frameobject.c Log Message: Check in my ultra-shortlived patch #597220. Move some debugging checks inside Py_DEBUG. They were causing cache misses according to cachegrind. Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -d -r2.64 -r2.65 *** frameobject.c 15 Aug 2002 14:59:02 -0000 2.64 --- frameobject.c 19 Aug 2002 16:54:08 -0000 2.65 *************** *** 239,249 **** return NULL; } ! if ((back != NULL && !PyFrame_Check(back)) || ! code == NULL || !PyCode_Check(code) || ! globals == NULL || !PyDict_Check(globals) || (locals != NULL && !PyDict_Check(locals))) { PyErr_BadInternalCall(); return NULL; } ncells = PyTuple_GET_SIZE(code->co_cellvars); nfrees = PyTuple_GET_SIZE(code->co_freevars); --- 239,249 ---- return NULL; } ! #ifdef Py_DEBUG ! if (code == NULL || globals == NULL || !PyDict_Check(globals) || (locals != NULL && !PyDict_Check(locals))) { PyErr_BadInternalCall(); return NULL; } + #endif ncells = PyTuple_GET_SIZE(code->co_cellvars); nfrees = PyTuple_GET_SIZE(code->co_freevars); From gvanrossum@users.sourceforge.net Mon Aug 19 17:50:50 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 09:50:50 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.188,2.189 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31549 Modified Files: object.c Log Message: Inline call to _PyObject_GetDictPtr() in PyObject_GenericGetAttr(). This causes a modest speedup. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** object.c 7 Aug 2002 16:21:51 -0000 2.188 --- object.c 19 Aug 2002 16:50:48 -0000 2.189 *************** *** 1293,1296 **** --- 1293,1297 ---- PyObject *res = NULL; descrgetfunc f; + long dictoffset; PyObject **dictptr; *************** *** 1331,1337 **** } ! dictptr = _PyObject_GetDictPtr(obj); ! if (dictptr != NULL) { ! PyObject *dict = *dictptr; if (dict != NULL) { res = PyDict_GetItem(dict, name); --- 1332,1354 ---- } ! /* Inline _PyObject_GetDictPtr */ ! dictoffset = tp->tp_dictoffset; ! if (dictoffset != 0) { ! PyObject *dict; ! if (dictoffset < 0) { ! int tsize; ! size_t size; ! ! tsize = ((PyVarObject *)obj)->ob_size; ! if (tsize < 0) ! tsize = -tsize; ! size = _PyObject_VAR_SIZE(tp, tsize); ! ! dictoffset += (long)size; ! assert(dictoffset > 0); ! assert(dictoffset % SIZEOF_VOID_P == 0); ! } ! dictptr = (PyObject **) ((char *)obj + dictoffset); ! dict = *dictptr; if (dict != NULL) { res = PyDict_GetItem(dict, name); From tim_one@users.sourceforge.net Mon Aug 19 18:32:01 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 19 Aug 2002 10:32:01 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv13169/spambayes Log Message: Directory /cvsroot/python/python/nondist/sandbox/spambayes added to the repository From gvanrossum@users.sourceforge.net Mon Aug 19 18:44:52 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 10:44:52 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv17705 Modified Files: pep-0283.txt Log Message: Move PEP 218 to the Completed features list. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pep-0283.txt 16 Aug 2002 02:31:08 -0000 1.16 --- pep-0283.txt 19 Aug 2002 17:44:50 -0000 1.17 *************** *** 78,81 **** --- 78,89 ---- - Warn for assignment to None (in various forms). + - PEP 218 Adding a Built-In Set Object Type Wilson + + Alex Martelli contributed a new version of Greg Wilson's + prototype, and I've reworked that quite a bit. It's in the + standard library now as the module "sets", although some details + may still change until the first beta release. (There are no + plans to make this a built-in type, for now.) + Planned features for 2.3 *************** *** 101,110 **** core module; maybe the whole thing should become a package). http://www.python.org/sf/578494 - - - PEP 218 Adding a Built-In Set Object Type Wilson - - I think it would be good to revive this in some form, using a - module rather than a built-in type. Alex Martelli has - contributed a new version: http://www.python.org/sf/580995 - A new command line option parser. Greg Ward's Optik --- 109,112 ---- From gvanrossum@users.sourceforge.net Mon Aug 19 19:45:39 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 11:45:39 -0700 Subject: [Python-checkins] python/dist/src/Include descrobject.h,2.10,2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv5076/Include Modified Files: descrobject.h Log Message: Make PyDescr_IsData() a macro. It's too simple to be a function. Should save 4% on slot lookups. Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/descrobject.h,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** descrobject.h 12 Aug 2002 07:21:56 -0000 2.10 --- descrobject.h 19 Aug 2002 18:45:37 -0000 2.11 *************** *** 77,81 **** PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); ! PyAPI_FUNC(int) PyDescr_IsData(PyObject *); PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); --- 77,81 ---- PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); ! #define PyDescr_IsData(d) ((d)->ob_type->tp_descr_set != NULL) PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); From gvanrossum@users.sourceforge.net Mon Aug 19 19:45:39 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 11:45:39 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5076/Objects Modified Files: descrobject.c Log Message: Make PyDescr_IsData() a macro. It's too simple to be a function. Should save 4% on slot lookups. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** descrobject.c 19 Aug 2002 16:02:33 -0000 2.29 --- descrobject.c 19 Aug 2002 18:45:37 -0000 2.30 *************** *** 556,565 **** } - int - PyDescr_IsData(PyObject *d) - { - return d->ob_type->tp_descr_set != NULL; - } - /* --- Readonly proxy for dictionaries (actually any mapping) --- */ --- 556,559 ---- From gvanrossum@users.sourceforge.net Mon Aug 19 20:22:53 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 12:22:53 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.189,2.190 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19571 Modified Files: object.c Log Message: Another modest speedup in PyObject_GenericGetAttr(): inline the call to _PyType_Lookup(). Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.189 retrieving revision 2.190 diff -C2 -d -r2.189 -r2.190 *** object.c 19 Aug 2002 16:50:48 -0000 2.189 --- object.c 19 Aug 2002 19:22:50 -0000 2.190 *************** *** 1290,1294 **** { PyTypeObject *tp = obj->ob_type; ! PyObject *descr; PyObject *res = NULL; descrgetfunc f; --- 1290,1294 ---- { PyTypeObject *tp = obj->ob_type; ! PyObject *descr = NULL; PyObject *res = NULL; descrgetfunc f; *************** *** 1322,1326 **** } ! descr = _PyType_Lookup(tp, name); f = NULL; if (descr != NULL) { --- 1322,1350 ---- } ! /* Inline _PyType_Lookup */ ! { ! int i, n; ! PyObject *mro, *base, *dict; ! ! /* Look in tp_dict of types in MRO */ ! mro = tp->tp_mro; ! assert(mro != NULL); ! assert(PyTuple_Check(mro)); ! n = PyTuple_GET_SIZE(mro); ! for (i = 0; i < n; i++) { ! base = PyTuple_GET_ITEM(mro, i); ! if (PyClass_Check(base)) ! dict = ((PyClassObject *)base)->cl_dict; ! else { ! assert(PyType_Check(base)); ! dict = ((PyTypeObject *)base)->tp_dict; ! } ! assert(dict && PyDict_Check(dict)); ! descr = PyDict_GetItem(dict, name); ! if (descr != NULL) ! break; ! } ! } ! f = NULL; if (descr != NULL) { From gvanrossum@users.sourceforge.net Mon Aug 19 20:26:44 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 12:26:44 -0700 Subject: [Python-checkins] python/dist/src/PC _winreg.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv20194/PC Modified Files: _winreg.c Log Message: Call me anal, but there was a particular phrase that was speading to comments everywhere that bugged me: /* Foo is inlined */ instead of /* Inline Foo */. Somehow the "is inlined" phrase always confused me for half a second (thinking, "No it isn't" until I added the missing "here"). The new phrase is hopefully unambiguous. Index: _winreg.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/_winreg.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _winreg.c 19 Jul 2002 06:55:41 -0000 1.11 --- _winreg.c 19 Aug 2002 19:26:41 -0000 1.12 *************** *** 607,611 **** PyHKEYObject *op; ! /* PyObject_New is inlined */ op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject)); if (op == NULL) --- 607,611 ---- PyHKEYObject *op; ! /* Inline PyObject_New */ op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject)); if (op == NULL) From gvanrossum@users.sourceforge.net Mon Aug 19 20:26:44 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 12:26:44 -0700 Subject: [Python-checkins] python/dist/src/Objects bufferobject.c,2.19,2.20 complexobject.c,2.62,2.63 floatobject.c,2.114,2.115 intobject.c,2.91,2.92 stringobject.c,2.180,2.181 tupleobject.c,2.71,2.72 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20194/Objects Modified Files: bufferobject.c complexobject.c floatobject.c intobject.c stringobject.c tupleobject.c Log Message: Call me anal, but there was a particular phrase that was speading to comments everywhere that bugged me: /* Foo is inlined */ instead of /* Inline Foo */. Somehow the "is inlined" phrase always confused me for half a second (thinking, "No it isn't" until I added the missing "here"). The new phrase is hopefully unambiguous. Index: bufferobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** bufferobject.c 25 Jun 2002 00:25:30 -0000 2.19 --- bufferobject.c 19 Aug 2002 19:26:42 -0000 2.20 *************** *** 139,143 **** return NULL; } ! /* PyObject_New is inlined */ o = PyObject_MALLOC(sizeof(*b) + size); if ( o == NULL ) --- 139,143 ---- return NULL; } ! /* Inline PyObject_New */ o = PyObject_MALLOC(sizeof(*b) + size); if ( o == NULL ) Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** complexobject.c 13 Jun 2002 20:32:56 -0000 2.62 --- complexobject.c 19 Aug 2002 19:26:42 -0000 2.63 *************** *** 200,204 **** register PyComplexObject *op; ! /* PyObject_New is inlined */ op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject)); if (op == NULL) --- 200,204 ---- register PyComplexObject *op; ! /* Inline PyObject_New */ op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject)); if (op == NULL) Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.114 retrieving revision 2.115 diff -C2 -d -r2.114 -r2.115 *** floatobject.c 17 Jul 2002 16:30:38 -0000 2.114 --- floatobject.c 19 Aug 2002 19:26:42 -0000 2.115 *************** *** 65,69 **** return NULL; } ! /* PyObject_New is inlined */ op = free_list; free_list = (PyFloatObject *)op->ob_type; --- 65,69 ---- return NULL; } ! /* Inline PyObject_New */ op = free_list; free_list = (PyFloatObject *)op->ob_type; Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -d -r2.91 -r2.92 *** intobject.c 14 Aug 2002 18:38:27 -0000 2.91 --- intobject.c 19 Aug 2002 19:26:42 -0000 2.92 *************** *** 114,118 **** return NULL; } ! /* PyObject_New is inlined */ v = free_list; free_list = (PyIntObject *)v->ob_type; --- 114,118 ---- return NULL; } ! /* Inline PyObject_New */ v = free_list; free_list = (PyIntObject *)v->ob_type; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.180 retrieving revision 2.181 diff -C2 -d -r2.180 -r2.181 *** stringobject.c 16 Aug 2002 23:20:39 -0000 2.180 --- stringobject.c 19 Aug 2002 19:26:42 -0000 2.181 *************** *** 63,67 **** } ! /* PyObject_NewVar is inlined */ op = (PyStringObject *) PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); --- 63,67 ---- } ! /* Inline PyObject_NewVar */ op = (PyStringObject *) PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); *************** *** 119,123 **** } ! /* PyObject_NewVar is inlined */ op = (PyStringObject *) PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); --- 119,123 ---- } ! /* Inline PyObject_NewVar */ op = (PyStringObject *) PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); *************** *** 879,883 **** } size = a->ob_size + b->ob_size; ! /* PyObject_NewVar is inlined */ op = (PyStringObject *) PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); --- 879,883 ---- } size = a->ob_size + b->ob_size; ! /* Inline PyObject_NewVar */ op = (PyStringObject *) PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.71 retrieving revision 2.72 diff -C2 -d -r2.71 -r2.72 *** tupleobject.c 9 Aug 2002 01:30:17 -0000 2.71 --- tupleobject.c 19 Aug 2002 19:26:42 -0000 2.72 *************** *** 49,53 **** fast_tuple_allocs++; #endif ! /* PyObject_InitVar is inlined */ #ifdef Py_TRACE_REFS op->ob_size = size; --- 49,53 ---- fast_tuple_allocs++; #endif ! /* Inline PyObject_InitVar */ #ifdef Py_TRACE_REFS op->ob_size = size; From tim_one@users.sourceforge.net Mon Aug 19 20:43:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 19 Aug 2002 12:43:39 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv25430/nondist/sandbox/spambayes Modified Files: GBayes.py Log Message: Turned off debugging vrbl mistakenly checked in at True. unlearn(): Gave this an update_probabilities=True default arg, for symmetry with learn(). Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GBayes.py 19 Aug 2002 17:33:52 -0000 1.1 --- GBayes.py 19 Aug 2002 19:43:36 -0000 1.2 *************** *** 58,62 **** ) ! DEBUG = True def __init__(self): --- 58,62 ---- ) ! DEBUG = False def __init__(self): *************** *** 140,144 **** self.update_probabilities() ! def unlearn(self, wordstream, is_spam): """In case of pilot error, call unlearn ASAP after screwing up. --- 140,144 ---- self.update_probabilities() ! def unlearn(self, wordstream, is_spam, update_probabilities=True): """In case of pilot error, call unlearn ASAP after screwing up. *************** *** 147,151 **** self._remove_msg(wordstream, is_spam) ! self.update_probabilities() def update_probabilities(self): --- 147,152 ---- self._remove_msg(wordstream, is_spam) ! if update_probabilities: ! self.update_probabilities() def update_probabilities(self): *************** *** 154,158 **** This computes a new probability for every word in the database, so can be expensive. learn() and unlearn() update the probabilities ! each time by default. learn() has an optional argument that allows to skip this step when feeding in many messages, and in that case you should call update_probabilities() after feeding the last --- 155,159 ---- This computes a new probability for every word in the database, so can be expensive. learn() and unlearn() update the probabilities ! each time by default. Thay have an optional argument that allows to skip this step when feeding in many messages, and in that case you should call update_probabilities() after feeding the last From gvanrossum@users.sourceforge.net Mon Aug 19 21:24:11 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 13:24:11 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.327,2.328 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8023 Modified Files: ceval.c Log Message: Another ugly inlining hack, expanding the two PyDict_GetItem() calls in LOAD_GLOBAL. Besides saving a C function call, it saves checks whether f_globals and f_builtins are dicts, and extracting and testing the string object's hash code is done only once. We bail out of the inlining if the name is not exactly a string, or when its hash is -1; because of interning, neither should ever happen. I believe interning guarantees that the hash code is set, and I believe that the 'names' tuple of a code object always contains interned strings, but I'm not assuming that -- I'm simply testing hash != -1. On my home machine, this makes a pystone variant with new-style classes and slots run at the same speed as classic pystone! (With new-style classes but without slots, it is still a lot slower.) Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.327 retrieving revision 2.328 diff -C2 -d -r2.327 -r2.328 *** ceval.c 16 Aug 2002 18:36:11 -0000 2.327 --- ceval.c 19 Aug 2002 20:24:07 -0000 2.328 *************** *** 1710,1720 **** case LOAD_GLOBAL: w = GETITEM(names, oparg); x = PyDict_GetItem(f->f_globals, w); if (x == NULL) { x = PyDict_GetItem(f->f_builtins, w); if (x == NULL) { format_exc_check_arg( PyExc_NameError, ! GLOBAL_NAME_ERROR_MSG ,w); break; } --- 1710,1744 ---- case LOAD_GLOBAL: w = GETITEM(names, oparg); + if (PyString_CheckExact(w)) { + long hash = ((PyStringObject *)w)->ob_shash; + if (hash != -1) { + /* Inline the PyDict_GetItem() calls */ + PyDictObject *d; + d = (PyDictObject *)(f->f_globals); + x = d->ma_lookup(d, w, hash)->me_value; + if (x != NULL) { + Py_INCREF(x); + PUSH(x); + continue; + } + d = (PyDictObject *)(f->f_builtins); + x = d->ma_lookup(d, w, hash)->me_value; + if (x != NULL) { + Py_INCREF(x); + PUSH(x); + continue; + } + goto load_global_error; + } + } + /* This is the un-inlined version of the code above */ x = PyDict_GetItem(f->f_globals, w); if (x == NULL) { x = PyDict_GetItem(f->f_builtins, w); if (x == NULL) { + load_global_error: format_exc_check_arg( PyExc_NameError, ! GLOBAL_NAME_ERROR_MSG, w); break; } From jeremy@alum.mit.edu Mon Aug 19 21:26:54 2002 From: jeremy@alum.mit.edu (Jeremy Hylton) Date: Mon, 19 Aug 2002 16:26:54 -0400 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.327,2.328 In-Reply-To: References: Message-ID: <15713.21646.190623.239730@slothrop.zope.com> /* Inline the PyDict_GetItem() calls */ PyDictObject *d; d = (PyDictObject *)(f->f_globals); x = d->ma_lookup(d, w, hash)->me_value; if (x != NULL) { Py_INCREF(x); PUSH(x); continue; } How about a macro here? #define PyDict_STRING_LOOKUP(D, S, HASH) \ ((PyDictObject *)D)->ma_lookup((D), (S), (HASH))->me_value Jeremy From guido@python.org Mon Aug 19 21:43:38 2002 From: guido@python.org (Guido van Rossum) Date: Mon, 19 Aug 2002 16:43:38 -0400 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.327,2.328 In-Reply-To: Your message of "Mon, 19 Aug 2002 16:26:54 EDT." <15713.21646.190623.239730@slothrop.zope.com> References: <15713.21646.190623.239730@slothrop.zope.com> Message-ID: <200208192043.g7JKhcx22462@pcp02138704pcs.reston01.va.comcast.net> > /* Inline the PyDict_GetItem() calls */ > PyDictObject *d; > d = (PyDictObject *)(f->f_globals); > x = d->ma_lookup(d, w, hash)->me_value; > if (x != NULL) { > Py_INCREF(x); > PUSH(x); > continue; > } > > How about a macro here? > > #define PyDict_STRING_LOOKUP(D, S, HASH) \ > ((PyDictObject *)D)->ma_lookup((D), (S), (HASH))->me_value That would only encourage more hacks like this. :-) This is a pretty extreme measure. Maybe I'll change my mind when I find more reasons to do this. --Guido van Rossum (home page: http://www.python.org/~guido/) From jeremy@alum.mit.edu Mon Aug 19 21:49:18 2002 From: jeremy@alum.mit.edu (Jeremy Hylton) Date: Mon, 19 Aug 2002 16:49:18 -0400 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.327,2.328 In-Reply-To: <200208192043.g7JKhcx22462@pcp02138704pcs.reston01.va.comcast.net> References: <15713.21646.190623.239730@slothrop.zope.com> <200208192043.g7JKhcx22462@pcp02138704pcs.reston01.va.comcast.net> Message-ID: <15713.22990.152266.200273@slothrop.zope.com> >>>>> "GvR" == Guido van Rossum writes: >> /* Inline the PyDict_GetItem() calls */ PyDictObject *d; d = >> (PyDictObject *)(f->f_globals); x = d->ma_lookup(d, w, >> hash)->me_value; if (x != NULL) { Py_INCREF(x); PUSH(x); >> continue; } >> >> How about a macro here? >> >> #define PyDict_STRING_LOOKUP(D, S, HASH) \ >> ((PyDictObject *)D)->ma_lookup((D), (S), (HASH))->me_value GvR> That would only encourage more hacks like this. :-) Then just define it locally. I think it would make the intent of the code a little clearer. Jeremy From gvanrossum@users.sourceforge.net Mon Aug 19 22:17:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 14:17:56 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.328,2.329 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27961 Modified Files: ceval.c Log Message: Add a warning comment to the LOAD_GLOBAL inline code. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.328 retrieving revision 2.329 diff -C2 -d -r2.328 -r2.329 *** ceval.c 19 Aug 2002 20:24:07 -0000 2.328 --- ceval.c 19 Aug 2002 21:17:53 -0000 2.329 *************** *** 1711,1717 **** w = GETITEM(names, oparg); if (PyString_CheckExact(w)) { long hash = ((PyStringObject *)w)->ob_shash; if (hash != -1) { - /* Inline the PyDict_GetItem() calls */ PyDictObject *d; d = (PyDictObject *)(f->f_globals); --- 1711,1719 ---- w = GETITEM(names, oparg); if (PyString_CheckExact(w)) { + /* Inline the PyDict_GetItem() calls. + WARNING: this is an extreme speed hack. + Do not try this at home. */ long hash = ((PyStringObject *)w)->ob_shash; if (hash != -1) { PyDictObject *d; d = (PyDictObject *)(f->f_globals); From gvanrossum@users.sourceforge.net Mon Aug 19 22:43:20 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 14:43:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.112,1.113 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2517/Doc/lib Modified Files: libfuncs.tex Log Message: SF patch 576101, by Oren Tirosh: alternative implementation of interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** libfuncs.tex 17 Jul 2002 13:55:33 -0000 1.112 --- libfuncs.tex 19 Aug 2002 21:43:18 -0000 1.113 *************** *** 519,524 **** the names used in Python programs are automatically interned, and the dictionaries used to hold module, class or instance attributes ! have interned keys. Interned strings are immortal (never get ! garbage collected). \end{funcdesc} --- 519,526 ---- the names used in Python programs are automatically interned, and the dictionaries used to hold module, class or instance attributes ! have interned keys. \versionchanged[Interned strings are not ! immortal (like they used to be in Python 2.2 and before); ! you must keep a reference to the return value of \function{intern()} ! around to benefit from it]{2.3} \end{funcdesc} From gvanrossum@users.sourceforge.net Mon Aug 19 22:43:20 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 14:43:20 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.474,1.475 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2517/Misc Modified Files: NEWS Log Message: SF patch 576101, by Oren Tirosh: alternative implementation of interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.474 retrieving revision 1.475 diff -C2 -d -r1.474 -r1.475 *** NEWS 19 Aug 2002 16:25:46 -0000 1.474 --- NEWS 19 Aug 2002 21:43:18 -0000 1.475 *************** *** 58,61 **** --- 58,65 ---- Core and builtins + - A subtle change to the semantics of the built-in function intern(): + interned strings are no longer immortal. You must keep a reference + to the return value intern() around to get the benefit. + - Use of 'None' as a variable, argument or attribute name now issues a SyntaxWarning. In the future, None may become a keyword. *************** *** 514,517 **** --- 518,534 ---- C API + + - The string object's layout has changed: the pointer member + ob_sinterned has been replaced by an int member ob_sstate. On some + platforms (e.g. most 64-bit systems) this may change the offset of + the ob_sval member, so as a precaution the API_VERSION has been + incremented. The apparently unused feature of "indirect interned + strings", supported by the ob_sinterned member, is gone. Interned + strings are now usually mortal; theres a new API, + PyString_InternImmortal() that creates immortal interned strings. + (The ob_sstate member can only take three values; however, while + making it a char saves a few bytes per string object on average, in + it also slowed things down a bit because ob_sval was no longer + aligned.) - The Py_InitModule*() functions now accept NULL for the 'methods' From gvanrossum@users.sourceforge.net Mon Aug 19 22:43:20 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 14:43:20 -0700 Subject: [Python-checkins] python/dist/src/Include modsupport.h,2.39,2.40 stringobject.h,2.36,2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv2517/Include Modified Files: modsupport.h stringobject.h Log Message: SF patch 576101, by Oren Tirosh: alternative implementation of interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings. Index: modsupport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/modsupport.h,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** modsupport.h 12 Aug 2002 07:21:57 -0000 2.39 --- modsupport.h 19 Aug 2002 21:43:18 -0000 2.40 *************** *** 24,29 **** PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *); ! #define PYTHON_API_VERSION 1011 ! #define PYTHON_API_STRING "1011" /* The API version is maintained (independently from the Python version) so we can detect mismatches between the interpreter and dynamically --- 24,29 ---- PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, char *, char *); ! #define PYTHON_API_VERSION 1012 ! #define PYTHON_API_STRING "1012" /* The API version is maintained (independently from the Python version) so we can detect mismatches between the interpreter and dynamically *************** *** 38,41 **** --- 38,44 ---- Please add a line or two to the top of this log for each API version change: + + 19-Aug-2002 GvR 1012 Changes to string object struct for + interning changes, saving 3 bytes. 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side Index: stringobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/stringobject.h,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** stringobject.h 14 Aug 2002 07:46:22 -0000 2.36 --- stringobject.h 19 Aug 2002 21:43:18 -0000 2.37 *************** *** 26,30 **** /* Caching the hash (ob_shash) saves recalculation of a string's hash value. ! Interning strings (ob_sinterned) tries to ensure that only one string object with a given value exists, so equality tests can be one pointer comparison. This is generally restricted to strings that "look like" --- 26,30 ---- /* Caching the hash (ob_shash) saves recalculation of a string's hash value. ! Interning strings (ob_sstate) tries to ensure that only one string object with a given value exists, so equality tests can be one pointer comparison. This is generally restricted to strings that "look like" *************** *** 36,43 **** PyObject_VAR_HEAD long ob_shash; ! PyObject *ob_sinterned; char ob_sval[1]; } PyStringObject; PyAPI_DATA(PyTypeObject) PyBaseString_Type; PyAPI_DATA(PyTypeObject) PyString_Type; --- 36,47 ---- PyObject_VAR_HEAD long ob_shash; ! int ob_sstate; char ob_sval[1]; } PyStringObject; + #define SSTATE_NOT_INTERNED 0 + #define SSTATE_INTERNED_MORTAL 1 + #define SSTATE_INTERNED_IMMORTAL 2 + PyAPI_DATA(PyTypeObject) PyBaseString_Type; PyAPI_DATA(PyTypeObject) PyString_Type; *************** *** 67,72 **** --- 71,80 ---- PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); + PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); + + /* Use only if you know it's a string */ + #define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) /* Macro, trading safety for speed */ From gvanrossum@users.sourceforge.net Mon Aug 19 22:43:20 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 19 Aug 2002 14:43:20 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.160,2.161 dictobject.c,2.128,2.129 stringobject.c,2.181,2.182 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2517/Objects Modified Files: classobject.c dictobject.c stringobject.c Log Message: SF patch 576101, by Oren Tirosh: alternative implementation of interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.160 retrieving revision 2.161 diff -C2 -d -r2.160 -r2.161 *** classobject.c 11 Jul 2002 06:23:50 -0000 2.160 --- classobject.c 19 Aug 2002 21:43:18 -0000 2.161 *************** *** 2301,2335 **** } ! static char * ! getclassname(PyObject *class) { PyObject *name; if (class == NULL) ! name = NULL; ! else ! name = PyObject_GetAttrString(class, "__name__"); if (name == NULL) { /* This function cannot return an exception */ PyErr_Clear(); ! return "?"; } ! if (!PyString_Check(name)) { ! Py_DECREF(name); ! return "?"; } - PyString_InternInPlace(&name); Py_DECREF(name); - return PyString_AS_STRING(name); } ! static char * ! getinstclassname(PyObject *inst) { PyObject *class; - char *name; ! if (inst == NULL) ! return "nothing"; class = PyObject_GetAttrString(inst, "__class__"); --- 2301,2336 ---- } ! static void ! getclassname(PyObject *class, char *buf, int bufsize) { PyObject *name; + assert(bufsize > 1); + strcpy(buf, "?"); /* Default outcome */ if (class == NULL) ! return; ! name = PyObject_GetAttrString(class, "__name__"); if (name == NULL) { /* This function cannot return an exception */ PyErr_Clear(); ! return; } ! if (PyString_Check(name)) { ! strncpy(buf, PyString_AS_STRING(name), bufsize); ! buf[bufsize-1] = '\0'; } Py_DECREF(name); } ! static void ! getinstclassname(PyObject *inst, char *buf, int bufsize) { PyObject *class; ! if (inst == NULL) { ! assert(bufsize > strlen("nothing")); ! strcpy(buf, "nothing"); ! return; ! } class = PyObject_GetAttrString(inst, "__class__"); *************** *** 2340,2346 **** Py_INCREF(class); } ! name = getclassname(class); Py_XDECREF(class); - return name; } --- 2341,2346 ---- Py_INCREF(class); } ! getclassname(class, buf, bufsize); Py_XDECREF(class); } *************** *** 2367,2370 **** --- 2367,2374 ---- } if (!ok) { + char clsbuf[256]; + char instbuf[256]; + getclassname(class, clsbuf, sizeof(clsbuf)); + getinstclassname(self, instbuf, sizeof(instbuf)); PyErr_Format(PyExc_TypeError, "unbound method %s%s must be called with " *************** *** 2373,2378 **** PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), ! getclassname(class), ! getinstclassname(self), self == NULL ? "" : " instance"); return NULL; --- 2377,2382 ---- PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), ! clsbuf, ! instbuf, self == NULL ? "" : " instance"); return NULL; Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.128 retrieving revision 2.129 diff -C2 -d -r2.128 -r2.129 *** dictobject.c 17 Jul 2002 16:30:37 -0000 2.128 --- dictobject.c 19 Aug 2002 21:43:18 -0000 2.129 *************** *** 512,524 **** mp = (dictobject *)op; if (PyString_CheckExact(key)) { ! if (((PyStringObject *)key)->ob_sinterned != NULL) { ! key = ((PyStringObject *)key)->ob_sinterned; ! hash = ((PyStringObject *)key)->ob_shash; ! } ! else { ! hash = ((PyStringObject *)key)->ob_shash; ! if (hash == -1) ! hash = PyObject_Hash(key); ! } } else { --- 512,518 ---- mp = (dictobject *)op; if (PyString_CheckExact(key)) { ! hash = ((PyStringObject *)key)->ob_shash; ! if (hash == -1) ! hash = PyObject_Hash(key); } else { Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.181 retrieving revision 2.182 diff -C2 -d -r2.181 -r2.182 *** stringobject.c 19 Aug 2002 19:26:42 -0000 2.181 --- stringobject.c 19 Aug 2002 21:43:18 -0000 2.182 *************** *** 16,19 **** --- 16,30 ---- static PyStringObject *nullstring; + /* This dictionary holds all interned strings. Note that references to + strings in this dictionary are *not* counted in the string's ob_refcnt. + When the interned string reaches a refcnt of 0 the string deallocation + function will delete the reference from this dictionary. + + Another way to look at this is that to say that the actual reference + count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) + */ + static PyObject *interned; + + /* For both PyString_FromString() and PyString_FromStringAndSize(), the *************** *** 70,74 **** PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sinterned = NULL; if (str != NULL) memcpy(op->ob_sval, str, size); --- 81,85 ---- PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sstate = SSTATE_NOT_INTERNED; if (str != NULL) memcpy(op->ob_sval, str, size); *************** *** 126,130 **** PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sinterned = NULL; memcpy(op->ob_sval, str, size+1); /* share short strings */ --- 137,141 ---- PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sstate = SSTATE_NOT_INTERNED; memcpy(op->ob_sval, str, size+1); /* share short strings */ *************** *** 487,490 **** --- 498,519 ---- string_dealloc(PyObject *op) { + switch (PyString_CHECK_INTERNED(op)) { + case SSTATE_NOT_INTERNED: + break; + + case SSTATE_INTERNED_MORTAL: + /* revive dead object temporarily for DelItem */ + op->ob_refcnt = 3; + if (PyDict_DelItem(interned, op) != 0) + Py_FatalError( + "deletion of interned string failed"); + break; + + case SSTATE_INTERNED_IMMORTAL: + Py_FatalError("Immortal interned string died."); + + default: + Py_FatalError("Inconsistent interned string state."); + } op->ob_type->tp_free(op); } *************** *** 886,890 **** PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sinterned = NULL; memcpy(op->ob_sval, a->ob_sval, (int) a->ob_size); memcpy(op->ob_sval + a->ob_size, b->ob_sval, (int) b->ob_size); --- 915,919 ---- PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sstate = SSTATE_NOT_INTERNED; memcpy(op->ob_sval, a->ob_sval, (int) a->ob_size); memcpy(op->ob_sval + a->ob_size, b->ob_sval, (int) b->ob_size); *************** *** 929,933 **** PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sinterned = NULL; for (i = 0; i < size; i += a->ob_size) memcpy(op->ob_sval+i, a->ob_sval, (int) a->ob_size); --- 958,962 ---- PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; ! op->ob_sstate = SSTATE_NOT_INTERNED; for (i = 0; i < size; i += a->ob_size) memcpy(op->ob_sval+i, a->ob_sval, (int) a->ob_size); *************** *** 1094,1100 **** if (a->ob_shash != -1) return a->ob_shash; - if (a->ob_sinterned != NULL) - return (a->ob_shash = - ((PyStringObject *)(a->ob_sinterned))->ob_shash); len = a->ob_size; p = (unsigned char *) a->ob_sval; --- 1123,1126 ---- *************** *** 3068,3073 **** ((PyStringObject *)pnew)->ob_shash = ((PyStringObject *)tmp)->ob_shash; ! ((PyStringObject *)pnew)->ob_sinterned = ! ((PyStringObject *)tmp)->ob_sinterned; } Py_DECREF(tmp); --- 3094,3098 ---- ((PyStringObject *)pnew)->ob_shash = ((PyStringObject *)tmp)->ob_shash; ! ((PyStringObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; } Py_DECREF(tmp); *************** *** 3984,4003 **** } - - - /* This dictionary will leak at PyString_Fini() time. That's acceptable - * because PyString_Fini() specifically frees interned strings that are - * only referenced by this dictionary. The CVS log entry for revision 2.45 - * says: - * - * Change the Fini function to only remove otherwise unreferenced - * strings from the interned table. There are references in - * hard-to-find static variables all over the interpreter, and it's not - * worth trying to get rid of all those; but "uninterning" isn't fair - * either and may cause subtle failures later -- so we have to keep them - * in the interned table. - */ - static PyObject *interned; - void PyString_InternInPlace(PyObject **p) --- 4009,4012 ---- *************** *** 4007,4053 **** if (s == NULL || !PyString_Check(s)) Py_FatalError("PyString_InternInPlace: strings only please!"); ! if ((t = s->ob_sinterned) != NULL) { ! if (t == (PyObject *)s) ! return; ! Py_INCREF(t); ! *p = t; ! Py_DECREF(s); return; - } if (interned == NULL) { interned = PyDict_New(); ! if (interned == NULL) return; } if ((t = PyDict_GetItem(interned, (PyObject *)s)) != NULL) { Py_INCREF(t); ! *p = s->ob_sinterned = t; ! Py_DECREF(s); return; } ! /* Ensure that only true string objects appear in the intern dict, ! and as the value of ob_sinterned. */ ! if (PyString_CheckExact(s)) { ! t = (PyObject *)s; ! if (PyDict_SetItem(interned, t, t) == 0) { ! s->ob_sinterned = t; ! return; ! } ! } ! else { t = PyString_FromStringAndSize(PyString_AS_STRING(s), PyString_GET_SIZE(s)); ! if (t != NULL) { ! if (PyDict_SetItem(interned, t, t) == 0) { ! *p = s->ob_sinterned = t; ! Py_DECREF(s); ! return; ! } ! Py_DECREF(t); } } PyErr_Clear(); } PyObject * --- 4016,4070 ---- if (s == NULL || !PyString_Check(s)) Py_FatalError("PyString_InternInPlace: strings only please!"); ! if (PyString_CHECK_INTERNED(s)) return; if (interned == NULL) { interned = PyDict_New(); ! if (interned == NULL) { ! PyErr_Clear(); /* Don't leave an exception */ return; + } } if ((t = PyDict_GetItem(interned, (PyObject *)s)) != NULL) { Py_INCREF(t); ! Py_DECREF(*p); ! *p = t; return; } ! /* Ensure that only true string objects appear in the intern dict */ ! if (!PyString_CheckExact(s)) { t = PyString_FromStringAndSize(PyString_AS_STRING(s), PyString_GET_SIZE(s)); ! if (t == NULL) { ! PyErr_Clear(); ! return; } + } else { + t = (PyObject*) s; + Py_INCREF(t); } + + if (PyDict_SetItem(interned, t, t) == 0) { + /* The two references in interned are not counted by + refcnt. The string deallocator will take care of this */ + ((PyObject *)t)->ob_refcnt-=2; + PyString_CHECK_INTERNED(t) = SSTATE_INTERNED_MORTAL; + Py_DECREF(*p); + *p = t; + return; + } + Py_DECREF(t); PyErr_Clear(); } + void + PyString_InternImmortal(PyObject **p) + { + PyString_InternInPlace(p); + if (PyString_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { + PyString_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; + Py_INCREF(*p); + } + } + PyObject * *************** *** 4071,4097 **** Py_XDECREF(nullstring); nullstring = NULL; - if (interned) { - int pos, changed; - PyObject *key, *value; - do { - changed = 0; - pos = 0; - while (PyDict_Next(interned, &pos, &key, &value)) { - if (key->ob_refcnt == 2 && key == value) { - PyDict_DelItem(interned, key); - changed = 1; - } - } - } while (changed); - } } void _Py_ReleaseInternedStrings(void) { ! if (interned) { ! fprintf(stderr, "releasing interned strings\n"); ! PyDict_Clear(interned); ! Py_DECREF(interned); ! interned = NULL; } } --- 4088,4134 ---- Py_XDECREF(nullstring); nullstring = NULL; } void _Py_ReleaseInternedStrings(void) { ! PyObject *keys; ! PyStringObject *s; ! int i, n; ! ! if (interned == NULL || !PyDict_Check(interned)) ! return; ! keys = PyDict_Keys(interned); ! if (keys == NULL || !PyList_Check(keys)) { ! PyErr_Clear(); ! return; ! } ! ! /* Since _Py_ReleaseInternedStrings() is intended to help a leak ! detector, interned strings are not forcibly deallocated; rather, we ! give them their stolen references back, and then clear and DECREF ! the interned dict. */ ! ! fprintf(stderr, "releasing interned strings\n"); ! n = PyList_GET_SIZE(keys); ! for (i = 0; i < n; i++) { ! s = (PyStringObject *) PyList_GET_ITEM(keys, i); ! switch (s->ob_sstate) { ! case SSTATE_NOT_INTERNED: ! /* XXX Shouldn't happen */ ! break; ! case SSTATE_INTERNED_IMMORTAL: ! s->ob_refcnt += 1; ! break; ! case SSTATE_INTERNED_MORTAL: ! s->ob_refcnt += 2; ! break; ! default: ! Py_FatalError("Inconsistent interned string state."); ! } ! s->ob_sstate = SSTATE_NOT_INTERNED; } + Py_DECREF(keys); + PyDict_Clear(interned); + Py_DECREF(interned); + interned = NULL; } From fdrake@users.sourceforge.net Mon Aug 19 22:59:00 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 19 Aug 2002 14:59:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.104,1.105 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7981 Modified Files: libstdtypes.tex Log Message: Extend some comments on the order of values in the returns from dict.items/keys/values/iteritems/iterkeys/itervalues(). Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** libstdtypes.tex 7 Aug 2002 15:40:15 -0000 1.104 --- libstdtypes.tex 19 Aug 2002 21:58:58 -0000 1.105 *************** *** 1050,1060 **** \lineiii{\var{a}.iteritems()} {return an iterator over (\var{key}, \var{value}) pairs} ! {(2)} \lineiii{\var{a}.iterkeys()} {return an iterator over the mapping's keys} ! {(2)} \lineiii{\var{a}.itervalues()} {return an iterator over the mapping's values} ! {(2)} \end{tableiii} --- 1050,1060 ---- \lineiii{\var{a}.iteritems()} {return an iterator over (\var{key}, \var{value}) pairs} ! {(2), (3)} \lineiii{\var{a}.iterkeys()} {return an iterator over the mapping's keys} ! {(2), (3)} \lineiii{\var{a}.itervalues()} {return an iterator over the mapping's values} ! {(2), (3)} \end{tableiii} *************** *** 1068,1076 **** \item[(3)] Keys and values are listed in random order. If ! \method{keys()} and \method{values()} are called with no intervening ! modifications to the dictionary, the two lists will directly ! correspond. This allows the creation of \code{(\var{value}, ! \var{key})} pairs using \function{zip()}: \samp{pairs = ! zip(\var{a}.values(), \var{a}.keys())}. \item[(4)] Never raises an exception if \var{k} is not in the map, --- 1068,1082 ---- \item[(3)] Keys and values are listed in random order. If ! \method{items()}, \method{keys()}, \method{values()}, ! \method{iteritems()}, \method{iterkeys()}, and \method{itervalues()} ! are called with no intervening modifications to the dictionary, the ! lists will directly correspond. This allows the creation of ! \code{(\var{value}, \var{key})} pairs using \function{zip()}: ! \samp{pairs = zip(\var{a}.values(), \var{a}.keys())}. The same ! relationship holds for the \method{iterkeys()} and ! \method{itervalues()} methods: \samp{pairs = zip(\var{a}.itervalues(), ! \var{a}.iterkeys())} provides the same value for \code{pairs}. ! Another way to create the same list is \samp{pairs = [(v, k) for (k, ! v) in \var{a}.iteritems()]}. \item[(4)] Never raises an exception if \var{k} is not in the map, From fdrake@users.sourceforge.net Mon Aug 19 23:01:22 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 19 Aug 2002 15:01:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.11,1.80.6.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8835 Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Extend some comments on the order of values in the returns from dict.items/keys/values/iteritems/iterkeys/itervalues(). Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.11 retrieving revision 1.80.6.12 diff -C2 -d -r1.80.6.11 -r1.80.6.12 *** libstdtypes.tex 7 Aug 2002 15:41:31 -0000 1.80.6.11 --- libstdtypes.tex 19 Aug 2002 22:01:19 -0000 1.80.6.12 *************** *** 1023,1033 **** \lineiii{\var{a}.iteritems()} {return an iterator over (\var{key}, \var{value}) pairs} ! {(2)} \lineiii{\var{a}.iterkeys()} {return an iterator over the mapping's keys} ! {(2)} \lineiii{\var{a}.itervalues()} {return an iterator over the mapping's values} ! {(2)} \end{tableiii} --- 1023,1033 ---- \lineiii{\var{a}.iteritems()} {return an iterator over (\var{key}, \var{value}) pairs} ! {(2), (3)} \lineiii{\var{a}.iterkeys()} {return an iterator over the mapping's keys} ! {(2), (3)} \lineiii{\var{a}.itervalues()} {return an iterator over the mapping's values} ! {(2), (3)} \end{tableiii} *************** *** 1041,1049 **** \item[(3)] Keys and values are listed in random order. If ! \method{keys()} and \method{values()} are called with no intervening ! modifications to the dictionary, the two lists will directly ! correspond. This allows the creation of \code{(\var{value}, ! \var{key})} pairs using \function{zip()}: \samp{pairs = ! zip(\var{a}.values(), \var{a}.keys())}. \item[(4)] Never raises an exception if \var{k} is not in the map, --- 1041,1055 ---- \item[(3)] Keys and values are listed in random order. If ! \method{items()}, \method{keys()}, \method{values()}, ! \method{iteritems()}, \method{iterkeys()}, and \method{itervalues()} ! are called with no intervening modifications to the dictionary, the ! lists will directly correspond. This allows the creation of ! \code{(\var{value}, \var{key})} pairs using \function{zip()}: ! \samp{pairs = zip(\var{a}.values(), \var{a}.keys())}. The same ! relationship holds for the \method{iterkeys()} and ! \method{itervalues()} methods: \samp{pairs = zip(\var{a}.itervalues(), ! \var{a}.iterkeys())} provides the same value for \code{pairs}. ! Another way to create the same list is \samp{pairs = [(v, k) for (k, ! v) in \var{a}.iteritems()]}. \item[(4)] Never raises an exception if \var{k} is not in the map, From nnorwitz@users.sourceforge.net Mon Aug 19 23:38:04 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 19 Aug 2002 15:38:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboperator.tex,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19312/Doc/lib Modified Files: liboperator.tex Log Message: Add versionadded for operator.pow Index: liboperator.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboperator.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** liboperator.tex 19 Aug 2002 03:19:09 -0000 1.22 --- liboperator.tex 19 Aug 2002 22:38:01 -0000 1.23 *************** *** 135,138 **** --- 135,139 ---- \funcline{__pow__}{a, b} Return \var{a} \code{**} \var{b}, for \var{a} and \var{b} numbers. + \versionadded{2.3} \end{funcdesc} From bwarsaw@users.sourceforge.net Tue Aug 20 00:32:19 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 19 Aug 2002 16:32:19 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv2462 Modified Files: GBayes.py Log Message: Lots of hacks great and small to the main() program, but I didn't touch the guts of the algorithm. Added a module docstring/usage message. Added a bunch of switches to train the system on an mbox of known good and known spam messages (using PortableUnixMailbox only for now). Uses the email package but does not decoding of message bodies. Also, allows you to specify a file for pickling the training data, and for setting a threshold, above which messages get an X-Bayes-Score header. Also output messages (marked and unmarked) to an output file for retraining. Print some statistics at the end. Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GBayes.py 19 Aug 2002 19:43:36 -0000 1.2 --- GBayes.py 19 Aug 2002 23:32:17 -0000 1.3 *************** *** 1,4 **** --- 1,38 ---- + """Usage: %(program)s [options] + + Where: + -h + show usage and exit + -g mboxfile + mbox of known good messages (non-spam) + -s mboxfile + mbox of known spam messages + -u mboxfile + mbox of unknown messages + -p file + use file as the persistent pickle. loads data from this file if it + exists, and saves data to this file at the end. omit for one shot. + -c num + train the system with just `num' number of messages from both the + known spam and known good files. the system works best with + approximately the same number of messages from both collections. + -m threshold + mark messages with a threshold above float `threshold' with a header + such as "X-Bayes-Score: score". use the -o option to output the + marked folder. + -o file + with -m, output all messages, with marks, to file + """ + + import sys + import getopt import time as _time from heapq import heapreplace as _heapreplace + import cPickle as pickle + import mailbox + import email + import errno + + program = sys.argv[0] # This is an implementation of the Bayes-like spam classifier sketched at *************** *** 473,484 **** -Barry ! """ ! b = GrahamBayes() ! b.learn(tokenize(spam1), True) ! b.learn(tokenize(spam2), True) ! b.learn(tokenize(good1), False) ! b.learn(tokenize(good2), False) ! print "P(spam3 is spam) =", b.spamprob(tokenize(spam3)) ! print "P(good3 is spam) =", b.spamprob(tokenize(good3)) --- 507,668 ---- -Barry ! """ #' ! def main1(): ! b = GrahamBayes() ! b.learn(tokenize(spam1), True) ! b.learn(tokenize(spam2), True) ! b.learn(tokenize(good1), False) ! b.learn(tokenize(good2), False) ! print "P(spam3 is spam) =", b.spamprob(tokenize(spam3)) ! print "P(good3 is spam) =", b.spamprob(tokenize(good3)) ! ! ! def usage(code, msg=''): ! print >> sys.stderr, __doc__ % globals() ! if msg: ! print >> sys.stderr, msg ! sys.exit(code) ! ! ! def main2(): ! try: ! opts, args = getopt.getopt(sys.argv[1:], 'hg:s:u:p:c:m:o:') ! except getopt.error, msg: ! usage(1, msg) ! ! threshold = count = good = spam = unknown = pck = mark = output = None ! for opt, arg in opts: ! if opt == '-h': ! usage(0) ! elif opt == '-g': ! good = arg ! elif opt == '-s': ! spam = arg ! elif opt == '-u': ! unknown = arg ! elif opt == '-p': ! pck = arg ! elif opt == '-c': ! count = int(arg) ! elif opt == '-m': ! threshold = float(arg) ! elif opt == '-o': ! output = arg ! ! if args: ! usage(1) ! ! save = False ! bayes = None ! if pck: ! try: ! fp = open(pck, 'rb') ! except IOError, e: ! if e.errno <> errno.ENOENT: raise ! else: ! bayes = pickle.load(fp) ! fp.close() ! if bayes is None: ! bayes = GrahamBayes() ! ! def _factory(fp): ! # Guido sez: IMO, for body encoding, we should do the same level of ! # decoding that a typical mail client does, so that we "see" the same ! # thing an end user sees. This means base64, but not uuencode ! # (because most mailers don't unpack that automatically). We may save ! # time base64-decoding by not botherin with attachments, since those ! # aren't shown by default. ! try: ! return email.message_from_file(fp) ! except email.Errors.MessageParseError: ! return '' ! ! # Assume Unix mailbox format ! if good: ! print 'training with the known good messages' ! fp = open(good) ! mbox = mailbox.PortableUnixMailbox(fp, _factory) ! i = 0 ! for msg in mbox: ! # For now we'll take an extremely naive view of messages; we won't ! # decode them at all, just to see what happens. Later, we might ! # want to uu- or base64-decode, or do other pre-processing on the ! # message. ! bayes.learn(tokenize(str(msg)), False, False) ! i += 1 ! if count is not None and i > count: ! break ! fp.close() ! save = True ! print 'done training', i, 'messages' ! ! if spam: ! print 'training with the known spam messages' ! fp = open(spam) ! mbox = mailbox.PortableUnixMailbox(fp, _factory) ! i = 0 ! for msg in mbox: ! # For now we'll take an extremely naive view of messages; we won't ! # decode them at all, just to see what happens. Later, we might ! # want to uu- or base64-decode, or do other pre-processing on the ! # message. ! bayes.learn(tokenize(str(msg)), True, False) ! i += 1 ! if count is not None and i > count: ! break ! fp.close() ! save = True ! print 'done training', i, 'messages' ! ! bayes.update_probabilities() ! ! if pck and save: ! fp = open(pck, 'wb') ! pickle.dump(bayes, fp, 1) ! fp.close() ! ! if unknown: ! if output: ! output = open(output, 'w') ! print 'classifying the unknown' ! fp = open(unknown) ! mbox = mailbox.PortableUnixMailbox(fp, email.message_from_file) ! pos = 0 ! allcnt = 0 ! spamcnt = goodcnt = 0 ! for msg in mbox: ! msgid = msg.get('message-id', '' % pos) ! pos = fp.tell() ! # For now we'll take an extremely naive view of messages; we won't ! # decode them at all, just to see what happens. Later, we might ! # want to uu- or base64-decode, or do other pre-processing on the ! # message. ! try: ! prob = bayes.spamprob(tokenize(str(msg))) ! except ValueError: ! # Sigh, bad Content-Type ! continue ! if threshold is not None and prob > threshold: ! msg['X-Bayes-Score'] = str(prob) ! print 'P(%s) =' % msgid, prob ! if output: ! print >> output, msg ! # XXX hardcode ! if prob > 0.90: ! spamcnt += 1 ! if prob < 0.09: ! goodcnt += 1 ! allcnt += 1 ! if output: ! output.close() ! fp.close() ! print 'Num messages =', allcnt ! print 'Good count =', goodcnt ! print 'Spam count =', spamcnt ! print 'Hard to tell =', allcnt - (goodcnt + spamcnt) ! ! ! if __name__ == '__main__': ! main2() From akuchling@users.sourceforge.net Tue Aug 20 01:54:39 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 19 Aug 2002 17:54:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv21554 Modified Files: whatsnew23.tex Log Message: Create two subsections of the "Core Language Changes" section, because the list is getting awfully long Mention Karatsuba multiplication and some other items Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** whatsnew23.tex 15 Aug 2002 14:59:00 -0000 1.45 --- whatsnew23.tex 20 Aug 2002 00:54:36 -0000 1.46 *************** *** 17,22 **** % New sorting code % - % Karatsuba multiplication for long ints (#560379) - % % xreadlines obsolete; files are their own iterator --- 17,20 ---- *************** *** 501,524 **** described in section~\ref{section-generators} of this document. - \item The \code{in} operator now works differently for strings. - Previously, when evaluating \code{\var{X} in \var{Y}} where \var{X} - and \var{Y} are strings, \var{X} could only be a single character. - That's now changed; \var{X} can be a string of any length, and - \code{\var{X} in \var{Y}} will return \constant{True} if \var{X} is a - substring of \var{Y}. If \var{X} is the empty string, the result is - always \constant{True}. - - \begin{verbatim} - >>> 'ab' in 'abcd' - True - >>> 'ad' in 'abcd' - False - >>> '' in 'abcd' - True - \end{verbatim} - - Note that this doesn't tell you where the substring starts; the - \method{find()} method is still necessary to figure that out. - \item A new built-in function \function{enumerate()} was added, as described in section~\ref{section-enumerate} of this --- 499,502 ---- *************** *** 559,562 **** --- 537,619 ---- (Patch contributed by Raymond Hettinger.) + \item The \keyword{assert} statement no longer checks the \code{__debug__} + flag, so you can no longer disable assertions by assigning to \code{__debug__}. + Running Python with the \programopt{-O} switch will still generate + code that doesn't execute any assertions. + + \item Most type objects are now callable, so you can use them + to create new objects such as functions, classes, and modules. (This + means that the \module{new} module can be deprecated in a future + Python version, because you can now use the type objects available + in the \module{types} module.) + % XXX should new.py use PendingDeprecationWarning? + For example, you can create a new module object with the following code: + + \begin{verbatim} + >>> import types + >>> m = types.ModuleType('abc','docstring') + >>> m + + >>> m.__doc__ + 'docstring' + \end{verbatim} + + \item + A new warning, \exception{PendingDeprecationWarning} was added to + indicate features which are in the process of being + deprecated. The warning will \emph{not} be printed by default. To + check for use of features that will be deprecated in the future, + supply \programopt{-Walways::PendingDeprecationWarning::} on the + command line or use \function{warnings.filterwarnings()}. + + \item Using \code{None} as a variable name will now result in a + \exception{SyntaxWarning} warning. In a future version of Python, + \code{None} may finally become a keyword. + + \item One minor but far-reaching change is that the names of extension + types defined by the modules included with Python now contain the + module and a \samp{.} in front of the type name. For example, in + Python 2.2, if you created a socket and printed its + \member{__class__}, you'd get this output: + + \begin{verbatim} + >>> s = socket.socket() + >>> s.__class__ + + \end{verbatim} + + In 2.3, you get this: + \begin{verbatim} + >>> s.__class__ + + \end{verbatim} + + \end{itemize} + + + \subsection{String Changes} + + \begin{itemize} + + \item The \code{in} operator now works differently for strings. + Previously, when evaluating \code{\var{X} in \var{Y}} where \var{X} + and \var{Y} are strings, \var{X} could only be a single character. + That's now changed; \var{X} can be a string of any length, and + \code{\var{X} in \var{Y}} will return \constant{True} if \var{X} is a + substring of \var{Y}. If \var{X} is the empty string, the result is + always \constant{True}. + + \begin{verbatim} + >>> 'ab' in 'abcd' + True + >>> 'ad' in 'abcd' + False + >>> '' in 'abcd' + True + \end{verbatim} + + Note that this doesn't tell you where the substring starts; the + \method{find()} method is still necessary to figure that out. + \item The \method{strip()}, \method{lstrip()}, and \method{rstrip()} string methods now have an optional argument for specifying the *************** *** 599,607 **** (Contributed by Walter D\"orwald.) - \item The \keyword{assert} statement no longer checks the \code{__debug__} - flag, so you can no longer disable assertions by assigning to \code{__debug__}. - Running Python with the \programopt{-O} switch will still generate - code that doesn't execute any assertions. - \item A new type object, \class{basestring}, has been added. Both 8-bit strings and Unicode strings inherit from this type, so --- 656,659 ---- *************** *** 610,661 **** can't create \class{basestring} instances. ! \item The \method{sort()} method of list objects has been extensively ! rewritten by Tim Peters, and the implementation is significantly ! faster. ! \item Most type objects are now callable, so you can use them ! to create new objects such as functions, classes, and modules. (This ! means that the \module{new} module can be deprecated in a future ! Python version, because you can now use the type objects available ! in the \module{types} module.) ! % XXX should new.py use PendingDeprecationWarning? ! For example, you can create a new module object with the following code: - \begin{verbatim} - >>> import types - >>> m = types.ModuleType('abc','docstring') - >>> m - - >>> m.__doc__ - 'docstring' - \end{verbatim} ! \item ! A new warning, \exception{PendingDeprecationWarning} was added to ! indicate features which are in the process of being ! deprecated. The warning will \emph{not} be printed by default. To ! check for use of features that will be deprecated in the future, ! supply \programopt{-Walways::PendingDeprecationWarning::} on the ! command line or use \function{warnings.filterwarnings()}. ! \item One minor but far-reaching change is that the names of extension ! types defined by the modules included with Python now contain the ! module and a \samp{.} in front of the type name. For example, in ! Python 2.2, if you created a socket and printed its ! \member{__class__}, you'd get this output: ! \begin{verbatim} ! >>> s = socket.socket() ! >>> s.__class__ ! ! \end{verbatim} ! In 2.3, you get this: ! \begin{verbatim} ! >>> s.__class__ ! ! \end{verbatim} \end{itemize} %====================================================================== --- 662,698 ---- can't create \class{basestring} instances. ! \item Interned strings are no longer immortal. Interned will now be ! garbage-collected in the usual way when the only reference to them is ! from the internal dictionary of interned strings. (Implemented by ! Oren Tirosh.) ! \end{itemize} ! \subsection{Optimizations} ! \begin{itemize} ! \item The \method{sort()} method of list objects has been extensively ! rewritten by Tim Peters, and the implementation is significantly ! faster. ! \item Multiplication of large long integers is now much faster thanks ! to an implementation of Karatsuba multiplication, an algorithm that ! scales better than the O(n*n) required for the grade-school ! multiplication algorithm. (Original patch by Christopher A. Craig, ! and significantly reworked by Tim Peters.) ! ! \item The \code{SET_LINENO} opcode is now gone. This may provide a ! small speed increase, subject to your compiler's idiosyncrasies. ! (Removed by Michael Hudson.) ! ! \item A number of small rearrangements have been made in various ! hotspots to improve performance, inlining a function here, removing ! some code there. (Implemented mostly by GvR, but lots of people have ! contributed to one change or another.) \end{itemize} + %====================================================================== From akuchling@users.sourceforge.net Tue Aug 20 02:34:08 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 19 Aug 2002 18:34:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv29840 Modified Files: whatsnew23.tex Log Message: Cover the sets module. (There's a link to PEP218; has PEP218 been updated to match the actual module implementation?) Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** whatsnew23.tex 20 Aug 2002 00:54:36 -0000 1.46 --- whatsnew23.tex 20 Aug 2002 01:34:06 -0000 1.47 *************** *** 42,45 **** --- 42,140 ---- %====================================================================== + \section{PEP 218: A Standard Set Datatype} + + The new \module{sets} module contains an implementation of a set + datatype. The \class{Set} class is for mutable sets, sets that can + have members added and removed. The \class{ImmutableSet} class is for + sets that can't be modified, and can be used as dictionary keys. Sets + are built on top of dictionaries, so the elements within a set must be + hashable. + + As a simple example, + + \begin{verbatim} + >>> import sets + >>> S = sets.Set([1,2,3]) + >>> S + Set([1, 2, 3]) + >>> 1 in S + True + >>> 0 in S + False + >>> S.add(5) + >>> S.remove(3) + >>> S + Set([1, 2, 5]) + >>> + \end{verbatim} + + The union and intersection of sets can be computed with the + \method{union()} and \method{intersection()} methods, or, + alternatively, using the bitwise operators \samp{\&} and \samp{|}. + Mutable sets also have in-place versions of these methods, + \method{union_update()} and \method{intersection_update()}. + + \begin{verbatim} + >>> S1 = sets.Set([1,2,3]) + >>> S2 = sets.Set([4,5,6]) + >>> S1.union(S2) + Set([1, 2, 3, 4, 5, 6]) + >>> S1 | S2 # Alternative notation + Set([1, 2, 3, 4, 5, 6]) + >>> S1.intersection(S2) + Set([]) + >>> S1 & S2 # Alternative notation + Set([]) + >>> S1.union_update(S2) + Set([1, 2, 3, 4, 5, 6]) + >>> S1 + Set([1, 2, 3, 4, 5, 6]) + >>> + \end{verbatim} + + It's also possible to take the symmetric difference of two sets. This + is the set of all elements in the union that aren't in the + intersection. An alternative way of expressing the symmetric + difference is that it contains all elements that are in exactly one + set. Again, there's an in-place version, with the ungainly name + \method{symmetric_difference_update()}. + + \begin{verbatim} + >>> S1 = sets.Set([1,2,3,4]) + >>> S2 = sets.Set([3,4,5,6]) + >>> S1.symmetric_difference(S2) + Set([1, 2, 5, 6]) + >>> S1 ^ S2 + Set([1, 2, 5, 6]) + >>> + \end{verbatim} + + There are also methods, \method{issubset()} and \method{issuperset()}, + for checking whether one set is a strict subset or superset of + another: + + \begin{verbatim} + >>> S1 = sets.Set([1,2,3]) + >>> S2 = sets.Set([2,3]) + >>> S2.issubset(S1) + True + >>> S1.issubset(S2) + False + >>> S1.issuperset(S2) + True + >>> + \end{verbatim} + + + \begin{seealso} + + \seepep{218}{Adding a Built-In Set Object Type}{PEP written by Greg V. Wilson. + Implemented by Greg V. Wilson, Alex Martelli, and GvR.} + + \end{seealso} + + + + %====================================================================== \section{PEP 255: Simple Generators\label{section-generators}} From montanaro@users.sourceforge.net Tue Aug 20 04:49:58 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 19 Aug 2002 20:49:58 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv28017 Modified Files: GBayes.py Log Message: help make it more easily executable... ;-) Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GBayes.py 19 Aug 2002 23:32:17 -0000 1.3 --- GBayes.py 20 Aug 2002 03:49:56 -0000 1.4 *************** *** 1,2 **** --- 1,4 ---- + #!/usr/bin/env python + """Usage: %(program)s [options] From tim_one@users.sourceforge.net Tue Aug 20 06:16:51 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 19 Aug 2002 22:16:51 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv13368 Modified Files: GBayes.py Log Message: Neutral typo repairs, except that clearjunk() has a better chance of not blowing up immediately now . Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GBayes.py 20 Aug 2002 03:49:56 -0000 1.4 --- GBayes.py 20 Aug 2002 05:16:48 -0000 1.5 *************** *** 143,147 **** smallest_best = nbest[0][0] ! prob_product = inverse_prod_product = 1.0 for distance, prob, word, record in nbest: if prob is None: # it's one of the dummies nbest started with --- 143,147 ---- smallest_best = nbest[0][0] ! prob_product = inverse_prob_product = 1.0 for distance, prob, word, record in nbest: if prob is None: # it's one of the dummies nbest started with *************** *** 152,158 **** print 'nbest P(%r) = %g' % (word, prob) prob_product *= prob ! inverse_prod_product *= 1.0 - prob ! return prob_product / (prob_product + inverse_prod_product) def learn(self, wordstream, is_spam, update_probabilities=True): --- 152,158 ---- print 'nbest P(%r) = %g' % (word, prob) prob_product *= prob ! inverse_prob_product *= 1.0 - prob ! return prob_product / (prob_product + inverse_prob_product) def learn(self, wordstream, is_spam, update_probabilities=True): *************** *** 234,238 **** wordinfo = self.wordinfo mincount = float(mincount) ! tonuke = [w for w, r in wordinfo.itervalues() if r.modtime < oldesttime and SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount] --- 234,238 ---- wordinfo = self.wordinfo mincount = float(mincount) ! tonuke = [w for w, r in wordinfo.iteritems() if r.modtime < oldesttime and SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount] From bwarsaw@users.sourceforge.net Tue Aug 20 13:54:09 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 05:54:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv19987 Modified Files: test_email.py Log Message: test_three_lines(): Test case reported by Andrew McNamara. Works in email 2.2 but fails in email 1.0. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_email.py 23 Jul 2002 19:46:35 -0000 1.3 --- test_email.py 20 Aug 2002 12:54:07 -0000 1.4 *************** *** 1741,1744 **** --- 1741,1752 ---- neq(part2a.get_payload(), 'message 2\n') + def test_three_lines(self): + # A bug report by Andrew McNamara + lines = ['From: Andrew Person Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6570 Modified Files: pep-0283.txt Log Message: Move PEP 269 back into the realm of possibilities. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pep-0283.txt 19 Aug 2002 17:44:50 -0000 1.17 --- pep-0283.txt 20 Aug 2002 13:56:21 -0000 1.18 *************** *** 153,156 **** --- 153,160 ---- covered yet (e.g. string.whitespace and types.TracebackType). + - PEP 269 Pgen Module for Python Riehl + + Jon Riehl is going to attempt an implementation by mid-September. + - Documentation: complete the distribution and installation manuals. *************** *** 192,201 **** and inlining the dict access: http://tothink.com/python/fastnames/ - - - PEP 269 Pgen Module for Python Riehl - - Based on Jonathan Riehl's latest posts in the parser-sig, e.g. - http://mail.python.org/pipermail/parser-sig/2002-August/000012.html - I consider this project dead. - Lazily tracking tuples? --- 196,199 ---- From fdrake@users.sourceforge.net Tue Aug 20 14:57:51 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 Aug 2002 06:57:51 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7081/lib Modified Files: libre.tex Log Message: Clarify the endpos argument to the rx.match() method. Closes SF bug #597177. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** libre.tex 30 Jul 2002 17:51:20 -0000 1.85 --- libre.tex 20 Aug 2002 13:57:47 -0000 1.86 *************** *** 669,674 **** The optional parameter \var{endpos} limits how far the string will be searched; it will be as if the string is \var{endpos} characters ! long, so only the characters from \var{pos} to \var{endpos} will be ! searched for a match. \end{methoddesc} --- 669,678 ---- The optional parameter \var{endpos} limits how far the string will be searched; it will be as if the string is \var{endpos} characters ! long, so only the characters from \var{pos} to \code{\var{endpos} - ! 1} will be searched for a match. If \var{endpos} is less than ! \var{pos}, no match will be found, otherwise, if \var{rx} is a ! compiled regular expression object, ! \code{\var{rx}.match(\var{string}, 0, 50)} is equivalent to ! \code{\var{rx}.match(\var{string}[:50], 0)}. \end{methoddesc} From fdrake@users.sourceforge.net Tue Aug 20 14:58:14 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 Aug 2002 06:58:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.73.6.8,1.73.6.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7233/lib Modified Files: Tag: release22-maint libre.tex Log Message: Clarify the endpos argument to the rx.match() method. Closes SF bug #597177. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.73.6.8 retrieving revision 1.73.6.9 diff -C2 -d -r1.73.6.8 -r1.73.6.9 *** libre.tex 30 Jul 2002 17:52:05 -0000 1.73.6.8 --- libre.tex 20 Aug 2002 13:58:12 -0000 1.73.6.9 *************** *** 680,685 **** The optional parameter \var{endpos} limits how far the string will be searched; it will be as if the string is \var{endpos} characters ! long, so only the characters from \var{pos} to \var{endpos} will be ! searched for a match. \end{methoddesc} --- 680,689 ---- The optional parameter \var{endpos} limits how far the string will be searched; it will be as if the string is \var{endpos} characters ! long, so only the characters from \var{pos} to \code{\var{endpos} - ! 1} will be searched for a match. If \var{endpos} is less than ! \var{pos}, no match will be found, otherwise, if \var{rx} is a ! compiled regular expression object, ! \code{\var{rx}.match(\var{string}, 0, 50)} is equivalent to ! \code{\var{rx}.match(\var{string}[:50], 0)}. \end{methoddesc} From guido@python.org Tue Aug 20 15:03:44 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 20 Aug 2002 10:03:44 -0400 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.46,1.47 In-Reply-To: Your message of "Mon, 19 Aug 2002 18:34:08 PDT." References: Message-ID: <200208201403.g7KE3iZ12987@odiug.zope.com> > (There's a link to PEP218; has PEP218 been updated to match the actual > module implementation?) No; I've added a note warning the reader for now; I hope that Greg Wilson will make another pass over the PEP to match the implementation now checked in (unless he objects to some aspect of the implementation, in which case I'd be glad to discuss this on python-dev). --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@users.sourceforge.net Tue Aug 20 15:31:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 20 Aug 2002 07:31:39 -0700 Subject: [Python-checkins] python/dist/src/Objects classobject.c,2.161,2.162 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18176/python/Objects Modified Files: classobject.c Log Message: getinstclassname(): Squash new compiler wng in assert (comparison of signed vs unsigned). Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.161 retrieving revision 2.162 diff -C2 -d -r2.161 -r2.162 *** classobject.c 19 Aug 2002 21:43:18 -0000 2.161 --- classobject.c 20 Aug 2002 14:31:35 -0000 2.162 *************** *** 2329,2333 **** if (inst == NULL) { ! assert(bufsize > strlen("nothing")); strcpy(buf, "nothing"); return; --- 2329,2333 ---- if (inst == NULL) { ! assert(bufsize > 0 && (size_t)bufsize > strlen("nothing")); strcpy(buf, "nothing"); return; From gvanrossum@users.sourceforge.net Tue Aug 20 15:00:47 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 07:00:47 -0700 Subject: [Python-checkins] python/nondist/peps pep-0218.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8231 Modified Files: pep-0218.txt Log Message: Add note about discrepancies between this PEP and the new sets module. Index: pep-0218.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0218.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0218.txt 7 May 2001 19:51:10 -0000 1.5 --- pep-0218.txt 20 Aug 2002 14:00:44 -0000 1.6 *************** *** 10,13 **** --- 10,23 ---- + Cautionary note + + Much of this PEP has been implemented in the new "sets" module, + added to Python 2.3. The sets module differs in a number of + aspects from this PEP; in particular its approach to mutability is + different. It is my hope that this PEP's author will update his + PEP to match the sets module more closely. [note added by Guido + van Rossum] + + Introduction From bwarsaw@users.sourceforge.net Tue Aug 20 15:47:33 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 07:47:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv24004/email Modified Files: Generator.py Log Message: _dispatch(): Use get_content_maintype() and get_content_subtype() to get the MIME main and sub types, instead of getting the whole ctype and splitting it here. The two more specific methods now correctly implement RFC 2045, section 5.2. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Generator.py 19 Jul 2002 22:21:02 -0000 1.13 --- Generator.py 20 Aug 2002 14:47:30 -0000 1.14 *************** *** 124,130 **** # full MIME type, then dispatch to self._handle_(). If # that's missing too, then dispatch to self._writeBody(). ! ctype = msg.get_content_type() ! # We do have a Content-Type: header. ! main, sub = ctype.split('/') specific = UNDERSCORE.join((main, sub)).replace('-', '_') meth = getattr(self, '_handle_' + specific, None) --- 124,129 ---- # full MIME type, then dispatch to self._handle_(). If # that's missing too, then dispatch to self._writeBody(). ! main = msg.get_content_maintype() ! sub = msg.get_content_subtype() specific = UNDERSCORE.join((main, sub)).replace('-', '_') meth = getattr(self, '_handle_' + specific, None) From bwarsaw@users.sourceforge.net Tue Aug 20 15:50:12 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 07:50:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv25168/email Modified Files: Message.py Log Message: get_content_type(), get_content_maintype(), get_content_subtype(): RFC 2045, section 5.2 states that if the Content-Type: header is syntactically invalid, the default type should be text/plain. Implement minimal sanity checking of the header -- it must have exactly one slash in it. This closes SF patch #597593 by Skip, but in a different way. Note that these methods used to raise ValueError for invalid ctypes, but now they won't. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Message.py 19 Jul 2002 22:24:55 -0000 1.17 --- Message.py 20 Aug 2002 14:50:09 -0000 1.18 *************** *** 423,427 **** # This should have no parameters return self.get_default_type() ! return paramre.split(value)[0].lower().strip() def get_content_maintype(self): --- 423,431 ---- # This should have no parameters return self.get_default_type() ! ctype = paramre.split(value)[0].lower().strip() ! # RFC 2045, section 5.2 says if its invalid, use text/plain ! if ctype.count('/') <> 1: ! return 'text/plain' ! return ctype def get_content_maintype(self): *************** *** 433,438 **** """ ctype = self.get_content_type() - if ctype.count('/') <> 1: - raise ValueError, 'No maintype found in: %s' % ctype return ctype.split('/')[0] --- 437,440 ---- *************** *** 445,450 **** """ ctype = self.get_content_type() - if ctype.count('/') <> 1: - raise ValueError, 'No subtype found in: %s' % ctype return ctype.split('/')[1] --- 447,450 ---- From bwarsaw@users.sourceforge.net Tue Aug 20 15:51:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 07:51:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv25594/email/test Modified Files: test_email.py Log Message: Added tests for SF patch #597593, syntactically invalid Content-Type: headers. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_email.py 20 Aug 2002 12:54:07 -0000 1.4 --- test_email.py 20 Aug 2002 14:51:10 -0000 1.5 *************** *** 429,438 **** msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' ! self.assertRaises(ValueError, msg.get_content_maintype) def test_get_content_subtype_error(self): msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' ! self.assertRaises(ValueError, msg.get_content_subtype) --- 429,438 ---- msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' ! self.assertEqual(msg.get_content_maintype(), 'text') def test_get_content_subtype_error(self): msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' ! self.assertEqual(msg.get_content_subtype(), 'plain') *************** *** 1007,1010 **** --- 1007,1031 ---- finally: fp.close() + + def test_invalid_content_type(self): + eq = self.assertEqual + neq = self.ndiffAssertEqual + msg = Message() + # RFC 2045, $5.2 says invalid yields text/plain + msg['Content-Type'] = 'text' + eq(msg.get_content_maintype(), 'text') + eq(msg.get_content_subtype(), 'plain') + eq(msg.get_content_type(), 'text/plain') + # Clear the old value and try something /really/ invalid + del msg['content-type'] + msg['Content-Type'] = 'foo' + eq(msg.get_content_maintype(), 'text') + eq(msg.get_content_subtype(), 'plain') + eq(msg.get_content_type(), 'text/plain') + # Still, make sure that the message is idempotently generated + s = StringIO() + g = Generator(s) + g.flatten(msg) + neq(s.getvalue(), 'Content-Type: foo\n\n') From bwarsaw@users.sourceforge.net Tue Aug 20 15:51:36 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 07:51:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv25762/email Modified Files: __init__.py Log Message: Bump version number to 2.3 Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** __init__.py 19 Jul 2002 22:26:01 -0000 1.11 --- __init__.py 20 Aug 2002 14:51:34 -0000 1.12 *************** *** 5,9 **** """ ! __version__ = '2.2' __all__ = ['Charset', --- 5,9 ---- """ ! __version__ = '2.3' __all__ = ['Charset', From mwh@users.sourceforge.net Tue Aug 20 16:19:17 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 20 Aug 2002 08:19:17 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.329,2.330 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv3102 Modified Files: ceval.c Log Message: My patch #597221. Use f_lasti more consistently. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.329 retrieving revision 2.330 diff -C2 -d -r2.329 -r2.330 *** ceval.c 19 Aug 2002 21:17:53 -0000 2.329 --- ceval.c 20 Aug 2002 15:19:14 -0000 2.330 *************** *** 600,609 **** freevars = f->f_localsplus + f->f_nlocals; _PyCode_GETCODEPTR(co, &first_instr); ! if (f->f_lasti < 0) { ! next_instr = first_instr; ! } ! else { ! next_instr = first_instr + f->f_lasti; ! } stack_pointer = f->f_stacktop; assert(stack_pointer != NULL); --- 600,612 ---- freevars = f->f_localsplus + f->f_nlocals; _PyCode_GETCODEPTR(co, &first_instr); ! /* An explanation is in order for the next line. ! ! f->f_lasti now refers to the index of the last instruction ! executed. You might think this was obvious from the name, but ! this wasn't always true before 2.3! PyFrame_New now sets ! f->f_lasti to -1 (i.e. the index *before* the first instruction ! and YIELD_VALUE doesn't fiddle with f_lasti any more. So this ! does work. Promise. */ ! next_instr = first_instr + f->f_lasti + 1; stack_pointer = f->f_stacktop; assert(stack_pointer != NULL); *************** *** 1522,1528 **** retval = POP(); f->f_stacktop = stack_pointer; - /* abuse the lasti field: here it points to - the *next* instruction */ - f->f_lasti = INSTR_OFFSET(); why = WHY_YIELD; break; --- 1525,1528 ---- From mwh@users.sourceforge.net Tue Aug 20 16:43:19 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 20 Aug 2002 08:43:19 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.330,2.331 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13063 Modified Files: ceval.c Log Message: Comment typo repair. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.330 retrieving revision 2.331 diff -C2 -d -r2.330 -r2.331 *** ceval.c 20 Aug 2002 15:19:14 -0000 2.330 --- ceval.c 20 Aug 2002 15:43:16 -0000 2.331 *************** *** 605,609 **** executed. You might think this was obvious from the name, but this wasn't always true before 2.3! PyFrame_New now sets ! f->f_lasti to -1 (i.e. the index *before* the first instruction and YIELD_VALUE doesn't fiddle with f_lasti any more. So this does work. Promise. */ --- 605,609 ---- executed. You might think this was obvious from the name, but this wasn't always true before 2.3! PyFrame_New now sets ! f->f_lasti to -1 (i.e. the index *before* the first instruction) and YIELD_VALUE doesn't fiddle with f_lasti any more. So this does work. Promise. */ From gvanrossum@users.sourceforge.net Tue Aug 20 17:58:00 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 09:58:00 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.149.4.8,1.149.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv7210/Misc Modified Files: Tag: release22-maint ACKS Log Message: Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug is already fixed in 2.3; I'll fix the others in 2.3 next. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.149.4.8 retrieving revision 1.149.4.9 diff -C2 -d -r1.149.4.8 -r1.149.4.9 *** ACKS 1 Aug 2002 19:03:42 -0000 1.149.4.8 --- ACKS 20 Aug 2002 16:57:57 -0000 1.149.4.9 *************** *** 258,261 **** --- 258,262 ---- Chris Lawrence Christopher Lee + Inyeol Lee Kip Lehman Marc-Andre Lemburg From gvanrossum@users.sourceforge.net Tue Aug 20 17:57:59 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 09:57:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.47.6.3,1.47.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7210/Lib/test Modified Files: Tag: release22-maint test_unicode.py Log Message: Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug is already fixed in 2.3; I'll fix the others in 2.3 next. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.47.6.3 retrieving revision 1.47.6.4 diff -C2 -d -r1.47.6.3 -r1.47.6.4 *** test_unicode.py 22 Apr 2002 18:42:44 -0000 1.47.6.3 --- test_unicode.py 20 Aug 2002 16:57:56 -0000 1.47.6.4 *************** *** 84,87 **** --- 84,91 ---- test('rfind', u'abcdefghiabc', 9, u'abc') + test('rfind', 'abcdefghiabc', 9, u'abc') + test('rfind', 'abcdefghiabc', 12, u'') + test('rfind', u'abcdefghiabc', 12, '') + test('rfind', u'abcdefghiabc', 12, u'') test('lower', u'HeLLo', u'hello') *************** *** 212,215 **** --- 216,221 ---- test('endswith', u'ab', 0, u'ab', 0, 1) test('endswith', u'ab', 0, u'ab', 0, 0) + test('endswith', 'helloworld', 1, u'd') + test('endswith', 'helloworld', 0, u'l') test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') From gvanrossum@users.sourceforge.net Tue Aug 20 17:58:02 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 09:58:02 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.147.6.7,2.147.6.8 unicodeobject.c,2.124.6.9,2.124.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7210/Objects Modified Files: Tag: release22-maint stringobject.c unicodeobject.c Log Message: Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug is already fixed in 2.3; I'll fix the others in 2.3 next. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.147.6.7 retrieving revision 2.147.6.8 diff -C2 -d -r2.147.6.7 -r2.147.6.8 *** stringobject.c 5 Aug 2002 06:28:55 -0000 2.147.6.7 --- stringobject.c 20 Aug 2002 16:57:58 -0000 2.147.6.8 *************** *** 1304,1308 **** #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) ! return PyUnicode_Find((PyObject *)self, subobj, i, last, 1); #endif else if (PyObject_AsCharBuffer(subobj, &sub, &n)) --- 1304,1308 ---- #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) ! return PyUnicode_Find((PyObject *)self, subobj, i, last, dir); #endif else if (PyObject_AsCharBuffer(subobj, &sub, &n)) *************** *** 2146,2150 **** int plen; int start = 0; ! int end = -1; PyObject *subobj; --- 2146,2150 ---- int plen; int start = 0; ! int end = INT_MAX; PyObject *subobj; *************** *** 2205,2209 **** int slen; int start = 0; ! int end = -1; int lower, upper; PyObject *subobj; --- 2205,2209 ---- int slen; int start = 0; ! int end = INT_MAX; int lower, upper; PyObject *subobj; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.9 retrieving revision 2.124.6.10 diff -C2 -d -r2.124.6.9 -r2.124.6.10 *** unicodeobject.c 30 Apr 2002 03:41:53 -0000 2.124.6.9 --- unicodeobject.c 20 Aug 2002 16:57:58 -0000 2.124.6.10 *************** *** 2867,2873 **** start = 0; - if (substring->length == 0) - return start; - if (end > self->length) end = self->length; --- 2867,2870 ---- *************** *** 2876,2879 **** --- 2873,2879 ---- if (end < 0) end = 0; + + if (substring->length == 0) + return (direction > 0) ? start : end; end -= substring->length; From akuchlin@mems-exchange.org Tue Aug 20 18:06:10 2002 From: akuchlin@mems-exchange.org (Andrew Kuchling) Date: Tue, 20 Aug 2002 13:06:10 -0400 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.46,1.47 In-Reply-To: <200208201403.g7KE3iZ12987@odiug.zope.com> References: <200208201403.g7KE3iZ12987@odiug.zope.com> Message-ID: <20020820170610.GA19704@ute.mems-exchange.org> On Tue, Aug 20, 2002 at 10:03:44AM -0400, Guido van Rossum wrote: >No; I've added a note warning the reader for now; I hope that Greg >Wilson will make another pass over the PEP to match the implementation >now checked in (unless he objects to some aspect of the >implementation, in which case I'd be glad to discuss this on >python-dev). OK. If Greg lacks the time or interest, and it's deemed appropriate by the PEP editor, I offer to update PEP218 to match the sets.py implementation before 2.3final. I won't make any comments on the API, just record what's there. --amk From gvanrossum@users.sourceforge.net Tue Aug 20 18:29:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 10:29:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18283/Lib/test Modified Files: test_unicode.py Log Message: Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** test_unicode.py 11 Aug 2002 12:23:03 -0000 1.65 --- test_unicode.py 20 Aug 2002 17:29:28 -0000 1.66 *************** *** 108,111 **** --- 108,115 ---- test('rfind', u'abcdefghiabc', 9, u'abc') + test('rfind', 'abcdefghiabc', 9, u'abc') + test('rfind', 'abcdefghiabc', 12, u'') + test('rfind', u'abcdefghiabc', 12, '') + test('rfind', u'abcdefghiabc', 12, u'') test('lower', u'HeLLo', u'hello') *************** *** 242,245 **** --- 246,251 ---- test('endswith', u'ab', False, u'ab', 0, 1) test('endswith', u'ab', False, u'ab', 0, 0) + test('endswith', 'helloworld', True, u'd') + test('endswith', 'helloworld', False, u'l') test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') From gvanrossum@users.sourceforge.net Tue Aug 20 18:29:31 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 10:29:31 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.197,1.198 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18283/Misc Modified Files: ACKS Log Message: Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.197 retrieving revision 1.198 diff -C2 -d -r1.197 -r1.198 *** ACKS 19 Aug 2002 13:17:39 -0000 1.197 --- ACKS 20 Aug 2002 17:29:29 -0000 1.198 *************** *** 293,296 **** --- 293,297 ---- Chris Lawrence Christopher Lee + Inyeol Lee Luc Lefebvre Kip Lehman From gvanrossum@users.sourceforge.net Tue Aug 20 18:29:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 10:29:32 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.182,2.183 unicodeobject.c,2.163,2.164 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18283/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.182 retrieving revision 2.183 diff -C2 -d -r2.182 -r2.183 *** stringobject.c 19 Aug 2002 21:43:18 -0000 2.182 --- stringobject.c 20 Aug 2002 17:29:29 -0000 2.183 *************** *** 1537,1541 **** #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) ! return PyUnicode_Find((PyObject *)self, subobj, i, last, 1); #endif else if (PyObject_AsCharBuffer(subobj, &sub, &n)) --- 1537,1541 ---- #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) ! return PyUnicode_Find((PyObject *)self, subobj, i, last, dir); #endif else if (PyObject_AsCharBuffer(subobj, &sub, &n)) Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.163 retrieving revision 2.164 diff -C2 -d -r2.163 -r2.164 *** unicodeobject.c 14 Aug 2002 18:38:27 -0000 2.163 --- unicodeobject.c 20 Aug 2002 17:29:29 -0000 2.164 *************** *** 2892,2898 **** start = 0; - if (substring->length == 0) - return start; - if (end > self->length) end = self->length; --- 2892,2895 ---- *************** *** 2901,2904 **** --- 2898,2904 ---- if (end < 0) end = 0; + + if (substring->length == 0) + return (direction > 0) ? start : end; end -= substring->length; From gvanrossum@users.sourceforge.net Tue Aug 20 19:22:52 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 11:22:52 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv2396 Modified Files: GBayes.py Log Message: Some minor cleanup: - Move the identifying comment to the top, clarify it a bit, and add author info. - There's no reason for _time and _heapreplace to be hidden names; change these back to time and heapreplace. - Rename main1() to _test() and main2() to main(); when main() sees there are no options or arguments, it runs _test(). - Get rid of a list comprehension from clearjunk(). - Put wordinfo.get as a local variable in _add_msg(). Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GBayes.py 20 Aug 2002 05:16:48 -0000 1.5 --- GBayes.py 20 Aug 2002 18:22:50 -0000 1.6 *************** *** 1,4 **** --- 1,14 ---- #!/usr/bin/env python + # This is an implementation of the Bayes-like spam classifier sketched + # by Paul Graham at . We say + # "Bayes-like" because there are many ad hoc deviations from a + # "normal" Bayesian classifier. + # + # Tim Peters wrote the algorithmic part of the code. + # + # Barry Warsaw added integration infrastructure like command line + # options and a pickled database. + """Usage: %(program)s [options] *************** *** 25,34 **** -o file with -m, output all messages, with marks, to file """ import sys import getopt ! import time as _time ! from heapq import heapreplace as _heapreplace import cPickle as pickle import mailbox --- 35,46 ---- -o file with -m, output all messages, with marks, to file + + When called without any options or arguments, a short self-test is run. """ import sys import getopt ! import time ! from heapq import heapreplace import cPickle as pickle import mailbox *************** *** 38,44 **** program = sys.argv[0] - # This is an implementation of the Bayes-like spam classifier sketched at - # . I say "Bayes-like" because there - # are many ad hoc deviations from a "normal" Bayesian classifier. HAMBIAS = 2.0 SPAMBIAS = 1.0 --- 50,53 ---- *************** *** 56,59 **** --- 65,70 ---- # But the code snippet considers words that appear at least five times. # This implementation follows the code rather than the explanation. + # (In addition, the count compared is after multiplying it with the + # appropriate bias factor.) MINCOUNT = 5.0 *************** *** 122,126 **** wordinfoget = self.wordinfo.get ! now = _time.time() # A priority queue to remember the MAX_DISCRIMINATORS best --- 133,137 ---- wordinfoget = self.wordinfo.get ! now = time.time() # A priority queue to remember the MAX_DISCRIMINATORS best *************** *** 140,144 **** distance = abs(prob - 0.5) if distance > smallest_best: ! _heapreplace(nbest, (distance, prob, word, record)) smallest_best = nbest[0][0] --- 151,155 ---- distance = abs(prob - 0.5) if distance > smallest_best: ! heapreplace(nbest, (distance, prob, word, record)) smallest_best = nbest[0][0] *************** *** 234,245 **** wordinfo = self.wordinfo mincount = float(mincount) ! tonuke = [w for w, r in wordinfo.iteritems() ! if r.modtime < oldesttime and ! SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount] ! for word in tonuke: ! if self.DEBUG: ! r = wordinfo[word] ! print "clearjunk removing word %r: %r" % (word, r) ! del wordinfo[word] def _add_msg(self, wordstream, is_spam): --- 245,254 ---- wordinfo = self.wordinfo mincount = float(mincount) ! for w, r in wordinfo.iteritems(): ! if (r.modtime < oldesttime and ! SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount): ! if self.DEBUG: ! print "clearjunk removing word %r: %r" % (w, r) ! del wordinfo[w] def _add_msg(self, wordstream, is_spam): *************** *** 253,259 **** wordinfo = self.wordinfo ! now = _time.time() for word in wordstream: ! record = wordinfo.get(word) if record is None: record = wordinfo[word] = WordInfo(now) --- 262,269 ---- wordinfo = self.wordinfo ! wordinfoget = wordinfo.get ! now = time.time() for word in wordstream: ! record = wordinfoget(word) if record is None: record = wordinfo[word] = WordInfo(now) *************** *** 511,515 **** """ #' ! def main1(): b = GrahamBayes() b.learn(tokenize(spam1), True) --- 521,525 ---- """ #' ! def _test(): b = GrahamBayes() b.learn(tokenize(spam1), True) *************** *** 529,533 **** ! def main2(): try: opts, args = getopt.getopt(sys.argv[1:], 'hg:s:u:p:c:m:o:') --- 539,543 ---- ! def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hg:s:u:p:c:m:o:') *************** *** 535,538 **** --- 545,553 ---- usage(1, msg) + if not opts and not args: + # Called without options or arguments, run the self-test + _test() + return + threshold = count = good = spam = unknown = pck = mark = output = None for opt, arg in opts: *************** *** 668,670 **** if __name__ == '__main__': ! main2() --- 683,685 ---- if __name__ == '__main__': ! main() From gvanrossum@users.sourceforge.net Tue Aug 20 19:44:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 11:44:32 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv9046 Modified Files: GBayes.py Log Message: Indent repair in clearjunk(). Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GBayes.py 20 Aug 2002 18:22:50 -0000 1.6 --- GBayes.py 20 Aug 2002 18:44:30 -0000 1.7 *************** *** 250,254 **** if self.DEBUG: print "clearjunk removing word %r: %r" % (w, r) ! del wordinfo[w] def _add_msg(self, wordstream, is_spam): --- 250,254 ---- if self.DEBUG: print "clearjunk removing word %r: %r" % (w, r) ! del wordinfo[w] def _add_msg(self, wordstream, is_spam): From fdrake@users.sourceforge.net Tue Aug 20 19:53:10 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 Aug 2002 11:53:10 -0700 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,NONE,1.1 obj_datetime.c,NONE,1.1 obj_delta.c,NONE,1.1 Makefile,1.4,1.5 datetime.c,1.11,1.12 datetime.h,1.4,1.5 setup.py,1.1,1.2 test_cdatetime.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory usw-pr-cvs1:/tmp/cvs-serv11723 Modified Files: Makefile datetime.c datetime.h setup.py test_cdatetime.py Added Files: obj_date.c obj_datetime.c obj_delta.c Log Message: Many updates to the datetime module: - now implements both the date and timedelta types - starts to add the datetime arithmetic support (very partial) - passes many more tests The implementation has been split into several files (1 per type); they will all be merged when the initial implementation is complete, prior to being merged into Python. --- NEW FILE: obj_date.c --- /* imp_date.c * * PyDateTime_Date implementation. */ static int normalize_date(long int *year, long int *month, long int *day) { long int carry, dim; /* This is muddy: the proper range for day can't be determined * without knowing the correct month and year, but if day is, * e.g., plus or minus a million, the current month and year * values make no sense (and may also be out of bounds * themselves). Saying 12 months == 1 year should be * non-controversial. */ if (*month > 12) { carry = (*month - 1) / 12; *month -= (carry * 12); *year += carry; assert(*month >= 1); assert(*month <= 12); } /* Now only day can be out of bounds (year may also be out of * bounds for a datetime object, but we don't care about that * here). If day is out of bounds, what to do is arguable, but at * least the method here is principled and explainable. */ dim = days_in_month(*year, *month); if (*day < 1 || *day > dim) { /* Move day-1 days from the first of the month. First try to * get off cheap if we're only one day out of range * (adjustments for timezone alone can't be worse than that). */ if (*day == 0) { *month -= 1; if (*month > 0) *day = days_in_month(*year, *month); else { *year -= 1; *month = 12; *day = 31; } } else if (*day == dim + 1) { /* move forward a day */ *month += 1; *day = 1; if (*month > 12) { *month = 1; *year += 1; } } else { long int ordinal = ymd_to_ord(*year, *month, 1) + *day - 1; ord_to_ymd(ordinal, year, month, day); } } assert(*month > 0); assert(*day > 0); if (*year < MINYEAR) { PyErr_SetString(PyExc_OverflowError, "date value out of range"); return 0; } return 1; } static PyObject * datetime_add(PyObject *left, PyObject *right); static PyObject * datetime_subtract(PyObject *left, PyObject *right); /* date(2009, 12, 28) + timedelta(4) == 2010-01-01 (2010, 1, -2) expected (2009, 53, 5) */ static PyObject * add_date_timedelta(PyDateTime_Date *date, PyDateTime_Delta *delta) { PyObject *result; /* delta + date */ if (GET_TD_SECONDS(delta) != 0 || GET_TD_MICROSECONDS(delta) != 0) { /* Convert to datetime and pass it off. */ PyObject *dt = new_datetime(GET_YEAR(date), GET_MONTH(date), GET_DAY(date), 0, 0, 0, 0); if (dt == NULL) return NULL; result = datetime_add((PyObject *)delta, dt); Py_DECREF(dt); } else if (GET_TD_DAYS(delta) != 0) { /* There's actually something to do. */ long int year = GET_YEAR(date); long int month = GET_MONTH(date); long int day = GET_DAY(date) + GET_TD_DAYS(delta); if (normalize_date(&year, &month, &day)) result = new_date(year, month, day); else result = NULL; } else { /* The delta is timedelta(0), so return the original date. */ Py_INCREF(date); result = (PyObject *) date; } return result; } static PyObject * date_add(PyObject *left, PyObject *right) { PyTypeObject *left_type = left->ob_type; PyTypeObject *right_type = right->ob_type; if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType) || PyType_IsSubtype(right_type, &PyDateTime_DateTimeType)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if (PyType_IsSubtype(left_type, &PyDateTime_DateType)) { /* date + ??? */ if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) return add_date_timedelta((PyDateTime_Date *) left, (PyDateTime_Delta *) right); } else { /* 'right' must be one of us, or we wouldn't have been called */ if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) return add_date_timedelta((PyDateTime_Date *) right, (PyDateTime_Delta *) left); /* else fall through; we don't support it here */ } Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } static int date_compare(PyDateTime_Date *self, PyObject *other) { if (!PyType_IsSubtype(other->ob_type, &PyDateTime_DateType)) { PyErr_SetString(PyExc_TypeError, "can't compare date to %s instance"); return -1; } return memcmp(self->data, ((PyDateTime_Date *)other)->data, _PyDateTime_DATE_DATA_SIZE); } static PyObject * date_ctime(PyDateTime_Date *self) { return format_ctime(self, 0, 0, 0); } static int date_hash(PyDateTime_Date *self) { if (self->hashcode == -1) { PyObject *temp = Py_BuildValue("lll", GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); if (temp != NULL) { self->hashcode = PyObject_Hash(temp); Py_DECREF(temp); } } return self->hashcode; } static PyObject * date_new(PyTypeObject *type, PyObject *args, PyObject *kw) { PyObject *self = NULL; long int year, month, day; static char *keywords[] = { "year", "month", "day", NULL }; if (PyArg_ParseTupleAndKeywords(args, kw, "lll", keywords, &year, &month, &day)) { if (year < MINYEAR || year > MAXYEAR) { PyErr_SetString(PyExc_ValueError, "year is out of range"); return NULL; } if (month < 1 || month > 12) { PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); return NULL; } if (day < 1 || day > days_in_month(year, month)) { PyErr_SetString(PyExc_ValueError, "day is out of range for month"); return NULL; } self = new_date(year, month, day); } return self; } static PyObject * date_year(PyDateTime_Date *self, void *unused) { return (PyInt_FromLong(GET_YEAR(self))); } static PyObject * date_month(PyDateTime_Date *self, void *unused) { return (PyInt_FromLong(GET_MONTH(self))); } static PyObject * date_day(PyDateTime_Date *self, void *unused) { return (PyInt_FromLong(GET_DAY(self))); } static PyGetSetDef date_getset[] = { {"year", (getter)date_year}, {"month", (getter)date_month}, {"day", (getter)date_day}, {NULL} }; static PyObject * date_isocalendar(PyDateTime_Date *self) { int year = GET_YEAR(self); int week1_monday = iso_week1_monday(year); long today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); int week = (today - week1_monday) / 7; int day = (today - week1_monday) % 7; if (week < 0) { --year; week1_monday = iso_week1_monday(year); week = (today - week1_monday) / 7; day = (today - week1_monday) % 7; } else if (week >= 52 && today >= iso_week1_monday(year + 1)) { ++year; week = 0; } return Py_BuildValue("iii", year, week + 1, day + 1); } static PyObject * date_isoformat(PyDateTime_Date *self, PyObject *args, PyObject *kw) { char buffer[128]; isoformat_date(self, buffer, sizeof(buffer)); return PyString_FromString(buffer); } static PyObject * date_isoweekday(PyDateTime_Date *self) { int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); return PyInt_FromLong(dow + 1); } static int date_nonzero(PyDateTime_Date *self) { return (GET_YEAR(self) != 0 || GET_MONTH(self) != 0 || GET_DAY(self) != 0); } static PyObject * date_repr(PyDateTime_Date *self) { char buffer[1028]; char *typename; typename = self->ob_type->tp_name; PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)", typename, GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); return PyString_FromString(buffer); } static PyObject * date_str(PyDateTime_Date *self) { char buffer[128]; isoformat_date(self, buffer, sizeof(buffer)); return PyString_FromString(buffer); } static PyObject * date_subtract(PyObject *left, PyObject *right) { PyTypeObject *left_type = left->ob_type; PyTypeObject *right_type = right->ob_type; if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType) || PyType_IsSubtype(right_type, &PyDateTime_DateTimeType)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } if (PyType_IsSubtype(left_type, &PyDateTime_DateType)) { if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { /* date - date */ long int left_ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), GET_DAY(left)); long int right_ord = ymd_to_ord(GET_YEAR(right), GET_MONTH(right), GET_DAY(right)); return new_delta(left_ord - right_ord, 0, 0); } if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { PyObject *result = NULL; if (GET_TD_SECONDS(right) != 0 || GET_TD_MICROSECONDS(right) != 0) { /* need to convert to datetime + delta */ PyObject *dt = new_datetime(GET_YEAR(left), GET_MONTH(left), GET_DAY(left), 0, 0, 0, 0); if (dt != NULL) { result = datetime_subtract(dt, right); Py_DECREF(dt); } } else if (GET_TD_DAYS(right) == 0) { /* date - timedelta(0) */ Py_INCREF(left); result = left; } else { long int year, month, day; long int ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), GET_DAY(left)); ord -= GET_TD_DAYS(right); if (ord < 1) PyErr_SetString(PyExc_OverflowError, "resulting value out of range"); else { ord_to_ymd(ord, &year, &month, &day); result = new_date(year, month, day); } } return result; } } Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } static PyObject * date_today(PyObject *self, PyObject *cls) { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ struct timeval t; struct tm *tm; time_t timet; #ifdef GETTIMEOFDAY_NO_TZ gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ timet = t.tv_sec; tm = localtime(&timet); return PyObject_CallFunction(cls, "iii", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday); } static PyObject * date_toordinal(PyDateTime_Date *self) { return PyInt_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self), GET_DAY(self))); } static PyObject * date_weekday(PyDateTime_Date *self) { int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); return PyInt_FromLong(dow); } static PyMethodDef date_methods[] = { /* Class methods: */ {"today", (PyCFunction)date_today, METH_O | METH_CLASS, "Return a new date that represents the current date."}, /* Instance methods: */ {"ctime", (PyCFunction)date_ctime, METH_NOARGS, "Return ctime() style string."}, {"isocalendar", (PyCFunction)date_isocalendar, METH_NOARGS, "Return a 3-tuple containing ISO year, week number, and weekday.\n\n" "The first ISO week of the year is the (Mon-Sun) week containing the\n" "year's first Thursday; everything rest derives from that."}, {"isoformat", (PyCFunction)date_isoformat, METH_KEYWORDS, "Return the day of the week represented by the date.\n" "Monday == 1 ... Sunday == 7"}, {"isoweekday", (PyCFunction)date_isoweekday, METH_NOARGS, "Return the day of the week represented by the date.\n" "Monday == 1 ... Sunday == 7"}, {"toordinal", (PyCFunction)date_toordinal, METH_NOARGS, "Return proleptic Gregorian ordinal for the year, month and day.\n" "January 1 of year 1 is day 1."}, {"weekday", (PyCFunction)date_weekday, METH_NOARGS, "Return the day of the week represented by the date.\n" "Monday == 0 ... Sunday == 6"}, {NULL} }; static char date_doc[] = "Basic date type."; static PyNumberMethods date_as_number = { date_add, /* nb_add */ date_subtract, /* nb_subtract */ 0, /* nb_multiply */ 0, /* nb_divide */ 0, /* nb_remainder */ 0, /* nb_divmod */ 0, /* nb_power */ 0, /* nb_negative */ 0, /* nb_positive */ 0, /* nb_absolute */ (inquiry)date_nonzero, /* nb_nonzero */ }; static PyTypeObject PyDateTime_DateType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "date", /* tp_name */ sizeof(PyDateTime_Date), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyObject_Del, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)date_compare, /* tp_compare */ (reprfunc)date_repr, /* tp_repr */ &date_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)date_hash, /* tp_hash */ 0, /* tp_call */ (reprfunc)date_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ date_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ date_methods, /* tp_methods */ 0, /* tp_members */ date_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ date_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; --- NEW FILE: obj_datetime.c --- /* imp_datetime.c * * PyDateTime_DateTime implementation. */ static void normalize_pair(long int *parent, long int *child, int size) { if (*child < 0) { long int borrow = (*child / size) + 1; *parent -= borrow; *child += (borrow * size); } else if (*child >= size) { long int carry = *child / size; *parent += carry; *child -= (carry * size); } } static int normalize_datetime(long int *year, long int *month, long int *day, long int *hour, long int *minute, long int *second, long int *microsecond) { normalize_pair(second, microsecond, 1000000); normalize_pair(minute, second, 60); normalize_pair(hour, minute, 60); normalize_pair(day, hour, 24); return normalize_date(year, month, day); } static PyObject * add_datetime_timedelta(PyDateTime_DateTime *date, PyDateTime_Delta *delta) { long int year = GET_YEAR(date); long int month = GET_MONTH(date); long int day = GET_DAY(date) + GET_TD_DAYS(delta); long int hour = GET_HOUR(date); long int minute = GET_MINUTE(date); long int second = GET_SECOND(date) + GET_TD_SECONDS(delta); long int microsecond = GET_MICROSECOND(date) + GET_TD_MICROSECONDS(delta); if (normalize_datetime(&year, &month, &day, &hour, &minute, &second, µsecond)) return new_datetime(year, month, day, hour, minute, second, microsecond); else return NULL; } static PyObject * datetime_add(PyObject *left, PyObject *right) { PyTypeObject *left_type = left->ob_type; PyTypeObject *right_type = right->ob_type; if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType)) { /* datetime + ??? */ if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) return add_datetime_timedelta((PyDateTime_DateTime *) left, (PyDateTime_Delta *) right); } else if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) { /* delta + datetime */ return add_datetime_timedelta((PyDateTime_DateTime *) right, (PyDateTime_Delta *) left); } Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } static int datetime_compare(PyDateTime_DateTime *self, PyObject *other) { if (!PyType_IsSubtype(other->ob_type, &PyDateTime_DateTimeType)) { PyErr_SetString(PyExc_TypeError, "can't compare date to %s instance"); return -1; } return memcmp(self->data, ((PyDateTime_DateTime *)other)->data, _PyDateTime_DATETIME_DATA_SIZE); } static PyObject * datetime_ctime(PyDateTime_DateTime *self) { return format_ctime((PyDateTime_Date *)self, GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); } static int datetime_hash(PyDateTime_DateTime *self) { if (self->hashcode == -1) { PyObject *temp; if (GET_MICROSECOND(self) != 0) temp = Py_BuildValue("lllllll", GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self), GET_MICROSECOND(self)); else if (GET_SECOND(self) != 0) temp = Py_BuildValue("llllll", GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); else if (GET_MINUTE(self) != 0) temp = Py_BuildValue("lllll", GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self), GET_MINUTE(self)); else if (GET_HOUR(self) != 0) temp = Py_BuildValue("llll", GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self)); else temp = Py_BuildValue("lll", GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); if (temp != NULL) { self->hashcode = PyObject_Hash(temp); Py_DECREF(temp); } } return self->hashcode; } static PyObject * datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) { PyObject *self = NULL; long int year, month, day, hour = 0, minute = 0, second = 0, usecond = 0; static char *keywords[] = { "year", "month", "day", "hour", "minute", "second", "microsecond", NULL }; if (PyArg_ParseTupleAndKeywords(args, kw, "lll|llll", keywords, &year, &month, &day, &hour, &minute, &second, &usecond)) { if (year < MINYEAR || year > MAXYEAR) { PyErr_SetString(PyExc_ValueError, "year is out of range"); return NULL; } if (month < 1 || month > 12) { PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); return NULL; } if (day < 1 || day > days_in_month(year, month)) { PyErr_SetString(PyExc_ValueError, "day is out of range for month"); return NULL; } if (hour < 0 || hour > 23) { PyErr_SetString(PyExc_ValueError, "hour must be in 0..23"); return NULL; } if (minute < 0 || minute > 59) { PyErr_SetString(PyExc_ValueError, "minute must be in 0..59"); return NULL; } if (second < 0 || second > 59) { PyErr_SetString(PyExc_ValueError, "second must be in 0..59"); return NULL; } if (usecond < 0 || usecond > 999999) { PyErr_SetString(PyExc_ValueError, "microsecond must be in 0..999999"); return NULL; } self = new_datetime(year, month, day, hour, minute, second, usecond); } return self; } static PyObject * datetime_repr(PyDateTime_DateTime *self) { char buffer[1028]; char *typename; typename = self->ob_type->tp_name; if (GET_MICROSECOND(self)) { PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d, %d)", typename, GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self), GET_MICROSECOND(self)); } else if (GET_SECOND(self)) { PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d)", typename, GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); } else { PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d)", typename, GET_YEAR(self), GET_MONTH(self), GET_DAY(self), GET_HOUR(self), GET_MINUTE(self)); } return PyString_FromString(buffer); } static PyObject * datetime_str(PyDateTime_DateTime *self) { char buffer[128]; char *cp; cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); *cp++ = ' '; isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); return PyString_FromString(buffer); } static PyObject * datetime_subtract(PyObject *left, PyObject *right) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } static PyObject * datetime_hour(PyDateTime_DateTime *self, void *unused) { return (PyInt_FromLong(GET_HOUR(self))); } static PyObject * datetime_minute(PyDateTime_DateTime *self, void *unused) { return (PyInt_FromLong(GET_MINUTE(self))); } static PyObject * datetime_second(PyDateTime_DateTime *self, void *unused) { return (PyInt_FromLong(GET_SECOND(self))); } static PyObject * datetime_microsecond(PyDateTime_DateTime *self, void *unused) { return (PyInt_FromLong(GET_MICROSECOND(self))); } static PyGetSetDef datetime_getset[] = { {"hour", (getter)datetime_hour}, {"minute", (getter)datetime_minute}, {"second", (getter)datetime_second}, {"microsecond", (getter)datetime_microsecond}, {NULL} }; static PyObject * datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw) { char buffer[128]; char sep = 'T'; char *cp; static char *keywords[] = {"sep", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kw, "|c:isoformat", keywords, &sep)) return NULL; cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); assert(cp != NULL); *cp++ = sep; isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); return PyString_FromString(buffer); } static int datetime_nonzero(PyDateTime_DateTime *self) { return (GET_MICROSECOND(self) != 0 || GET_SECOND(self) != 0 || GET_MINUTE(self) != 0 || GET_HOUR(self) != 0 || date_nonzero((PyDateTime_Date *) self) != 0); } static PyObject * datetime_now(PyObject *self, PyObject *cls) { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ struct timeval t; struct tm *tm; time_t timet; #ifdef GETTIMEOFDAY_NO_TZ gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ timet = t.tv_sec; tm = localtime(&timet); return PyObject_CallFunction(cls, "iiiiiil", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, t.tv_usec); } static PyObject * datetime_today(PyObject *self, PyObject *cls) { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ struct timeval t; struct tm *tm; time_t timet; #ifdef GETTIMEOFDAY_NO_TZ gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ timet = t.tv_sec; tm = localtime(&timet); return PyObject_CallFunction(cls, "iiiiiil", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, 0, 0, 0, 0); } static PyMethodDef datetime_methods[] = { /* Class methods: */ {"now", (PyCFunction)datetime_now, METH_O | METH_CLASS, "Return a new datetime that represents the current time."}, {"today", (PyCFunction)datetime_today, METH_O | METH_CLASS, "Return a new datetime that represents the current date."}, /* Instance methods: */ {"ctime", (PyCFunction)datetime_ctime, METH_NOARGS, "Return ctime() style string."}, {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, "Return the day of the week represented by the datetime.\n" "Monday == 1 ... Sunday == 7"}, {NULL} }; static char datetime_doc[] = "Basic date/time type."; static PyNumberMethods datetime_as_number = { datetime_add, /* nb_add */ datetime_subtract, /* nb_subtract */ 0, /* nb_multiply */ 0, /* nb_divide */ 0, /* nb_remainder */ 0, /* nb_divmod */ 0, /* nb_power */ 0, /* nb_negative */ 0, /* nb_positive */ 0, /* nb_absolute */ (inquiry)datetime_nonzero, /* nb_nonzero */ }; statichere PyTypeObject PyDateTime_DateTimeType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "datetime", /* tp_name */ sizeof(PyDateTime_DateTime), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)PyObject_Del, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)datetime_compare, /* tp_compare */ (reprfunc)datetime_repr, /* tp_repr */ &datetime_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)datetime_hash, /* tp_hash */ 0, /* tp_call */ (reprfunc)datetime_str, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ datetime_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ datetime_methods, /* tp_methods */ 0, /* tp_members */ datetime_getset, /* tp_getset */ &PyDateTime_DateType, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ datetime_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; --- NEW FILE: obj_delta.c --- /* imp_delta.c * * PyDateTime_Delta implementation. */ static PyObject * delta_add(PyObject *left, PyObject *right) { PyTypeObject *left_type = left->ob_type; PyTypeObject *right_type = right->ob_type; PyDateTime_Delta *delta; PyObject *other; PyTypeObject *other_type; if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) { /* delta + ??? */ delta = (PyDateTime_Delta *) left; if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ long int days = GET_TD_DAYS(delta) + GET_TD_DAYS(right); long int seconds = GET_TD_SECONDS(delta) + GET_TD_SECONDS(right); long int microseconds = (GET_TD_MICROSECONDS(delta) + GET_TD_MICROSECONDS(right)); return new_delta(days, seconds, microseconds); } other = right; other_type = right_type; } else { /* !delta + delta */ delta = (PyDateTime_Delta *) right; other = left; other_type = left_type; } Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } static int delta_compare(PyDateTime_Delta *self, PyObject *other) { int result = -1; if (!PyObject_TypeCheck(other, &PyDateTime_DeltaType)) PyErr_Format(PyExc_TypeError, "can't compare %s to %s instance", self->ob_type->tp_name, other->ob_type->tp_name); else { long diff = GET_TD_DAYS(self) - GET_TD_DAYS(other); if (diff == 0) { diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); if (diff == 0) diff = GET_TD_MICROSECONDS(self) - GET_TD_MICROSECONDS(other); } if (diff == 0) result = 0; else if (diff > 0) result = 1; } return result; } static int delta_hash(PyDateTime_Delta *self) { return -2; } static PyObject * multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) { long i = PyInt_AS_LONG(intobj); return new_delta(GET_TD_DAYS(delta) * i, GET_TD_SECONDS(delta) * i, GET_TD_MICROSECONDS(delta) * i); } static PyObject * delta_multiply(PyObject *left, PyObject *right) { PyObject *result = NULL; if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType)) { /* delta * ??? */ if (PyInt_Check(right)) result = multiply_int_timedelta(right, (PyDateTime_Delta *) left); else { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } } else if (PyInt_Check(left)) result = multiply_int_timedelta(left, (PyDateTime_Delta *) right); else { /* !(delta | int) * delta */ Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } return result; } static PyObject * delta_negative(PyDateTime_Delta *self) { return new_delta(-GET_TD_DAYS(self), -GET_TD_SECONDS(self), -GET_TD_MICROSECONDS(self)); } static PyObject * delta_new(PyTypeObject *type, PyObject *args, PyObject *kw) { PyObject *self = NULL; long int days, seconds = 0, microseconds = 0; static char *keywords[] = { "days", "seconds", "microseconds", NULL }; if (PyArg_ParseTupleAndKeywords(args, kw, "l|ll:__new__", keywords, &days, &seconds, µseconds)) { if (seconds < 0 || seconds >= (24 * 3600)) { PyErr_SetString(PyExc_ValueError, "seconds must be in 0..86399"); return NULL; } if (microseconds < 0 || microseconds >= 1000000) { PyErr_SetString(PyExc_ValueError, "microseconds must be in 0..999999"); return NULL; } self = new_delta(days, seconds, microseconds); } return self; } static PyObject * delta_subtract(PyObject *left, PyObject *right) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } static int delta_nonzero(PyDateTime_Delta *self) { return (GET_TD_DAYS(self) != 0 || GET_TD_SECONDS(self) != 0 || GET_TD_MICROSECONDS(self) != 0); } static PyObject * delta_repr(PyDateTime_Delta *self) { if (GET_TD_MICROSECONDS(self) != 0) return PyString_FromFormat("%s(%ld, %ld, %ld)", self->ob_type->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self), GET_TD_MICROSECONDS(self)); if (GET_TD_SECONDS(self) != 0) return PyString_FromFormat("%s(%ld, %ld)", self->ob_type->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self)); return PyString_FromFormat("%s(%ld)", self->ob_type->tp_name, GET_TD_DAYS(self)); } #define OFFSET(field) offsetof(PyDateTime_Delta, field) static PyMemberDef delta_members[] = { {"days", T_LONG, OFFSET(days), READONLY, "Number os days."}, {"seconds", T_LONG, OFFSET(seconds), READONLY, "Number of seconds (less than 1 day)."}, {"microseconds", T_LONG, OFFSET(microseconds), READONLY, "Number of microseconds (less than 1 second)."}, {NULL} }; static char delta_doc[] = "Difference between two datetime values."; static PyNumberMethods delta_as_number = { delta_add, /* nb_add */ delta_subtract, /* nb_subtract */ delta_multiply, /* nb_multiply */ 0, /* nb_divide */ 0, /* nb_remainder */ 0, /* nb_divmod */ 0, /* nb_power */ (unaryfunc)delta_negative, /* nb_negative */ 0, /* nb_positive */ 0, /* nb_absolute */ (inquiry)delta_nonzero, /* nb_nonzero */ }; static PyTypeObject PyDateTime_DeltaType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "timedelta", /* tp_name */ sizeof(PyDateTime_Delta), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ (cmpfunc)delta_compare, /* tp_compare */ (reprfunc)delta_repr, /* tp_repr */ &delta_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)delta_hash, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ delta_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ delta_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ delta_new, /* tp_new */ _PyObject_Del, /* tp_free */ }; Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 28 Mar 2002 21:17:47 -0000 1.4 --- Makefile 20 Aug 2002 18:53:07 -0000 1.5 *************** *** 1,3 **** ! PYTHON=python2.3 default: check --- 1,4 ---- ! #PYTHON=python2.3 ! PYTHON=../../../trunk/debug/python default: check Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** datetime.c 28 Mar 2002 21:17:47 -0000 1.11 --- datetime.c 20 Aug 2002 18:53:07 -0000 1.12 *************** *** 5,8 **** --- 5,9 ---- #include "Python.h" #include "modsupport.h" + #include "structmember.h" #include *************** *** 13,38 **** #define MAXYEAR 9999 /* Rename the long macros in datetime.h to more reasonable short names. */ ! #define GET_YEAR(o) PyDateTime_GET_YEAR(o) ! #define GET_MONTH(o) PyDateTime_GET_MONTH(o) ! #define GET_DAY(o) PyDateTime_GET_DAY(o) ! #define GET_HOUR(o) PyDateTime_GET_HOUR(o) ! #define GET_MINUTE(o) PyDateTime_GET_MINUTE(o) ! #define GET_SECOND(o) PyDateTime_GET_SECOND(o) ! #define GET_MICROSECOND(o) PyDateTime_GET_MICROSECOND(o) ! /* Set accessors. */ ! #define SET_YEAR(o, v) (((o)->data[0] = ((v) & 0xff00) >> 8), \ ! ((o)->data[1] = ((v) & 0x00ff))) ! #define SET_MONTH(o, v) (PyDateTime_GET_MONTH(o) = (v)) ! #define SET_DAY(o, v) (PyDateTime_GET_DAY(o) = (v)) ! #define SET_HOUR(o, v) (PyDateTime_GET_HOUR(o) = (v)) ! #define SET_MINUTE(o, v) (PyDateTime_GET_MINUTE(o) = (v)) ! #define SET_SECOND(o, v) (PyDateTime_GET_SECOND(o) = (v)) ! #define SET_MICROSECOND(o, v) (((o)->data[7] = ((v) & 0xff0000) >> 16), \ ! ((o)->data[8] = ((v) & 0x00ff00) >> 8), \ ! ((o)->data[9] = ((v) & 0x0000ff))) ! staticforward PyTypeObject PyDateTime_Type; /* --- 14,60 ---- #define MAXYEAR 9999 + typedef struct + { + PyObject_HEAD + int hashcode; + long int days; + long int seconds; + long int microseconds; + } PyDateTime_Delta; + /* Rename the long macros in datetime.h to more reasonable short names. */ ! #define GET_YEAR(o) PyDateTime_GET_YEAR(o) ! #define GET_MONTH(o) PyDateTime_GET_MONTH(o) ! #define GET_DAY(o) PyDateTime_GET_DAY(o) ! #define GET_HOUR(o) PyDateTime_GET_HOUR(o) ! #define GET_MINUTE(o) PyDateTime_GET_MINUTE(o) ! #define GET_SECOND(o) PyDateTime_GET_SECOND(o) ! #define GET_MICROSECOND(o) PyDateTime_GET_MICROSECOND(o) ! /* Date accessors. */ ! #define SET_YEAR(o, v) (((o)->data[0] = ((v) & 0xff00) >> 8), \ ! ((o)->data[1] = ((v) & 0x00ff))) ! #define SET_MONTH(o, v) (PyDateTime_GET_MONTH(o) = (v)) ! #define SET_DAY(o, v) (PyDateTime_GET_DAY(o) = (v)) ! /* Date/Time accessors. */ ! #define SET_HOUR(o, v) (PyDateTime_GET_HOUR(o) = (v)) ! #define SET_MINUTE(o, v) (PyDateTime_GET_MINUTE(o) = (v)) ! #define SET_SECOND(o, v) (PyDateTime_GET_SECOND(o) = (v)) ! #define SET_MICROSECOND(o, v) (((o)->data[7] = ((v) & 0xff0000) >> 16), \ ! ((o)->data[8] = ((v) & 0x00ff00) >> 8), \ ! ((o)->data[9] = ((v) & 0x0000ff))) ! ! /* Delta accessors. */ ! #define GET_TD_DAYS(o) (((PyDateTime_Delta *)(o))->days) ! #define GET_TD_SECONDS(o) (((PyDateTime_Delta *)(o))->seconds) ! #define GET_TD_MICROSECONDS(o) (((PyDateTime_Delta *)(o))->microseconds) ! ! #define SET_TD_DAYS(o, v) ((o)->days = (v)) ! #define SET_TD_SECONDS(o, v) ((o)->seconds = (v)) ! #define SET_TD_MICROSECONDS(o, v) ((o)->microseconds = (v)) ! ! static PyTypeObject PyDateTime_DateType; ! static PyTypeObject PyDateTime_DateTimeType; /* *************** *** 43,47 **** is_leap(int year) { ! return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); } --- 65,69 ---- is_leap(int year) { ! return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0; } *************** *** 88,91 **** --- 110,163 ---- } + /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ + static void + ord_to_ymd(long int ordinal, long int *year, long int *month, long int *day) + { + int di400y = days_before_year(401); + int di100y = days_before_year(101); + int di4y = days_before_year(5); + int n, n1, n4, n100, n400, leapyear, preceding; + + assert(ordinal >= 1); + --ordinal; + n400 = ordinal / di400y; + n = ordinal % di400y; + *year = n400 * 400 + 1; + + n100 = n / di100y; + n = n % di100y; + + n4 = n / di4y; + n = n % di4y; + + n1 = n / 365; + n = n % 365; + + *year += n100 * 100 + n4 * 4 + n1; + if (n1 == 4 || n100 == 4) { + assert(n == 0); + *year -= 1; + *month = 12; + *day = 31; + return; + } + leapyear = (n1 == 3 && (n4 != 24 || n100 == 3)) ? 1 : 0; + assert(leapyear == is_leap(*year)); + *month = (n + 50) >> 5; + preceding = (_days_before_month[*month] + + ((*month > 2 && leapyear) ? 1 : 0)); + if (preceding > n) { + /* estimate is too large */ + *month -= 1; + preceding -= days_in_month(*year, *month); + } + n -= preceding; + assert(0 <= n); + assert(n < days_in_month(*year, *month)); + + *day = n + 1; + } + + /* year, month, day -> ordinal, considering 01-Jan-0001 as day 1. */ static long ymd_to_ord(int year, int month, int day) *************** *** 114,187 **** } ! /* ! * PyDateTime_Object implementation ! */ ! static int ! datetime_compare(PyDateTime_Object *self, PyObject *other) ! { ! if (!PyType_IsSubtype(other->ob_type, &PyDateTime_Type)) { ! PyErr_SetString(PyExc_TypeError, ! "can't compare date to %s instance"); ! return -1; ! } ! return memcmp(self->data, ((PyDateTime_Object *)other)->data, ! _PyDateTime_DATA_SIZE); } ! static PyObject * ! datetime_repr(PyDateTime_Object *self) { ! char buffer[1028]; ! char *typename; ! ! typename = self->ob_type->tp_name; ! if (GET_MICROSECOND(self)) { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self), ! GET_MICROSECOND(self)); ! } ! else if (GET_SECOND(self)) { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); ! } ! else { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self)); ! } ! return PyString_FromString(buffer); } static void ! isoformat(PyDateTime_Object *dt, char sep, char buffer[], int bufflen) { PyOS_snprintf(buffer, bufflen, ! "%04d-%02d-%02d%c%02d:%02d:%02d.%06d", ! GET_YEAR(dt), GET_MONTH(dt), GET_DAY(dt), ! sep, GET_HOUR(dt), GET_MINUTE(dt), GET_SECOND(dt), GET_MICROSECOND(dt)); } static PyObject * ! datetime_str(PyDateTime_Object *self) { ! char buffer[128]; ! isoformat(self, ' ', buffer, sizeof(buffer)); ! ! return PyString_FromString(buffer); ! } ! static int ! datetime_hash(PyDateTime_Object *self) ! { ! return -2; } --- 186,245 ---- } + static PyObject * + format_ctime(PyDateTime_Date *date, + int hours, int minutes, int seconds) + { + static char *DayNames[] = { + "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" + }; + static char *MonthNames[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; ! char buffer[128]; ! int wday = weekday(GET_YEAR(date), GET_MONTH(date), GET_DAY(date)); ! PyOS_snprintf(buffer, sizeof(buffer), "%s %s %2d %02d:%02d:%02d %04d", ! DayNames[wday], MonthNames[GET_MONTH(date) - 1], ! GET_DAY(date), hours, minutes, seconds, ! GET_YEAR(date)); ! return PyString_FromString(buffer); } ! static char * ! isoformat_date(PyDateTime_Date *dt, char buffer[], int bufflen) { ! int x; ! x = PyOS_snprintf(buffer, bufflen, ! "%04d-%02d-%02d", ! GET_YEAR(dt), GET_MONTH(dt), GET_DAY(dt)); ! return buffer + x; } static void ! isoformat_time(PyDateTime_DateTime *dt, char buffer[], int bufflen) { PyOS_snprintf(buffer, bufflen, ! "%02d:%02d:%02d.%06d", GET_HOUR(dt), GET_MINUTE(dt), GET_SECOND(dt), GET_MICROSECOND(dt)); } + + /* Create a date instance with no range checking. */ static PyObject * ! new_date(int year, int month, int day) { ! PyDateTime_Date *self; ! self = PyObject_New(PyDateTime_Date, &PyDateTime_DateType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_YEAR(self, year); ! SET_MONTH(self, month); ! SET_DAY(self, day); ! } ! return (PyObject *) self; } *************** *** 191,198 **** int second, int usecond) { ! PyDateTime_Object *self; ! self = PyObject_New(PyDateTime_Object, &PyDateTime_Type); if (self != NULL) { SET_YEAR(self, year); SET_MONTH(self, month); --- 249,257 ---- int second, int usecond) { ! PyDateTime_DateTime *self; ! self = PyObject_New(PyDateTime_DateTime, &PyDateTime_DateTimeType); if (self != NULL) { + self->hashcode = -1; SET_YEAR(self, year); SET_MONTH(self, month); *************** *** 207,463 **** static PyObject * ! datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int year, month, day, hour = 0, minute = 0, second = 0, usecond = 0; ! ! static char *keywords[] = { ! "year", "month", "day", "hour", "minute", "second", "microsecond", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "lll|llll", keywords, ! &year, &month, &day, &hour, &minute, ! &second, &usecond)) { ! if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, "year is out of range"); ! return NULL; ! } ! if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); ! return NULL; ! } ! if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, "day is out of range for month"); ! return NULL; ! } ! if (hour < 0 || hour > 23) { ! PyErr_SetString(PyExc_ValueError, "hour must be in 0..23"); ! return NULL; ! } ! if (minute < 0 || minute > 59) { ! PyErr_SetString(PyExc_ValueError, "minute must be in 0..59"); ! return NULL; ! } ! if (second < 0 || second > 59) { ! PyErr_SetString(PyExc_ValueError, "second must be in 0..59"); ! return NULL; ! } ! if (usecond < 0 || usecond > 999999) { ! PyErr_SetString(PyExc_ValueError, ! "microsecond must be in 0..999999"); ! return NULL; ! } ! self = new_datetime(year, month, day, hour, minute, second, usecond); } ! return self; ! } ! ! ! static PyObject * ! datetime_year(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_YEAR(self))); ! } ! ! static PyObject * ! datetime_month(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_MONTH(self))); ! } ! ! static PyObject * ! datetime_day(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_DAY(self))); ! } ! ! static PyObject * ! datetime_hour(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_HOUR(self))); ! } ! ! static PyObject * ! datetime_minute(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_MINUTE(self))); ! } ! ! static PyObject * ! datetime_second(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_SECOND(self))); ! } ! ! static PyObject * ! datetime_microsecond(PyDateTime_Object *self, void *unused) ! { ! return (PyInt_FromLong(GET_MICROSECOND(self))); ! } ! ! static PyGetSetDef datetime_getset[] = { ! {"year",(getter)datetime_year}, ! {"month", (getter)datetime_month}, ! {"day", (getter)datetime_day}, ! {"hour", (getter)datetime_hour}, ! {"minute", (getter)datetime_minute}, ! {"second", (getter)datetime_second}, ! {"microsecond", (getter)datetime_microsecond}, ! {NULL} ! }; ! ! static PyObject * ! datetime_isocalendar(PyDateTime_Object *self) ! { ! int year = GET_YEAR(self); ! int week1_monday = iso_week1_monday(year); ! long today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); ! int week = (today - week1_monday) / 7; ! int day = (today - week1_monday) % 7; ! ! if (week < 0) { ! --year; ! week1_monday = iso_week1_monday(year); ! week = (today - week1_monday) / 7; ! day = (today - week1_monday) % 7; } ! else if (week >= 52 && ! today >= iso_week1_monday(year + 1)) { ! ++year; ! week = 0; } ! return Py_BuildValue("iii", year, week + 1, day + 1); ! } ! ! static PyObject * ! datetime_isoformat(PyDateTime_Object *self, PyObject *args, PyObject *kw) ! { ! char buffer[128]; ! char sep = 'T'; ! ! static char *keywords[] = {"sep", NULL}; ! ! if (!PyArg_ParseTupleAndKeywords(args, kw, "|c:isoformat", keywords, &sep)) ! return NULL; ! isoformat(self, sep, buffer, sizeof(buffer)); ! ! return PyString_FromString(buffer); ! } ! ! static PyObject * ! datetime_isoweekday(PyDateTime_Object *self) ! { ! int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! ! return PyInt_FromLong(dow + 1); ! } ! ! static PyObject * ! datetime_weekday(PyDateTime_Object *self) ! { ! int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! ! return PyInt_FromLong(dow); ! } ! ! static PyObject * ! datetime_now(PyObject *self, PyObject *cls) ! { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; ! ! #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); ! #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); ! #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! ! return PyObject_CallFunction(cls, "iiiiiil", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday, tm->tm_hour, tm->tm_min, ! tm->tm_sec, t.tv_usec); } ! static PyMethodDef datetime_methods[] = { ! /* Class methods: */ ! {"now", (PyCFunction)datetime_now, METH_O | METH_CLASS, ! "Return a new datetime that represents the current time."}, ! ! /* Instance methods: */ ! {"isocalendar", (PyCFunction)datetime_isocalendar, METH_NOARGS, ! "Return a 3-tuple containing ISO year, week number, and weekday.\n\n" ! "The first ISO week of the year is the (Mon-Sun) week containing the\n" ! "year's first Thursday; everything rest derives from that."}, ! {"isoformat", (PyCFunction)datetime_isoformat, METH_VARARGS|METH_KEYWORDS, ! "Return the day of the week represented by the datetime.\n" ! "Monday == 1 ... Sunday == 7"}, ! {"isoweekday", (PyCFunction)datetime_isoweekday, METH_NOARGS, ! "Return the day of the week represented by the datetime.\n" ! "Monday == 1 ... Sunday == 7"}, ! {"weekday", (PyCFunction)datetime_weekday, METH_NOARGS, ! "Return the day of the week represented by the datetime.\n" ! "Monday == 0 ... Sunday == 6"}, ! {NULL} ! }; ! ! ! static char datetime_doc[] = ! "Basic date/time type."; ! ! ! statichere PyTypeObject PyDateTime_Type = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "datetime", /* tp_name */ ! sizeof(PyDateTime_Object), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! _PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)datetime_compare, /* tp_compare */ ! (reprfunc)datetime_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)datetime_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)datetime_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ ! datetime_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! datetime_methods, /* tp_methods */ ! 0, /* tp_members */ ! datetime_getset, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! datetime_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ ! }; ! ! ! static ! PyMethodDef functions[] = { ! {NULL, NULL, 0, NULL} ! }; ! void --- 266,294 ---- static PyObject * ! new_delta(long int days, long int seconds, long int microseconds) { ! PyDateTime_Delta *self; ! if (microseconds >= 1000000 || microseconds <= -1000000) { ! seconds += microseconds / 1000000; ! microseconds %= 1000000; } ! if (seconds >= 24*3600 || seconds <= 24*3600) { ! days += seconds / (24*3600); ! seconds %= (24*3600); } ! self = PyObject_New(PyDateTime_Delta, &PyDateTime_DeltaType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_TD_DAYS(self, days); ! SET_TD_SECONDS(self, seconds); ! SET_TD_MICROSECONDS(self, microseconds); } ! return (PyObject *) self; } ! #include "obj_delta.c" ! #include "obj_date.c" ! #include "obj_datetime.c" void *************** *** 466,477 **** PyObject *m; PyObject *d, *dt; - int err; ! PyDateTime_Type.ob_type = &PyType_Type; ! if (PyType_Ready(&PyDateTime_Type) < 0) return; ! d = PyDateTime_Type.tp_dict; dt = new_datetime(1, 1, 1, 0, 0, 0, 0); if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) --- 297,325 ---- PyObject *m; PyObject *d, *dt; ! if (PyType_Ready(&PyDateTime_DateType) < 0) ! return; ! if (PyType_Ready(&PyDateTime_DateTimeType) < 0) ! return; ! if (PyType_Ready(&PyDateTime_DeltaType) < 0) ! return; ! /* date values */ ! d = PyDateTime_DateType.tp_dict; ! dt = new_date(1, 1, 1); ! if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_date(MAXYEAR, 12, 31); ! if (dt == NULL || PyDict_SetItemString(d, "max", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_delta(1, 0, 0); ! if (dt == NULL || PyDict_SetItemString(d, "resolution", dt) < 0) return; + Py_DECREF(dt); ! /* date/time values */ ! d = PyDateTime_DateTimeType.tp_dict; dt = new_datetime(1, 1, 1, 0, 0, 0, 0); if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) *************** *** 482,491 **** return; Py_DECREF(dt); ! m = Py_InitModule3("_datetime", functions, "Fast implementation of the datetime type."); PyModule_AddIntConstant(m, "MINYEAR", 1); ! PyModule_AddIntConstant(m, "MAXYEAR", 9999); ! Py_INCREF(&PyDateTime_Type); ! PyModule_AddObject(m, "datetime", (PyObject *) &PyDateTime_Type); } --- 330,348 ---- return; Py_DECREF(dt); + dt = new_delta(0, 0, 1); + if (dt == NULL || PyDict_SetItemString(d, "resolution", dt) < 0) + return; + Py_DECREF(dt); ! /* module initialization */ ! m = Py_InitModule3("_datetime", NULL, "Fast implementation of the datetime type."); PyModule_AddIntConstant(m, "MINYEAR", 1); ! PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); ! Py_INCREF(&PyDateTime_DateType); ! PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType); ! Py_INCREF(&PyDateTime_DateTimeType); ! PyModule_AddObject(m, "datetime", (PyObject *) &PyDateTime_DateTimeType); ! Py_INCREF(&PyDateTime_DeltaType); ! PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType); } Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** datetime.h 12 Mar 2002 22:33:51 -0000 1.4 --- datetime.h 20 Aug 2002 18:53:07 -0000 1.5 *************** *** 5,27 **** #define DATETIME_H ! #define _PyDateTime_DATA_SIZE 10 typedef struct { PyObject_HEAD ! unsigned char data[_PyDateTime_DATA_SIZE]; ! } PyDateTime_Object; ! #define PyDateTime_GET_YEAR(o) (((PyDateTime_Object*)o)->data[0] << 8 \ ! | ((PyDateTime_Object*)o)->data[1]) ! #define PyDateTime_GET_MONTH(o) (((PyDateTime_Object*)o)->data[2]) ! #define PyDateTime_GET_DAY(o) (((PyDateTime_Object*)o)->data[3]) ! #define PyDateTime_GET_HOUR(o) (((PyDateTime_Object*)o)->data[4]) ! #define PyDateTime_GET_MINUTE(o) (((PyDateTime_Object*)o)->data[5]) ! #define PyDateTime_GET_SECOND(o) (((PyDateTime_Object*)o)->data[6]) ! #define PyDateTime_GET_MICROSECOND(o) (((PyDateTime_Object*)o)->data[7] << 16 \ ! | ((PyDateTime_Object*)o)->data[8] << 8\ ! | ((PyDateTime_Object*)o)->data[9]) #endif --- 5,42 ---- #define DATETIME_H ! #define _PyDateTime_DATE_DATA_SIZE 4 ! #define _PyDateTime_DATETIME_DATA_SIZE 10 typedef struct { PyObject_HEAD ! long hashcode; ! unsigned char data[_PyDateTime_DATE_DATA_SIZE]; ! } PyDateTime_Date; + typedef struct + { + PyObject_HEAD + long hashcode; + unsigned char data[_PyDateTime_DATETIME_DATA_SIZE]; + } PyDateTime_DateTime; ! PyAPI_DATA(PyTypeObject) PyDateTime_DateType; ! PyAPI_DATA(PyTypeObject) PyDateTime_DateTimeType; ! PyAPI_DATA(PyTypeObject) PyDateTime_DeltaType; ! ! /* Apply for date instances. */ ! #define PyDateTime_GET_YEAR(o) (((PyDateTime_Date*)o)->data[0] << 8 \ ! | ((PyDateTime_Date*)o)->data[1]) ! #define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) ! #define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) ! ! /* Apply for datetime instances. */ ! #define PyDateTime_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) ! #define PyDateTime_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) ! #define PyDateTime_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) ! #define PyDateTime_GET_MICROSECOND(o) (((PyDateTime_DateTime*)o)->data[7] << 16 \ ! | ((PyDateTime_DateTime*)o)->data[8] << 8\ ! | ((PyDateTime_DateTime*)o)->data[9]) #endif Index: setup.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 4 Mar 2002 14:36:16 -0000 1.1 --- setup.py 20 Aug 2002 18:53:07 -0000 1.2 *************** *** 1,4 **** from distutils.core import setup, Extension setup(name="datetime", version = "0.1", ! ext_modules=[Extension("_datetime", ["datetime.c"])]) --- 1,13 ---- + #! /usr/bin/env python + # + # For now, the individual object implementations are split out into + # separate files (obj_*.c), with helper functions and module + # initialization in datetime.c. This will be changed to simply be a + # single file when things have settled down. + from distutils.core import setup, Extension setup(name="datetime", version = "0.1", ! ext_modules=[Extension("_datetime", ["datetime.c"], ! depends=["obj_date.c", "obj_datetime.c", ! "obj_delta.c"])]) Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_cdatetime.py 26 Mar 2002 22:22:50 -0000 1.4 --- test_cdatetime.py 20 Aug 2002 18:53:07 -0000 1.5 *************** *** 8,11 **** --- 8,218 ---- from _datetime import datetime, MINYEAR, MAXYEAR + from _datetime import date, timedelta + + + class TestDate(unittest.TestCase): + + theclass = date + + def test_basic_attributes(self): + dt = self.theclass(2002, 3, 1) + self.assertEqual(dt.year, 2002) + self.assertEqual(dt.month, 3) + self.assertEqual(dt.day, 1) + + def test_roundtrip(self): + for dt in (self.theclass(1, 2, 3), + self.theclass.today()): + # Verify dt -> string -> date identity. + s = repr(dt) + dt2 = eval(s) + self.assertEqual(dt, dt2) + + # Verify identity via reconstructing from pieces. + dt2 = self.theclass(dt.year, dt.month, dt.day) + self.assertEqual(dt, dt2) + + def test_bad_constructor_arguments(self): + # bad years + self.theclass(MINYEAR, 1, 1) # no exception + self.theclass(MAXYEAR, 1, 1) # no exception + self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) + self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) + # bad months + self.theclass(2000, 1, 1) # no exception + self.theclass(2000, 12, 1) # no exception + self.assertRaises(ValueError, self.theclass, 2000, 0, 1) + self.assertRaises(ValueError, self.theclass, 2000, 13, 1) + # bad days + self.theclass(2000, 2, 29) # no exception + self.theclass(2004, 2, 29) # no exception + self.theclass(2400, 2, 29) # no exception + self.assertRaises(ValueError, self.theclass, 2000, 2, 30) + self.assertRaises(ValueError, self.theclass, 2001, 2, 29) + self.assertRaises(ValueError, self.theclass, 2100, 2, 29) + self.assertRaises(ValueError, self.theclass, 1900, 2, 29) + self.assertRaises(ValueError, self.theclass, 2000, 1, 0) + self.assertRaises(ValueError, self.theclass, 2000, 1, 32) + + def test_hash_equality(self): + d = self.theclass(2000, 12, 31) + # same thing + e = self.theclass(2000, 12, 31) + self.assertEqual(d, e) + self.assertEqual(hash(d), hash(e)) + + dic = {d: 1} + dic[e] = 2 + self.assertEqual(len(dic), 1) + self.assertEqual(dic[d], 2) + self.assertEqual(dic[e], 2) + + d = self.theclass(2001, 1, 1) + # same thing + e = self.theclass(2001, 1, 1) + self.assertEqual(d, e) + self.assertEqual(hash(d), hash(e)) + + dic = {d: 1} + dic[e] = 2 + self.assertEqual(len(dic), 1) + self.assertEqual(dic[d], 2) + self.assertEqual(dic[e], 2) + + def test_computations(self): + a = self.theclass(2002, 1, 31) + b = self.theclass(1956, 1, 31) + ## print >>sys.__stderr__, a, b + ## diff = a-b + ## self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) + ## self.assertEqual(diff.seconds, 0) + ## self.assertEqual(diff.microseconds, 0) + day = timedelta(1) + week = timedelta(7) + a = self.theclass(2002, 3, 2) + self.assertEqual(a + day, self.theclass(2002, 3, 3)) + self.assertEqual(a - day, self.theclass(2002, 3, 1)) + self.assertEqual(a + week, self.theclass(2002, 3, 9)) + self.assertEqual(a - week, self.theclass(2002, 2, 23)) + self.assertEqual(a + 52*week, self.theclass(2003, 3, 1)) + self.assertEqual(a - 52*week, self.theclass(2001, 3, 3)) + self.assertEqual((a + week) - a, week) + self.assertEqual((a + day) - a, day) + self.assertEqual((a - week) - a, -week) + self.assertEqual((a - day) - a, -day) + self.assertEqual(a - (a + week), -week) + self.assertEqual(a - (a + day), -day) + self.assertEqual(a - (a - week), week) + self.assertEqual(a - (a - day), day) + # Add/sub ints, longs, floats should be illegal + for i in 1, 1L, 1.0: + self.assertRaises(TypeError, lambda: a+i) + self.assertRaises(TypeError, lambda: a-i) + self.assertRaises(TypeError, lambda: i+a) + self.assertRaises(TypeError, lambda: i-a) + + def test_overflow(self): + tiny = self.theclass.resolution + + dt = self.theclass.min + tiny + dt -= tiny # no problem + self.assertRaises(OverflowError, dt.__sub__, tiny) + self.assertRaises(OverflowError, dt.__add__, -tiny) + + dt = self.theclass.max - tiny + dt += tiny # no problem + ## self.assertRaises(OverflowError, dt.__add__, tiny) + ## self.assertRaises(OverflowError, dt.__sub__, -tiny) + + def test_weekday(self): + for i in range(7): + # March 4, 2002 is a Monday + self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i) + self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1) + # January 2, 1956 is a Monday + self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i) + self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) + + def test_isocalendar(self): + # Check examples from + # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm + for i in range(7): + d = self.theclass(2003, 12, 22+i) + self.assertEqual(d.isocalendar(), (2003, 52, i+1)) + d = self.theclass(2003, 12, 29) + timedelta(i) + self.assertEqual(d.isocalendar(), (2004, 1, i+1)) + d = self.theclass(2004, 1, 5+i) + self.assertEqual(d.isocalendar(), (2004, 2, i+1)) + d = self.theclass(2009, 12, 21+i) + self.assertEqual(d.isocalendar(), (2009, 52, i+1)) + d = self.theclass(2009, 12, 28) + timedelta(i) + ## print >>sys.__stderr__, i, `d`, d.isocalendar() + ## self.assertEqual(d.isocalendar(), (2009, 53, i+1)) + d = self.theclass(2010, 1, 4+i) + self.assertEqual(d.isocalendar(), (2010, 1, i+1)) + + def test_iso_long_years(self): + # Calculate long ISO years and compare to table from + # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm + ISO_LONG_YEARS_TABLE = """ + 4 32 60 88 + 9 37 65 93 + 15 43 71 99 + 20 48 76 + 26 54 82 + + 105 133 161 189 + 111 139 167 195 + 116 144 172 + 122 150 178 + 128 156 184 + + 201 229 257 285 + 207 235 263 291 + 212 240 268 296 + 218 246 274 + 224 252 280 + + 303 331 359 387 + 308 336 364 392 + 314 342 370 398 + 320 348 376 + 325 353 381 + """ + iso_long_years = map(int, ISO_LONG_YEARS_TABLE.split()) + iso_long_years.sort() + L = [] + for i in range(400): + d = self.theclass(2000+i, 12, 31) + d1 = self.theclass(1600+i, 12, 31) + self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:]) + if d.isocalendar()[1] == 53: + L.append(i) + self.assertEqual(L, iso_long_years) + + def test_isoformat(self): + t = self.theclass(2, 3, 2) + self.assertEqual(t.isoformat(), "0002-03-02") + + def test_ctime(self): + t = self.theclass(2002, 3, 2) + self.assertEqual(t.ctime(), "Sat Mar 2 00:00:00 2002") + + def test_resolution_info(self): + self.assert_(isinstance(self.theclass.min, self.theclass)) + self.assert_(isinstance(self.theclass.max, self.theclass)) + self.assert_(isinstance(self.theclass.resolution, timedelta)) + self.assert_(self.theclass.max > self.theclass.min) + + def test_extreme_timedelta(self): + big = self.theclass.max - self.theclass.min + # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds + n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds + # n = 315537897599999999 ~= 2**58.13 + ## justasbig = timedelta(0, 0, n) + ## self.assertEqual(big, justasbig) + self.assertEqual(self.theclass.min + big, self.theclass.max) + self.assertEqual(self.theclass.max - big, self.theclass.min) + class TestDateTime(unittest.TestCase): *************** *** 55,65 **** d = self.theclass(2003, 12, 22+i) self.assertEqual(d.isocalendar(), (2003, 52, i+1)) ! ## d = self.theclass(2003, 12, 29) + timedelta(i) ! ## self.assertEqual(d.isocalendar(), (2004, 1, i+1)) d = self.theclass(2004, 1, 5+i) self.assertEqual(d.isocalendar(), (2004, 2, i+1)) d = self.theclass(2009, 12, 21+i) self.assertEqual(d.isocalendar(), (2009, 52, i+1)) ! ## d = self.theclass(2009, 12, 28) + timedelta(i) ## self.assertEqual(d.isocalendar(), (2009, 53, i+1)) d = self.theclass(2010, 1, 4+i) --- 262,272 ---- d = self.theclass(2003, 12, 22+i) self.assertEqual(d.isocalendar(), (2003, 52, i+1)) ! d = self.theclass(2003, 12, 29) + timedelta(i) ! self.assertEqual(d.isocalendar(), (2004, 1, i+1)) d = self.theclass(2004, 1, 5+i) self.assertEqual(d.isocalendar(), (2004, 2, i+1)) d = self.theclass(2009, 12, 21+i) self.assertEqual(d.isocalendar(), (2009, 52, i+1)) ! d = self.theclass(2009, 12, 28) + timedelta(i) ## self.assertEqual(d.isocalendar(), (2009, 53, i+1)) d = self.theclass(2010, 1, 4+i) *************** *** 120,127 **** self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) def test_suite(): ! s1 = unittest.makeSuite(TestDateTime, 'test') ! return unittest.TestSuite([s1]) def test_main(): --- 327,339 ---- self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) + def test_ctime(self): + t = self.theclass(2002, 3, 2, 18, 3, 5, 123) + self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") + def test_suite(): ! s1 = unittest.makeSuite(TestDate, 'test') ! s2 = unittest.makeSuite(TestDateTime, 'test') ! return unittest.TestSuite([s1, s2]) def test_main(): From tim_one@users.sourceforge.net Tue Aug 20 20:00:26 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 20 Aug 2002 12:00:26 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.141,1.142 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12415/python/Objects Modified Files: longobject.c Log Message: long_format(), long_lshift(): Someone on c.l.py is trying to boost SHIFT and MASK, and widen digit. One problem is that code of the form digit << small_integer implicitly assumes that the result fits in an int or unsigned int (platform-dependent, but "int sized" in any case), since digit is promoted "just" to int or unsigned via the usual integer promotions. But if digit is typedef'ed as unsigned int, this loses information. The cure for this is just to cast digit to twodigits first. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** longobject.c 15 Aug 2002 20:10:45 -0000 1.141 --- longobject.c 20 Aug 2002 19:00:22 -0000 1.142 *************** *** 950,954 **** for (i = 0; i < size_a; ++i) { ! accum |= a->ob_digit[i] << accumbits; accumbits += SHIFT; assert(accumbits >= basebits); --- 950,954 ---- for (i = 0; i < size_a; ++i) { ! accum |= (twodigits)a->ob_digit[i] << accumbits; accumbits += SHIFT; assert(accumbits >= basebits); *************** *** 2346,2350 **** accum = 0; for (i = wordshift, j = 0; j < oldsize; i++, j++) { ! accum |= a->ob_digit[j] << remshift; z->ob_digit[i] = (digit)(accum & MASK); accum >>= SHIFT; --- 2346,2350 ---- accum = 0; for (i = wordshift, j = 0; j < oldsize; i++, j++) { ! accum |= (twodigits)a->ob_digit[j] << remshift; z->ob_digit[i] = (digit)(accum & MASK); accum >>= SHIFT; From fdrake@users.sourceforge.net Tue Aug 20 20:02:44 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 Aug 2002 12:02:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/datetime Makefile,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory usw-pr-cvs1:/tmp/cvs-serv14667 Modified Files: Makefile Log Message: Don't expect others to share my paths. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 20 Aug 2002 18:53:07 -0000 1.5 --- Makefile 20 Aug 2002 19:02:40 -0000 1.6 *************** *** 1,4 **** ! #PYTHON=python2.3 ! PYTHON=../../../trunk/debug/python default: check --- 1,4 ---- ! PYTHON=python2.3 ! #PYTHON=../../../trunk/debug/python default: check From bwarsaw@users.sourceforge.net Tue Aug 20 20:08:48 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 12:08:48 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes cleanarch,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv16802 Added Files: cleanarch Log Message: An archive cleaner, adapted from the Mailman 2.1b3 version, but de-Mailman-ified. --- NEW FILE: cleanarch --- #! /usr/bin/env python # Copyright (C) 2001,2002 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """Clean up an .mbox archive file. The archiver looks for Unix-From lines separating messages in an mbox archive file. For compatibility, it specifically looks for lines that start with "From " -- i.e. the letters capital-F, lowercase-r, o, m, space, ignoring everything else on the line. Normally, any lines that start "From " in the body of a message should be escaped such that a > character is actually the first on a line. It is possible though that body lines are not actually escaped. This script attempts to fix these by doing a stricter test of the Unix-From lines. Any lines that start "From " but do not pass this stricter test are escaped with a > character. Usage: cleanarch [options] < inputfile > outputfile Options: -s n --status=n Print a # character every n lines processed -q / --quiet Don't print changed line information to standard error. -n / --dry-run Don't actually output anything. -h / --help Print this message and exit """ import sys import re import getopt import mailbox cre = re.compile(mailbox.UnixMailbox._fromlinepattern) # From RFC 2822, a header field name must contain only characters from 33-126 # inclusive, excluding colon. I.e. from oct 41 to oct 176 less oct 072. Must # use re.match() so that it's anchored at the beginning of the line. fre = re.compile(r'[\041-\071\073-\0176]+') def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def escape_line(line, lineno, quiet, output): if output: sys.stdout.write('>' + line) if not quiet: print >> sys.stderr, '[%d]' % lineno, line[:-1] def main(): try: opts, args = getopt.getopt( sys.argv[1:], 'hqns:', ['help', 'quiet', 'dry-run', 'status=']) except getopt.error, msg: usage(1, msg) quiet = 0 output = 1 status = -1 for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-q', '--quiet'): quiet = 1 elif opt in ('-n', '--dry-run'): output = 0 elif opt in ('-s', '--status'): try: status = int(arg) except ValueError: usage(1, 'Bad status number: %s' % arg) if args: usage(1) lineno = 0 statuscnt = 0 messages = 0 while 1: lineno += 1 line = sys.stdin.readline() if not line: break if line.startswith('From '): if cre.match(line): # This is a real Unix-From line. But it could be a message # /about/ Unix-From lines, so as a second order test, make # sure there's at least one RFC 2822 header following nextline = sys.stdin.readline() lineno += 1 if not nextline: # It was the last line of the mbox, so it couldn't have # been a Unix-From escape_line(line, lineno, quiet, output) break fieldname = nextline.split(':', 1) if len(fieldname) < 2 or not fre.match(nextline): # The following line was not a header, so this wasn't a # valid Unix-From escape_line(line, lineno, quiet, output) if output: sys.stdout.write(nextline) else: # It's a valid Unix-From line messages += 1 if output: sys.stdout.write(line) sys.stdout.write(nextline) else: # This is a bogus Unix-From line escape_line(line, lineno, quiet, output) elif output: # Any old line sys.stdout.write(line) if status > 0 and (lineno % status) == 0: sys.stderr.write('#') statuscnt += 1 if statuscnt > 50: print >> sys.stderr statuscnt = 0 # We've found `messages' separators, so the number of messages is +1 messages += 1 print >> sys.stderr, messages, 'messages found' if __name__ == '__main__': main() From gvanrossum@users.sourceforge.net Tue Aug 20 20:55:08 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 12:55:08 -0700 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32141 Modified Files: CGIHTTPServer.py Log Message: SF patch 595846 by Brett Cannon: Update environ for CGIHTTPServer.py This patch causes CGIHTTPServer to update os.environ regardless of how it tries to handle calls (fork, popen*, etc.). Backport bugfix candidate. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** CGIHTTPServer.py 1 Aug 2002 21:12:35 -0000 1.26 --- CGIHTTPServer.py 20 Aug 2002 19:55:06 -0000 1.27 *************** *** 183,186 **** --- 183,187 ---- 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") + so.environ.update(env) self.send_response(200, "Script output follows") *************** *** 222,226 **** else: popenx = os.popen2 - os.environ.update(env) cmdline = scriptfile if self.is_python(scriptfile): --- 223,226 ---- *************** *** 260,264 **** else: # Other O.S. -- execute script in this process - os.environ.update(env) save_argv = sys.argv save_stdin = sys.stdin --- 260,263 ---- From fdrake@acm.org Tue Aug 20 21:02:17 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 20 Aug 2002 16:02:17 -0400 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.26,1.27 In-Reply-To: References: Message-ID: <15714.41033.723435.444585@grendel.zope.com> gvanrossum@users.sourceforge.net writes: > Modified Files: > CGIHTTPServer.py > Log Message: > SF patch 595846 by Brett Cannon: Update environ for CGIHTTPServer.py > > This patch causes CGIHTTPServer to update os.environ regardless of how > it tries to handle calls (fork, popen*, etc.). ... > *************** > *** 183,186 **** > --- 183,187 ---- > 'HTTP_USER_AGENT', 'HTTP_COOKIE'): > env.setdefault(k, "") > + so.environ.update(env) Appearantly we need a test for this still. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From gvanrossum@users.sourceforge.net Tue Aug 20 21:05:27 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 13:05:27 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3542 Modified Files: sets.py Log Message: Add a note reminding the reader that sets are not sequences. I received feedback that was based in the misunderstanding that sets were sequences. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sets.py 19 Aug 2002 16:29:58 -0000 1.2 --- sets.py 20 Aug 2002 20:05:23 -0000 1.3 *************** *** 5,8 **** --- 5,18 ---- are provided as both methods and operators. + Important: sets are not sequences! While they support 'x in s', + 'len(s)', and 'for x in s', none of those operations are unique for + sequences; for example, mappings support all three as well. The + characteristic operation for sequences is subscripting with small + integers: s[i], for i in range(len(s)). Sets don't support + subscripting at all. Also, sequences allow multiple occurrences and + their elements have a definite order; sets on the other hand don't + record multiple occurrences and don't remember the order of element + insertion (which is why they don't support s[i]). + The following classes are provided: From gvanrossum@users.sourceforge.net Tue Aug 20 21:07:13 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 13:07:13 -0700 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4036 Modified Files: CGIHTTPServer.py Log Message: Typo repair. Please include in any backports. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** CGIHTTPServer.py 20 Aug 2002 19:55:06 -0000 1.27 --- CGIHTTPServer.py 20 Aug 2002 20:07:10 -0000 1.28 *************** *** 183,187 **** 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") ! so.environ.update(env) self.send_response(200, "Script output follows") --- 183,187 ---- 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") ! os.environ.update(env) self.send_response(200, "Script output follows") From gvanrossum@users.sourceforge.net Tue Aug 20 21:27:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 13:27:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.18,1.19 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10777 Modified Files: pep-0283.txt Log Message: Add open issues suggested by effbot. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pep-0283.txt 20 Aug 2002 13:56:21 -0000 1.18 --- pep-0283.txt 20 Aug 2002 20:27:14 -0000 1.19 *************** *** 33,36 **** --- 33,57 ---- + Open issues + + There are some issues that may need more work and/or thought + before the final release (and preferably before the first beta + release). For example: + + - Set API issues; is the sets module perfect? + + - A nicer API to open text files, replacing the ugly (in some + people's eyes) "U" mode flag. There's a proposal out there to + have a new built-in type textfile(filename, mode, encoding). + (Shouldn't it have a bufsize argument too?) + + - Fredrik Lundh's basetime proposal: + http://effbot.org/ideas/time-type.htm + + - New widgets for Tkinter??? + + - Tk 8.4 update. + + Completed features for 2.3 From tim_one@users.sourceforge.net Tue Aug 20 21:43:01 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 20 Aug 2002 13:43:01 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv13113 Modified Files: GBayes.py Log Message: Added a bunch of simple tokenizers. The originals are renamed to tokenize_words_foldcase and tokenize_5gram_foldcase_wscollapse. New ones are tokenize_words, tokenize_split_foldcase, tokenize_split, tokenize_5gram, tokenize_10gram, and tokenize_15gram. I don't expect any of these to be the last word. When Barry has the test corpus set up it should be easy to let the data tell us which "pure" strategy works best. Straight character n-grams are very appealing because they're the simplest and most language-neutral; I didn't have any luck with them over the weekend, but the size of my training data was trivial. Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GBayes.py 20 Aug 2002 18:44:30 -0000 1.7 --- GBayes.py 20 Aug 2002 20:42:59 -0000 1.8 *************** *** 310,323 **** del re ! def tokenize(string): return _token_re.findall(string.lower()) # Do an N-gram generator instead. Fold case and collapse runs of whitespace. # Probably a good idea to fold punctuation characters into one (or just a # few) representatives too. ! def xtokenize(string, N=5): normalized = " ".join(string.lower().split()) for i in xrange(len(normalized)-N+1): yield normalized[i : i+N] spam1 = """ --- 310,347 ---- del re ! def tokenize_words_foldcase(string): return _token_re.findall(string.lower()) + def tokenize_words(string): + return _token_re.findall(string) + + def tokenize_split_foldcase(string): + return string.lower().split() + + def tokenize_split(string): + return string.split() + # Do an N-gram generator instead. Fold case and collapse runs of whitespace. # Probably a good idea to fold punctuation characters into one (or just a # few) representatives too. ! def tokenize_5gram_foldcase_wscollapse(string, N=5): normalized = " ".join(string.lower().split()) for i in xrange(len(normalized)-N+1): yield normalized[i : i+N] + + def tokenize_ngram(string, N): + for i in xrange(len(string)-N+1): + yield string[i : i+N] + + def tokenize_5gram(string): + return tokenize_ngram(string, 5) + + def tokenize_10gram(string): + return tokenize_ngram(string, 10) + + def tokenize_15gram(string): + return tokenize_ngram(string, 15) + + tokenize = tokenize_words_foldcase spam1 = """ From bwarsaw@users.sourceforge.net Tue Aug 20 22:18:32 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 14:18:32 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes split.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv28692 Added Files: split.py Log Message: A simple mailbox splitter --- NEW FILE: split.py --- #! /usr/bin/env python """Split an mbox into two files based on a given percentage. This script will troll through a Unix mbox file randomly assigning each message to one of two bins. The split is based on a given float percentage. E.g. % split.py -1 mbox20 -2 mbox80 20 sourcembox yields two mbox files, where mbox20 contains approximately 20% of the messages and mbox80 contains 80% of the messages. Messages are assigned to each bin randomly. Usage: %(programs)s -1 file -2 file [options] percent sourcembox Options: -h / --help Print this help message and exit -1 file Names the first output file. Approximately percent % of the messages from the original source file will end up in this collection. -2 file Names the second output file. Approximately 100-percent % of the messages from the original source file will end up in this collection. percent is a floating point number between 1 and 99. sourcembox is a Unix mailbox file. All arguments except -h/--help are required. """ import sys import random import mailbox import email import getopt program = sys.argv[0] def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def _factory(fp): try: return email.message_from_file(fp) except email.Errors.MessageParseError: return None def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'h1:2:', ['help']) except getopt.error, msg: usage(1, msg) bin1 = bin2 = percentage = mboxfile = None for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt == '-1': bin1 = arg elif opt == '-2': bin2 = arg if bin1 is None or bin2 is None: usage(1, 'Both options -1 and -2 are required') try: percent = float(args[0]) if not (0 < percent < 100): raise ValueError percent /= 100.0 mboxfile = args[1] except IndexError: usage(1, 'Not enough arguments') except ValueError: usage(1, 'Percent argument must be a float between 1.0 and 99.0') # Cruise bin1out = open(bin1, 'w') bin2out = open(bin2, 'w') infp = open(mboxfile) mbox = mailbox.PortableUnixMailbox(infp, _factory) for msg in mbox: if random.random() < percent: outfp = bin1out else: outfp = bin2out print >> outfp, msg outfp.close() bin1out.close() bin2out.close() if __name__ == '__main__': main() From bwarsaw@users.sourceforge.net Tue Aug 20 22:37:05 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 14:37:05 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes split.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv2069 Modified Files: split.py Log Message: Get rid of the -1 and -2 arguments and make them positional. Index: split.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/split.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** split.py 20 Aug 2002 21:18:29 -0000 1.1 --- split.py 20 Aug 2002 21:37:01 -0000 1.2 *************** *** 7,11 **** E.g. ! % split.py -1 mbox20 -2 mbox80 20 sourcembox yields two mbox files, where mbox20 contains approximately 20% of the messages --- 7,11 ---- E.g. ! % split.py mbox20 mbox80 20 sourcembox yields two mbox files, where mbox20 contains approximately 20% of the messages *************** *** 13,28 **** randomly. ! Usage: %(programs)s -1 file -2 file [options] percent sourcembox Options: -h / --help Print this help message and exit ! -1 file ! Names the first output file. Approximately percent % of the messages ! from the original source file will end up in this collection. ! -2 file ! Names the second output file. Approximately 100-percent % of the ! messages from the original source file will end up in this ! collection. percent is a floating point number between 1 and 99. sourcembox is a Unix --- 13,24 ---- randomly. ! Usage: %(programs)s [options] file1 file2 percent sourcembox Options: -h / --help Print this help message and exit ! ! file1 and file2 are where the output goes. Approximately percent % of ! messages will go to file1 and (100 - percent) % of messages will go to file2. percent is a floating point number between 1 and 99. sourcembox is a Unix *************** *** 58,62 **** def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'h1:2:', ['help']) except getopt.error, msg: usage(1, msg) --- 54,58 ---- def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'h', ['help']) except getopt.error, msg: usage(1, msg) *************** *** 66,83 **** if opt in ('-h', '--help'): usage(0) - elif opt == '-1': - bin1 = arg - elif opt == '-2': - bin2 = arg - - if bin1 is None or bin2 is None: - usage(1, 'Both options -1 and -2 are required') try: ! percent = float(args[0]) if not (0 < percent < 100): raise ValueError percent /= 100.0 ! mboxfile = args[1] except IndexError: usage(1, 'Not enough arguments') --- 62,74 ---- if opt in ('-h', '--help'): usage(0) try: ! bin1 = args[0] ! bin2 = args[1] ! percent = float(args[2]) if not (0 < percent < 100): raise ValueError percent /= 100.0 ! mboxfile = args[3] except IndexError: usage(1, 'Not enough arguments') From gvanrossum@users.sourceforge.net Tue Aug 20 22:38:39 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 14:38:39 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2530 Modified Files: sets.py Log Message: Move __init__ from BaseSet into Set and ImmutableSet. This causes a tiny amount of code duplication, but makes it possible to give BaseSet an __init__ that raises an exception. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sets.py 20 Aug 2002 20:05:23 -0000 1.3 --- sets.py 20 Aug 2002 21:38:37 -0000 1.4 *************** *** 64,81 **** # Constructor ! def __init__(self, seq=None): ! """Construct a set, optionally initializing it from a sequence.""" ! self._data = {} ! if seq is not None: ! # I don't know a faster way to do this in pure Python. ! # Custom code written in C only did it 65% faster, ! # preallocating the dict to len(seq); without ! # preallocation it was only 25% faster. So the speed of ! # this Python code is respectable. Just copying True into ! # a local variable is responsible for a 7-8% speedup. ! data = self._data ! value = True ! for key in seq: ! data[key] = value # Standard protocols: __len__, __repr__, __str__, __iter__ --- 64,73 ---- # Constructor ! def __init__(self): ! """This is an abstract class.""" ! # Don't call this from a concrete subclass! ! if self.__class__ is BaseSet: ! raise NotImplementedError, ("BaseSet is an abstract class. " ! "Use Set or ImmutableSet.") # Standard protocols: __len__, __repr__, __str__, __iter__ *************** *** 290,296 **** def __init__(self, seq): """Construct an immutable set from a sequence.""" - # Override the constructor to make 'seq' a required argument - BaseSet.__init__(self, seq) self._hashcode = None def __hash__(self): --- 282,298 ---- def __init__(self, seq): """Construct an immutable set from a sequence.""" self._hashcode = None + self._data = data = {} + # I don't know a faster way to do this in pure Python. + # Custom code written in C only did it 65% faster, + # preallocating the dict to len(seq); without + # preallocation it was only 25% faster. So the speed of + # this Python code is respectable. Just copying True into + # a local variable is responsible for a 7-8% speedup. + value = True + # XXX Should this perhaps look for _as_immutable? + # XXX If so, should use self.update(seq). + for key in seq: + data[key] = value def __hash__(self): *************** *** 306,309 **** --- 308,321 ---- # BaseSet + operations requiring mutability; no hashing + + def __init__(self, seq=None): + """Construct an immutable set from a sequence.""" + self._data = data = {} + if seq is not None: + value = True + # XXX Should this perhaps look for _as_immutable? + # XXX If so, should use self.update(seq). + for key in seq: + data[key] = value # In-place union, intersection, differences From gvanrossum@users.sourceforge.net Tue Aug 20 22:52:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 14:52:01 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7149 Modified Files: sets.py Log Message: Rename popitem() to pop(). (An idea from SF patch 597444.) Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sets.py 20 Aug 2002 21:38:37 -0000 1.4 --- sets.py 20 Aug 2002 21:51:58 -0000 1.5 *************** *** 421,425 **** pass ! def popitem(self): """Remove and return a randomly-chosen set element.""" return self._data.popitem()[0] --- 421,425 ---- pass ! def pop(self): """Remove and return a randomly-chosen set element.""" return self._data.popitem()[0] From gvanrossum@users.sourceforge.net Tue Aug 20 22:52:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 14:52:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7149/test Modified Files: test_sets.py Log Message: Rename popitem() to pop(). (An idea from SF patch 597444.) Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sets.py 19 Aug 2002 16:19:15 -0000 1.1 --- test_sets.py 20 Aug 2002 21:51:59 -0000 1.2 *************** *** 293,300 **** assert len(self.set) == 0, "Clearing set" ! def test_popitem(self): popped = {} while self.set: ! popped[self.set.popitem()] = None assert len(popped) == len(self.values), "Popping items" for v in self.values: --- 293,300 ---- assert len(self.set) == 0, "Clearing set" ! def test_pop(self): popped = {} while self.set: ! popped[self.set.pop()] = None assert len(popped) == len(self.values), "Popping items" for v in self.values: From bwarsaw@users.sourceforge.net Tue Aug 20 23:07:19 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 Aug 2002 15:07:19 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes split.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv12552 Modified Files: split.py Log Message: Guido suggests a different order for the positional args. Index: split.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/split.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** split.py 20 Aug 2002 21:37:01 -0000 1.2 --- split.py 20 Aug 2002 22:07:17 -0000 1.3 *************** *** 7,11 **** E.g. ! % split.py mbox20 mbox80 20 sourcembox yields two mbox files, where mbox20 contains approximately 20% of the messages --- 7,11 ---- E.g. ! % split.py sourcembox 20 mbox20 mbox80 yields two mbox files, where mbox20 contains approximately 20% of the messages *************** *** 13,17 **** randomly. ! Usage: %(programs)s [options] file1 file2 percent sourcembox Options: --- 13,17 ---- randomly. ! Usage: %(programs)s [options] sourcembox percent file1 file2 Options: *************** *** 64,74 **** try: ! bin1 = args[0] ! bin2 = args[1] ! percent = float(args[2]) if not (0 < percent < 100): raise ValueError percent /= 100.0 ! mboxfile = args[3] except IndexError: usage(1, 'Not enough arguments') --- 64,74 ---- try: ! mboxfile = args[0] ! percent = float(args[1]) if not (0 < percent < 100): raise ValueError percent /= 100.0 ! bin1 = args[2] ! bin2 = args[3] except IndexError: usage(1, 'Not enough arguments') From rhettinger@users.sourceforge.net Wed Aug 21 00:34:03 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 16:34:03 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5368 Modified Files: sets.py Log Message: Minor typo Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sets.py 20 Aug 2002 21:51:58 -0000 1.5 --- sets.py 20 Aug 2002 23:34:01 -0000 1.6 *************** *** 33,37 **** Only hashable objects can be added to a Set. In particular, you cannot really add a Set as an element to another Set; if you try, what is ! actuallly added is an ImmutableSet built from it (it compares equal to the one you tried adding). --- 33,37 ---- Only hashable objects can be added to a Set. In particular, you cannot really add a Set as an element to another Set; if you try, what is ! actually added is an ImmutableSet built from it (it compares equal to the one you tried adding). From rhettinger@users.sourceforge.net Wed Aug 21 00:59:35 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 16:59:35 -0700 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.20.8.2,1.20.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12168 Modified Files: Tag: release22-maint CGIHTTPServer.py Log Message: SF 595846. Backport deltas from 1.26 to 1.28. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.20.8.2 retrieving revision 1.20.8.3 diff -C2 -d -r1.20.8.2 -r1.20.8.3 *** CGIHTTPServer.py 1 Aug 2002 21:14:33 -0000 1.20.8.2 --- CGIHTTPServer.py 20 Aug 2002 23:59:33 -0000 1.20.8.3 *************** *** 183,186 **** --- 183,187 ---- 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "") + os.environ.update(env) self.send_response(200, "Script output follows") *************** *** 222,226 **** else: popenx = os.popen2 - os.environ.update(env) cmdline = scriptfile if self.is_python(scriptfile): --- 223,226 ---- *************** *** 260,264 **** else: # Other O.S. -- execute script in this process - os.environ.update(env) save_argv = sys.argv save_stdin = sys.stdin --- 260,263 ---- From rhettinger@users.sourceforge.net Wed Aug 21 02:35:31 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 18:35:31 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4509 Modified Files: sets.py Log Message: Optimize try/except ordering in sets.py. Gains a 5:1 speed-up for membership testing by handling the most common case first (the case where the element is hashable). Closes SF Patch 597444. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sets.py 20 Aug 2002 23:34:01 -0000 1.6 --- sets.py 21 Aug 2002 01:35:29 -0000 1.7 *************** *** 228,237 **** """ try: ! transform = element._as_temporarily_immutable ! except AttributeError: ! pass ! else: ! element = transform() ! return element in self._data # Subset and superset test --- 228,237 ---- """ try: ! return element in self._data ! except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! return transform() in self._data # Subset and superset test *************** *** 370,381 **** data = self._data value = True ! for elt in iterable: try: ! transform = elt._as_immutable ! except AttributeError: ! pass ! else: ! elt = transform() ! data[elt] = value def clear(self): --- 370,381 ---- data = self._data value = True ! for element in iterable: try: ! data[element] = value ! except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! data[transform()] = value def clear(self): *************** *** 391,400 **** """ try: ! transform = element._as_immutable ! except AttributeError: ! pass ! else: ! element = transform() ! self._data[element] = True def remove(self, element): --- 391,400 ---- """ try: ! self._data[element] = True ! except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! self._data[transform()] = True def remove(self, element): *************** *** 404,413 **** """ try: ! transform = element._as_temporarily_immutable ! except AttributeError: ! pass ! else: ! element = transform() ! del self._data[element] def discard(self, element): --- 404,413 ---- """ try: ! del self._data[element] ! except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! del self._data[transform()] def discard(self, element): From rhettinger@users.sourceforge.net Wed Aug 21 03:22:10 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 19:22:10 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15434 Modified Files: sets.py Log Message: Fast size check for sub/super set tests Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sets.py 21 Aug 2002 01:35:29 -0000 1.7 --- sets.py 21 Aug 2002 02:22:08 -0000 1.8 *************** *** 240,243 **** --- 240,245 ---- """Report whether another set contains this set.""" self._binary_sanity_check(other) + if len(self) > len(other): # Fast check for obvious cases + return False for elt in self: if elt not in other: *************** *** 248,251 **** --- 250,255 ---- """Report whether this set contains another set.""" self._binary_sanity_check(other) + if len(self) < len(other): # Fast check for obvious cases + return False for elt in other: if elt not in self: From gvanrossum@users.sourceforge.net Wed Aug 21 03:44:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 19:44:07 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20120 Modified Files: sets.py Log Message: Add Raymond H to the list of authors; add some XXX comments about possible API improvements. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sets.py 21 Aug 2002 02:22:08 -0000 1.8 --- sets.py 21 Aug 2002 02:44:04 -0000 1.9 *************** *** 52,55 **** --- 52,58 ---- # - Guido van Rossum rewrote much of the code, made some API changes, # and cleaned up the docstrings. + # + # - Raymond Hettinger implemented a number of speedups and other + # improvements. *************** *** 68,71 **** --- 71,75 ---- # Don't call this from a concrete subclass! if self.__class__ is BaseSet: + # XXX Maybe raise TypeError instead, like basestring()? raise NotImplementedError, ("BaseSet is an abstract class. " "Use Set or ImmutableSet.") *************** *** 286,289 **** --- 290,295 ---- def __init__(self, seq): """Construct an immutable set from a sequence.""" + # XXX Maybe this should default seq to None? + # XXX Creating an empty immutable set is not unheard of. self._hashcode = None self._data = data = {} *************** *** 297,300 **** --- 303,309 ---- # XXX Should this perhaps look for _as_immutable? # XXX If so, should use self.update(seq). + # XXX (Well, ImmutableSet doesn't have update(); the base + # XXX class could have _update() which does this though, and + # XXX we could use that here and in Set.update().) for key in seq: data[key] = value From gvanrossum@users.sourceforge.net Wed Aug 21 04:20:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 20 Aug 2002 20:20:46 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29223 Modified Files: sets.py Log Message: Ouch. The test suite *really* needs work!!!!! There were several superficial errors and one deep one that aren't currently caught. I'm headed for bed after this checkin. - Fixed several typos introduced by Raymond Hettinger (through cut-n-paste from my template): it's _as_temporarily_immutable, not _as_temporary_immutable, and moreover when the element is added, we should use _as_immutable. - Made the seq argument to ImmutableSet.__init__ optional, so we can write ImmutableSet() to create an immutable empty set. - Rename the seq argument to Set and ImmutableSet to iterable. - Add a Set.__hash__ method that raises a TypeError. We inherit a default __hash__ implementation from object, and we don't want that. We can then catch this in update(), so that e.g. s.update([Set([1])]) will transform the Set([1]) to ImmutableSet([1]). - Added the dance to catch TypeError and try _as_immutable in the constructors too (by calling _update()). This is needed so that Set([Set([1])]) is correctly interpreted as Set([ImmutableSet([1])]). (I was puzzled by a side effect of this and the inherited __hash__ when comparing two sets of sets while testing different powerset implementations: the Set element passed to a Set constructor wasn't transformed to an ImmutableSet, and then the dictionary didn't believe the Set found in one dict it was the same as ImmutableSet in the other, because the hashes were different.) - Refactored Set.update() and both __init__() methods; moved the body of update() into BaseSet as _update(), and call this from __init__() and update(). - Changed the NotImplementedError in BaseSet.__init__ to TypeError, both for consistency with basestring() and because we have to use TypeError when denying Set.__hash__. Together those provide sufficient evidence that an unimplemented method needs to raise TypeError. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sets.py 21 Aug 2002 02:44:04 -0000 1.9 --- sets.py 21 Aug 2002 03:20:44 -0000 1.10 *************** *** 53,58 **** # and cleaned up the docstrings. # ! # - Raymond Hettinger implemented a number of speedups and other ! # improvements. --- 53,58 ---- # and cleaned up the docstrings. # ! # - Raymond Hettinger added a number of speedups and other ! # bugs^H^H^H^Himprovements. *************** *** 71,77 **** # Don't call this from a concrete subclass! if self.__class__ is BaseSet: ! # XXX Maybe raise TypeError instead, like basestring()? ! raise NotImplementedError, ("BaseSet is an abstract class. " ! "Use Set or ImmutableSet.") # Standard protocols: __len__, __repr__, __str__, __iter__ --- 71,76 ---- # Don't call this from a concrete subclass! if self.__class__ is BaseSet: ! raise TypeError, ("BaseSet is an abstract class. " ! "Use Set or ImmutableSet.") # Standard protocols: __len__, __repr__, __str__, __iter__ *************** *** 234,238 **** return element in self._data except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise # re-raise the TypeError exception we caught --- 233,237 ---- return element in self._data except TypeError: ! transform = getattr(element, "_as_temporarily_immutable", None) if transform is None: raise # re-raise the TypeError exception we caught *************** *** 280,283 **** --- 279,297 ---- return result + def _update(self, iterable): + # The main loop for update() and the subclass __init__() methods. + # XXX This can be optimized a bit by first trying the loop + # without setting up a try/except for each element. + data = self._data + value = True + for element in iterable: + try: + data[element] = value + except TypeError: + transform = getattr(element, "_as_immutable", None) + if transform is None: + raise # re-raise the TypeError exception we caught + data[transform()] = value + class ImmutableSet(BaseSet): *************** *** 288,311 **** # BaseSet + hashing ! def __init__(self, seq): ! """Construct an immutable set from a sequence.""" ! # XXX Maybe this should default seq to None? ! # XXX Creating an empty immutable set is not unheard of. self._hashcode = None ! self._data = data = {} ! # I don't know a faster way to do this in pure Python. ! # Custom code written in C only did it 65% faster, ! # preallocating the dict to len(seq); without ! # preallocation it was only 25% faster. So the speed of ! # this Python code is respectable. Just copying True into ! # a local variable is responsible for a 7-8% speedup. ! value = True ! # XXX Should this perhaps look for _as_immutable? ! # XXX If so, should use self.update(seq). ! # XXX (Well, ImmutableSet doesn't have update(); the base ! # XXX class could have _update() which does this though, and ! # XXX we could use that here and in Set.update().) ! for key in seq: ! data[key] = value def __hash__(self): --- 302,311 ---- # BaseSet + hashing ! def __init__(self, iterable=None): ! """Construct an immutable set from an optional iterable.""" self._hashcode = None ! self._data = {} ! if iterable is not None: ! self._update(iterable) def __hash__(self): *************** *** 322,334 **** # BaseSet + operations requiring mutability; no hashing ! def __init__(self, seq=None): ! """Construct an immutable set from a sequence.""" ! self._data = data = {} ! if seq is not None: ! value = True ! # XXX Should this perhaps look for _as_immutable? ! # XXX If so, should use self.update(seq). ! for key in seq: ! data[key] = value # In-place union, intersection, differences --- 322,335 ---- # BaseSet + operations requiring mutability; no hashing ! def __init__(self, iterable=None): ! """Construct a set from an optional iterable.""" ! self._data = {} ! if iterable is not None: ! self._update(iterable) ! ! def __hash__(self): ! """A Set cannot be hashed.""" ! # We inherit object.__hash__, so we must deny this explicitly ! raise TypeError, "Can't hash a Set, only an ImmutableSet." # In-place union, intersection, differences *************** *** 381,394 **** def update(self, iterable): """Add all values from an iterable (such as a list or file).""" ! data = self._data ! value = True ! for element in iterable: ! try: ! data[element] = value ! except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! data[transform()] = value def clear(self): --- 382,386 ---- def update(self, iterable): """Add all values from an iterable (such as a list or file).""" ! self._update(iterable) def clear(self): *************** *** 406,410 **** self._data[element] = True except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise # re-raise the TypeError exception we caught --- 398,402 ---- self._data[element] = True except TypeError: ! transform = getattr(element, "_as_immutable", None) if transform is None: raise # re-raise the TypeError exception we caught *************** *** 419,423 **** del self._data[element] except TypeError: ! transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise # re-raise the TypeError exception we caught --- 411,415 ---- del self._data[element] except TypeError: ! transform = getattr(element, "_as_temporarily_immutable", None) if transform is None: raise # re-raise the TypeError exception we caught From rhettinger@users.sourceforge.net Wed Aug 21 05:12:07 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 21:12:07 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7435 Modified Files: sets.py Log Message: Sped ._update() method by factoring try/except out of the inner loop. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sets.py 21 Aug 2002 03:20:44 -0000 1.10 --- sets.py 21 Aug 2002 04:12:03 -0000 1.11 *************** *** 281,291 **** def _update(self, iterable): # The main loop for update() and the subclass __init__() methods. - # XXX This can be optimized a bit by first trying the loop - # without setting up a try/except for each element. data = self._data value = True ! for element in iterable: try: ! data[element] = value except TypeError: transform = getattr(element, "_as_immutable", None) --- 281,292 ---- def _update(self, iterable): # The main loop for update() and the subclass __init__() methods. data = self._data value = True ! it = iter(iterable) ! while True: try: ! for element in it: ! data[element] = value ! return except TypeError: transform = getattr(element, "_as_immutable", None) From rhettinger@users.sourceforge.net Wed Aug 21 05:54:03 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 21:54:03 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.170,1.171 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv14360 Modified Files: tut.tex Log Message: Replace all cases of "while 1" with "while True". Though slightly slower, has better clarity and teaching value. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** tut.tex 15 Aug 2002 14:59:00 -0000 1.170 --- tut.tex 21 Aug 2002 04:54:00 -0000 1.171 *************** *** 1216,1220 **** \begin{verbatim} ! >>> while 1: ... pass # Busy-wait for keyboard interrupt ... --- 1216,1220 ---- \begin{verbatim} ! >>> while True: ... pass # Busy-wait for keyboard interrupt ... *************** *** 1359,1363 **** \begin{verbatim} def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): ! while 1: ok = raw_input(prompt) if ok in ('y', 'ye', 'yes'): return 1 --- 1359,1363 ---- \begin{verbatim} def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): ! while True: ok = raw_input(prompt) if ok in ('y', 'ye', 'yes'): return 1 *************** *** 3077,3084 **** \begin{verbatim} ! >>> while 1 print 'Hello world' File "", line 1, in ? ! while 1 print 'Hello world' ! ^ SyntaxError: invalid syntax \end{verbatim} --- 3077,3084 ---- \begin{verbatim} ! >>> while True print 'Hello world' File "", line 1, in ? ! while True print 'Hello world' ! ^ SyntaxError: invalid syntax \end{verbatim} *************** *** 3150,3154 **** \begin{verbatim} ! >>> while 1: ... try: ... x = int(raw_input("Please enter a number: ")) --- 3150,3154 ---- \begin{verbatim} ! >>> while True: ... try: ... x = int(raw_input("Please enter a number: ")) *************** *** 3761,3765 **** \begin{verbatim} xf = x.f ! while 1: print xf() \end{verbatim} --- 3761,3765 ---- \begin{verbatim} xf = x.f ! while True: print xf() \end{verbatim} From rhettinger@users.sourceforge.net Wed Aug 21 07:38:46 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 Aug 2002 23:38:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5753 Modified Files: test_sets.py Log Message: Add regression test for proper construction of sets of sets. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_sets.py 20 Aug 2002 21:51:59 -0000 1.2 --- test_sets.py 21 Aug 2002 06:38:44 -0000 1.3 *************** *** 133,136 **** --- 133,145 ---- #============================================================================== + class TestSetOfSets(unittest.TestCase): + def test_constructor(self): + inner = Set([1]) + outer = Set([inner]) + element = outer.pop() + assert type(element) == ImmutableSet, "Construct set of sets" + + #============================================================================== + class TestBinaryOps(unittest.TestCase): def setUp(self): *************** *** 537,540 **** --- 546,550 ---- def makeAllTests(): suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestSetOfSets)) suite.addTest(unittest.makeSuite(TestBasicOpsEmpty)) suite.addTest(unittest.makeSuite(TestBasicOpsSingleton)) From rhettinger@users.sourceforge.net Wed Aug 21 14:20:53 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 21 Aug 2002 06:20:53 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1654 Modified Files: sets.py Log Message: Now that __init__ transforms set elements, we know that all of the elements are hashable, so we can use dict.update() or dict.copy() for a C speed Set.copy(). Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sets.py 21 Aug 2002 04:12:03 -0000 1.11 --- sets.py 21 Aug 2002 13:20:51 -0000 1.12 *************** *** 134,138 **** def copy(self): """Return a shallow copy of a set.""" ! return self.__class__(self) __copy__ = copy # For the copy module --- 134,140 ---- def copy(self): """Return a shallow copy of a set.""" ! result = self.__class__([]) ! result._data.update(self._data) ! return result __copy__ = copy # For the copy module From fdrake@users.sourceforge.net Wed Aug 21 20:24:23 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 21 Aug 2002 12:24:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5430/lib Modified Files: libcgi.tex Log Message: Clarify that even though some of the relevant specifications define the order in which form variables should be encoded in a request, a CGI script should not rely on that since a client may not conform to those specs, or they may not be relevant to the request. Closes SF bug #596866. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** libcgi.tex 26 Apr 2002 20:44:14 -0000 1.36 --- libcgi.tex 21 Aug 2002 19:24:21 -0000 1.37 *************** *** 205,212 **** \begin{verbatim} - from types import ListType - item = form.getvalue("item") ! if isinstance(item, ListType): # The user is requesting more than one item. else: --- 205,210 ---- \begin{verbatim} item = form.getvalue("item") ! if isinstance(item, list): # The user is requesting more than one item. else: *************** *** 253,260 **** more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser ! and should not be counted on. If no such form field or value exists ! then the method returns the value specified by the optional ! parameter \var{default}. This parameter defaults to \code{None} if ! not specified. \end{methoddesc} --- 251,262 ---- more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser ! and should not be counted on.\footnote{Note that some recent ! versions of the HTML specification do state what order the ! field values should be supplied in, but knowing whether a ! request was received from a conforming browser, or even from a ! browser at all, is tedious and error-prone.} If no such form ! field or value exists then the method returns the value specified by ! the optional parameter \var{default}. This parameter defaults to ! \code{None} if not specified. \end{methoddesc} *************** *** 271,275 **** import cgi form = cgi.FieldStorage() ! user = form.getfirst("user").toupper() # This way it's safe. for item in form.getlist("item"): do_something(item) --- 273,277 ---- import cgi form = cgi.FieldStorage() ! user = form.getfirst("user", "").toupper() # This way it's safe. for item in form.getlist("item"): do_something(item) From fdrake@users.sourceforge.net Wed Aug 21 20:24:45 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 21 Aug 2002 12:24:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.35.4.1,1.35.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5724/lib Modified Files: Tag: release22-maint libcgi.tex Log Message: Clarify that even though some of the relevant specifications define the order in which form variables should be encoded in a request, a CGI script should not rely on that since a client may not conform to those specs, or they may not be relevant to the request. Closes SF bug #596866. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.35.4.1 retrieving revision 1.35.4.2 diff -C2 -d -r1.35.4.1 -r1.35.4.2 *** libcgi.tex 26 Apr 2002 20:43:59 -0000 1.35.4.1 --- libcgi.tex 21 Aug 2002 19:24:43 -0000 1.35.4.2 *************** *** 205,212 **** \begin{verbatim} - from types import ListType - item = form.getvalue("item") ! if isinstance(item, ListType): # The user is requesting more than one item. else: --- 205,210 ---- \begin{verbatim} item = form.getvalue("item") ! if isinstance(item, list): # The user is requesting more than one item. else: *************** *** 253,260 **** more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser ! and should not be counted on. If no such form field or value exists ! then the method returns the value specified by the optional ! parameter \var{default}. This parameter defaults to \code{None} if ! not specified. \end{methoddesc} --- 251,262 ---- more values were posted under such name. Please note that the order in which the values are received may vary from browser to browser ! and should not be counted on.\footnote{Note that some recent ! versions of the HTML specification do state what order the ! field values should be supplied in, but knowing whether a ! request was received from a conforming browser, or even from a ! browser at all, is tedious and error-prone.} If no such form ! field or value exists then the method returns the value specified by ! the optional parameter \var{default}. This parameter defaults to ! \code{None} if not specified. \end{methoddesc} *************** *** 271,275 **** import cgi form = cgi.FieldStorage() ! user = form.getfirst("user").toupper() # This way it's safe. for item in form.getlist("item"): do_something(item) --- 273,277 ---- import cgi form = cgi.FieldStorage() ! user = form.getfirst("user", "").toupper() # This way it's safe. for item in form.getlist("item"): do_something(item) From fdrake@users.sourceforge.net Wed Aug 21 21:23:25 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 21 Aug 2002 13:23:25 -0700 Subject: [Python-checkins] python/dist/src/Lib py_compile.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3978 Modified Files: py_compile.py Log Message: Refactor: Remove some code that was obsoleted when this module was changed to use universal newlines. Remove all imports from the compile() function; these are now done at the top of the module ("Python normal form"), and define a helper based on the platform instead of testing the platform in the compile() function. Index: py_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/py_compile.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** py_compile.py 1 Jun 2002 19:51:15 -0000 1.21 --- py_compile.py 21 Aug 2002 20:23:22 -0000 1.22 *************** *** 4,12 **** --- 4,27 ---- """ + import __builtin__ import imp + import marshal + import os + import sys + import traceback + MAGIC = imp.get_magic() __all__ = ["compile"] + # Define an internal helper according to the platform + if os.name == "mac": + import macfs + def set_creator_type(file): + macfs.FSSpec(file).SetCreatorType('Pyth', 'PYC ') + else: + def set_creator_type(file): + pass + def wr_long(f, x): """Internal; write a 32-bit int to a file in little-endian order.""" *************** *** 44,48 **** """ - import os, marshal, __builtin__ f = open(file, 'U') try: --- 59,62 ---- *************** *** 51,59 **** timestamp = long(os.stat(file).st_mtime) codestring = f.read() - # If parsing from a string, line breaks are \n (see parsetok.c:tok_nextc) - # Replace will return original string if pattern is not found, so - # we don't need to check whether it is found first. - codestring = codestring.replace("\r\n","\n") - codestring = codestring.replace("\r","\n") f.close() if codestring and codestring[-1] != '\n': --- 65,68 ---- *************** *** 62,70 **** codeobject = __builtin__.compile(codestring, dfile or file, 'exec') except SyntaxError, detail: - import traceback, sys lines = traceback.format_exception_only(SyntaxError, detail) for line in lines: sys.stderr.write(line.replace('File ""', ! 'File "%s"' % (dfile or file))) return if cfile is None: --- 71,78 ---- codeobject = __builtin__.compile(codestring, dfile or file, 'exec') except SyntaxError, detail: lines = traceback.format_exception_only(SyntaxError, detail) for line in lines: sys.stderr.write(line.replace('File ""', ! 'File "%s"' % (dfile or file))) return if cfile is None: *************** *** 78,82 **** fc.write(MAGIC) fc.close() ! if os.name == 'mac': ! import macfs ! macfs.FSSpec(cfile).SetCreatorType('Pyth', 'PYC ') --- 86,88 ---- fc.write(MAGIC) fc.close() ! set_creator_type(cfile) From fdrake@users.sourceforge.net Wed Aug 21 21:56:24 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 21 Aug 2002 13:56:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libpycompile.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15699/Doc/lib Modified Files: libpycompile.tex Log Message: Added a main() function and support to run this module as a script. Closes SF feature request #588768. Index: libpycompile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpycompile.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libpycompile.tex 3 Apr 2000 20:13:54 -0000 1.2 --- libpycompile.tex 21 Aug 2002 20:56:21 -0000 1.3 *************** *** 11,16 **** \indexii{file}{byte-code} ! The \module{py_compile} module provides a single function to generate ! a byte-code file from a source file. Though not often needed, this function can be useful when installing --- 11,17 ---- \indexii{file}{byte-code} ! The \module{py_compile} module provides a function to generate a ! byte-code file from a source file, and another function used when the ! module source file is invoked as a script. Though not often needed, this function can be useful when installing *************** *** 29,32 **** --- 30,44 ---- \end{funcdesc} + + \begin{funcdesc}{main}{\optional{args}} + Compile several source files. The files named in \var{args} (or on + the command line, if \var{args} is not specified) are compiled and + the resulting bytecode is cached in the normal manner. This + function does not search a directory structure to locate source + files; it only compiles files named explicitly. + \end{funcdesc} + + When this module is run as a script, the \function{main()} is used to + compile all the files named on the command line. \begin{seealso} From fdrake@users.sourceforge.net Wed Aug 21 21:56:25 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 21 Aug 2002 13:56:25 -0700 Subject: [Python-checkins] python/dist/src/Lib py_compile.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15699/Lib Modified Files: py_compile.py Log Message: Added a main() function and support to run this module as a script. Closes SF feature request #588768. Index: py_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/py_compile.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** py_compile.py 21 Aug 2002 20:23:22 -0000 1.22 --- py_compile.py 21 Aug 2002 20:56:21 -0000 1.23 *************** *** 13,17 **** MAGIC = imp.get_magic() ! __all__ = ["compile"] # Define an internal helper according to the platform --- 13,17 ---- MAGIC = imp.get_magic() ! __all__ = ["compile", "main"] # Define an internal helper according to the platform *************** *** 87,88 **** --- 87,106 ---- fc.close() set_creator_type(cfile) + + def main(args=None): + """Compile several source files. + + The files named in 'args' (or on the command line, if 'args' is + not specified) are compiled and the resulting bytecode is cached + in the normal manner. This function does not search a directory + structure to locate source files; it only compiles files named + explicitly. + + """ + if args is None: + args = sys.argv[1:] + for filename in args: + compile(filename) + + if __name__ == "__main__": + main() From tim_one@users.sourceforge.net Wed Aug 21 22:01:57 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 Aug 2002 14:01:57 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv17414 Modified Files: GBayes.py Log Message: Renamed "modtime" to "atime", to better reflect its meaning, and added a comment block to explain that better. Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GBayes.py 20 Aug 2002 20:42:59 -0000 1.8 --- GBayes.py 21 Aug 2002 21:01:47 -0000 1.9 *************** *** 74,78 **** class WordInfo(object): ! __slots__ = ('modtime', # when this record was last touched 'spamcount', # # of times word appears in spam 'hamcount', # # of times word appears in non-spam --- 74,78 ---- class WordInfo(object): ! __slots__ = ('atime', # when this record was last used by scoring(*) 'spamcount', # # of times word appears in spam 'hamcount', # # of times word appears in non-spam *************** *** 80,100 **** 'spamprob', # prob(spam | msg contains this word) ) ! def __init__(self, modtime): ! self.modtime = modtime self.spamcount = self.hamcount = self.killcount = 0 self.spamprob = None def __repr__(self): ! return "WordInfo%r" % repr((self.modtime, self.spamcount, self.hamcount, self.killcount, self.spamprob)) def __getstate__(self): ! return (self.modtime, self.spamcount, self.hamcount, self.killcount, self.spamprob) def __setstate__(self, t): ! (self.modtime, self.spamcount, self.hamcount, self.killcount, self.spamprob) = t --- 80,109 ---- 'spamprob', # prob(spam | msg contains this word) ) + # (*)atime is the last access time, a UTC time.time() value. It's the + # most recent time this word was used by scoring (i.e., by spamprob(), + # not by training via learn()); or, if the word has never been used by + # scoring, the time the word record was created (i.e., by learn()). + # One good criterion for identifying junk (word records that have no + # value) is to delete words that haven't been used for a long time. + # Perhaps they were typos, or unique identifiers, or relevant to a + # once-hot topic or scam that's fallen out of favor. Whatever, if + # a word is no longer being used, it's just wasting space. ! def __init__(self, atime): ! self.atime = atime self.spamcount = self.hamcount = self.killcount = 0 self.spamprob = None def __repr__(self): ! return "WordInfo%r" % repr((self.atime, self.spamcount, self.hamcount, self.killcount, self.spamprob)) def __getstate__(self): ! return (self.atime, self.spamcount, self.hamcount, self.killcount, self.spamprob) def __setstate__(self, t): ! (self.atime, self.spamcount, self.hamcount, self.killcount, self.spamprob) = t *************** *** 146,150 **** prob = UNKNOWN_SPAMPROB else: ! record.modtime = now prob = record.spamprob --- 155,159 ---- prob = UNKNOWN_SPAMPROB else: ! record.atime = now prob = record.spamprob *************** *** 246,250 **** mincount = float(mincount) for w, r in wordinfo.iteritems(): ! if (r.modtime < oldesttime and SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount): if self.DEBUG: --- 255,259 ---- mincount = float(mincount) for w, r in wordinfo.iteritems(): ! if (r.atime < oldesttime and SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount): if self.DEBUG: From mwh@users.sourceforge.net Thu Aug 22 14:36:15 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 22 Aug 2002 06:36:15 -0700 Subject: [Python-checkins] python/dist/src/Misc pymemcompat.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27201/Misc Modified Files: pymemcompat.h Log Message: Fix grammatically inept comment. Index: pymemcompat.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/pymemcompat.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pymemcompat.h 30 May 2002 16:41:14 -0000 1.2 --- pymemcompat.h 22 Aug 2002 13:36:11 -0000 1.3 *************** *** 28,33 **** malloc/realloc/free interface from ANSI C, but the object memory allocator can (and, since 2.3, does by default) use a different ! allocation strategy biased towards lots of lots of "small" ! allocations. The object family is used for allocating Python objects, and the --- 28,32 ---- malloc/realloc/free interface from ANSI C, but the object memory allocator can (and, since 2.3, does by default) use a different ! allocation strategy biased towards lots of "small" allocations. The object family is used for allocating Python objects, and the From fdrake@users.sourceforge.net Thu Aug 22 15:27:24 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 Aug 2002 07:27:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.7,1.100.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10080 Modified Files: Tag: release22-maint libfuncs.tex Log Message: Add a note that apply() is needed since the extended call syntax is completely equivalent. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.7 retrieving revision 1.100.4.8 diff -C2 -d -r1.100.4.7 -r1.100.4.8 *** libfuncs.tex 17 Jul 2002 13:55:46 -0000 1.100.4.7 --- libfuncs.tex 22 Aug 2002 14:27:22 -0000 1.100.4.8 *************** *** 76,79 **** --- 76,81 ---- exactly one argument. The use of \function{apply()} is equivalent to \code{\var{function}(*\var{args}, **\var{keywords})}. + Use of \function{apply()} is not necessary since the ``extended call + syntax,'' as used in the last example, is completely equivalent. \end{funcdesc} From fdrake@users.sourceforge.net Thu Aug 22 15:27:37 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 Aug 2002 07:27:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.113,1.114 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10191 Modified Files: libfuncs.tex Log Message: Add a note that apply() is needed since the extended call syntax is completely equivalent. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** libfuncs.tex 19 Aug 2002 21:43:18 -0000 1.113 --- libfuncs.tex 22 Aug 2002 14:27:35 -0000 1.114 *************** *** 76,79 **** --- 76,81 ---- exactly one argument. The use of \function{apply()} is equivalent to \code{\var{function}(*\var{args}, **\var{keywords})}. + Use of \function{apply()} is not necessary since the ``extended call + syntax,'' as used in the last example, is completely equivalent. \end{funcdesc} From fdrake@users.sourceforge.net Thu Aug 22 17:51:11 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 Aug 2002 09:51:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv1150 Modified Files: whatsnew23.tex Log Message: Give the section on PEP 263 a more meaningful title, so readers will be able to locate this information without knowing the PEP number. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** whatsnew23.tex 20 Aug 2002 01:34:06 -0000 1.47 --- whatsnew23.tex 22 Aug 2002 16:51:08 -0000 1.48 *************** *** 283,287 **** %====================================================================== ! \section{PEP 263: \label{section-encodings}} Python source files can now be declared as being in different --- 283,287 ---- %====================================================================== ! \section{PEP 263: Source Code Encodings \label{section-encodings}} Python source files can now be declared as being in different From gvanrossum@users.sourceforge.net Thu Aug 22 18:23:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 10:23:37 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14729 Modified Files: sets.py Log Message: Change the binary operators |, &, ^, - to return NotImplemented rather than raising TypeError when the other argument is not a BaseSet. This made it necessary to separate the implementation of e.g. __or__ from the union method; the latter should not return NotImplemented but raise TypeError. This is accomplished by making union(self, other) return self|other, etc.; Python's binary operator machinery will raise TypeError. The idea behind this change is to allow other set implementations with an incompatible internal structure; these can provide union (etc.) with standard sets by implementing __ror__ etc. I wish I could do this for comparisons too, but the default comparison implementation allows comparing anything to anything else (returning false); we don't want that (at least the test suite makes sure e.g. Set()==42 raises TypeError). That's probably fine; otherwise other set implementations would be constrained to implementing a hash that's compatible with ours. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sets.py 21 Aug 2002 13:20:51 -0000 1.12 --- sets.py 22 Aug 2002 17:23:33 -0000 1.13 *************** *** 54,58 **** # # - Raymond Hettinger added a number of speedups and other ! # bugs^H^H^H^Himprovements. --- 54,58 ---- # # - Raymond Hettinger added a number of speedups and other ! # improvements. *************** *** 156,179 **** return result ! # Standard set operations: union, intersection, both differences ! def union(self, other): """Return the union of two sets as a new set. (I.e. all elements that are in either set.) """ ! self._binary_sanity_check(other) result = self.__class__(self._data) result._data.update(other._data) return result ! __or__ = union ! def intersection(self, other): """Return the intersection of two sets as a new set. (I.e. all elements that are in both sets.) """ ! self._binary_sanity_check(other) if len(self) <= len(other): little, big = self, other --- 156,188 ---- return result ! # Standard set operations: union, intersection, both differences. ! # Each has an operator version (e.g. __or__, invoked with |) and a ! # method version (e.g. union). ! def __or__(self, other): """Return the union of two sets as a new set. (I.e. all elements that are in either set.) """ ! if not isinstance(other, BaseSet): ! return NotImplemented result = self.__class__(self._data) result._data.update(other._data) return result ! def union(self, other): ! """Return the union of two sets as a new set. ! (I.e. all elements that are in either set.) ! """ ! return self | other ! ! def __and__(self, other): """Return the intersection of two sets as a new set. (I.e. all elements that are in both sets.) """ ! if not isinstance(other, BaseSet): ! return NotImplemented if len(self) <= len(other): little, big = self, other *************** *** 188,199 **** return result ! __and__ = intersection ! def symmetric_difference(self, other): """Return the symmetric difference of two sets as a new set. (I.e. all elements that are in exactly one of the sets.) """ ! self._binary_sanity_check(other) result = self.__class__([]) data = result._data --- 197,214 ---- return result ! def intersection(self, other): ! """Return the intersection of two sets as a new set. ! (I.e. all elements that are in both sets.) ! """ ! return self & other ! ! def __xor__(self, other): """Return the symmetric difference of two sets as a new set. (I.e. all elements that are in exactly one of the sets.) """ ! if not isinstance(other, BaseSet): ! return NotImplemented result = self.__class__([]) data = result._data *************** *** 207,218 **** return result ! __xor__ = symmetric_difference ! def difference(self, other): """Return the difference of two sets as a new Set. (I.e. all elements that are in this set and not in the other.) """ ! self._binary_sanity_check(other) result = self.__class__([]) data = result._data --- 222,239 ---- return result ! def symmetric_difference(self, other): ! """Return the symmetric difference of two sets as a new set. ! (I.e. all elements that are in exactly one of the sets.) ! """ ! return self ^ other ! ! def __sub__(self, other): """Return the difference of two sets as a new Set. (I.e. all elements that are in this set and not in the other.) """ ! if not isinstance(other, BaseSet): ! return NotImplemented result = self.__class__([]) data = result._data *************** *** 223,227 **** return result ! __sub__ = difference # Membership test --- 244,253 ---- return result ! def difference(self, other): ! """Return the difference of two sets as a new Set. ! ! (I.e. all elements that are in this set and not in the other.) ! """ ! return self - other # Membership test From gvanrossum@users.sourceforge.net Thu Aug 22 18:31:26 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 10:31:26 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17393 Modified Files: socket.py Log Message: On Windows, make sure SocketType is the same as socket. (SF bug 598097) Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** socket.py 8 Aug 2002 20:07:03 -0000 1.34 --- socket.py 22 Aug 2002 17:31:16 -0000 1.35 *************** *** 182,186 **** if _needwrapper: ! socket = _socketobject class _fileobject(object): --- 182,186 ---- if _needwrapper: ! socket = SocketType = _socketobject class _fileobject(object): From gward@users.sourceforge.net Thu Aug 22 19:11:12 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 11:11:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31538 Added Files: test_textwrap.py Log Message: Test script for the textwrap module. Kindly provided by Peter Hansen based on a test script that's been kicking around my home directory for a couple of months now and only saw the light of day because I included it when I sent textwrap.py to python-dev for review. --- NEW FILE: test_textwrap.py --- #!/usr/bin/env python import unittest # import item under test from textwrap import TextWrapper, wrap, fill class WrapperTestCase(unittest.TestCase): '''Parent class with utility methods for textwrap tests.''' def show(self, textin): if isinstance(textin, list): result = [] for i in range(len(textin)): result.append(" %d: %r" % (i, textin[i])) result = '\n'.join(result) elif isinstance(textin, (str, unicode)): result = " %s\n" % repr(textin) return result def check(self, result, expect): self.assertEquals(result, expect, 'Expected:\n%s\nbut got:\n%s' % ( self.show(result), self.show(expect))) # Note: a new TestCase instance is created before running each # test method. class WrapTestCase(WrapperTestCase): # called before each test method def setUp(self): self.wrapper = TextWrapper(width=45, fix_sentence_endings=True) # Note: any methods that start with "test" are called automatically # by the unittest framework. def testSimpleCases(self): '''Simple case: just words, spaces, and a bit of punctuation.''' t = "Hello there, how are you this fine day? I'm glad to hear it!" # bizarre formatting intended to increase maintainability subcases = [ ( (t, 12), [ "Hello there,", "how are you", "this fine", "day? I'm", "glad to hear", "it!" ] ), ( (t, 42), [ "Hello there, how are you this fine day?", "I'm glad to hear it!" ] ), ( (t, 80), [ t ] ), ] for test, expect in subcases: result = wrap(*test) self.check(result, expect) def testWhitespace(self): '''Whitespace munging and end-of-sentence detection.''' t = """\ This is a paragraph that already has line breaks. But some of its lines are much longer than the others, so it needs to be wrapped. Some lines are \ttabbed too. What a mess! """ # bizarre formatting intended to increase maintainability expect = [ "This is a paragraph that already has line", "breaks. But some of its lines are much", "longer than the others, so it needs to be", "wrapped. Some lines are tabbed too. What a", "mess!" ] result = self.wrapper.wrap(t) self.check(result, expect) result = self.wrapper.fill(t) self.check(result, '\n'.join(expect)) def testWrappingShortToLong(self): '''Wrapping to make short lines longer.''' t = "This is a\nshort paragraph." # bizarre formatting intended to increase maintainability subcases = [ ( (t, 20), [ "This is a short", "paragraph." ] ), ( (t, 40), [ "This is a short paragraph." ] ), ] for test, expect in subcases: result = wrap(*test) self.check(result, expect) def testHyphenated(self): '''Test breaking hyphenated words.''' t = "this-is-a-useful-feature-for-reformatting-posts-from-tim-peters'ly" subcases = [ ( (t, 40), [ "this-is-a-useful-feature-for-", "reformatting-posts-from-tim-peters'ly" ] ), ( (t, 41), [ "this-is-a-useful-feature-for-", "reformatting-posts-from-tim-peters'ly" ] ), ( (t, 42), [ "this-is-a-useful-feature-for-reformatting-", "posts-from-tim-peters'ly" ] ), ] for test, expect in subcases: result = wrap(*test) self.check(result, expect) def test_split(self): '''Ensure that the standard _split() method works as advertised in the comments (don't you hate it when code and comments diverge?).''' t = "Hello there -- you goof-ball, use the -b option!" result = self.wrapper._split(t) self.check(result, ["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-", "ball,", " ", "use", " ", "the", " ", "-b", " ", "option!"]) def testPoppins(self): '''Please rename this test based on its purpose.''' t = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? ''' # bizarre formatting intended to increase maintainability subcases = [ ( (t, 30), [ 'Did you say "supercalifragilis', 'ticexpialidocious?" How *do*', 'you spell that odd word,', 'anyways?' ] ), ( (t, 50), [ 'Did you say "supercalifragilisticexpialidocious?"', 'How *do* you spell that odd word, anyways?' ] ), ] for test, expect in subcases: result = wrap(*test) self.check(result, expect) def testBreakLongWordsOff(self): '''Test with break_long_words disabled.''' t = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? ''' self.wrapper.break_long_words = 0 self.wrapper.width = 30 result = self.wrapper.wrap(t) expect = [ 'Did you say', '"supercalifragilisticexpialidocious?"', 'How *do* you spell that odd', 'word, anyways?' ] self.check(result, expect) # Same thing with kwargs passed to standalone wrap() function. result = wrap(t, width=30, break_long_words=0) self.check(result, expect) class IndentTestCases(WrapperTestCase): # called before each test method def setUp(self): self.testString = '''\ This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).''' def testFill(self): '''Test the fill() method.''' expect = '''\ This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).''' result = fill(self.testString, 40) self.check(result, expect) def testInitialIndent(self): '''Test initial_indent parameter.''' expect = [ " This paragraph will be filled,", "first without any indentation, and then", "with some (including a hanging indent)."] result = wrap(self.testString, 40, initial_indent=" ") self.check(result, expect) expect = '''\ This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).''' result = fill(self.testString, 40, initial_indent=" ") self.check(result, expect) def testSubsequentIndent(self): '''Test subsequent_indent parameter.''' expect = '''\ * This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).''' result = fill(self.testString, 40, initial_indent=" * ", subsequent_indent=" ") self.check(result, expect) if __name__ == '__main__': unittest.main() From gward@users.sourceforge.net Thu Aug 22 19:35:51 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 11:35:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7560 Modified Files: test_textwrap.py Log Message: Conform to standards documented in README: * lowercase test*() methods * define test_main() and use it instead of unittest.main() Kill #! line. Improve some test names and docstrings. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_textwrap.py 22 Aug 2002 18:11:10 -0000 1.1 --- test_textwrap.py 22 Aug 2002 18:35:49 -0000 1.2 *************** *** 1,7 **** - #!/usr/bin/env python - import unittest - # import item under test from textwrap import TextWrapper, wrap, fill --- 1,5 ---- import unittest + from test import test_support from textwrap import TextWrapper, wrap, fill *************** *** 40,44 **** # by the unittest framework. ! def testSimpleCases(self): '''Simple case: just words, spaces, and a bit of punctuation.''' --- 38,42 ---- # by the unittest framework. ! def test_simple(self): '''Simple case: just words, spaces, and a bit of punctuation.''' *************** *** 69,73 **** ! def testWhitespace(self): '''Whitespace munging and end-of-sentence detection.''' --- 67,71 ---- ! def test_whitespace(self): '''Whitespace munging and end-of-sentence detection.''' *************** *** 96,100 **** ! def testWrappingShortToLong(self): '''Wrapping to make short lines longer.''' --- 94,98 ---- ! def test_wrap_short(self): '''Wrapping to make short lines longer.''' *************** *** 117,121 **** ! def testHyphenated(self): '''Test breaking hyphenated words.''' --- 115,119 ---- ! def test_hyphenated(self): '''Test breaking hyphenated words.''' *************** *** 144,148 **** def test_split(self): '''Ensure that the standard _split() method works as advertised ! in the comments (don't you hate it when code and comments diverge?).''' t = "Hello there -- you goof-ball, use the -b option!" --- 142,146 ---- def test_split(self): '''Ensure that the standard _split() method works as advertised ! in the comments.''' t = "Hello there -- you goof-ball, use the -b option!" *************** *** 154,159 **** ! def testPoppins(self): ! '''Please rename this test based on its purpose.''' t = ''' --- 152,157 ---- ! def test_funky_punc(self): ! '''Wrap text with long words and lots of punctuation.''' t = ''' *************** *** 180,184 **** ! def testBreakLongWordsOff(self): '''Test with break_long_words disabled.''' t = ''' --- 178,182 ---- ! def test_long_words(self): '''Test with break_long_words disabled.''' t = ''' *************** *** 212,216 **** ! def testFill(self): '''Test the fill() method.''' --- 210,214 ---- ! def test_fill(self): '''Test the fill() method.''' *************** *** 224,228 **** ! def testInitialIndent(self): '''Test initial_indent parameter.''' --- 222,226 ---- ! def test_initial_indent(self): '''Test initial_indent parameter.''' *************** *** 244,248 **** ! def testSubsequentIndent(self): '''Test subsequent_indent parameter.''' --- 242,246 ---- ! def test_subsequent_indent(self): '''Test subsequent_indent parameter.''' *************** *** 258,261 **** if __name__ == '__main__': ! unittest.main() \ No newline at end of file --- 256,265 ---- + def test_main(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(WrapTestCase)) + suite.addTest(unittest.makeSuite(IndentTestCases)) + test_support.run_suite(suite) + if __name__ == '__main__': ! test_main() From gward@users.sourceforge.net Thu Aug 22 19:37:52 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 11:37:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8774 Modified Files: test_textwrap.py Log Message: Add comment header block. Remove some useless comments (redundant, or info presumably available in PyUnit docs). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_textwrap.py 22 Aug 2002 18:35:49 -0000 1.2 --- test_textwrap.py 22 Aug 2002 18:37:50 -0000 1.3 *************** *** 1,2 **** --- 1,12 ---- + # + # Test script for the textwrap module. + # + # Original tests written by Greg Ward . + # Converted to PyUnit by Peter Hansen . + # Currently maintained by Greg Ward. + # + # $Id$ + # + import unittest from test import test_support *************** *** 25,41 **** - - # Note: a new TestCase instance is created before running each - # test method. class WrapTestCase(WrapperTestCase): - # called before each test method def setUp(self): self.wrapper = TextWrapper(width=45, fix_sentence_endings=True) - - # Note: any methods that start with "test" are called automatically - # by the unittest framework. - def test_simple(self): '''Simple case: just words, spaces, and a bit of punctuation.''' --- 35,43 ---- *************** *** 43,47 **** t = "Hello there, how are you this fine day? I'm glad to hear it!" - # bizarre formatting intended to increase maintainability subcases = [ ( (t, 12), [ --- 45,48 ---- *************** *** 78,82 **** """ - # bizarre formatting intended to increase maintainability expect = [ "This is a paragraph that already has line", --- 79,82 ---- *************** *** 99,103 **** t = "This is a\nshort paragraph." - # bizarre formatting intended to increase maintainability subcases = [ ( (t, 20), [ --- 99,102 ---- *************** *** 159,163 **** How *do* you spell that odd word, anyways? ''' - # bizarre formatting intended to increase maintainability subcases = [ ( (t, 30), [ --- 158,161 ---- From gward@users.sourceforge.net Thu Aug 22 19:45:05 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 11:45:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11185 Modified Files: test_textwrap.py Log Message: Simplify and reformat the use of 'subcases' lists (and following for-loops) in test_simple(), test_wrap_short() test_hyphenated(), and test_funky_punc(). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_textwrap.py 22 Aug 2002 18:37:50 -0000 1.3 --- test_textwrap.py 22 Aug 2002 18:45:02 -0000 1.4 *************** *** 46,68 **** subcases = [ ! ( (t, 12), [ ! "Hello there,", ! "how are you", ! "this fine", ! "day? I'm", ! "glad to hear", ! "it!" ! ] ), ! ( (t, 42), [ ! "Hello there, how are you this fine day?", ! "I'm glad to hear it!" ! ] ), ! ( (t, 80), [ ! t ! ] ), ] ! for test, expect in subcases: ! result = wrap(*test) self.check(result, expect) --- 46,62 ---- subcases = [ ! (12, ["Hello there,", ! "how are you", ! "this fine", ! "day? I'm", ! "glad to hear", ! "it!"]), ! (42, ["Hello there, how are you this fine day?", ! "I'm glad to hear it!"]), ! (80, [t]), ] ! for width, expect in subcases: ! result = wrap(t, width) self.check(result, expect) *************** *** 100,114 **** subcases = [ ! ( (t, 20), [ ! "This is a short", ! "paragraph." ! ] ), ! ( (t, 40), [ ! "This is a short paragraph." ! ] ), ] ! for test, expect in subcases: ! result = wrap(*test) self.check(result, expect) --- 94,104 ---- subcases = [ ! (20, ["This is a short", ! "paragraph."]), ! (40, ["This is a short paragraph."]), ] ! for width, expect in subcases: ! result = wrap(t, width) self.check(result, expect) *************** *** 120,139 **** subcases = [ ! ( (t, 40), [ ! "this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly" ! ] ), ! ( (t, 41), [ ! "this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly" ! ] ), ! ( (t, 42), [ ! "this-is-a-useful-feature-for-reformatting-", ! "posts-from-tim-peters'ly" ! ] ), ] ! for test, expect in subcases: ! result = wrap(*test) self.check(result, expect) --- 110,123 ---- subcases = [ ! (40, ["this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly"]), ! (41, ["this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly"]), ! (42, ["this-is-a-useful-feature-for-reformatting-", ! "posts-from-tim-peters'ly"]), ] ! for width, expect in subcases: ! result = wrap(t, width) self.check(result, expect) *************** *** 159,176 **** ''' subcases = [ ! ( (t, 30), [ ! 'Did you say "supercalifragilis', ! 'ticexpialidocious?" How *do*', ! 'you spell that odd word,', ! 'anyways?' ! ] ), ! ( (t, 50), [ ! 'Did you say "supercalifragilisticexpialidocious?"', ! 'How *do* you spell that odd word, anyways?' ! ] ), ] ! for test, expect in subcases: ! result = wrap(*test) self.check(result, expect) --- 143,156 ---- ''' subcases = [ ! (30, ['Did you say "supercalifragilis', ! 'ticexpialidocious?" How *do*', ! 'you spell that odd word,', ! 'anyways?']), ! (50, ['Did you say "supercalifragilisticexpialidocious?"', ! 'How *do* you spell that odd word, anyways?']), ] ! for width, expect in subcases: ! result = wrap(t, width) self.check(result, expect) From gward@users.sourceforge.net Thu Aug 22 19:57:28 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 11:57:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15593 Modified Files: test_textwrap.py Log Message: Rename base test case class to (yawn) BaseTestCase. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_textwrap.py 22 Aug 2002 18:55:38 -0000 1.5 --- test_textwrap.py 22 Aug 2002 18:57:26 -0000 1.6 *************** *** 15,19 **** ! class WrapperTestCase(unittest.TestCase): '''Parent class with utility methods for textwrap tests.''' --- 15,19 ---- ! class BaseTestCase(unittest.TestCase): '''Parent class with utility methods for textwrap tests.''' *************** *** 39,43 **** ! class WrapTestCase(WrapperTestCase): def setUp(self): --- 39,43 ---- ! class WrapTestCase(BaseTestCase): def setUp(self): *************** *** 164,168 **** ! class IndentTestCases(WrapperTestCase): # called before each test method --- 164,168 ---- ! class IndentTestCases(BaseTestCase): # called before each test method From gward@users.sourceforge.net Thu Aug 22 20:02:41 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:02:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17051 Modified Files: test_textwrap.py Log Message: Factor LongWordTestCase out of WrapTestCase, and rename its methods (tests) from test_funky_punc() to test_break_long() and test_long_words() to test_nobreak_long(). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_textwrap.py 22 Aug 2002 18:57:26 -0000 1.6 --- test_textwrap.py 22 Aug 2002 19:02:37 -0000 1.7 *************** *** 125,151 **** ! def test_funky_punc(self): ! '''Wrap text with long words and lots of punctuation.''' ! ! text = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? ''' ! self.check_wrap(text, 30, ['Did you say "supercalifragilis', 'ticexpialidocious?" How *do*', 'you spell that odd word,', 'anyways?']) ! self.check_wrap(text, 50, ['Did you say "supercalifragilisticexpialidocious?"', 'How *do* you spell that odd word, anyways?']) ! def test_long_words(self): '''Test with break_long_words disabled.''' - text = ''' - Did you say "supercalifragilisticexpialidocious?" - How *do* you spell that odd word, anyways? - ''' self.wrapper.break_long_words = 0 self.wrapper.width = 30 --- 125,151 ---- ! class LongWordTestCase (BaseTestCase): ! def setUp(self): ! self.wrapper = TextWrapper() ! self.text = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? ''' ! ! def test_break_long(self): ! '''Wrap text with long words and lots of punctuation.''' ! ! self.check_wrap(self.text, 30, ['Did you say "supercalifragilis', 'ticexpialidocious?" How *do*', 'you spell that odd word,', 'anyways?']) ! self.check_wrap(self.text, 50, ['Did you say "supercalifragilisticexpialidocious?"', 'How *do* you spell that odd word, anyways?']) ! def test_nobreak_long(self): '''Test with break_long_words disabled.''' self.wrapper.break_long_words = 0 self.wrapper.width = 30 *************** *** 155,163 **** 'word, anyways?' ] ! result = self.wrapper.wrap(text) self.check(result, expect) # Same thing with kwargs passed to standalone wrap() function. ! result = wrap(text, width=30, break_long_words=0) self.check(result, expect) --- 155,163 ---- 'word, anyways?' ] ! result = self.wrapper.wrap(self.text) self.check(result, expect) # Same thing with kwargs passed to standalone wrap() function. ! result = wrap(self.text, width=30, break_long_words=0) self.check(result, expect) *************** *** 222,225 **** --- 222,226 ---- suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(WrapTestCase)) + suite.addTest(unittest.makeSuite(LongWordTestCase)) suite.addTest(unittest.makeSuite(IndentTestCases)) test_support.run_suite(suite) From gward@users.sourceforge.net Thu Aug 22 19:55:41 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 11:55:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14594 Modified Files: test_textwrap.py Log Message: Ditch the whole loop-over-subcases way of working. Add check_wrap() to base class (WrapperTestCase) instead, and call it repeatedly in the methods that used to have a loop-over-subcases. Much simpler. Rename perennial temp variable 't' to 'text'. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_textwrap.py 22 Aug 2002 18:45:02 -0000 1.4 --- test_textwrap.py 22 Aug 2002 18:55:38 -0000 1.5 *************** *** 34,37 **** --- 34,41 ---- self.show(result), self.show(expect))) + def check_wrap (self, text, width, expect): + result = wrap(text, width) + self.check(result, expect) + class WrapTestCase(WrapperTestCase): *************** *** 43,63 **** '''Simple case: just words, spaces, and a bit of punctuation.''' ! t = "Hello there, how are you this fine day? I'm glad to hear it!" ! ! subcases = [ ! (12, ["Hello there,", ! "how are you", ! "this fine", ! "day? I'm", ! "glad to hear", ! "it!"]), ! (42, ["Hello there, how are you this fine day?", ! "I'm glad to hear it!"]), ! (80, [t]), ! ] ! for width, expect in subcases: ! result = wrap(t, width) ! self.check(result, expect) --- 47,63 ---- '''Simple case: just words, spaces, and a bit of punctuation.''' ! text = "Hello there, how are you this fine day? I'm glad to hear it!" ! self.check_wrap(text, 12, ! ["Hello there,", ! "how are you", ! "this fine", ! "day? I'm", ! "glad to hear", ! "it!"]) ! self.check_wrap(text, 42, ! ["Hello there, how are you this fine day?", ! "I'm glad to hear it!"]) ! self.check_wrap(text, 80, [text]) *************** *** 65,69 **** '''Whitespace munging and end-of-sentence detection.''' ! t = """\ This is a paragraph that already has line breaks. But some of its lines are much longer than the others, --- 65,69 ---- '''Whitespace munging and end-of-sentence detection.''' ! text = """\ This is a paragraph that already has line breaks. But some of its lines are much longer than the others, *************** *** 73,88 **** """ ! expect = [ ! "This is a paragraph that already has line", ! "breaks. But some of its lines are much", ! "longer than the others, so it needs to be", ! "wrapped. Some lines are tabbed too. What a", ! "mess!" ! ] ! result = self.wrapper.wrap(t) self.check(result, expect) ! result = self.wrapper.fill(t) self.check(result, '\n'.join(expect)) --- 73,86 ---- """ ! expect = ["This is a paragraph that already has line", ! "breaks. But some of its lines are much", ! "longer than the others, so it needs to be", ! "wrapped. Some lines are tabbed too. What a", ! "mess!"] ! result = self.wrapper.wrap(text) self.check(result, expect) ! result = self.wrapper.fill(text) self.check(result, '\n'.join(expect)) *************** *** 91,105 **** '''Wrapping to make short lines longer.''' ! t = "This is a\nshort paragraph." ! ! subcases = [ ! (20, ["This is a short", ! "paragraph."]), ! (40, ["This is a short paragraph."]), ! ] ! for width, expect in subcases: ! result = wrap(t, width) ! self.check(result, expect) --- 89,97 ---- '''Wrapping to make short lines longer.''' ! text = "This is a\nshort paragraph." ! self.check_wrap(text, 20, ["This is a short", ! "paragraph."]) ! self.check_wrap(text, 40, ["This is a short paragraph."]) *************** *** 107,124 **** '''Test breaking hyphenated words.''' ! t = "this-is-a-useful-feature-for-reformatting-posts-from-tim-peters'ly" ! ! subcases = [ ! (40, ["this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly"]), ! (41, ["this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly"]), ! (42, ["this-is-a-useful-feature-for-reformatting-", ! "posts-from-tim-peters'ly"]), ! ] ! for width, expect in subcases: ! result = wrap(t, width) ! self.check(result, expect) --- 99,114 ---- '''Test breaking hyphenated words.''' ! text = ("this-is-a-useful-feature-for-" ! "reformatting-posts-from-tim-peters'ly") ! self.check_wrap(text, 40, ! ["this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly"]) ! self.check_wrap(text, 41, ! ["this-is-a-useful-feature-for-", ! "reformatting-posts-from-tim-peters'ly"]) ! self.check_wrap(text, 42, ! ["this-is-a-useful-feature-for-reformatting-", ! "posts-from-tim-peters'ly"]) *************** *** 127,133 **** in the comments.''' ! t = "Hello there -- you goof-ball, use the -b option!" ! result = self.wrapper._split(t) self.check(result, ["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-", --- 117,123 ---- in the comments.''' ! text = "Hello there -- you goof-ball, use the -b option!" ! result = self.wrapper._split(text) self.check(result, ["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-", *************** *** 138,162 **** '''Wrap text with long words and lots of punctuation.''' ! t = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? ''' ! subcases = [ ! (30, ['Did you say "supercalifragilis', ! 'ticexpialidocious?" How *do*', ! 'you spell that odd word,', ! 'anyways?']), ! (50, ['Did you say "supercalifragilisticexpialidocious?"', ! 'How *do* you spell that odd word, anyways?']), ! ] ! ! for width, expect in subcases: ! result = wrap(t, width) ! self.check(result, expect) def test_long_words(self): '''Test with break_long_words disabled.''' ! t = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? --- 128,148 ---- '''Wrap text with long words and lots of punctuation.''' ! text = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? ''' ! self.check_wrap(text, 30, ! ['Did you say "supercalifragilis', ! 'ticexpialidocious?" How *do*', ! 'you spell that odd word,', ! 'anyways?']) ! self.check_wrap(text, 50, ! ['Did you say "supercalifragilisticexpialidocious?"', ! 'How *do* you spell that odd word, anyways?']) def test_long_words(self): '''Test with break_long_words disabled.''' ! text = ''' Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways? *************** *** 164,178 **** self.wrapper.break_long_words = 0 self.wrapper.width = 30 ! result = self.wrapper.wrap(t) ! expect = [ ! 'Did you say', ! '"supercalifragilisticexpialidocious?"', ! 'How *do* you spell that odd', ! 'word, anyways?' ! ] self.check(result, expect) # Same thing with kwargs passed to standalone wrap() function. ! result = wrap(t, width=30, break_long_words=0) self.check(result, expect) --- 150,163 ---- self.wrapper.break_long_words = 0 self.wrapper.width = 30 ! expect = ['Did you say', ! '"supercalifragilisticexpialidocious?"', ! 'How *do* you spell that odd', ! 'word, anyways?' ! ] ! result = self.wrapper.wrap(text) self.check(result, expect) # Same thing with kwargs passed to standalone wrap() function. ! result = wrap(text, width=30, break_long_words=0) self.check(result, expect) From gward@users.sourceforge.net Thu Aug 22 20:06:48 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:06:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18687 Modified Files: test_textwrap.py Log Message: Simplification/cleanup in IndentTestCases. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_textwrap.py 22 Aug 2002 19:02:37 -0000 1.7 --- test_textwrap.py 22 Aug 2002 19:06:45 -0000 1.8 *************** *** 168,172 **** # called before each test method def setUp(self): ! self.testString = '''\ This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).''' --- 168,172 ---- # called before each test method def setUp(self): ! self.text = '''\ This paragraph will be filled, first without any indentation, and then with some (including a hanging indent).''' *************** *** 181,185 **** some (including a hanging indent).''' ! result = fill(self.testString, 40) self.check(result, expect) --- 181,185 ---- some (including a hanging indent).''' ! result = fill(self.text, 40) self.check(result, expect) *************** *** 188,205 **** '''Test initial_indent parameter.''' ! expect = [ ! " This paragraph will be filled,", ! "first without any indentation, and then", ! "with some (including a hanging indent)."] ! ! result = wrap(self.testString, 40, initial_indent=" ") self.check(result, expect) ! expect = '''\ ! This paragraph will be filled, ! first without any indentation, and then ! with some (including a hanging indent).''' ! ! result = fill(self.testString, 40, initial_indent=" ") self.check(result, expect) --- 188,199 ---- '''Test initial_indent parameter.''' ! expect = [" This paragraph will be filled,", ! "first without any indentation, and then", ! "with some (including a hanging indent)."] ! result = wrap(self.text, 40, initial_indent=" ") self.check(result, expect) ! expect = "\n".join(expect) ! result = fill(self.text, 40, initial_indent=" ") self.check(result, expect) *************** *** 214,219 **** indent).''' ! result = fill(self.testString, 40, initial_indent=" * ", ! subsequent_indent=" ") self.check(result, expect) --- 208,213 ---- indent).''' ! result = fill(self.text, 40, ! initial_indent=" * ", subsequent_indent=" ") self.check(result, expect) From gward@users.sourceforge.net Thu Aug 22 20:15:37 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:15:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext embedding.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv24258/ext Modified Files: embedding.tex Log Message: Fix peculiar (and ungrammatical) wording in an example program. Index: embedding.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/embedding.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** embedding.tex 21 Jun 2002 12:33:08 -0000 1.6 --- embedding.tex 22 Aug 2002 19:15:35 -0000 1.7 *************** *** 146,150 **** \begin{verbatim} def multiply(a,b): ! print "Thy shall add", a, "times", b c = 0 for i in range(0, a): --- 146,150 ---- \begin{verbatim} def multiply(a,b): ! print "Will compute", a, "times", b c = 0 for i in range(0, a): *************** *** 157,161 **** \begin{verbatim} $ call multiply 3 2 ! Thy shall add 3 times 2 Result of call: 6 \end{verbatim} % $ --- 157,161 ---- \begin{verbatim} $ call multiply 3 2 ! Will compute 3 times 2 Result of call: 6 \end{verbatim} % $ From gvanrossum@users.sourceforge.net Thu Aug 22 20:18:59 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:18:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_base64.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26734 Modified Files: test_base64.py Log Message: Made it more readable. Index: test_base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_base64.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_base64.py 15 Aug 2002 22:14:24 -0000 1.4 --- test_base64.py 22 Aug 2002 19:18:56 -0000 1.5 *************** *** 1,52 **** ! import unittest ! from test import test_support ! import base64 ! from binascii import Error as binascii_error ! class Base64TestCase(unittest.TestCase): ! def test_encode_string(self): ! """Testing encode string""" ! test_support.verify(base64.encodestring("www.python.org") == ! "d3d3LnB5dGhvbi5vcmc=\n", ! reason="www.python.org encodestring failed") ! test_support.verify(base64.encodestring("a") == ! "YQ==\n", ! reason="a encodestring failed") ! test_support.verify(base64.encodestring("ab") == ! "YWI=\n", ! reason="ab encodestring failed") ! test_support.verify(base64.encodestring("abc") == ! "YWJj\n", ! reason="abc encodestring failed") ! test_support.verify(base64.encodestring("") == ! "", ! reason="null encodestring failed") ! test_support.verify(base64.encodestring( ! "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}") == ! "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n", ! reason = "long encodestring failed") ! def test_decode_string(self): ! """Testing decode string""" ! test_support.verify(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n") == ! "www.python.org", ! reason="www.python.org decodestring failed") ! test_support.verify(base64.decodestring("YQ==\n") == ! "a", ! reason="a decodestring failed") ! test_support.verify(base64.decodestring("YWI=\n") == ! "ab", ! reason="ab decodestring failed") ! test_support.verify(base64.decodestring("YWJj\n") == ! "abc", ! reason="abc decodestring failed") ! test_support.verify(base64.decodestring( ! "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") == ! "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}", ! reason = "long decodestring failed") ! test_support.verify(base64.decodestring('') == '') def test_main(): ! test_support.run_unittest(Base64TestCase) if __name__ == "__main__": --- 1,36 ---- ! from unittest import TestCase ! from test.test_support import vereq, run_unittest ! from base64 import encodestring, decodestring ! class Base64TestCase(TestCase): ! def test_encodestring(self): ! vereq(encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n") ! vereq(encodestring("a"), "YQ==\n") ! vereq(encodestring("ab"), "YWI=\n") ! vereq(encodestring("abc"), "YWJj\n") ! vereq(encodestring(""), "") ! vereq(encodestring("abcdefghijklmnopqrstuvwxyz" ! "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ! "0123456789!@#0^&*();:<>,. []{}"), ! "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" ! "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" ! "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") ! ! def test_decodestring(self): ! vereq(decodestring("d3d3LnB5dGhvbi5vcmc=\n"), "www.python.org") ! vereq(decodestring("YQ==\n"), "a") ! vereq(decodestring("YWI=\n"), "ab") ! vereq(decodestring("YWJj\n"), "abc") ! vereq(decodestring("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" ! "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" ! "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), ! "abcdefghijklmnopqrstuvwxyz" ! "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ! "0123456789!@#0^&*();:<>,. []{}") ! vereq(decodestring(''), '') def test_main(): ! run_unittest(Base64TestCase) if __name__ == "__main__": From gvanrossum@users.sourceforge.net Thu Aug 22 20:38:16 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:38:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hmac.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6538 Modified Files: test_hmac.py Log Message: Standardize behavior: no docstrings in test functions; create a single suite merging all test cases. Index: test_hmac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hmac.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_hmac.py 23 Jul 2002 19:03:54 -0000 1.5 --- test_hmac.py 22 Aug 2002 19:38:14 -0000 1.6 *************** *** 4,9 **** class TestVectorsTestCase(unittest.TestCase): def test_vectors(self): ! """Test the HMAC module against test vectors from the RFC.""" def md5test(key, data, digest): --- 4,10 ---- class TestVectorsTestCase(unittest.TestCase): + def test_vectors(self): ! # Test the HMAC module against test vectors from the RFC. def md5test(key, data, digest): *************** *** 24,29 **** class ConstructorTestCase(unittest.TestCase): def test_normal(self): ! """Standard constructor call.""" failed = 0 try: --- 25,31 ---- class ConstructorTestCase(unittest.TestCase): + def test_normal(self): ! # Standard constructor call. failed = 0 try: *************** *** 33,37 **** def test_withtext(self): ! """Constructor call with text.""" try: h = hmac.HMAC("key", "hash this!") --- 35,39 ---- def test_withtext(self): ! # Constructor call with text. try: h = hmac.HMAC("key", "hash this!") *************** *** 40,44 **** def test_withmodule(self): ! """Constructor call with text and digest module.""" import sha try: --- 42,46 ---- def test_withmodule(self): ! # Constructor call with text and digest module. import sha try: *************** *** 48,53 **** class SanityTestCase(unittest.TestCase): def test_default_is_md5(self): ! """Testing if HMAC defaults to MD5 algorithm.""" import md5 h = hmac.HMAC("key") --- 50,56 ---- class SanityTestCase(unittest.TestCase): + def test_default_is_md5(self): ! # Testing if HMAC defaults to MD5 algorithm. import md5 h = hmac.HMAC("key") *************** *** 55,59 **** def test_exercise_all_methods(self): ! """Exercising all methods once.""" # This must not raise any exceptions try: --- 58,62 ---- def test_exercise_all_methods(self): ! # Exercising all methods once. # This must not raise any exceptions try: *************** *** 67,72 **** class CopyTestCase(unittest.TestCase): def test_attributes(self): ! """Testing if attributes are of same type.""" h1 = hmac.HMAC("key") h2 = h1.copy() --- 70,76 ---- class CopyTestCase(unittest.TestCase): + def test_attributes(self): ! # Testing if attributes are of same type. h1 = hmac.HMAC("key") h2 = h1.copy() *************** *** 79,83 **** def test_realcopy(self): ! """Testing if the copy method created a real copy.""" h1 = hmac.HMAC("key") h2 = h1.copy() --- 83,87 ---- def test_realcopy(self): ! # Testing if the copy method created a real copy. h1 = hmac.HMAC("key") h2 = h1.copy() *************** *** 90,94 **** def test_equality(self): ! """Testing if the copy has the same digests.""" h1 = hmac.HMAC("key") h1.update("some random text") --- 94,98 ---- def test_equality(self): ! # Testing if the copy has the same digests. h1 = hmac.HMAC("key") h1.update("some random text") *************** *** 100,107 **** def test_main(): ! test_support.run_unittest(TestVectorsTestCase) ! test_support.run_unittest(ConstructorTestCase) ! test_support.run_unittest(SanityTestCase) ! test_support.run_unittest(CopyTestCase) if __name__ == "__main__": --- 104,113 ---- def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestVectorsTestCase)) ! suite.addTest(unittest.makeSuite(ConstructorTestCase)) ! suite.addTest(unittest.makeSuite(SanityTestCase)) ! suite.addTest(unittest.makeSuite(CopyTestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": From gvanrossum@users.sourceforge.net Thu Aug 22 20:40:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:40:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8188 Modified Files: test_os.py Log Message: Standardize behavior: create a single suite merging all test cases. Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_os.py 23 Jul 2002 19:03:58 -0000 1.12 --- test_os.py 22 Aug 2002 19:40:33 -0000 1.13 *************** *** 10,14 **** warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) ! from test.test_support import TESTFN, run_unittest class TemporaryFileTests(unittest.TestCase): --- 10,14 ---- warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) ! from test.test_support import TESTFN, run_suite class TemporaryFileTests(unittest.TestCase): *************** *** 187,192 **** def test_main(): ! run_unittest(TemporaryFileTests) ! run_unittest(StatAttributeTests) if __name__ == "__main__": --- 187,194 ---- def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TemporaryFileTests)) ! suite.addTest(unittest.makeSuite(StatAttributeTests)) ! run_suite(suite) if __name__ == "__main__": From gvanrossum@users.sourceforge.net Thu Aug 22 20:43:53 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:43:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_parser.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10579 Modified Files: test_parser.py Log Message: Standardize behavior: no docstrings in test functions. Index: test_parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_parser.py 23 Jul 2002 19:03:58 -0000 1.12 --- test_parser.py 22 Aug 2002 19:43:51 -0000 1.13 *************** *** 10,13 **** --- 10,14 ---- class RoundtripLegalSyntaxTestCase(unittest.TestCase): + def roundtrip(self, f, s): st1 = f(s) *************** *** 135,138 **** --- 136,140 ---- class IllegalSyntaxTestCase(unittest.TestCase): + def check_bad_tree(self, tree, label): try: *************** *** 148,152 **** def test_illegal_yield_1(self): ! """Illegal yield statement: def f(): return 1; yield 1""" tree = \ (257, --- 150,154 ---- def test_illegal_yield_1(self): ! # Illegal yield statement: def f(): return 1; yield 1 tree = \ (257, *************** *** 203,207 **** def test_illegal_yield_2(self): ! """Illegal return in generator: def f(): return 1; yield 1""" tree = \ (257, --- 205,209 ---- def test_illegal_yield_2(self): ! # Illegal return in generator: def f(): return 1; yield 1 tree = \ (257, *************** *** 267,271 **** def test_print_chevron_comma(self): ! """Illegal input: print >>fp,""" tree = \ (257, --- 269,273 ---- def test_print_chevron_comma(self): ! # Illegal input: print >>fp, tree = \ (257, *************** *** 290,294 **** def test_a_comma_comma_c(self): ! """Illegal input: a,,c""" tree = \ (258, --- 292,296 ---- def test_a_comma_comma_c(self): ! # Illegal input: a,,c tree = \ (258, *************** *** 317,321 **** def test_illegal_operator(self): ! """Illegal input: a $= b""" tree = \ (257, --- 319,323 ---- def test_illegal_operator(self): ! # Illegal input: a $= b tree = \ (257, From gvanrossum@users.sourceforge.net Thu Aug 22 20:45:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:45:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pprint.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12114 Modified Files: test_pprint.py Log Message: Standardize behavior: no docstrings in test functions. Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_pprint.py 23 Jul 2002 19:03:59 -0000 1.9 --- test_pprint.py 22 Aug 2002 19:45:32 -0000 1.10 *************** *** 17,21 **** def test_basic(self): ! """Verify .isrecursive() and .isreadable() w/o recursion.""" verify = self.assert_ for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"), --- 17,21 ---- def test_basic(self): ! # Verify .isrecursive() and .isreadable() w/o recursion verify = self.assert_ for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"), *************** *** 27,31 **** def test_knotted(self): ! """Verify .isrecursive() and .isreadable() w/ recursion.""" # Tie a knot. self.b[67] = self.a --- 27,31 ---- def test_knotted(self): ! # Verify .isrecursive() and .isreadable() w/ recursion # Tie a knot. self.b[67] = self.a *************** *** 52,56 **** def test_unreadable(self): ! """Not recursive but not readable anyway.""" verify = self.assert_ for unreadable in type(3), pprint, pprint.isrecursive: --- 52,56 ---- def test_unreadable(self): ! # Not recursive but not readable anyway verify = self.assert_ for unreadable in type(3), pprint, pprint.isrecursive: *************** *** 61,65 **** def test_same_as_repr(self): ! "Simple objects and small containers that should be same as repr()." verify = self.assert_ for simple in (0, 0L, 0+0j, 0.0, "", uni(""), (), [], {}, verify, pprint, --- 61,65 ---- def test_same_as_repr(self): ! # Simple objects and small containers that should be same as repr() verify = self.assert_ for simple in (0, 0L, 0+0j, 0.0, "", uni(""), (), [], {}, verify, pprint, *************** *** 78,82 **** def test_basic_line_wrap(self): ! """verify basic line-wrapping operation""" o = {'RPM_cal': 0, 'RPM_cal2': 48059, --- 78,82 ---- def test_basic_line_wrap(self): ! # verify basic line-wrapping operation o = {'RPM_cal': 0, 'RPM_cal2': 48059, *************** *** 106,109 **** --- 106,110 ---- class DottedPrettyPrinter(pprint.PrettyPrinter): + def format(self, object, context, maxlevels, level): if isinstance(object, str): From gward@users.sourceforge.net Thu Aug 22 20:47:29 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:47:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13611 Modified Files: test_textwrap.py Log Message: Add test_em_dash() to WrapTestCase to make sure that TextWrapper handles em-dashes -- like this -- properly. (Also--like this. Although this usage may be incompatible with fixing bug #596434; we shall see.) Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_textwrap.py 22 Aug 2002 19:06:45 -0000 1.8 --- test_textwrap.py 22 Aug 2002 19:47:27 -0000 1.9 *************** *** 31,36 **** def check(self, result, expect): self.assertEquals(result, expect, ! 'Expected:\n%s\nbut got:\n%s' % ( ! self.show(result), self.show(expect))) def check_wrap (self, text, width, expect): --- 31,36 ---- def check(self, result, expect): self.assertEquals(result, expect, ! 'expected:\n%s\nbut got:\n%s' % ( ! self.show(expect), self.show(result))) def check_wrap (self, text, width, expect): *************** *** 112,115 **** --- 112,166 ---- "posts-from-tim-peters'ly"]) + def test_em_dash(self): + '''Test text with em-dashes.''' + text = "Em-dashes should be written -- thus." + self.check_wrap(text, 25, + ["Em-dashes should be", + "written -- thus."]) + + # Probe the boundaries of the properly written em-dash, + # ie. " -- ". + self.check_wrap(text, 29, + ["Em-dashes should be written", + "-- thus."]) + expect = ["Em-dashes should be written --", + "thus."] + self.check_wrap(text, 30, expect) + self.check_wrap(text, 35, expect) + self.check_wrap(text, 36, + ["Em-dashes should be written -- thus."]) + + # The improperly written em-dash is handled too, because + # it's adjacent to non-whitespace on both sides. + text = "You can also do--this or even---this." + expect = ["You can also do", + "--this or even", + "---this."] + self.check_wrap(text, 15, expect) + self.check_wrap(text, 16, expect) + expect = ["You can also do--", + "this or even---", + "this."] + self.check_wrap(text, 17, expect) + self.check_wrap(text, 19, expect) + expect = ["You can also do--this or even", + "---this."] + self.check_wrap(text, 29, expect) + self.check_wrap(text, 31, expect) + expect = ["You can also do--this or even---", + "this."] + self.check_wrap(text, 32, expect) + self.check_wrap(text, 35, expect) + + # All of the above behaviour could be deduced by probing the + # _split() method. + text = "Here's an -- em-dash and--here's another---and another!" + result = self.wrapper._split(text) + expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ", + "and", "--", "here's", " ", "another", "---", + "and", " ", "another!"] + self.assertEquals(result, expect, + "\nexpected %r\n" + "but got %r" % (expect, result)) def test_split(self): From gvanrossum@users.sourceforge.net Thu Aug 22 20:57:52 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 12:57:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20518 Modified Files: test_strptime.py Log Message: Standardize behavior: no docstrings in test functions; add a proper test_main() that creates a suite and runs it. Don't mess with sys.path!!! Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_strptime.py 8 Aug 2002 20:19:19 -0000 1.2 --- test_strptime.py 22 Aug 2002 19:57:50 -0000 1.3 *************** *** 1,10 **** """PyUnit testing against strptime >= 2.1.0.""" - import sys - sys.path.append('..') import unittest import time import locale import re import _strptime --- 1,9 ---- """PyUnit testing against strptime >= 2.1.0.""" import unittest import time import locale import re + from test import test_support import _strptime *************** *** 13,17 **** class LocaleTime_Tests(unittest.TestCase): ! """Contains all tests for _strptime.LocaleTime.""" def setUp(self): --- 12,16 ---- class LocaleTime_Tests(unittest.TestCase): ! """Tests for _strptime.LocaleTime.""" def setUp(self): *************** *** 31,51 **** def test_weekday(self): ! """Make sure that full and abbreviated weekday names are correct in ! both string and position with tuple. ! ! """ self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, "Testing of full weekday name failed") self.compare_against_time(self.LT_ins.a_weekday, '%a', 6, "Testing of abbreviated weekday name failed") def test_month(self): ! """Test full and abbreviated month names; both string and position ! within the tuple. ! ! """ self.compare_against_time(self.LT_ins.f_month, '%B', 1, "Testing against full month name failed") self.compare_against_time(self.LT_ins.a_month, '%b', 1, "Testing against abbreviated month name failed") def test_am_pm(self): ! """Make sure AM/PM representation done properly.""" strftime_output = time.strftime("%p", self.time_tuple) self.failUnless(strftime_output in self.LT_ins.am_pm, "AM/PM representation not in tuple") --- 30,46 ---- def test_weekday(self): ! # Make sure that full and abbreviated weekday names are correct in ! # both string and position with tuple self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, "Testing of full weekday name failed") self.compare_against_time(self.LT_ins.a_weekday, '%a', 6, "Testing of abbreviated weekday name failed") def test_month(self): ! # Test full and abbreviated month names; both string and position ! # within the tuple self.compare_against_time(self.LT_ins.f_month, '%B', 1, "Testing against full month name failed") self.compare_against_time(self.LT_ins.a_month, '%b', 1, "Testing against abbreviated month name failed") def test_am_pm(self): ! # Make sure AM/PM representation done properly strftime_output = time.strftime("%p", self.time_tuple) self.failUnless(strftime_output in self.LT_ins.am_pm, "AM/PM representation not in tuple") *************** *** 55,64 **** def test_timezone(self): ! """Make sure timezone is correct.""" if time.strftime("%Z", self.time_tuple): self.compare_against_time(self.LT_ins.timezone, '%Z', 8, "Testing against timezone failed") 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") --- 50,59 ---- def test_timezone(self): ! # Make sure timezone is correct if time.strftime("%Z", self.time_tuple): self.compare_against_time(self.LT_ins.timezone, '%Z', 8, "Testing against timezone failed") 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") *************** *** 69,77 **** def test_lang(self): ! """Make sure lang is set.""" self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], locale.getlocale(locale.LC_TIME)), "Setting of lang failed") def test_by_hand_input(self): ! """Test passed-in initialization value checks.""" self.failUnless(_strptime.LocaleTime(f_weekday=range(7)), "Argument size check for f_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(8)) --- 64,72 ---- def test_lang(self): ! # Make sure lang is set self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], locale.getlocale(locale.LC_TIME)), "Setting of lang failed") def test_by_hand_input(self): ! # Test passed-in initialization value checks self.failUnless(_strptime.LocaleTime(f_weekday=range(7)), "Argument size check for f_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(8)) *************** *** 104,108 **** def test_getitem(self): ! """Make sure that __getitem__ works properly.""" self.failUnless(self.time_re['m'], "Fetching 'm' directive (built-in) failed") self.failUnless(self.time_re['b'], "Fetching 'b' directive (built w/ __tupleToRE) failed") --- 99,103 ---- def test_getitem(self): ! # Make sure that __getitem__ works properly self.failUnless(self.time_re['m'], "Fetching 'm' directive (built-in) failed") self.failUnless(self.time_re['b'], "Fetching 'b' directive (built w/ __tupleToRE) failed") *************** *** 114,118 **** def test_pattern(self): ! """Test TimeRE.pattern.""" pattern_string = self.time_re.pattern(r"%a %A %d") self.failUnless(pattern_string.find(self.locale_time.a_weekday[2]) != -1, "did not find abbreviated weekday in pattern string '%s'" % pattern_string) --- 109,113 ---- def test_pattern(self): ! # Test TimeRE.pattern pattern_string = self.time_re.pattern(r"%a %A %d") self.failUnless(pattern_string.find(self.locale_time.a_weekday[2]) != -1, "did not find abbreviated weekday in pattern string '%s'" % pattern_string) *************** *** 121,125 **** def test_compile(self): ! """Check that compiled regex is correct.""" found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) self.failUnless(found and found.group('A') == self.locale_time.f_weekday[6], "re object for '%A' failed") --- 116,120 ---- def test_compile(self): ! # Check that compiled regex is correct found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) self.failUnless(found and found.group('A') == self.locale_time.f_weekday[6], "re object for '%A' failed") *************** *** 143,151 **** def test_TypeError(self): ! """Make sure ValueError is raised when match fails.""" self.assertRaises(ValueError,_strptime.strptime, data_string="%d", format="%A") def test_returning_RE(self): ! """Make sure that an re can be returned.""" strp_output = _strptime.strptime(False, "%Y") self.failUnless(isinstance(strp_output, type(re.compile(''))), "re object not returned correctly") --- 138,146 ---- def test_TypeError(self): ! # Make sure ValueError is raised when match fails self.assertRaises(ValueError,_strptime.strptime, data_string="%d", format="%A") def test_returning_RE(self): ! # Make sure that an re can be returned strp_output = _strptime.strptime(False, "%Y") self.failUnless(isinstance(strp_output, type(re.compile(''))), "re object not returned correctly") *************** *** 161,179 **** def test_year(self): ! """Test that the year is handled properly.""" for directive in ('y', 'Y'): self.helper(directive, 0) def test_month(self): ! """Test for month directives.""" for directive in ('B', 'b', 'm'): self.helper(directive, 1) def test_day(self): ! """Test for day directives.""" self.helper('d', 2) def test_hour(self): ! """Test hour directives.""" self.helper('H', 3) strf_output = time.strftime("%I %p", self.time_tuple) --- 156,174 ---- def test_year(self): ! # Test that the year is handled properly for directive in ('y', 'Y'): self.helper(directive, 0) def test_month(self): ! # Test for month directives for directive in ('B', 'b', 'm'): self.helper(directive, 1) def test_day(self): ! # Test for day directives self.helper('d', 2) def test_hour(self): ! # Test hour directives self.helper('H', 3) strf_output = time.strftime("%I %p", self.time_tuple) *************** *** 182,207 **** def test_minute(self): ! """Test minute directives.""" self.helper('M', 4) def test_second(self): ! """Test second directives.""" self.helper('S', 5) def test_weekday(self): ! """Test weekday directives.""" for directive in ('A', 'a', 'w'): self.helper(directive,6) def test_julian(self): ! """Test julian directives.""" self.helper('j', 7) def test_timezone(self): ! """Test timezone directives. ! ! When gmtime() is used with %Z, entire result of strftime() is empty. ! ! """ time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone --- 177,199 ---- def test_minute(self): ! # Test minute directives self.helper('M', 4) def test_second(self): ! # Test second directives self.helper('S', 5) def test_weekday(self): ! # Test weekday directives for directive in ('A', 'a', 'w'): self.helper(directive,6) def test_julian(self): ! # Test julian directives self.helper('j', 7) def test_timezone(self): ! # Test timezone directives. ! # When gmtime() is used with %Z, entire result of strftime() is empty. time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone *************** *** 210,229 **** def test_date_time(self): ! """*** Test %c directive. ***""" for position in range(6): self.helper('c', position) def test_date(self): ! """*** Test %x directive. ***""" for position in range(0,3): self.helper('x', position) def test_time(self): ! """*** Test %X directive. ***""" for position in range(3,6): self.helper('X', position) def test_percent(self): ! """Make sure % signs are handled properly.""" strf_output = time.strftime("%m %% %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%m %% %Y") --- 202,221 ---- def test_date_time(self): ! # Test %c directive for position in range(6): self.helper('c', position) def test_date(self): ! # Test %x directive for position in range(0,3): self.helper('x', position) def test_time(self): ! # Test %X directive for position in range(3,6): self.helper('X', position) def test_percent(self): ! # Make sure % signs are handled properly strf_output = time.strftime("%m %% %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%m %% %Y") *************** *** 238,247 **** def test_julianday_result(self): ! """Test julianday.""" result = _strptime.julianday(self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]) self.failUnless(result == self.time_tuple[7], "julianday failed; %s != %s" % (result, self.time_tuple[7])) def test_julianday_trigger(self): ! """Make sure julianday is called.""" strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") --- 230,239 ---- def test_julianday_result(self): ! # Test julianday result = _strptime.julianday(self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]) self.failUnless(result == self.time_tuple[7], "julianday failed; %s != %s" % (result, self.time_tuple[7])) def test_julianday_trigger(self): ! # Make sure julianday is called strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") *************** *** 249,253 **** def test_gregorian_result(self): ! """Test gregorian.""" result = _strptime.gregorian(self.time_tuple[7], self.time_tuple[0]) comparison = [self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]] --- 241,245 ---- def test_gregorian_result(self): ! # Test gregorian result = _strptime.gregorian(self.time_tuple[7], self.time_tuple[0]) comparison = [self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]] *************** *** 255,259 **** def test_gregorian_trigger(self): ! """Test that gregorian() is triggered.""" strf_output = time.strftime("%j %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%j %Y") --- 247,251 ---- def test_gregorian_trigger(self): ! # Test that gregorian() is triggered strf_output = time.strftime("%j %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%j %Y") *************** *** 261,265 **** def test_dayofweek_result(self): ! """Test dayofweek.""" result = _strptime.dayofweek(self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]) comparison = self.time_tuple[6] --- 253,257 ---- def test_dayofweek_result(self): ! # Test dayofweek result = _strptime.dayofweek(self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]) comparison = self.time_tuple[6] *************** *** 267,271 **** def test_dayofweek_trigger(self): ! """Make sure dayofweek() gets triggered.""" strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") --- 259,263 ---- def test_dayofweek_trigger(self): ! # Make sure dayofweek() gets triggered strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") *************** *** 273,279 **** ! if __name__ == '__main__': ! unittest.main() --- 265,277 ---- ! def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(LocaleTime_Tests)) ! suite.addTest(unittest.makeSuite(TimeRETests)) ! suite.addTest(unittest.makeSuite(StrptimeTests)) ! suite.addTest(unittest.makeSuite(FxnTests)) ! test_support.run_suite(suite) if __name__ == '__main__': ! test_main() From gvanrossum@users.sourceforge.net Thu Aug 22 21:02:05 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 13:02:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23773 Modified Files: test_tempfile.py Log Message: Standardize behavior: no docstrings in test functions. Also get rid of dummy_test_TemporaryFile class; when NamedTemporaryFile and TemporaryFile are the same, simply don't add a test suite for TemporaryFile. Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_tempfile.py 18 Aug 2002 06:47:19 -0000 1.9 --- test_tempfile.py 22 Aug 2002 20:02:03 -0000 1.10 *************** *** 59,63 **** class test_exports(TC): def test_exports(self): ! """There are no surprising symbols in the tempfile module""" dict = tempfile.__dict__ --- 59,63 ---- class test_exports(TC): def test_exports(self): ! # There are no surprising symbols in the tempfile module dict = tempfile.__dict__ *************** *** 92,101 **** def test_get_six_char_str(self): ! """_RandomNameSequence returns a six-character string""" s = self.r.next() self.nameCheck(s, '', '', '') def test_many(self): ! """_RandomNameSequence returns no duplicate strings (stochastic)""" dict = {} --- 92,101 ---- def test_get_six_char_str(self): ! # _RandomNameSequence returns a six-character string s = self.r.next() self.nameCheck(s, '', '', '') def test_many(self): ! # _RandomNameSequence returns no duplicate strings (stochastic) dict = {} *************** *** 108,112 **** def test_supports_iter(self): ! """_RandomNameSequence supports the iterator protocol""" i = 0 --- 108,112 ---- def test_supports_iter(self): ! # _RandomNameSequence supports the iterator protocol i = 0 *************** *** 127,131 **** def test_nonempty_list(self): ! """_candidate_tempdir_list returns a nonempty list of strings""" cand = tempfile._candidate_tempdir_list() --- 127,131 ---- def test_nonempty_list(self): ! # _candidate_tempdir_list returns a nonempty list of strings cand = tempfile._candidate_tempdir_list() *************** *** 137,141 **** def test_wanted_dirs(self): ! """_candidate_tempdir_list contains the expected directories""" # Make sure the interesting environment variables are all set. --- 137,141 ---- def test_wanted_dirs(self): ! # _candidate_tempdir_list contains the expected directories # Make sure the interesting environment variables are all set. *************** *** 178,187 **** def test_retval(self): ! """_get_candidate_names returns a _RandomNameSequence object""" obj = tempfile._get_candidate_names() self.assert_(isinstance(obj, tempfile._RandomNameSequence)) def test_same_thing(self): ! """_get_candidate_names always returns the same object""" a = tempfile._get_candidate_names() b = tempfile._get_candidate_names() --- 178,187 ---- def test_retval(self): ! # _get_candidate_names returns a _RandomNameSequence object obj = tempfile._get_candidate_names() self.assert_(isinstance(obj, tempfile._RandomNameSequence)) def test_same_thing(self): ! # _get_candidate_names always returns the same object a = tempfile._get_candidate_names() b = tempfile._get_candidate_names() *************** *** 226,230 **** def test_basic(self): ! """_mkstemp_inner can create files""" self.do_create().write("blat") self.do_create(pre="a").write("blat") --- 226,230 ---- def test_basic(self): ! # _mkstemp_inner can create files self.do_create().write("blat") self.do_create(pre="a").write("blat") *************** *** 234,238 **** def test_basic_many(self): ! """_mkstemp_inner can create many files (stochastic)""" extant = range(TEST_FILES) for i in extant: --- 234,238 ---- def test_basic_many(self): ! # _mkstemp_inner can create many files (stochastic) extant = range(TEST_FILES) for i in extant: *************** *** 240,244 **** def test_choose_directory(self): ! """_mkstemp_inner can create files in a user-selected directory""" dir = tempfile.mkdtemp() try: --- 240,244 ---- def test_choose_directory(self): ! # _mkstemp_inner can create files in a user-selected directory dir = tempfile.mkdtemp() try: *************** *** 248,252 **** def test_file_mode(self): ! """_mkstemp_inner creates files with the proper mode""" if not has_stat: return # ugh, can't use TestSkipped. --- 248,252 ---- def test_file_mode(self): ! # _mkstemp_inner creates files with the proper mode if not has_stat: return # ugh, can't use TestSkipped. *************** *** 263,267 **** def test_noinherit(self): ! """_mkstemp_inner file handles are not inherited by child processes""" if not has_spawnl: return # ugh, can't use TestSkipped. --- 263,267 ---- def test_noinherit(self): ! # _mkstemp_inner file handles are not inherited by child processes if not has_spawnl: return # ugh, can't use TestSkipped. *************** *** 293,297 **** def test_textmode(self): ! """_mkstemp_inner can create files in text mode""" if not has_textmode: return # ugh, can't use TestSkipped. --- 293,297 ---- def test_textmode(self): ! # _mkstemp_inner can create files in text mode if not has_textmode: return # ugh, can't use TestSkipped. *************** *** 307,311 **** def test_sane_template(self): ! """gettempprefix returns a nonempty prefix string""" p = tempfile.gettempprefix() --- 307,311 ---- def test_sane_template(self): ! # gettempprefix returns a nonempty prefix string p = tempfile.gettempprefix() *************** *** 314,318 **** def test_usable_template(self): ! """gettempprefix returns a usable prefix string""" # Create a temp directory, avoiding use of the prefix. --- 314,318 ---- def test_usable_template(self): ! # gettempprefix returns a usable prefix string # Create a temp directory, avoiding use of the prefix. *************** *** 339,343 **** def test_directory_exists(self): ! """gettempdir returns a directory which exists""" dir = tempfile.gettempdir() --- 339,343 ---- def test_directory_exists(self): ! # gettempdir returns a directory which exists dir = tempfile.gettempdir() *************** *** 348,352 **** def test_directory_writable(self): ! """gettempdir returns a directory writable by the user""" # sneaky: just instantiate a NamedTemporaryFile, which --- 348,352 ---- def test_directory_writable(self): ! # gettempdir returns a directory writable by the user # sneaky: just instantiate a NamedTemporaryFile, which *************** *** 361,365 **** def test_same_thing(self): ! """gettempdir always returns the same object""" a = tempfile.gettempdir() b = tempfile.gettempdir() --- 361,365 ---- def test_same_thing(self): ! # gettempdir always returns the same object a = tempfile.gettempdir() b = tempfile.gettempdir() *************** *** 372,375 **** --- 372,376 ---- class test_mkstemp(TC): """Test mkstemp().""" + def do_create(self, dir=None, pre="", suf="", ): if dir is None: *************** *** 387,391 **** def test_basic(self): ! """mkstemp can create files""" self.do_create() self.do_create(pre="a") --- 388,392 ---- def test_basic(self): ! # mkstemp can create files self.do_create() self.do_create(pre="a") *************** *** 395,399 **** def test_choose_directory(self): ! """mkstemp can create directories in a user-selected directory""" dir = tempfile.mkdtemp() try: --- 396,400 ---- def test_choose_directory(self): ! # mkstemp can create directories in a user-selected directory dir = tempfile.mkdtemp() try: *************** *** 424,428 **** def test_basic(self): ! """mkdtemp can create directories""" os.rmdir(self.do_create()) os.rmdir(self.do_create(pre="a")) --- 425,429 ---- def test_basic(self): ! # mkdtemp can create directories os.rmdir(self.do_create()) os.rmdir(self.do_create(pre="a")) *************** *** 432,436 **** def test_basic_many(self): ! """mkdtemp can create many directories (stochastic)""" extant = range(TEST_FILES) try: --- 433,437 ---- def test_basic_many(self): ! # mkdtemp can create many directories (stochastic) extant = range(TEST_FILES) try: *************** *** 443,447 **** def test_choose_directory(self): ! """mkdtemp can create directories in a user-selected directory""" dir = tempfile.mkdtemp() try: --- 444,448 ---- def test_choose_directory(self): ! # mkdtemp can create directories in a user-selected directory dir = tempfile.mkdtemp() try: *************** *** 451,455 **** def test_mode(self): ! """mkdtemp creates directories with the proper mode""" if not has_stat: return # ugh, can't use TestSkipped. --- 452,456 ---- def test_mode(self): ! # mkdtemp creates directories with the proper mode if not has_stat: return # ugh, can't use TestSkipped. *************** *** 512,516 **** def test_basic(self): ! """mktemp can choose usable file names""" self.do_create() self.do_create(pre="a") --- 513,517 ---- def test_basic(self): ! # mktemp can choose usable file names self.do_create() self.do_create(pre="a") *************** *** 520,524 **** def test_many(self): ! """mktemp can choose many usable file names (stochastic)""" extant = range(TEST_FILES) for i in extant: --- 521,525 ---- def test_many(self): ! # mktemp can choose many usable file names (stochastic) extant = range(TEST_FILES) for i in extant: *************** *** 526,530 **** def test_warning(self): ! """mktemp issues a warning when used""" warnings.filterwarnings("error", category=RuntimeWarning, --- 527,531 ---- def test_warning(self): ! # mktemp issues a warning when used warnings.filterwarnings("error", category=RuntimeWarning, *************** *** 555,559 **** def test_basic(self): ! """NamedTemporaryFile can create files""" self.do_create() self.do_create(pre="a") --- 556,560 ---- def test_basic(self): ! # NamedTemporaryFile can create files self.do_create() self.do_create(pre="a") *************** *** 563,567 **** def test_creates_named(self): ! """NamedTemporaryFile creates files with names""" f = tempfile.NamedTemporaryFile() self.failUnless(os.path.exists(f.name), --- 564,568 ---- def test_creates_named(self): ! # NamedTemporaryFile creates files with names f = tempfile.NamedTemporaryFile() self.failUnless(os.path.exists(f.name), *************** *** 569,573 **** def test_del_on_close(self): ! """A NamedTemporaryFile is deleted when closed""" dir = tempfile.mkdtemp() try: --- 570,574 ---- def test_del_on_close(self): ! # A NamedTemporaryFile is deleted when closed dir = tempfile.mkdtemp() try: *************** *** 581,585 **** def test_multiple_close(self): ! """A NamedTemporaryFile can be closed many times without error""" f = tempfile.NamedTemporaryFile() --- 582,586 ---- def test_multiple_close(self): ! # A NamedTemporaryFile can be closed many times without error f = tempfile.NamedTemporaryFile() *************** *** 601,605 **** def test_basic(self): ! """TemporaryFile can create files""" # No point in testing the name params - the file has no name. try: --- 602,606 ---- def test_basic(self): ! # TemporaryFile can create files # No point in testing the name params - the file has no name. try: *************** *** 609,613 **** def test_has_no_name(self): ! """TemporaryFile creates files with no names (on this system)""" dir = tempfile.mkdtemp() f = tempfile.TemporaryFile(dir=dir) --- 610,614 ---- def test_has_no_name(self): ! # TemporaryFile creates files with no names (on this system) dir = tempfile.mkdtemp() f = tempfile.TemporaryFile(dir=dir) *************** *** 626,630 **** def test_multiple_close(self): ! """A TemporaryFile can be closed many times without error""" f = tempfile.TemporaryFile() f.write('abc\n') --- 627,631 ---- def test_multiple_close(self): ! # A TemporaryFile can be closed many times without error f = tempfile.TemporaryFile() f.write('abc\n') *************** *** 638,649 **** # How to test the mode and bufsize parameters? - class dummy_test_TemporaryFile(TC): - def test_dummy(self): - """TemporaryFile and NamedTemporaryFile are the same (on this system)""" - pass ! if tempfile.NamedTemporaryFile is tempfile.TemporaryFile: ! test_classes.append(dummy_test_TemporaryFile) ! else: test_classes.append(test_TemporaryFile) --- 639,644 ---- # How to test the mode and bufsize parameters? ! if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile: test_classes.append(test_TemporaryFile) From gvanrossum@users.sourceforge.net Thu Aug 22 21:08:16 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 13:08:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test README,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28357 Modified Files: README Log Message: Document that docstrings are verboten for test functions. Expand the example to show some actual test functions, and a setUp() and tearDown() method. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** README 23 Jul 2002 19:13:45 -0000 1.15 --- README 22 Aug 2002 20:08:14 -0000 1.16 *************** *** 49,54 **** underscores. All PyUnit-based tests in the Python test suite use boilerplate that ! looks like this: import unittest --- 49,60 ---- underscores. + Test methods should *not* have docstrings! The unittest module prints + the docstring if there is one, but otherwise prints the function name + and the full class name. When there's a problem with a test, the + latter information makes it easier to find the source for the test + than the docstring. + All PyUnit-based tests in the Python test suite use boilerplate that ! looks like this (with minor variations): import unittest *************** *** 56,68 **** class MyTestCase1(unittest.TestCase): ! # define test methods here... class MyTestCase2(unittest.TestCase): ! # define more test methods here... def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(MyTestCase1)) ! suite.addTest(unittest.makeSuite(MyTestCase2)) test_support.run_suite(suite) --- 62,96 ---- class MyTestCase1(unittest.TestCase): ! ! # Define setUp and tearDown only if needed ! ! def setUp(self): ! unittest.TestCase.setUp(self) ! ... additional initialization... ! ! def tearDown(self): ! ... additional finalization... ! unittest.TestCase.tearDown(self) ! ! def test_feature_one(self): ! # Testing feature one ! ...unit test for feature one... ! ! def test_feature_two(self): ! # Testing feature two ! ...unit test for feature two... ! ! ...etc... class MyTestCase2(unittest.TestCase): ! ...same structure as MyTestCase1... ! ! ...etc... def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(MyTestCase1)) ! suite.addTest(unittest.makeSuite(MyTestCase2)) ! ...add more suites... test_support.run_suite(suite) From gvanrossum@users.sourceforge.net Thu Aug 22 21:13:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 13:13:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32260 Modified Files: test_textwrap.py Log Message: Standardize behavior: no docstrings in test functions. Also strip trailing whitespace. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_textwrap.py 22 Aug 2002 19:47:27 -0000 1.9 --- test_textwrap.py 22 Aug 2002 20:13:47 -0000 1.10 *************** *** 30,34 **** def check(self, result, expect): ! self.assertEquals(result, expect, 'expected:\n%s\nbut got:\n%s' % ( self.show(expect), self.show(result))) --- 30,34 ---- def check(self, result, expect): ! self.assertEquals(result, expect, 'expected:\n%s\nbut got:\n%s' % ( self.show(expect), self.show(result))) *************** *** 45,49 **** def test_simple(self): ! '''Simple case: just words, spaces, and a bit of punctuation.''' text = "Hello there, how are you this fine day? I'm glad to hear it!" --- 45,49 ---- def test_simple(self): ! # Simple case: just words, spaces, and a bit of punctuation text = "Hello there, how are you this fine day? I'm glad to hear it!" *************** *** 63,67 **** def test_whitespace(self): ! '''Whitespace munging and end-of-sentence detection.''' text = """\ --- 63,67 ---- def test_whitespace(self): ! # Whitespace munging and end-of-sentence detection text = """\ *************** *** 87,91 **** def test_wrap_short(self): ! '''Wrapping to make short lines longer.''' text = "This is a\nshort paragraph." --- 87,91 ---- def test_wrap_short(self): ! # Wrapping to make short lines longer text = "This is a\nshort paragraph." *************** *** 97,101 **** def test_hyphenated(self): ! '''Test breaking hyphenated words.''' text = ("this-is-a-useful-feature-for-" --- 97,101 ---- def test_hyphenated(self): ! # Test breaking hyphenated words text = ("this-is-a-useful-feature-for-" *************** *** 113,117 **** def test_em_dash(self): ! '''Test text with em-dashes.''' text = "Em-dashes should be written -- thus." self.check_wrap(text, 25, --- 113,117 ---- def test_em_dash(self): ! # Test text with em-dashes text = "Em-dashes should be written -- thus." self.check_wrap(text, 25, *************** *** 130,134 **** self.check_wrap(text, 36, ["Em-dashes should be written -- thus."]) ! # The improperly written em-dash is handled too, because # it's adjacent to non-whitespace on both sides. --- 130,134 ---- self.check_wrap(text, 36, ["Em-dashes should be written -- thus."]) ! # The improperly written em-dash is handled too, because # it's adjacent to non-whitespace on both sides. *************** *** 165,170 **** def test_split(self): ! '''Ensure that the standard _split() method works as advertised ! in the comments.''' text = "Hello there -- you goof-ball, use the -b option!" --- 165,170 ---- def test_split(self): ! # Ensure that the standard _split() method works as advertised ! # in the comments text = "Hello there -- you goof-ball, use the -b option!" *************** *** 185,189 **** def test_break_long(self): ! '''Wrap text with long words and lots of punctuation.''' self.check_wrap(self.text, 30, --- 185,189 ---- def test_break_long(self): ! # Wrap text with long words and lots of punctuation self.check_wrap(self.text, 30, *************** *** 197,202 **** ! def test_nobreak_long(self): ! '''Test with break_long_words disabled.''' self.wrapper.break_long_words = 0 self.wrapper.width = 30 --- 197,202 ---- ! def test_nobreak_long(self): ! # Test with break_long_words disabled self.wrapper.break_long_words = 0 self.wrapper.width = 30 *************** *** 205,209 **** 'How *do* you spell that odd', 'word, anyways?' ! ] result = self.wrapper.wrap(self.text) self.check(result, expect) --- 205,209 ---- 'How *do* you spell that odd', 'word, anyways?' ! ] result = self.wrapper.wrap(self.text) self.check(result, expect) *************** *** 225,229 **** def test_fill(self): ! '''Test the fill() method.''' expect = '''\ --- 225,229 ---- def test_fill(self): ! # Test the fill() method expect = '''\ *************** *** 237,241 **** def test_initial_indent(self): ! '''Test initial_indent parameter.''' expect = [" This paragraph will be filled,", --- 237,241 ---- def test_initial_indent(self): ! # Test initial_indent parameter expect = [" This paragraph will be filled,", *************** *** 251,255 **** def test_subsequent_indent(self): ! '''Test subsequent_indent parameter.''' expect = '''\ --- 251,255 ---- def test_subsequent_indent(self): ! # Test subsequent_indent parameter expect = '''\ From gvanrossum@users.sourceforge.net Thu Aug 22 21:18:41 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 13:18:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_timeout.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3048 Modified Files: test_timeout.py Log Message: Standardize behavior: no docstrings in test functions. Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_timeout.py 23 Jul 2002 19:04:06 -0000 1.7 --- test_timeout.py 22 Aug 2002 20:18:38 -0000 1.8 *************** *** 18,27 **** def testObjectCreation(self): ! "Test Socket creation" self.assertEqual(self.sock.gettimeout(), None, "timeout not disabled by default") def testFloatReturnValue(self): ! "Test return value of gettimeout()" self.sock.settimeout(7.345) self.assertEqual(self.sock.gettimeout(), 7.345) --- 18,27 ---- def testObjectCreation(self): ! # Test Socket creation self.assertEqual(self.sock.gettimeout(), None, "timeout not disabled by default") def testFloatReturnValue(self): ! # Test return value of gettimeout() self.sock.settimeout(7.345) self.assertEqual(self.sock.gettimeout(), 7.345) *************** *** 34,38 **** def testReturnType(self): ! "Test return type of gettimeout()" self.sock.settimeout(1) self.assertEqual(type(self.sock.gettimeout()), type(1.0)) --- 34,38 ---- def testReturnType(self): ! # Test return type of gettimeout() self.sock.settimeout(1) self.assertEqual(type(self.sock.gettimeout()), type(1.0)) *************** *** 42,46 **** def testTypeCheck(self): ! "Test type checking by settimeout()" self.sock.settimeout(0) self.sock.settimeout(0L) --- 42,46 ---- def testTypeCheck(self): ! # Test type checking by settimeout() self.sock.settimeout(0) self.sock.settimeout(0L) *************** *** 55,59 **** def testRangeCheck(self): ! "Test range checking by settimeout()" self.assertRaises(ValueError, self.sock.settimeout, -1) self.assertRaises(ValueError, self.sock.settimeout, -1L) --- 55,59 ---- def testRangeCheck(self): ! # Test range checking by settimeout() self.assertRaises(ValueError, self.sock.settimeout, -1) self.assertRaises(ValueError, self.sock.settimeout, -1L) *************** *** 61,65 **** def testTimeoutThenBlocking(self): ! "Test settimeout() followed by setblocking()" self.sock.settimeout(10) self.sock.setblocking(1) --- 61,65 ---- def testTimeoutThenBlocking(self): ! # Test settimeout() followed by setblocking() self.sock.settimeout(10) self.sock.setblocking(1) *************** *** 75,79 **** def testBlockingThenTimeout(self): ! "Test setblocking() followed by settimeout()" self.sock.setblocking(0) self.sock.settimeout(1) --- 75,79 ---- def testBlockingThenTimeout(self): ! # Test setblocking() followed by settimeout() self.sock.setblocking(0) self.sock.settimeout(1) *************** *** 99,103 **** def testConnectTimeout(self): ! "Test connect() timeout" _timeout = 0.02 self.sock.settimeout(_timeout) --- 99,103 ---- def testConnectTimeout(self): ! # Test connect() timeout _timeout = 0.02 self.sock.settimeout(_timeout) *************** *** 114,118 **** def testRecvTimeout(self): ! "Test recv() timeout" _timeout = 0.02 self.sock.connect(self.addr_remote) --- 114,118 ---- def testRecvTimeout(self): ! # Test recv() timeout _timeout = 0.02 self.sock.connect(self.addr_remote) *************** *** 129,133 **** def testAcceptTimeout(self): ! "Test accept() timeout" _timeout = 2 self.sock.settimeout(_timeout) --- 129,133 ---- def testAcceptTimeout(self): ! # Test accept() timeout _timeout = 2 self.sock.settimeout(_timeout) *************** *** 145,149 **** def testRecvfromTimeout(self): ! "Test recvfrom() timeout" _timeout = 2 self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) --- 145,149 ---- def testRecvfromTimeout(self): ! # Test recvfrom() timeout _timeout = 2 self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) *************** *** 161,175 **** def testSend(self): ! "Test send() timeout" # couldn't figure out how to test it pass def testSendto(self): ! "Test sendto() timeout" # couldn't figure out how to test it pass def testSendall(self): ! "Test sendall() timeout" # couldn't figure out how to test it pass --- 161,175 ---- def testSend(self): ! # Test send() timeout # couldn't figure out how to test it pass def testSendto(self): ! # Test sendto() timeout # couldn't figure out how to test it pass def testSendall(self): ! # Test sendall() timeout # couldn't figure out how to test it pass From gvanrossum@users.sourceforge.net Thu Aug 22 21:21:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 13:21:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4914 Modified Files: test_weakref.py Log Message: Standardize behavior: no docstrings in test functions. Also use unittest.makeSuite() rather than loader.loadTestsFromTestCase(). Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_weakref.py 23 Jul 2002 19:04:09 -0000 1.20 --- test_weakref.py 22 Aug 2002 20:21:30 -0000 1.21 *************** *** 75,80 **** def test_multiple_selfref_callbacks(self): ! """Make sure all references are invalidated before callbacks ! are called.""" # # What's important here is that we're using the first --- 75,79 ---- def test_multiple_selfref_callbacks(self): ! # Make sure all references are invalidated before callbacks are called # # What's important here is that we're using the first *************** *** 263,267 **** def test_callbacks_protected(self): ! """Callbacks protected from already-set exceptions?""" # Regression test for SF bug #478534. class BogusError(Exception): --- 262,266 ---- def test_callbacks_protected(self): ! # Callbacks protected from already-set exceptions? # Regression test for SF bug #478534. class BogusError(Exception): *************** *** 521,528 **** def test_main(): - loader = unittest.TestLoader() suite = unittest.TestSuite() ! suite.addTest(loader.loadTestsFromTestCase(ReferencesTestCase)) ! suite.addTest(loader.loadTestsFromTestCase(MappingTestCase)) test_support.run_suite(suite) --- 520,526 ---- def test_main(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(ReferencesTestCase)) ! suite.addTest(unittest.makeSuite(MappingTestCase)) test_support.run_suite(suite) From gvanrossum@users.sourceforge.net Thu Aug 22 21:22:18 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 13:22:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_whichdb.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5436 Modified Files: test_whichdb.py Log Message: Standardize behavior: no docstrings in test functions. Index: test_whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_whichdb.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_whichdb.py 9 Aug 2002 16:37:36 -0000 1.3 --- test_whichdb.py 22 Aug 2002 20:22:16 -0000 1.4 *************** *** 43,50 **** continue ! def test_whichdb_name(self,name=name,mod=mod): ! """Check whether whichdb correctly guesses module name ! for databases opened with module mod. ! """ f = mod.open(_fname, 'c') f["1"] = "1" --- 43,49 ---- continue ! def test_whichdb_name(self, name=name, mod=mod): ! # Check whether whichdb correctly guesses module name ! # for databases opened with module mod. f = mod.open(_fname, 'c') f["1"] = "1" From gward@users.sourceforge.net Thu Aug 22 22:04:23 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 14:04:23 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5474 Modified Files: textwrap.py Log Message: Fix SF bug #596434: tweak wordsep_re so "--foo-bar" now splits into /--foo-/bar/ rather than /--/foo-/bar/. Needed for Optik and Docutils to handle Unix-style command-line options properly. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** textwrap.py 16 Jul 2002 21:35:23 -0000 1.13 --- textwrap.py 22 Aug 2002 21:04:21 -0000 1.14 *************** *** 56,60 **** # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace ! r'\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=\w)-{2,}(?=\w))') # em-dash --- 56,60 ---- # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace ! r'-*\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=\w)-{2,}(?=\w))') # em-dash From gward@users.sourceforge.net Thu Aug 22 22:10:10 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 14:10:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12274 Modified Files: test_textwrap.py Log Message: Add test_unix_options() to WrapTestCase to test for SF bug #596434. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_textwrap.py 22 Aug 2002 20:13:47 -0000 1.10 --- test_textwrap.py 22 Aug 2002 21:10:07 -0000 1.11 *************** *** 164,167 **** --- 164,195 ---- "but got %r" % (expect, result)) + def test_unix_options (self): + # Test that Unix-style command-line options are wrapped correctly. + # Both Optik (OptionParser) and Docutils rely on this behaviour! + + text = "You should use the -n option, or --dry-run in its long form." + self.check_wrap(text, 20, + ["You should use the", + "-n option, or --dry-", + "run in its long", + "form."]) + self.check_wrap(text, 21, + ["You should use the -n", + "option, or --dry-run", + "in its long form."]) + expect = ["You should use the -n option, or", + "--dry-run in its long form."] + self.check_wrap(text, 32, expect) + self.check_wrap(text, 34, expect) + self.check_wrap(text, 35, expect) + self.check_wrap(text, 38, expect) + expect = ["You should use the -n option, or --dry-", + "run in its long form."] + self.check_wrap(text, 39, expect) + self.check_wrap(text, 41, expect) + expect = ["You should use the -n option, or --dry-run", + "in its long form."] + self.check_wrap(text, 42, expect) + def test_split(self): # Ensure that the standard _split() method works as advertised From gward@users.sourceforge.net Thu Aug 22 22:12:56 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 14:12:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14186 Modified Files: test_textwrap.py Log Message: Test _split() method in test_unix_options(). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_textwrap.py 22 Aug 2002 21:10:07 -0000 1.11 --- test_textwrap.py 22 Aug 2002 21:12:54 -0000 1.12 *************** *** 192,195 **** --- 192,204 ---- self.check_wrap(text, 42, expect) + # Again, all of the above can be deduced from _split(). + text = "the -n option, or --dry-run or --dryrun" + result = self.wrapper._split(text) + expect = ["the", " ", "-n", " ", "option,", " ", "or", " ", + "--dry-", "run", " ", "or", " ", "--dryrun"] + self.assertEquals(result, expect, + "\nexpected %r\n" + "but got %r" % (expect, result)) + def test_split(self): # Ensure that the standard _split() method works as advertised From gward@users.sourceforge.net Thu Aug 22 22:16:28 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 14:16:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17027 Modified Files: test_textwrap.py Log Message: Factored out BaseTestCase.check_split() method -- use it wherever we need to test TextWrapper._split(). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_textwrap.py 22 Aug 2002 21:12:54 -0000 1.12 --- test_textwrap.py 22 Aug 2002 21:16:25 -0000 1.13 *************** *** 38,41 **** --- 38,47 ---- self.check(result, expect) + def check_split (self, wrapper, text, expect): + result = wrapper._split(text) + self.assertEquals(result, expect, + "\nexpected %r\n" + "but got %r" % (expect, result)) + class WrapTestCase(BaseTestCase): *************** *** 156,166 **** # _split() method. text = "Here's an -- em-dash and--here's another---and another!" - result = self.wrapper._split(text) expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ", "and", "--", "here's", " ", "another", "---", "and", " ", "another!"] ! self.assertEquals(result, expect, ! "\nexpected %r\n" ! "but got %r" % (expect, result)) def test_unix_options (self): --- 162,169 ---- # _split() method. text = "Here's an -- em-dash and--here's another---and another!" expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ", "and", "--", "here's", " ", "another", "---", "and", " ", "another!"] ! self.check_split(self.wrapper, text, expect) def test_unix_options (self): *************** *** 194,203 **** # Again, all of the above can be deduced from _split(). text = "the -n option, or --dry-run or --dryrun" - result = self.wrapper._split(text) expect = ["the", " ", "-n", " ", "option,", " ", "or", " ", "--dry-", "run", " ", "or", " ", "--dryrun"] ! self.assertEquals(result, expect, ! "\nexpected %r\n" ! "but got %r" % (expect, result)) def test_split(self): --- 197,203 ---- # Again, all of the above can be deduced from _split(). text = "the -n option, or --dry-run or --dryrun" expect = ["the", " ", "-n", " ", "option,", " ", "or", " ", "--dry-", "run", " ", "or", " ", "--dryrun"] ! self.check_split(self.wrapper, text, expect) def test_split(self): From gward@users.sourceforge.net Thu Aug 22 22:27:07 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 14:27:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27873 Modified Files: test_textwrap.py Log Message: Test an em-dash with adjacent punctuation. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_textwrap.py 22 Aug 2002 21:16:25 -0000 1.13 --- test_textwrap.py 22 Aug 2002 21:27:05 -0000 1.14 *************** *** 167,170 **** --- 167,176 ---- self.check_split(self.wrapper, text, expect) + text = "and then--bam!--he was gone" + expect = ["and", " ", "then", "--", "bam!", "--", + "he", " ", "was", " ", "gone"] + self.check_split(self.wrapper, text, expect) + + def test_unix_options (self): # Test that Unix-style command-line options are wrapped correctly. From gward@users.sourceforge.net Thu Aug 22 22:28:02 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 Aug 2002 14:28:02 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29547 Modified Files: textwrap.py Log Message: Tweak wordsep_re again: this time to recognize an em-dash with any non-whitespace characters adjacent, not just \w. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** textwrap.py 22 Aug 2002 21:04:21 -0000 1.14 --- textwrap.py 22 Aug 2002 21:28:00 -0000 1.15 *************** *** 57,61 **** wordsep_re = re.compile(r'(\s+|' # any whitespace r'-*\w{2,}-(?=\w{2,})|' # hyphenated words ! r'(?<=\w)-{2,}(?=\w))') # em-dash # XXX will there be a locale-or-charset-aware version of --- 57,61 ---- wordsep_re = re.compile(r'(\s+|' # any whitespace r'-*\w{2,}-(?=\w{2,})|' # hyphenated words ! r'(?<=\S)-{2,}(?=\S))') # em-dash # XXX will there be a locale-or-charset-aware version of From tim_one@users.sourceforge.net Fri Aug 23 03:36:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 Aug 2002 19:36:10 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes mboxcount.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv29337 Added Files: mboxcount.py Log Message: Utility to count and display the # of msgs in (one or more) Unix mboxes. --- NEW FILE: mboxcount.py --- #! /usr/bin/env python """Count the number of messages in Unix mboxes. Usage: %(programs)s [-g] [-h] path1 ... Options: -h Print this help message and exit -g Do globbing on each path. This is helpful on Windows, where the native shells don't glob. """ """ Stats for Barry's corpora, as of 22-Aug-2002: \code\edu-sig-clean.mbox 252 \code\python-dev-clean.mbox 8326 \code\mailman-developers-clean.mbox 2427 \code\python-list-clean.mbox 85500 \code\zope3-clean.mbox 2177 """ import sys import mailbox import email import getopt import glob program = sys.argv[0] def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def _factory(fp): try: return email.message_from_file(fp) except email.Errors.MessageParseError: return None def count(fname): fp = open(fname, 'rb') mbox = mailbox.PortableUnixMailbox(fp, _factory) count = 0 for msg in mbox: count += 1 fp.close() return count def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hg', ['help']) except getopt.error, msg: usage(1, msg) doglob = False for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt == '-g': doglob = True for path in args: if doglob: fnames = glob.glob(path) else: fnames = [path] for fname in fnames: n = count(fname) print "%-50s %7d" % (fname, n) if __name__ == '__main__': main() From tim_one@users.sourceforge.net Fri Aug 23 03:12:02 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 Aug 2002 19:12:02 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes split.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv23927 Modified Files: split.py Log Message: Open files in binary mode. Else, e.g., about 400MB of Barry's python-list corpus vanishes on Windows. Also use file.write() instead of print>>, as the latter invents an extra newline. Index: split.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/split.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** split.py 20 Aug 2002 22:07:17 -0000 1.3 --- split.py 23 Aug 2002 02:11:57 -0000 1.4 *************** *** 77,83 **** # Cruise ! bin1out = open(bin1, 'w') ! bin2out = open(bin2, 'w') ! infp = open(mboxfile) mbox = mailbox.PortableUnixMailbox(infp, _factory) --- 77,83 ---- # Cruise ! bin1out = open(bin1, 'wb') ! bin2out = open(bin2, 'wb') ! infp = open(mboxfile, 'rb') mbox = mailbox.PortableUnixMailbox(infp, _factory) *************** *** 87,91 **** else: outfp = bin2out ! print >> outfp, msg outfp.close() --- 87,93 ---- else: outfp = bin2out ! astext = str(msg) ! assert astext.endswith('\n') ! outfp.write(astext) outfp.close() From gvanrossum@users.sourceforge.net Fri Aug 23 02:36:03 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 22 Aug 2002 18:36:03 -0700 Subject: [Python-checkins] python/dist/src/Lib pyclbr.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15469 Modified Files: pyclbr.py Log Message: Rewritten using the tokenize module, which gives us a real tokenizer rather than a number of approximating regular expressions. Alas, it is 3-4 times slower. Let that be a challenge for the tokenize module. Index: pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pyclbr.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pyclbr.py 3 Jun 2002 15:58:31 -0000 1.26 --- pyclbr.py 23 Aug 2002 01:36:01 -0000 1.27 *************** *** 5,12 **** The interface consists of a single function: ! readmodule(module, path) module is the name of a Python module, path is an optional list of directories where the module is to be searched. If present, path is ! prepended to the system search path sys.path. The return value is a dictionary. The keys of the dictionary are the names of the classes defined in the module (including classes --- 5,13 ---- The interface consists of a single function: ! readmodule_ex(module [, path[, inpackage]]) module is the name of a Python module, path is an optional list of directories where the module is to be searched. If present, path is ! prepended to the system search path sys.path. (inpackage is used ! internally to search for a submodule of a package.) The return value is a dictionary. The keys of the dictionary are the names of the classes defined in the module (including classes *************** *** 29,38 **** shouldn't happen often. BUGS - - Continuation lines are not dealt with at all, except inside strings. - Nested classes and functions can confuse it. - - Code that doesn't pass tabnanny or python -t will confuse it, unless - you set the module TABWIDTH vrbl (default 8) to the correct tab width - for the file. PACKAGE RELATED BUGS --- 30,37 ---- shouldn't happen often. + XXX describe the Function class. + BUGS - Nested classes and functions can confuse it. PACKAGE RELATED BUGS *************** *** 53,119 **** import sys import imp ! import re ! import string __all__ = ["readmodule"] - TABWIDTH = 8 - - _getnext = re.compile(r""" - (?P - \""" [^"\\]* (?: - (?: \\. | "(?!"") ) - [^"\\]* - )* - \""" - - | ''' [^'\\]* (?: - (?: \\. | '(?!'') ) - [^'\\]* - )* - ''' - - | " [^"\\\n]* (?: \\. [^"\\\n]*)* " - - | ' [^'\\\n]* (?: \\. [^'\\\n]*)* ' - ) - - | (?P - ^ - (?P [ \t]* ) - def [ \t]+ - (?P [a-zA-Z_] \w* ) - [ \t]* \( - ) - - | (?P - ^ - (?P [ \t]* ) - class [ \t]+ - (?P [a-zA-Z_] \w* ) - [ \t]* - (?P \( [^)\n]* \) )? - [ \t]* : - ) - - | (?P - ^ import [ \t]+ - (?P [^#;\n]+ ) - ) - - | (?P - ^ from [ \t]+ - (?P - [a-zA-Z_] \w* - (?: - [ \t]* \. [ \t]* [a-zA-Z_] \w* - )* - ) - [ \t]+ - import [ \t]+ - (?P [^#;\n]+ ) - ) - """, re.VERBOSE | re.DOTALL | re.MULTILINE).search - _modules = {} # cache of modules we've seen --- 52,60 ---- import sys import imp ! import tokenize # Python tokenizer ! from token import NAME __all__ = ["readmodule"] _modules = {} # cache of modules we've seen *************** *** 141,145 **** assert 0, "Function._addmethod() shouldn't be called" ! def readmodule(module, path=[], inpackage=0): '''Backwards compatible interface. --- 82,86 ---- assert 0, "Function._addmethod() shouldn't be called" ! def readmodule(module, path=[], inpackage=False): '''Backwards compatible interface. *************** *** 154,158 **** return res ! def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. --- 95,99 ---- return res ! def readmodule_ex(module, path=[], inpackage=False): '''Read a module file and return a dictionary of classes. *************** *** 169,173 **** submodule = module[i+1:].strip() parent = readmodule_ex(package, path, inpackage) ! child = readmodule_ex(submodule, parent['__path__'], 1) return child --- 110,114 ---- submodule = module[i+1:].strip() parent = readmodule_ex(package, path, inpackage) ! child = readmodule_ex(submodule, parent['__path__'], True) return child *************** *** 205,332 **** _modules[module] = dict classstack = [] # stack of (class, indent) pairs - src = f.read() - f.close() - - # To avoid having to stop the regexp at each newline, instead - # when we need a line number we simply count the number of - # newlines in the string since the last time we did this; i.e., - # lineno += src.count('\n', last_lineno_pos, here) - # last_lineno_pos = here - lineno, last_lineno_pos = 1, 0 - i = 0 - while 1: - m = _getnext(src, i) - if not m: - break - start, i = m.span() - - if m.start("Method") >= 0: - # found a method definition or function - thisindent = _indent(m.group("MethodIndent")) - meth_name = m.group("MethodName") - lineno += src.count('\n', last_lineno_pos, start) - last_lineno_pos = start - # close all classes indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: - del classstack[-1] - if classstack: - # it's a class method - cur_class = classstack[-1][0] - cur_class._addmethod(meth_name, lineno) - else: - # it's a function - f = Function(module, meth_name, - file, lineno) - dict[meth_name] = f ! elif m.start("String") >= 0: ! pass ! ! elif m.start("Class") >= 0: ! # we found a class definition ! thisindent = _indent(m.group("ClassIndent")) ! # close all classes indented at least as much ! while classstack and \ ! classstack[-1][1] >= thisindent: ! del classstack[-1] ! lineno += src.count('\n', last_lineno_pos, start) ! last_lineno_pos = start ! class_name = m.group("ClassName") ! inherit = m.group("ClassSupers") ! if inherit: ! # the class inherits from other classes ! inherit = inherit[1:-1].strip() ! names = [] ! for n in inherit.split(','): ! n = n.strip() ! if n in dict: ! # we know this super class ! n = dict[n] ! else: ! c = n.split('.') ! if len(c) > 1: ! # super class ! # is of the ! # form module.class: ! # look in ! # module for class ! m = c[-2] ! c = c[-1] ! if m in _modules: ! d = _modules[m] ! if c in d: ! n = d[c] ! names.append(n) ! inherit = names ! # remember this class ! cur_class = Class(module, class_name, inherit, ! file, lineno) ! dict[class_name] = cur_class ! classstack.append((cur_class, thisindent)) ! ! elif m.start("Import") >= 0: ! # import module ! for n in m.group("ImportList").split(','): ! n = n.strip() try: # recursively read the imported module ! d = readmodule_ex(n, path, inpackage) except: ! ##print 'module', n, 'not found' ! pass ! ! elif m.start("ImportFrom") >= 0: ! # from module import stuff ! mod = m.group("ImportFromPath") ! names = m.group("ImportFromList").split(',') ! try: ! # recursively read the imported module ! d = readmodule_ex(mod, path, inpackage) ! except: ! ##print 'module', mod, 'not found' ! continue ! # add any classes that were defined in the ! # imported module to our name space if they ! # were mentioned in the list ! for n in names: ! n = n.strip() ! if n in d: ! dict[n] = d[n] ! elif n == '*': ! # only add a name if not ! # already there (to mimic what ! # Python does internally) ! # also don't add names that ! # start with _ ! for n in d: ! if n[0] != '_' and \ ! not n in dict: ! dict[n] = d[n] ! else: ! assert 0, "regexp _getnext found something unexpected" return dict ! def _indent(ws, _expandtabs=string.expandtabs): ! return len(_expandtabs(ws, TABWIDTH)) --- 146,288 ---- _modules[module] = dict classstack = [] # stack of (class, indent) pairs ! g = tokenize.generate_tokens(f.readline) ! try: ! for tokentype, token, start, end, line in g: ! if token == 'def': ! lineno, thisindent = start ! tokentype, meth_name, start, end, line = g.next() ! if tokentype != NAME: ! continue # Syntax error ! # close all classes indented at least as much ! while classstack and \ ! classstack[-1][1] >= thisindent: ! del classstack[-1] ! if classstack: ! # it's a class method ! cur_class = classstack[-1][0] ! cur_class._addmethod(meth_name, lineno) ! else: ! # it's a function ! dict[meth_name] = Function(module, meth_name, file, lineno) ! elif token == 'class': ! lineno, thisindent = start ! tokentype, class_name, start, end, line = g.next() ! if tokentype != NAME: ! continue # Syntax error ! # close all classes indented at least as much ! while classstack and \ ! classstack[-1][1] >= thisindent: ! del classstack[-1] ! # parse what follows the class name ! tokentype, token, start, end, line = g.next() ! inherit = None ! if token == '(': ! names = [] # List of superclasses ! # there's a list of superclasses ! level = 1 ! super = [] # Tokens making up current superclass ! while True: ! tokentype, token, start, end, line = g.next() ! if token in (')', ',') and level == 1: ! n = "".join(super) ! if n in dict: ! # we know this super class ! n = dict[n] ! else: ! c = n.split('.') ! if len(c) > 1: ! # super class is of the form ! # module.class: look in module for ! # class ! m = c[-2] ! c = c[-1] ! if m in _modules: ! d = _modules[m] ! if c in d: ! n = d[c] ! names.append(n) ! if token == '(': ! level += 1 ! elif token == ')': ! level -= 1 ! if level == 0: ! break ! elif token == ',' and level == 1: ! pass ! else: ! super.append(token) ! inherit = names ! cur_class = Class(module, class_name, inherit, file, lineno) ! dict[class_name] = cur_class ! classstack.append((cur_class, thisindent)) ! elif token == 'import' and start[1] == 0: ! modules = _getnamelist(g) ! for mod, mod2 in modules: ! readmodule_ex(mod, path, inpackage) ! elif token == 'from' and start[1] == 0: ! mod, token = _getname(g) ! if not mod or token != "import": ! continue ! 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 ! # to our name space if they were mentioned in the list ! for n, n2 in names: ! if n in d: ! dict[n2 or n] = d[n] ! elif n == '*': ! # only add a name if not already there (to mimic ! # what Python does internally) also don't add ! # names that start with _ ! for n in d: ! if n[0] != '_' and not n in dict: ! dict[n] = d[n] ! except StopIteration: ! pass + f.close() return dict ! def _getnamelist(g): ! # Helper to get a comma-separated list of dotted names plus 'as' ! # clauses. Return a list of pairs (name, name2) where name2 is ! # the 'as' name, or None if there is no 'as' clause. ! names = [] ! while True: ! name, token = _getname(g) ! if not name: ! break ! if token == 'as': ! name2, token = _getname(g) ! else: ! name2 = None ! names.append((name, name2)) ! while token != "," and "\n" not in token: ! tokentype, token, start, end, line = g.next() ! if token != ",": ! break ! return names ! ! def _getname(g): ! # Helper to get a dotted name, return a pair (name, token) where ! # name is the dotted name, or None if there was no dotted name, ! # and token is the next input token. ! parts = [] ! tokentype, token, start, end, line = g.next() ! if tokentype != NAME and token != '*': ! return (None, token) ! parts.append(token) ! while True: ! tokentype, token, start, end, line = g.next() ! if token != '.': ! break ! tokentype, token, start, end, line = g.next() ! if tokentype != NAME: ! break ! parts.append(token) ! return (".".join(parts), token) From jackjansen@users.sourceforge.net Fri Aug 23 00:37:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:37:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts fullbuild.py,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv20219 Modified Files: fullbuild.py Log Message: Don't build ConfigurePythonCarbon and ConfigurePythonClassic any longer, classic Python is gone. Index: fullbuild.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/fullbuild.py,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** fullbuild.py 5 Aug 2002 14:12:24 -0000 1.83 --- fullbuild.py 22 Aug 2002 23:37:00 -0000 1.84 *************** *** 383,388 **** (":Mac:scripts:BuildApplication.py", "BuildApplication", None), (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None), ! (":Mac:scripts:ConfigurePython.py", "ConfigurePythonCarbon", "PythonInterpreterCarbon"), ! (":Mac:scripts:ConfigurePython.py", "ConfigurePythonClassic", "PythonInterpreterClassic"), (":Mac:Tools:IDE:PythonIDE.py", "Python IDE", None), (":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave", None), --- 383,388 ---- (":Mac:scripts:BuildApplication.py", "BuildApplication", None), (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None), ! ## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonCarbon", "PythonInterpreterCarbon"), ! ## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonClassic", "PythonInterpreterClassic"), (":Mac:Tools:IDE:PythonIDE.py", "Python IDE", None), (":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave", None), From jackjansen@users.sourceforge.net Fri Aug 23 00:36:13 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:36:13 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts BuildApplet.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv20078 Modified Files: BuildApplet.py Log Message: For MacPython-OS9 verbose is the default. Index: BuildApplet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/BuildApplet.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** BuildApplet.py 9 Jun 2002 22:08:52 -0000 1.14 --- BuildApplet.py 22 Aug 2002 23:36:11 -0000 1.15 *************** *** 82,85 **** --- 82,88 ---- elif opt in ('-?', '--help'): usage() + # On OS9 always be verbose + if sys.platform == 'mac' and not verbose: + verbose = 'default' # Loop over all files to be processed for filename in args: From jackjansen@users.sourceforge.net Fri Aug 23 00:31:39 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:31:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ah _AHmodule.c,NONE,1.1 ahscan.py,NONE,1.1 ahsupport.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ah In directory usw-pr-cvs1:/tmp/cvs-serv18945 Added Files: _AHmodule.c ahscan.py ahsupport.py Log Message: Interface to Apple Help Manager. --- NEW FILE: _AHmodule.c --- /* =========================== Module _AH =========================== */ #include "Python.h" #ifdef _WIN32 #include "pywintoolbox.h" #else #include "macglue.h" #include "pymactoolbox.h" #endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ "Not available in this shared library/OS version"); \ return NULL; \ }} while(0) #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif static PyObject *Ah_Error; static PyObject *Ah_AHSearch(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef bookname; CFStringRef query; if (!PyArg_ParseTuple(_args, "O&O&", CFStringRefObj_Convert, &bookname, CFStringRefObj_Convert, &query)) return NULL; _err = AHSearch(bookname, query); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Ah_AHGotoMainTOC(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; AHTOCType toctype; if (!PyArg_ParseTuple(_args, "s", &toctype)) return NULL; _err = AHGotoMainTOC(toctype); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Ah_AHGotoPage(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef bookname; CFStringRef path; CFStringRef anchor; if (!PyArg_ParseTuple(_args, "O&O&O&", CFStringRefObj_Convert, &bookname, CFStringRefObj_Convert, &path, CFStringRefObj_Convert, &anchor)) return NULL; _err = AHGotoPage(bookname, path, anchor); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Ah_AHLookupAnchor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFStringRef bookname; CFStringRef anchor; if (!PyArg_ParseTuple(_args, "O&O&", CFStringRefObj_Convert, &bookname, CFStringRefObj_Convert, &anchor)) return NULL; _err = AHLookupAnchor(bookname, anchor); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Ah_AHRegisterHelpBook(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; FSRef appBundleRef; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSRef, &appBundleRef)) return NULL; _err = AHRegisterHelpBook(&appBundleRef); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyMethodDef Ah_methods[] = { {"AHSearch", (PyCFunction)Ah_AHSearch, 1, PyDoc_STR("(CFStringRef bookname, CFStringRef query) -> None")}, {"AHGotoMainTOC", (PyCFunction)Ah_AHGotoMainTOC, 1, PyDoc_STR("(AHTOCType toctype) -> None")}, {"AHGotoPage", (PyCFunction)Ah_AHGotoPage, 1, PyDoc_STR("(CFStringRef bookname, CFStringRef path, CFStringRef anchor) -> None")}, {"AHLookupAnchor", (PyCFunction)Ah_AHLookupAnchor, 1, PyDoc_STR("(CFStringRef bookname, CFStringRef anchor) -> None")}, {"AHRegisterHelpBook", (PyCFunction)Ah_AHRegisterHelpBook, 1, PyDoc_STR("(FSRef appBundleRef) -> None")}, {NULL, NULL, 0} }; void init_AH(void) { PyObject *m; PyObject *d; m = Py_InitModule("_AH", Ah_methods); d = PyModule_GetDict(m); Ah_Error = PyMac_GetOSErrException(); if (Ah_Error == NULL || PyDict_SetItemString(d, "Error", Ah_Error) != 0) return; } /* ========================= End module _AH ========================= */ --- NEW FILE: ahscan.py --- # Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "AppleHelp" SHORT = "ah" OBJECT = "NOTUSED" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() print "=== Testing definitions output code ===" execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner_OSX): def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] # This is non-functional today if t == OBJECT and m == "InMode": classname = "Method" listname = "methods" return classname, listname def makeblacklistnames(self): return [ ] def makeblacklisttypes(self): return [ ] def makerepairinstructions(self): return [ ] if __name__ == "__main__": main() --- NEW FILE: ahsupport.py --- # This script generates a Python interface for an Apple Macintosh Manager. # It uses the "bgen" package to generate C code. # The function specifications are generated by scanning the mamager's header file, # using the "scantools" package (customized for this particular manager). import string # Declarations that change for each manager MACHEADERFILE = 'AppleHelp.h' # The Apple header file MODNAME = '_AH' # The name of the module # The following is *usually* unchanged but may still require tuning MODPREFIX = 'Ah' # The prefix for module-wide routines INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects AHTOCType = Type("AHTOCType", "s") includestuff = includestuff + """ #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif """ # From here on it's basically all boiler plate... # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) # Create the generator classes used to populate the lists Function = OSErrFunctionGenerator # Create and populate the lists functions = [] execfile(INPUTFILE) # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) for f in functions: module.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() From jackjansen@users.sourceforge.net Fri Aug 23 00:30:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ah - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ah In directory usw-pr-cvs1:/tmp/cvs-serv18836/ah Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/ah added to the repository From jackjansen@users.sourceforge.net Fri Aug 23 00:30:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon IBCarbonsupport.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory usw-pr-cvs1:/tmp/cvs-serv18635/Mac/Modules/ibcarbon Modified Files: IBCarbonsupport.py Log Message: Moved CoreFoundation type support to bgen/macsupport. Index: IBCarbonsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/IBCarbonsupport.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IBCarbonsupport.py 4 Aug 2002 21:34:24 -0000 1.1 --- IBCarbonsupport.py 22 Aug 2002 23:30:48 -0000 1.2 *************** *** 3,7 **** from macsupport import * - CFStringRef = OpaqueByValueType('CFStringRef', 'CFStringRefObj') IBNibRef = OpaqueByValueType('IBNibRef', 'IBNibRefObj') #CFBundleRef = OpaqueByValueType('CFBundleRef') --- 3,6 ---- From jackjansen@users.sourceforge.net Fri Aug 23 00:30:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:50 -0700 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen macsupport.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv18635/Tools/bgen/bgen Modified Files: macsupport.py Log Message: Moved CoreFoundation type support to bgen/macsupport. Index: macsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/macsupport.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** macsupport.py 18 Mar 2002 15:24:22 -0000 1.27 --- macsupport.py 22 Aug 2002 23:30:48 -0000 1.28 *************** *** 91,94 **** --- 91,105 ---- EventRecord_ptr = EventRecord + # CoreFoundation datatypes + CFTypeRef = OpaqueByValueType("CFTypeRef", "CFTypeRefObj") + CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") + CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj") + CFArrayRef = OpaqueByValueType("CFArrayRef", "CFArrayRefObj") + CFMutableArrayRef = OpaqueByValueType("CFMutableArrayRef", "CFMutableArrayRefObj") + CFDictionaryRef = OpaqueByValueType("CFDictionaryRef", "CFDictionaryRefObj") + CFMutableDictionaryRef = OpaqueByValueType("CFMutableDictionaryRef", "CFMutableDictionaryRefObj") + CFURLRef = OpaqueByValueType("CFURLRef", "CFURLRefObj") + OptionalCFURLRef = OpaqueByValueType("CFURLRef", "OptionalCFURLRefObj") + # OSErr is special because it is turned into an exception # (Could do this with less code using a variant of mkvalue("O&")?) From jackjansen@users.sourceforge.net Fri Aug 23 00:30:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/app appsupport.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv18635/Mac/Modules/app Modified Files: appsupport.py Log Message: Moved CoreFoundation type support to bgen/macsupport. Index: appsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** appsupport.py 24 Mar 2002 23:01:55 -0000 1.14 --- appsupport.py 22 Aug 2002 23:30:48 -0000 1.15 *************** *** 70,75 **** ThemeMetric = Type("ThemeMetric", "l") RGBColor = OpaqueType("RGBColor", "QdRGB") - CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") - CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj") TruncCode = Type("TruncCode", "h") --- 70,73 ---- From jackjansen@users.sourceforge.net Fri Aug 23 00:29:48 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:29:48 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastemodule.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv18432/Mac/Modules/waste Modified Files: wastemodule.c Log Message: Added PyDoc_STR's. Index: wastemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** wastemodule.c 17 Jul 2002 16:30:35 -0000 1.24 --- wastemodule.c 22 Aug 2002 23:29:45 -0000 1.25 *************** *** 362,382 **** static PyMethodDef WEOObj_methods[] = { {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1, ! "() -> (FlavorType _rv)"}, {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1, ! "() -> (Handle _rv)"}, {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1, ! "() -> (WEReference _rv)"}, {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1, ! "() -> (SInt32 _rv)"}, {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1, ! "() -> (Point _rv)"}, {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1, ! "(Point inObjectSize) -> None"}, {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1, ! "() -> (LongRect outObjectFrame)"}, {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1, ! "() -> (SInt32 _rv)"}, {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1, ! "(SInt32 inRefCon) -> None"}, {NULL, NULL, 0} }; --- 362,382 ---- static PyMethodDef WEOObj_methods[] = { {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1, ! PyDoc_STR("() -> (FlavorType _rv)")}, {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1, ! PyDoc_STR("() -> (WEReference _rv)")}, {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1, ! PyDoc_STR("() -> (Point _rv)")}, {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1, ! PyDoc_STR("(Point inObjectSize) -> None")}, {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1, ! PyDoc_STR("() -> (LongRect outObjectFrame)")}, {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1, ! PyDoc_STR("(SInt32 inRefCon) -> None")}, {NULL, NULL, 0} }; *************** *** 1914,2094 **** static PyMethodDef wasteObj_methods[] = { {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1, ! "() -> (Handle _rv)"}, {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1, ! "(SInt32 inOffset) -> (SInt16 _rv)"}, {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1, ! "() -> (SInt32 _rv)"}, {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1, ! "() -> (SInt32 outSelStart, SInt32 outSelEnd)"}, {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1, ! "() -> (LongRect outDestRect)"}, {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1, ! "() -> (LongRect outViewRect)"}, {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1, ! "() -> (Boolean _rv)"}, {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1, ! "() -> (UInt16 _rv)"}, {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1, ! "(SInt32 inSelStart, SInt32 inSelEnd) -> None"}, {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1, ! "(LongRect inDestRect) -> None"}, {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1, ! "(LongRect inViewRect) -> None"}, {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1, ! "(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)"}, {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1, ! "() -> (SInt32 _rv)"}, {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1, ! "(SInt32 inOffset) -> (SInt32 _rv)"}, {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1, ! "(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)"}, {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1, ! "(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)"}, {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1, ! "(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)"}, {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1, ! "(SInt32 inOffset) -> (Boolean _rv)"}, {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1, ! "() -> (SInt32 _rv)"}, {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1, ! "(SInt32 inOffset) -> (SInt32 _rv)"}, {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1, ! "(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)"}, {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1, ! "() -> (SInt32 _rv)"}, {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1, ! "(SInt32 inOffset) -> (SInt32 _rv)"}, {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1, ! "(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)"}, {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1, ! "(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)"}, {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1, ! "(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)"}, {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1, ! "(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)"}, {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1, ! "(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)"}, {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1, ! "(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)"}, {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1, ! "(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)"}, {"WEFind", (PyCFunction)wasteObj_WEFind, 1, ! "(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)"}, {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1, ! "(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None"}, {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1, ! "(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None"}, {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1, ! "(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None"}, {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1, ! "() -> (WEAlignment _rv)"}, {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1, ! "(WEAlignment inAlignment) -> None"}, {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1, ! "() -> (WEDirection _rv)"}, {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1, ! "(WEDirection inDirection) -> None"}, {"WECalText", (PyCFunction)wasteObj_WECalText, 1, ! "() -> None"}, {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1, ! "(RgnHandle inUpdateRgn) -> None"}, {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1, ! "(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None"}, {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1, ! "(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None"}, {"WESelView", (PyCFunction)wasteObj_WESelView, 1, ! "() -> None"}, {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1, ! "() -> None"}, {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1, ! "() -> None"}, {"WEKey", (PyCFunction)wasteObj_WEKey, 1, ! "(CharParameter inKey, EventModifiers inModifiers) -> None"}, {"WEClick", (PyCFunction)wasteObj_WEClick, 1, ! "(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None"}, {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1, ! "(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)"}, {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1, ! "() -> (UInt32 outMaxSleep)"}, {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1, ! "(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None"}, {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1, ! "(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None"}, {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1, ! "() -> None"}, {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1, ! "(Handle inText) -> None"}, {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1, ! "(SInt16 inCase) -> None"}, {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1, ! "(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None"}, {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1, ! "(WEStyleMode inMode, TextStyle inTextStyle) -> None"}, {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1, ! "(StScrpHandle inStyles) -> None"}, {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1, ! "() -> None"}, {"WERedo", (PyCFunction)wasteObj_WERedo, 1, ! "() -> None"}, {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1, ! "() -> None"}, {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1, ! "() -> (WEActionKind _rv, Boolean outRedoFlag)"}, {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1, ! "(SInt32 inUndoLevel) -> (WEActionKind _rv)"}, {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1, ! "() -> (Boolean _rv)"}, {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1, ! "() -> None"}, {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1, ! "(WEActionKind inActionKind) -> None"}, {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1, ! "() -> (UInt32 _rv)"}, {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1, ! "() -> None"}, {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1, ! "(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None"}, {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1, ! "() -> (WEObjectReference outObject)"}, {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1, ! "(SInt32 inOffset) -> (WEObjectReference outObject)"}, {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1, ! "(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)"}, {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1, ! "(WESoupHandle inSoup) -> None"}, {"WECut", (PyCFunction)wasteObj_WECut, 1, ! "() -> None"}, {"WECopy", (PyCFunction)wasteObj_WECopy, 1, ! "() -> None"}, {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1, ! "() -> None"}, {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1, ! "() -> (Boolean _rv)"}, {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1, ! "(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)"}, {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1, ! "(SInt32 inOffset) -> (SInt16 _rv)"}, {"WECharType", (PyCFunction)wasteObj_WECharType, 1, ! "(SInt32 inOffset) -> (SInt16 _rv)"}, {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1, ! "() -> None"}, {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1, ! "(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)"}, {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1, ! "(WESelector inUserTag) -> (SInt32 outUserInfo)"}, {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1, ! "(WESelector inUserTag, SInt32 inUserInfo) -> None"}, {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1, ! "(WESelector inUserTag) -> None"}, {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1, ! "() -> None"}, {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1, ! "() -> None"}, {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1, ! "() -> (Boolean _rv)"}, {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1, ! "() -> (SInt16 _rv)"}, {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1, ! "(SInt16 tabWidth) -> None"}, {NULL, NULL, 0} }; --- 1914,2094 ---- static PyMethodDef wasteObj_methods[] = { {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1, ! PyDoc_STR("() -> (Handle _rv)")}, {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")}, {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1, ! PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")}, {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1, ! PyDoc_STR("() -> (LongRect outDestRect)")}, {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1, ! PyDoc_STR("() -> (LongRect outViewRect)")}, {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1, ! PyDoc_STR("() -> (UInt16 _rv)")}, {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1, ! PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")}, {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1, ! PyDoc_STR("(LongRect inDestRect) -> None")}, {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1, ! PyDoc_STR("(LongRect inViewRect) -> None")}, {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1, ! PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")}, {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")}, {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1, ! PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")}, {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1, ! PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")}, {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1, ! PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")}, {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1, ! PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")}, {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")}, {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1, ! PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")}, {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1, ! PyDoc_STR("() -> (SInt32 _rv)")}, {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")}, {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1, ! PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")}, {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1, ! PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")}, {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1, ! PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")}, {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1, ! PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")}, {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1, ! PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")}, {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1, ! PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")}, {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1, ! PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")}, {"WEFind", (PyCFunction)wasteObj_WEFind, 1, ! PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")}, {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1, ! PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")}, {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1, ! PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")}, {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1, ! PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")}, {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1, ! PyDoc_STR("() -> (WEAlignment _rv)")}, {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1, ! PyDoc_STR("(WEAlignment inAlignment) -> None")}, {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1, ! PyDoc_STR("() -> (WEDirection _rv)")}, {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1, ! PyDoc_STR("(WEDirection inDirection) -> None")}, {"WECalText", (PyCFunction)wasteObj_WECalText, 1, ! PyDoc_STR("() -> None")}, {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1, ! PyDoc_STR("(RgnHandle inUpdateRgn) -> None")}, {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1, ! PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")}, {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1, ! PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")}, {"WESelView", (PyCFunction)wasteObj_WESelView, 1, ! PyDoc_STR("() -> None")}, {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1, ! PyDoc_STR("() -> None")}, {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1, ! PyDoc_STR("() -> None")}, {"WEKey", (PyCFunction)wasteObj_WEKey, 1, ! PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")}, {"WEClick", (PyCFunction)wasteObj_WEClick, 1, ! PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")}, {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1, ! PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")}, {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1, ! PyDoc_STR("() -> (UInt32 outMaxSleep)")}, {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1, ! PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")}, {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1, ! PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")}, {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1, ! PyDoc_STR("() -> None")}, {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1, ! PyDoc_STR("(Handle inText) -> None")}, {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1, ! PyDoc_STR("(SInt16 inCase) -> None")}, {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1, ! PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")}, {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1, ! PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")}, {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1, ! PyDoc_STR("(StScrpHandle inStyles) -> None")}, {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1, ! PyDoc_STR("() -> None")}, {"WERedo", (PyCFunction)wasteObj_WERedo, 1, ! PyDoc_STR("() -> None")}, {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1, ! PyDoc_STR("() -> None")}, {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1, ! PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")}, {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1, ! PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")}, {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1, ! PyDoc_STR("() -> None")}, {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1, ! PyDoc_STR("(WEActionKind inActionKind) -> None")}, {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1, ! PyDoc_STR("() -> None")}, {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1, ! PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")}, {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1, ! PyDoc_STR("() -> (WEObjectReference outObject)")}, {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1, ! PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")}, {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")}, {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1, ! PyDoc_STR("(WESoupHandle inSoup) -> None")}, {"WECut", (PyCFunction)wasteObj_WECut, 1, ! PyDoc_STR("() -> None")}, {"WECopy", (PyCFunction)wasteObj_WECopy, 1, ! PyDoc_STR("() -> None")}, {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1, ! PyDoc_STR("() -> None")}, {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1, ! PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")}, {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")}, {"WECharType", (PyCFunction)wasteObj_WECharType, 1, ! PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")}, {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1, ! PyDoc_STR("() -> None")}, {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1, ! PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")}, {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1, ! PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")}, {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1, ! PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")}, {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1, ! PyDoc_STR("(WESelector inUserTag) -> None")}, {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1, ! PyDoc_STR("() -> None")}, {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1, ! PyDoc_STR("() -> None")}, {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1, ! PyDoc_STR("() -> (SInt16 _rv)")}, {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1, ! PyDoc_STR("(SInt16 tabWidth) -> None")}, {NULL, NULL, 0} }; *************** *** 2417,2447 **** static PyMethodDef waste_methods[] = { {"WENew", (PyCFunction)waste_WENew, 1, ! "(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)"}, {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1, ! "(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None"}, {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1, ! "() -> None"}, {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1, ! "() -> None"}, {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1, ! "(AppleEvent inAppleEvent) -> (AppleEvent ioReply)"}, {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1, ! "(LongPt inLongPoint) -> (Point outPoint)"}, {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1, ! "(Point inPoint) -> (LongPt outLongPoint)"}, {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1, ! "(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)"}, {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1, ! "(LongRect inLongRect) -> (Rect outRect)"}, {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1, ! "(Rect inRect) -> (LongRect outLongRect)"}, {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1, ! "(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)"}, {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1, ! "(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)"}, {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1, ! NULL}, {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1, ! NULL}, {NULL, NULL, 0} }; --- 2417,2447 ---- static PyMethodDef waste_methods[] = { {"WENew", (PyCFunction)waste_WENew, 1, ! PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")}, {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1, ! PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")}, {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1, ! PyDoc_STR("() -> None")}, {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1, ! PyDoc_STR("() -> None")}, {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1, ! PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")}, {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1, ! PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")}, {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1, ! PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")}, {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1, ! PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")}, {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1, ! PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")}, {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1, ! PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")}, {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1, ! PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")}, {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1, ! PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")}, {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1, ! PyDoc_STR(NULL)}, {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1, ! PyDoc_STR(NULL)}, {NULL, NULL, 0} }; From jackjansen@users.sourceforge.net Fri Aug 23 00:30:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/win winsupport.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv18635/Mac/Modules/win Modified Files: winsupport.py Log Message: Moved CoreFoundation type support to bgen/macsupport. Index: winsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winsupport.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** winsupport.py 18 Dec 2001 15:38:59 -0000 1.30 --- winsupport.py 22 Aug 2002 23:30:49 -0000 1.31 *************** *** 52,56 **** WindowDefPartCode = Type("WindowDefPartCode", "h") WindowModality = Type("WindowModality", "l") - CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") GDHandle = OpaqueByValueType("GDHandle", "ResObj") WindowConstrainOptions = Type("WindowConstrainOptions", "l") --- 52,55 ---- From jackjansen@users.sourceforge.net Fri Aug 23 00:30:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.11,1.12 mltesupport.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory usw-pr-cvs1:/tmp/cvs-serv18635/Mac/Modules/mlte Modified Files: _Mltemodule.c mltesupport.py Log Message: Moved CoreFoundation type support to bgen/macsupport. Index: _Mltemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Mltemodule.c 17 Jul 2002 16:30:34 -0000 1.11 --- _Mltemodule.c 22 Aug 2002 23:30:48 -0000 1.12 *************** *** 1183,1296 **** static PyMethodDef TXNObj_methods[] = { {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1, ! "() -> None"}, {"TXNResizeFrame", (PyCFunction)TXNObj_TXNResizeFrame, 1, ! "(UInt32 iWidth, UInt32 iHeight, TXNFrameID iTXNFrameID) -> None"}, {"TXNSetFrameBounds", (PyCFunction)TXNObj_TXNSetFrameBounds, 1, ! "(SInt32 iTop, SInt32 iLeft, SInt32 iBottom, SInt32 iRight, TXNFrameID iTXNFrameID) -> None"}, {"TXNKeyDown", (PyCFunction)TXNObj_TXNKeyDown, 1, ! "(EventRecord iEvent) -> None"}, {"TXNAdjustCursor", (PyCFunction)TXNObj_TXNAdjustCursor, 1, ! "(RgnHandle ioCursorRgn) -> None"}, {"TXNClick", (PyCFunction)TXNObj_TXNClick, 1, ! "(EventRecord iEvent) -> None"}, #if TARGET_API_MAC_OS8 {"TXNTSMCheck", (PyCFunction)TXNObj_TXNTSMCheck, 1, ! "() -> (Boolean _rv, EventRecord ioEvent)"}, #endif {"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1, ! "() -> None"}, {"TXNFocus", (PyCFunction)TXNObj_TXNFocus, 1, ! "(Boolean iBecomingFocused) -> None"}, {"TXNUpdate", (PyCFunction)TXNObj_TXNUpdate, 1, ! "() -> None"}, {"TXNDraw", (PyCFunction)TXNObj_TXNDraw, 1, ! "(GWorldPtr iDrawPort) -> None"}, {"TXNForceUpdate", (PyCFunction)TXNObj_TXNForceUpdate, 1, ! "() -> None"}, {"TXNGetSleepTicks", (PyCFunction)TXNObj_TXNGetSleepTicks, 1, ! "() -> (UInt32 _rv)"}, {"TXNIdle", (PyCFunction)TXNObj_TXNIdle, 1, ! "() -> None"}, {"TXNGrowWindow", (PyCFunction)TXNObj_TXNGrowWindow, 1, ! "(EventRecord iEvent) -> None"}, {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1, ! "(short iPart) -> None"}, {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1, ! "() -> (Boolean _rv, TXNActionKey oTXNActionKey)"}, {"TXNUndo", (PyCFunction)TXNObj_TXNUndo, 1, ! "() -> None"}, {"TXNCanRedo", (PyCFunction)TXNObj_TXNCanRedo, 1, ! "() -> (Boolean _rv, TXNActionKey oTXNActionKey)"}, {"TXNRedo", (PyCFunction)TXNObj_TXNRedo, 1, ! "() -> None"}, {"TXNCut", (PyCFunction)TXNObj_TXNCut, 1, ! "() -> None"}, {"TXNCopy", (PyCFunction)TXNObj_TXNCopy, 1, ! "() -> None"}, {"TXNPaste", (PyCFunction)TXNObj_TXNPaste, 1, ! "() -> None"}, {"TXNClear", (PyCFunction)TXNObj_TXNClear, 1, ! "() -> None"}, {"TXNGetSelection", (PyCFunction)TXNObj_TXNGetSelection, 1, ! "() -> (TXNOffset oStartOffset, TXNOffset oEndOffset)"}, {"TXNShowSelection", (PyCFunction)TXNObj_TXNShowSelection, 1, ! "(Boolean iShowEnd) -> None"}, {"TXNIsSelectionEmpty", (PyCFunction)TXNObj_TXNIsSelectionEmpty, 1, ! "() -> (Boolean _rv)"}, {"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1, ! "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"}, {"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1, ! "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (ItemCount oRunCount)"}, {"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1, ! "() -> (ByteCount _rv)"}, {"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1, ! "(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (Handle oDataHandle)"}, {"TXNGetDataEncoded", (PyCFunction)TXNObj_TXNGetDataEncoded, 1, ! "(TXNOffset iStartOffset, TXNOffset iEndOffset, TXNDataType iEncoding) -> (Handle oDataHandle)"}, {"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1, ! "(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"}, {"TXNSetData", (PyCFunction)TXNObj_TXNSetData, 1, ! "(TXNDataType iDataType, Buffer iDataPtr, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None"}, {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1, ! "() -> (ItemCount _rv)"}, {"TXNSave", (PyCFunction)TXNObj_TXNSave, 1, ! "(TXNFileType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None"}, {"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1, ! "() -> None"}, {"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1, ! "() -> None"}, {"TXNPrint", (PyCFunction)TXNObj_TXNPrint, 1, ! "() -> None"}, {"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1, ! "() -> (Rect oViewRect)"}, {"TXNSetViewRect", (PyCFunction)TXNObj_TXNSetViewRect, 1, ! "(Rect iViewRect) -> None"}, {"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1, ! "(GWorldPtr iWindow, Boolean iIsActualWindow) -> None"}, {"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1, ! "() -> (Boolean _rv)"}, {"TXNDragTracker", (PyCFunction)TXNObj_TXNDragTracker, 1, ! "(TXNFrameID iTXNFrameID, DragTrackingMessage iMessage, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None"}, {"TXNDragReceiver", (PyCFunction)TXNObj_TXNDragReceiver, 1, ! "(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None"}, {"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1, ! "(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None"}, {"TXNEchoMode", (PyCFunction)TXNObj_TXNEchoMode, 1, ! "(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None"}, {"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1, ! "(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None"}, {"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1, ! "(TXNFontMenuObject iTXNFontMenuObject) -> None"}, {"TXNPointToOffset", (PyCFunction)TXNObj_TXNPointToOffset, 1, ! "(Point iPoint) -> (TXNOffset oOffset)"}, {"TXNOffsetToPoint", (PyCFunction)TXNObj_TXNOffsetToPoint, 1, ! "(TXNOffset iOffset) -> (Point oPoint)"}, {"TXNGetLineCount", (PyCFunction)TXNObj_TXNGetLineCount, 1, ! "() -> (ItemCount oLineTotal)"}, {"TXNGetLineMetrics", (PyCFunction)TXNObj_TXNGetLineMetrics, 1, ! "(UInt32 iLineNumber) -> (Fixed oLineWidth, Fixed oLineHeight)"}, {"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1, ! "(WindowPtr iWindow) -> (Boolean oAttached)"}, {NULL, NULL, 0} }; --- 1183,1296 ---- static PyMethodDef TXNObj_methods[] = { {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1, ! PyDoc_STR("() -> None")}, {"TXNResizeFrame", (PyCFunction)TXNObj_TXNResizeFrame, 1, ! PyDoc_STR("(UInt32 iWidth, UInt32 iHeight, TXNFrameID iTXNFrameID) -> None")}, {"TXNSetFrameBounds", (PyCFunction)TXNObj_TXNSetFrameBounds, 1, ! PyDoc_STR("(SInt32 iTop, SInt32 iLeft, SInt32 iBottom, SInt32 iRight, TXNFrameID iTXNFrameID) -> None")}, {"TXNKeyDown", (PyCFunction)TXNObj_TXNKeyDown, 1, ! PyDoc_STR("(EventRecord iEvent) -> None")}, {"TXNAdjustCursor", (PyCFunction)TXNObj_TXNAdjustCursor, 1, ! PyDoc_STR("(RgnHandle ioCursorRgn) -> None")}, {"TXNClick", (PyCFunction)TXNObj_TXNClick, 1, ! PyDoc_STR("(EventRecord iEvent) -> None")}, #if TARGET_API_MAC_OS8 {"TXNTSMCheck", (PyCFunction)TXNObj_TXNTSMCheck, 1, ! PyDoc_STR("() -> (Boolean _rv, EventRecord ioEvent)")}, #endif {"TXNSelectAll", (PyCFunction)TXNObj_TXNSelectAll, 1, ! PyDoc_STR("() -> None")}, {"TXNFocus", (PyCFunction)TXNObj_TXNFocus, 1, ! PyDoc_STR("(Boolean iBecomingFocused) -> None")}, {"TXNUpdate", (PyCFunction)TXNObj_TXNUpdate, 1, ! PyDoc_STR("() -> None")}, {"TXNDraw", (PyCFunction)TXNObj_TXNDraw, 1, ! PyDoc_STR("(GWorldPtr iDrawPort) -> None")}, {"TXNForceUpdate", (PyCFunction)TXNObj_TXNForceUpdate, 1, ! PyDoc_STR("() -> None")}, {"TXNGetSleepTicks", (PyCFunction)TXNObj_TXNGetSleepTicks, 1, ! PyDoc_STR("() -> (UInt32 _rv)")}, {"TXNIdle", (PyCFunction)TXNObj_TXNIdle, 1, ! PyDoc_STR("() -> None")}, {"TXNGrowWindow", (PyCFunction)TXNObj_TXNGrowWindow, 1, ! PyDoc_STR("(EventRecord iEvent) -> None")}, {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1, ! PyDoc_STR("(short iPart) -> None")}, {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1, ! PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")}, {"TXNUndo", (PyCFunction)TXNObj_TXNUndo, 1, ! PyDoc_STR("() -> None")}, {"TXNCanRedo", (PyCFunction)TXNObj_TXNCanRedo, 1, ! PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")}, {"TXNRedo", (PyCFunction)TXNObj_TXNRedo, 1, ! PyDoc_STR("() -> None")}, {"TXNCut", (PyCFunction)TXNObj_TXNCut, 1, ! PyDoc_STR("() -> None")}, {"TXNCopy", (PyCFunction)TXNObj_TXNCopy, 1, ! PyDoc_STR("() -> None")}, {"TXNPaste", (PyCFunction)TXNObj_TXNPaste, 1, ! PyDoc_STR("() -> None")}, {"TXNClear", (PyCFunction)TXNObj_TXNClear, 1, ! PyDoc_STR("() -> None")}, {"TXNGetSelection", (PyCFunction)TXNObj_TXNGetSelection, 1, ! PyDoc_STR("() -> (TXNOffset oStartOffset, TXNOffset oEndOffset)")}, {"TXNShowSelection", (PyCFunction)TXNObj_TXNShowSelection, 1, ! PyDoc_STR("(Boolean iShowEnd) -> None")}, {"TXNIsSelectionEmpty", (PyCFunction)TXNObj_TXNIsSelectionEmpty, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"TXNSetSelection", (PyCFunction)TXNObj_TXNSetSelection, 1, ! PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, {"TXNCountRunsInRange", (PyCFunction)TXNObj_TXNCountRunsInRange, 1, ! PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (ItemCount oRunCount)")}, {"TXNDataSize", (PyCFunction)TXNObj_TXNDataSize, 1, ! PyDoc_STR("() -> (ByteCount _rv)")}, {"TXNGetData", (PyCFunction)TXNObj_TXNGetData, 1, ! PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset) -> (Handle oDataHandle)")}, {"TXNGetDataEncoded", (PyCFunction)TXNObj_TXNGetDataEncoded, 1, ! PyDoc_STR("(TXNOffset iStartOffset, TXNOffset iEndOffset, TXNDataType iEncoding) -> (Handle oDataHandle)")}, {"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1, ! PyDoc_STR("(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, {"TXNSetData", (PyCFunction)TXNObj_TXNSetData, 1, ! PyDoc_STR("(TXNDataType iDataType, Buffer iDataPtr, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1, ! PyDoc_STR("() -> (ItemCount _rv)")}, {"TXNSave", (PyCFunction)TXNObj_TXNSave, 1, ! PyDoc_STR("(TXNFileType iType, OSType iResType, TXNPermanentTextEncodingType iPermanentEncoding, FSSpec iFileSpecification, SInt16 iDataReference, SInt16 iResourceReference) -> None")}, {"TXNRevert", (PyCFunction)TXNObj_TXNRevert, 1, ! PyDoc_STR("() -> None")}, {"TXNPageSetup", (PyCFunction)TXNObj_TXNPageSetup, 1, ! PyDoc_STR("() -> None")}, {"TXNPrint", (PyCFunction)TXNObj_TXNPrint, 1, ! PyDoc_STR("() -> None")}, {"TXNGetViewRect", (PyCFunction)TXNObj_TXNGetViewRect, 1, ! PyDoc_STR("() -> (Rect oViewRect)")}, {"TXNSetViewRect", (PyCFunction)TXNObj_TXNSetViewRect, 1, ! PyDoc_STR("(Rect iViewRect) -> None")}, {"TXNAttachObjectToWindow", (PyCFunction)TXNObj_TXNAttachObjectToWindow, 1, ! PyDoc_STR("(GWorldPtr iWindow, Boolean iIsActualWindow) -> None")}, {"TXNIsObjectAttachedToWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToWindow, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"TXNDragTracker", (PyCFunction)TXNObj_TXNDragTracker, 1, ! PyDoc_STR("(TXNFrameID iTXNFrameID, DragTrackingMessage iMessage, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")}, {"TXNDragReceiver", (PyCFunction)TXNObj_TXNDragReceiver, 1, ! PyDoc_STR("(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None")}, {"TXNActivate", (PyCFunction)TXNObj_TXNActivate, 1, ! PyDoc_STR("(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None")}, {"TXNEchoMode", (PyCFunction)TXNObj_TXNEchoMode, 1, ! PyDoc_STR("(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None")}, {"TXNDoFontMenuSelection", (PyCFunction)TXNObj_TXNDoFontMenuSelection, 1, ! PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None")}, {"TXNPrepareFontMenu", (PyCFunction)TXNObj_TXNPrepareFontMenu, 1, ! PyDoc_STR("(TXNFontMenuObject iTXNFontMenuObject) -> None")}, {"TXNPointToOffset", (PyCFunction)TXNObj_TXNPointToOffset, 1, ! PyDoc_STR("(Point iPoint) -> (TXNOffset oOffset)")}, {"TXNOffsetToPoint", (PyCFunction)TXNObj_TXNOffsetToPoint, 1, ! PyDoc_STR("(TXNOffset iOffset) -> (Point oPoint)")}, {"TXNGetLineCount", (PyCFunction)TXNObj_TXNGetLineCount, 1, ! PyDoc_STR("() -> (ItemCount oLineTotal)")}, {"TXNGetLineMetrics", (PyCFunction)TXNObj_TXNGetLineMetrics, 1, ! PyDoc_STR("(UInt32 iLineNumber) -> (Fixed oLineWidth, Fixed oLineHeight)")}, {"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1, ! PyDoc_STR("(WindowPtr iWindow) -> (Boolean oAttached)")}, {NULL, NULL, 0} }; *************** *** 1406,1412 **** static PyMethodDef TXNFontMenuObj_methods[] = { {"TXNGetFontMenuHandle", (PyCFunction)TXNFontMenuObj_TXNGetFontMenuHandle, 1, ! "() -> (MenuHandle oFontMenuHandle)"}, {"TXNDisposeFontMenuObject", (PyCFunction)TXNFontMenuObj_TXNDisposeFontMenuObject, 1, ! "() -> None"}, {NULL, NULL, 0} }; --- 1406,1412 ---- static PyMethodDef TXNFontMenuObj_methods[] = { {"TXNGetFontMenuHandle", (PyCFunction)TXNFontMenuObj_TXNGetFontMenuHandle, 1, ! PyDoc_STR("() -> (MenuHandle oFontMenuHandle)")}, {"TXNDisposeFontMenuObject", (PyCFunction)TXNFontMenuObj_TXNDisposeFontMenuObject, 1, ! PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 1618,1636 **** static PyMethodDef Mlte_methods[] = { {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, ! "(FSSpec * iFileSpec, WindowPtr iWindow, Rect * iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)"}, {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, ! "() -> None"}, {"TXNIsScrapPastable", (PyCFunction)Mlte_TXNIsScrapPastable, 1, ! "() -> (Boolean _rv)"}, {"TXNConvertToPublicScrap", (PyCFunction)Mlte_TXNConvertToPublicScrap, 1, ! "() -> None"}, {"TXNConvertFromPublicScrap", (PyCFunction)Mlte_TXNConvertFromPublicScrap, 1, ! "() -> None"}, {"TXNNewFontMenuObject", (PyCFunction)Mlte_TXNNewFontMenuObject, 1, ! "(MenuHandle iFontMenuHandle, SInt16 iMenuID, SInt16 iStartHierMenuID) -> (TXNFontMenuObject oTXNFontMenuObject)"}, {"TXNVersionInformation", (PyCFunction)Mlte_TXNVersionInformation, 1, ! "() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)"}, {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1, ! "(TXNInitOptions) -> None"}, {NULL, NULL, 0} }; --- 1618,1636 ---- static PyMethodDef Mlte_methods[] = { {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, ! PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect * iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")}, {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, ! PyDoc_STR("() -> None")}, {"TXNIsScrapPastable", (PyCFunction)Mlte_TXNIsScrapPastable, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, {"TXNConvertToPublicScrap", (PyCFunction)Mlte_TXNConvertToPublicScrap, 1, ! PyDoc_STR("() -> None")}, {"TXNConvertFromPublicScrap", (PyCFunction)Mlte_TXNConvertFromPublicScrap, 1, ! PyDoc_STR("() -> None")}, {"TXNNewFontMenuObject", (PyCFunction)Mlte_TXNNewFontMenuObject, 1, ! PyDoc_STR("(MenuHandle iFontMenuHandle, SInt16 iMenuID, SInt16 iStartHierMenuID) -> (TXNFontMenuObject oTXNFontMenuObject)")}, {"TXNVersionInformation", (PyCFunction)Mlte_TXNVersionInformation, 1, ! PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")}, {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1, ! PyDoc_STR("(TXNInitOptions) -> None")}, {NULL, NULL, 0} }; Index: mltesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltesupport.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mltesupport.py 5 Aug 2002 15:36:56 -0000 1.9 --- mltesupport.py 22 Aug 2002 23:30:48 -0000 1.10 *************** *** 126,130 **** OptGWorldPtr = OpaqueByValueType("GWorldPtr", "OptGWorldObj") MlteInBuffer = VarInputBufferType('void *', 'ByteCount', 'l') - CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") OptFSSpecPtr = OpaqueByValueType("FSSpec *", "OptFSSpecPtr") --- 126,129 ---- From jackjansen@users.sourceforge.net Fri Aug 23 00:30:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 22 Aug 2002 16:30:50 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu menusupport.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv18635/Mac/Modules/menu Modified Files: menusupport.py Log Message: Moved CoreFoundation type support to bgen/macsupport. Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** menusupport.py 2 Jan 2002 14:59:03 -0000 1.16 --- menusupport.py 22 Aug 2002 23:30:48 -0000 1.17 *************** *** 37,41 **** FMFontFamily = Type("FMFontFamily", "h") FMFontStyle = Type("FMFontStyle", "h") - CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj") UniChar = Type("UniChar", "h") --- 37,40 ---- From tim_one@users.sourceforge.net Fri Aug 23 04:10:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 Aug 2002 20:10:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv3157 Modified Files: GBayes.py Log Message: spamprob(): Commented some subtleties. clearjunk(): Undid Guido's attempt to space-optimize this. The problem is that you can't delete entries from a dict that's being crawled over by .iteritems(), which is why I (I suddenly recall) materialized a list of words to be deleted the first time I wrote this. It's a lot better to materialize a list of to-be-deleted words than to materialize the entire database in a dict.items() list. Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GBayes.py 21 Aug 2002 21:01:47 -0000 1.9 --- GBayes.py 23 Aug 2002 03:10:42 -0000 1.10 *************** *** 160,166 **** --- 160,183 ---- 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. Note: This is what Graham's code did, + # but it's dubious for reasons explained in great detail on Python- + # Dev: it's missing P(spam) and P(not-spam) adjustments that + # straightforward Bayesian analysis says should be here. It's + # unclear how much it matters, though, as the omissions here seem + # to tend in part to cancel out distortions introduced earlier by + # HAMBIAS. Experiments will decide the issue. prob_product = inverse_prob_product = 1.0 for distance, prob, word, record in nbest: *************** *** 254,263 **** wordinfo = self.wordinfo mincount = float(mincount) ! for w, r in wordinfo.iteritems(): ! if (r.atime < oldesttime and ! SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount): ! if self.DEBUG: ! print "clearjunk removing word %r: %r" % (w, r) ! del wordinfo[w] def _add_msg(self, wordstream, is_spam): --- 271,281 ---- wordinfo = self.wordinfo mincount = float(mincount) ! tonuke = [w for w, r in wordinfo.iteritems() ! if r.atime < oldesttime and ! SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount] ! for w in tonuke: ! if self.DEBUG: ! print "clearjunk removing word %r: %r" % (w, r) ! del wordinfo[w] def _add_msg(self, wordstream, is_spam): From jackjansen@users.sourceforge.net Fri Aug 23 09:40:46 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 23 Aug 2002 01:40:46 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21205 Modified Files: pydoc.py Log Message: Added the standard MacOSX location for documentation inside a framework to the list of places where pydoc looks for HTML documents. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** pydoc.py 11 Aug 2002 15:11:33 -0000 1.68 --- pydoc.py 23 Aug 2002 08:40:42 -0000 1.69 *************** *** 1500,1504 **** '/usr/doc/python-' + split(sys.version)[0], '/usr/doc/python-docs-' + sys.version[:3], ! '/usr/doc/python-' + sys.version[:3]]: if dir and os.path.isdir(os.path.join(dir, 'lib')): self.docdir = dir --- 1500,1505 ---- '/usr/doc/python-' + split(sys.version)[0], '/usr/doc/python-docs-' + sys.version[:3], ! '/usr/doc/python-' + sys.version[:3], ! os.path.join(sys.prefix, 'Resources/English.lproj/Documentation')]: if dir and os.path.isdir(os.path.join(dir, 'lib')): self.docdir = dir From gvanrossum@users.sourceforge.net Fri Aug 23 15:11:39 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 07:11:39 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.331,2.332 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31128 Modified Files: ceval.c Log Message: The error messages in err_args() -- which is only called when the required number of args is 0 or 1 -- were reversed. Also change "1" into "exactly one", the same words as used elsewhere for this condition. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.331 retrieving revision 2.332 diff -C2 -d -r2.331 -r2.332 *** ceval.c 20 Aug 2002 15:43:16 -0000 2.331 --- ceval.c 23 Aug 2002 14:11:35 -0000 2.332 *************** *** 3177,3186 **** if (flags & METH_NOARGS) PyErr_Format(PyExc_TypeError, ! "%.200s() takes 1 argument (%d given)", ((PyCFunctionObject *)func)->m_ml->ml_name, nargs); else PyErr_Format(PyExc_TypeError, ! "%.200s() takes no arguments (%d given)", ((PyCFunctionObject *)func)->m_ml->ml_name, nargs); --- 3177,3186 ---- if (flags & METH_NOARGS) PyErr_Format(PyExc_TypeError, ! "%.200s() takes no arguments (%d given)", ((PyCFunctionObject *)func)->m_ml->ml_name, nargs); else PyErr_Format(PyExc_TypeError, ! "%.200s() takes exactly one argument (%d given)", ((PyCFunctionObject *)func)->m_ml->ml_name, nargs); From montanaro@users.sourceforge.net Fri Aug 23 15:25:41 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 23 Aug 2002 07:25:41 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv4428a Modified Files: GBayes.py Log Message: Allow command line specification of tokenize functions run w/ -t flag to override default tokenize function run w/ -H flag to see list of tokenize functions When adding a new tokenizer, make docstring a short description and add a key/value pair to the tokenizers dict. The key is what the user specifies. The value is a tokenize function. Added two new tokenizers - tokenize_wordpairs_foldcase and tokenize_words_and_pairs. It's not obvious that either is better than any of the preexisting functions. Should probably add info to the pickle which indicates the tokenizing function used to build it. This could then be the default for spam detection runs. Next step is to drive this with spam/non-spam corpora, selecting each of the various tokenizer functions, and presenting the results in tabular form. Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GBayes.py 23 Aug 2002 03:10:42 -0000 1.10 --- GBayes.py 23 Aug 2002 14:25:39 -0000 1.11 *************** *** 35,39 **** -o file with -m, output all messages, with marks, to file ! When called without any options or arguments, a short self-test is run. """ --- 35,42 ---- -o file with -m, output all messages, with marks, to file ! -t func ! tokenize using function 'func'. for a list of functions, run w/ -H. ! -H ! describe all available tokenizing functions, then exit When called without any options or arguments, a short self-test is run. """ *************** *** 338,359 **** def tokenize_words_foldcase(string): return _token_re.findall(string.lower()) def tokenize_words(string): return _token_re.findall(string) def tokenize_split_foldcase(string): return string.lower().split() def tokenize_split(string): return string.split() # Do an N-gram generator instead. Fold case and collapse runs of whitespace. # Probably a good idea to fold punctuation characters into one (or just a # few) representatives too. def tokenize_5gram_foldcase_wscollapse(string, N=5): normalized = " ".join(string.lower().split()) ! for i in xrange(len(normalized)-N+1): ! yield normalized[i : i+N] def tokenize_ngram(string, N): --- 341,384 ---- def tokenize_words_foldcase(string): + r"""tokenize w/ re '[\w$\-]+', fold case""" return _token_re.findall(string.lower()) def tokenize_words(string): + r"""tokenize w/ re '[\w$\-]+'""" return _token_re.findall(string) def tokenize_split_foldcase(string): + r"""tokenize using simple string split(), fold case""" return string.lower().split() def tokenize_split(string): + r"""tokenize using simple string split()""" return string.split() + def tokenize_wordpairs_foldcase(string): + r"""tokenize w/ re '[\w$\-]+' -> 'w1 w2', 'w3 w4', ..., fold case""" + lst = _token_re.findall(string.lower()) + for i in range(0, len(lst), 2): + yield " ".join(lst[i:i+2]) + + def tokenize_words_and_pairs(string): + r"""tokenize w/ re '[\w$\-]+' -> w1, w2, 'w1 w2', w3, w4, 'w3 w4' ...""" + lst = _token_re.findall(string.lower()) + lst.append("") + for i in range(0, len(lst)-1, 2): + a = lst[i] + b = lst[i+1] + yield a + if b: + yield b + yield "%s %s" % (a, b) + # Do an N-gram generator instead. Fold case and collapse runs of whitespace. # Probably a good idea to fold punctuation characters into one (or just a # few) representatives too. def tokenize_5gram_foldcase_wscollapse(string, N=5): + r"""tokenize w/ 5-char runs, fold case, normalize whitespace""" normalized = " ".join(string.lower().split()) ! return tokenize_ngram(normalized, N) def tokenize_ngram(string, N): *************** *** 362,374 **** def tokenize_5gram(string): return tokenize_ngram(string, 5) def tokenize_10gram(string): return tokenize_ngram(string, 10) def tokenize_15gram(string): return tokenize_ngram(string, 15) ! tokenize = tokenize_words_foldcase spam1 = """ --- 387,415 ---- def tokenize_5gram(string): + r"""tokenize w/ strict 5-char runs""" return tokenize_ngram(string, 5) def tokenize_10gram(string): + r"""tokenize w/ strict 10-char runs""" return tokenize_ngram(string, 10) def tokenize_15gram(string): + r"""tokenize w/ strict 15-char runs""" return tokenize_ngram(string, 15) ! # add user-visible string as key and function as value - function's docstring ! # serves as help string when -H is used, so keep it brief! ! tokenizers = { ! "5gram": tokenize_5gram, ! "5gram_fold_normws": tokenize_5gram_foldcase_wscollapse, ! "10gram": tokenize_10gram, ! "15gram": tokenize_15gram, ! "word_and_pairs": tokenize_words_and_pairs, ! "wordpairs_fold": tokenize_wordpairs_foldcase, ! "split": tokenize_split, ! "split_fold": tokenize_split_foldcase, ! "words": tokenize_words, ! "words_fold": tokenize_words_foldcase, ! } spam1 = """ *************** *** 584,596 **** def usage(code, msg=''): - print >> sys.stderr, __doc__ % globals() if msg: print >> sys.stderr, msg sys.exit(code) def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'hg:s:u:p:c:m:o:') except getopt.error, msg: usage(1, msg) --- 625,659 ---- def usage(code, msg=''): if msg: print >> sys.stderr, msg + print >> sys.stderr + print >> sys.stderr, __doc__ % globals() sys.exit(code) + def describe_tokenizers(tokenize): + print >> sys.stderr, "Possible tokenizing functions are:" + keys = tokenizers.keys() + keys.sort() + maxlen = max(map(len, keys)) + default = "unknown" + for k in keys: + func = tokenizers[k] + if tokenize == func: + default = k + doc = func.__doc__ or "???" + if maxlen + 4 + len(doc) > 78: + sp = "\n"+" "*5 + else: + sp = " "*(maxlen-len(k)+1) + print >> sys.stderr, " %s:%s%s" % (k, sp, doc) + if default: + print >> sys.stderr, "Default tokenizer is", default + sys.exit(0) + + def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'hHg:s:u:p:c:m:o:t:') except getopt.error, msg: usage(1, msg) *************** *** 602,608 **** --- 665,674 ---- threshold = count = good = spam = unknown = pck = mark = output = None + tokenize = tokenize_words_foldcase for opt, arg in opts: if opt == '-h': usage(0) + elif opt == '-H': + describe_tokenizers(tokenize) elif opt == '-g': good = arg *************** *** 611,614 **** --- 677,684 ---- elif opt == '-u': unknown = arg + elif opt == '-t': + tokenize = tokenizers.get(arg) + if tokenize is None: + usage(1, "Unrecognized tokenize function: %s" % arg) elif opt == '-p': pck = arg From gvanrossum@users.sourceforge.net Fri Aug 23 15:45:04 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 07:45:04 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11945 Modified Files: sets.py Log Message: RH pointed out that discard(element) doesn't do the transformation on the element if necessary. Fixed by calling self.remove(element). Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sets.py 22 Aug 2002 17:23:33 -0000 1.13 --- sets.py 23 Aug 2002 14:45:02 -0000 1.14 *************** *** 451,455 **** """ try: ! del self._data[element] except KeyError: pass --- 451,455 ---- """ try: ! self.remove(element) except KeyError: pass From tim_one@users.sourceforge.net Fri Aug 23 16:17:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:17:44 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes splitn.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv25755 Added Files: splitn.py Log Message: Utility to split an mbox into N random pieces in one gulp. This gives a convenient way to break a giant corpus into multiple files that can then be used independently across multiple training and testing runs. It's important to do multiple runs on different random samples to avoid drawing conclusions based on accidents in a single random training corpus; if the algorithm is robust, it should have similar performance across all runs. --- NEW FILE: splitn.py --- #! /usr/bin/env python """Split an mbox into N random mboxes. Usage: %(program)s [-h] [-s seed] [-v] -n N sourcembox outfilebase Options: -h / --help Print this help message and exit -s seed Seed the random number generator with seed (an integer). By default, use system time at startup to seed. -v Verbose. Displays a period for each 100 messages parsed. May display other stuff. -n N The number of output mboxes desired. This is required. Arguments: sourcembox The mbox to split. outfilebase The base path + name prefix for each of the N output files. Output mboxes have names of the form outfilebase + ("%%d.mbox" %% i) Example: %(program)s -s 123 -n5 spam.mbox rspam produces 5 mboxes, named rspam1.mbox through rspam5.mbox. Each contains a random selection of the messages in spam.mbox, and together they contain every message in spam.mbox exactly once. Each has approximately the same number of messages. spam.mbox is not altered. In addition, the seed for the random number generator is forced to 123, so that while the split is random, it's reproducible. """ import sys import random import mailbox import email import getopt program = sys.argv[0] def usage(code, msg=''): print >> sys.stderr, __doc__ % globals() if msg: print >> sys.stderr, msg sys.exit(code) def _factory(fp): try: return email.message_from_file(fp) except email.Errors.MessageParseError: return None def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hn:s:v', ['help']) except getopt.error, msg: usage(1, msg) n = None verbose = False for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt == '-s': random.seed(int(arg)) elif opt == '-n': n = int(arg) elif opt == '-v': verbose = True if n is None or n <= 1: usage(1, "an -n value > 1 is required") if len(args) != 2: usage(1, "input mbox name and output base path are required") inputpath, outputbasepath = args infile = file(inputpath, 'rb') outfiles = [file(outputbasepath + ("%d.mbox" % i), 'wb') for i in range(1, n+1)] mbox = mailbox.PortableUnixMailbox(infile, _factory) counter = 0 for msg in mbox: i = random.randrange(n) astext = str(msg) assert astext.endswith('\n') outfiles[i].write(astext) counter += 1 if verbose: if counter % 100 == 0: print '.', if verbose: print print counter, "messages split into", n, "files" infile.close() for f in outfiles: f.close() if __name__ == '__main__': main() From rhettinger@users.sourceforge.net Fri Aug 23 16:18:40 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:18:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,NONE,1.1 lib.tex,1.203,1.204 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28055 Modified Files: lib.tex Added Files: libsets.tex Log Message: Load docs for sets.py --- NEW FILE: libsets.tex --- \section{\module{sets} --- Unordered collections of unique elements} \declaremodule{standard}{sets} \modulesynopsis{Implementation of sets of unique elements.} \moduleauthor{Greg V. Wilson}{gvwilson@nevex.com} \moduleauthor{Alex Martelli}{aleax@aleax.it} \moduleauthor{Guido van Rossum}{guido@python.org} \sectionauthor{Raymond D. Hettinger}{python@rcn.com} \versionadded{2.3} The \module{sets} module provides classes for constructing and manipulating unordered collections of unique elements. Common uses include membership testing, removing duplicates from a sequence, and computing standard math operations on sets such as intersection, union, difference, and symmetric difference. Like other collections, sets support \code{x in s}, \code{len(s)}, and \code{for x in s}. Being an unordered collection, sets do not record element position or order of insertion. Accordingly, sets do not support indexing, slicing or other sequence-like behavior. Most set applications use the \class{Set} class which provides every set method except for \method{__hash__()}. For advanced applications requiring a hash method, the \class{ImmutableSet} class adds a \method{__hash__()} method but omits methods which alter the contents of the set. Both \class{Set} and \class{ImmutableSet} derive from \class{BaseSet}, an abstract class useful for determining whether something is a set: \code{isinstance(x, BaseSet)}. The set classes are implemented using dictionaries. As a result, sets cannot contain mutable elements such as lists or dictionaries. However, they can contain immutable collections such as tuples or instances of \class(ImmutableSet). For convenience in implementing sets of sets, inner sets are automatically converted to immutable form, for example, \code{Set([Set(['dog'])])} is transformed to \code{Set([ImmutableSet(['dog'])])}. \begin{classdesc}{Set}{\optional{iterable}} Constructs a new empty \class{Set} object. If the optional \var{iterable} parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or be transformable to an immutable using the protocol described at \ref{immutable-transforms}. \end{classdesc} \begin{classdesc}{ImmutableSet}{\optional{iterable}} Constructs a new empty \class{ImmutableSet} object. If the optional \var{iterable} parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or be transformable to an immutable using the protocol described at \ref{immutable-transforms}. Because \class{ImmutableSet} objects provide a \method{__hash__()} method, they can be used as set elements or as dictionary keys. \class{ImmutableSet} objects do not have methods for adding or removing elements, so all of the elements must be known when the constructor is called. \end{classdesc} \subsection{set Objects} Instances of \class{Set} and \class{ImmutableSet} both provide the following operations: \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} \lineiii{len(\var{s})}{cardinality of set \var{s}}{} \hline \lineiii{\var{x} in \var{s}} {test \var{x} for membership in \var{s}}{} \lineiii{\var{x} not in \var{s}} {test \var{x} for non-membership in \var{s}}{} \lineiii{\var{s}.issubset(\var{t})} {test whether every element in \var{s} is in \var{t}}{} \lineiii{\var{s}.issuperset(\var{t})} {test whether every element in \var{t} is in \var{s}}{} \hline \lineiii{\var{s} | \var{t}} {new set with elements from both \var{s} and \var{t}}{} \lineiii{\var{s}.union(\var{t})} {new set with elements from both \var{s} and \var{t}}{} \lineiii{\var{s} & \var{t}} {new set with elements common to \var{s} and \var{t}}{} \lineiii{\var{s}.intersection(\var{t})} {new set with elements common to \var{s} and \var{t}}{} \lineiii{\var{s} - \var{t}} {new set with elements in \var{s} but not in \var{t}}{} \lineiii{\var{s}.difference(\var{t})} {new set with elements in \var{s} but not in \var{t}}{} \lineiii{\var{s} ^ \var{t}} {new set with elements in either \var{s} or \var{t} but not both}{} \lineiii{\var{s}.symmetric_difference(\var{t})} {new set with elements in either \var{s} or \var{t} but not both}{} \lineiii{\var{s}.copy()} {new set with a shallow copy of \var{s}}{} \end{tableiii} In addition to the above operations, both \class{Set} and \class{ImmutableSet} support set to set comparison operators based on the contents of their internal dictionaries. Two sets are equal if and only if every element of each set is contained in the other. The following table lists operations available in \class{ImmutableSet} but not found in \class{Set}: \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} \lineiii{hash(\var{s})}{returns a hash value for \var{s}}{} \end{tableiii} The following table lists operations available in \class{Set} but not found in \class{ImmutableSet}: \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} \lineiii{\var{s} |= \var{t}} {return set \var{s} with elements added from \var{t}}{} \lineiii{\var{s}.union_update(\var{t})} {return set \var{s} with elements added from \var{t}}{} \lineiii{\var{s} &= \var{t}} {return set \var{s} keeping only elements also found in \var{t}}{} \lineiii{\var{s}.intersection_update(\var{t})} {return set \var{s} keeping only elements also found in \var{t}}{} \lineiii{\var{s} -= \var{t}} {return set \var{s} after removing elements found in \var{t}}{} \lineiii{\var{s}.difference_update(\var{t})} {return set \var{s} after removing elements found in \var{t}}{} \lineiii{\var{s} ^= \var{t}} {return set \var{s} with elements from \var{s} or \var{t} but not both}{} \lineiii{\var{s}.symmetric_difference_update(\var{t})} {return set \var{s} with elements from \var{s} or \var{t} but not both}{} \hline \lineiii{\var{s}.add(\var{x})} {Add element \var{x} to set \var{s}}{} \lineiii{\var{s}.remove(\var{x})} {Remove element \var{x} from set \var{s}}{} \lineiii{\var{s}.discard(\var{x})} {Removes element \var{x} from set \var{s} like \var{s}.remove(\var{x}) but does not raise a KeyError if \var{x} is not in \var{s}}{} \lineiii{\var{s}.pop()} {Remove and return a randomly-chosen element from \var{s}}{} \lineiii{\var{s}.update(\var{t})} {Add elements from \var{t} to set \var{s}}{} \lineiii{\var{s}.clear()} {Remove all elements from set \var{s}}{} \end{tableiii} \subsection{Example} \begin{verbatim} >>> from sets import Set >>> engineers = Set(['John', 'Jane', 'Jack', 'Janice']) >>> programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) >>> management = Set(['Jane', 'Jack', 'Susan', 'Zack']) >>> employees = engineers | programmers | management # union >>> engineering_management = engineers & programmers # intersection >>> fulltime_management = management - engineers - programmers # difference >>> engineers.add('Marvin') # add element >>> print engineers Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) >>> employees.issuperset(engineers) # superset test False >>> employees.update(engineers) # update from another set >>> employees.issuperset(engineers) True >>> for group in [engineers, programmers, management, employees]: group.discard('Susan') # unconditionally remove element print group Set(['Jane', 'Marvin', 'Janice', 'John', 'Jack']) Set(['Janice', 'Jack', 'Sam']) Set(['Jane', 'Zack', 'Jack']) Set(['Jack', 'Sam', 'Jane', 'Marvin', 'Janice', 'John', 'Zack']) \end{verbatim} \subsection{Protocol for automatic conversion to immutable \label{immutable-transforms}} Sets can only contain immutable elements. For convenience, mutable \class{Set} objects are automatically copied to an \class{ImmutableSet} before being added as a set element. The mechanism is to always add a hashable element, or if it is not hashable, the element is checked to see if it has an \method{_as_immutable()} method which returns an immutable equivalent. Since \class{Set} objects have a \method{_as_immutable()} method returning an instance of \class{ImmutableSet}, it is possible to construct sets of sets. A similar mechanism is needed by the \method{__contains__()} and \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability and, if not, check for a \method{_as_Temporarily_Immutable} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. The alternate mechanism spares the need to build a separate copy of the original mutable object. \class{Set} objects implement the \method{_as_Temporarily_Immutable} method which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. The two mechanisms for adding hashability are normally invisible to the user; however, a conflict can arise in a multi-threaded environment where one thread is updating a Set while another has temporarily wrapped it in \class{_TemporarilyImmutableSet}. In other words, sets of mutable sets are not thread-safe. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.203 retrieving revision 1.204 diff -C2 -d -r1.203 -r1.204 *** lib.tex 2 Aug 2002 18:03:23 -0000 1.203 --- lib.tex 23 Aug 2002 15:18:37 -0000 1.204 *************** *** 123,126 **** --- 123,127 ---- \input{libheapq} \input{libarray} + \input{libsets} \input{libcfgparser} \input{libfileinput} From mwh@users.sourceforge.net Fri Aug 23 16:27:54 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:27:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.160.10.1,1.160.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv31843 Modified Files: Tag: release22-maint Tkinter.py Log Message: backport loewis' checkin of revision 1.161 of Tkinter.py Ignore widgets with unknown names in winfo_children. Fixes #518283. 2.2.2 candidate. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.160.10.1 retrieving revision 1.160.10.2 diff -C2 -d -r1.160.10.1 -r1.160.10.2 *** Tkinter.py 23 Jul 2002 02:55:14 -0000 1.160.10.1 --- Tkinter.py 23 Aug 2002 15:27:52 -0000 1.160.10.2 *************** *** 606,612 **** def winfo_children(self): """Return a list of all widgets which are children of this widget.""" ! return map(self._nametowidget, ! self.tk.splitlist(self.tk.call( ! 'winfo', 'children', self._w))) def winfo_class(self): """Return window class name of this widget.""" --- 606,620 ---- def winfo_children(self): """Return a list of all widgets which are children of this widget.""" ! result = [] ! for child in self.tk.splitlist( ! self.tk.call('winfo', 'children', self._w)): ! try: ! # Tcl sometimes returns extra windows, e.g. for ! # menus; those need to be skipped ! result.append(self._nametowidget(child)) ! except KeyError: ! pass ! return result ! def winfo_class(self): """Return window class name of this widget.""" From fdrake@users.sourceforge.net Fri Aug 23 16:38:04 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:38:04 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.88,1.89 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv2554 Modified Files: Makefile.deps Log Message: Add an entry for the sets module documentation. Move another entry so the boilerplate doesn't get mixed up with document-specific content. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Makefile.deps 2 Aug 2002 18:20:34 -0000 1.88 --- Makefile.deps 23 Aug 2002 15:38:02 -0000 1.89 *************** *** 84,87 **** --- 84,88 ---- # LaTeX source files for the Python Library Reference LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ + texinputs/reportingbugs.tex \ lib/lib.tex \ lib/asttable.tex \ *************** *** 96,100 **** lib/emailparser.tex \ lib/emailutil.tex \ - texinputs/reportingbugs.tex \ lib/libintro.tex \ lib/libobjs.tex \ --- 97,100 ---- *************** *** 106,109 **** --- 106,110 ---- lib/libfpectl.tex \ lib/libgc.tex \ + lib/libsets.tex \ lib/libweakref.tex \ lib/libinspect.tex \ From mwh@users.sourceforge.net Fri Aug 23 16:42:29 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:42:29 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.51.24.1,1.51.24.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4047 Modified Files: Tag: release22-maint pdb.py Log Message: backport gvanrossum's checkin of revision 1.52 of pdb.py date: 2002/04/15 00:48:24; author: gvanrossum; state: Exp; lines: +4 -1 Add exit as alias for quit, as the easiest way to address SF bug #543674. Bugfix candidate. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.51.24.1 retrieving revision 1.51.24.2 diff -C2 -d -r1.51.24.1 -r1.51.24.2 *** pdb.py 12 Jul 2002 13:12:44 -0000 1.51.24.1 --- pdb.py 23 Aug 2002 15:42:27 -0000 1.51.24.2 *************** *** 498,501 **** --- 498,502 ---- return 1 do_q = do_quit + do_exit = do_quit def do_args(self, arg): *************** *** 820,825 **** def help_q(self): ! print """q(uit) Quit from the debugger. The program being executed is aborted.""" def help_whatis(self): --- 821,828 ---- def help_q(self): ! print """q(uit) or exit - Quit from the debugger. The program being executed is aborted.""" + + help_exit = help_q def help_whatis(self): From tim_one@users.sourceforge.net Fri Aug 23 16:42:50 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:42:50 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,NONE,1.1 GBayes.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv2797 Modified Files: GBayes.py Added Files: classifier.py Log Message: Moved all the interesting code that was in the *original* GBayes.py into a new classifier.py. It was designed to have a very clean interface, and there's no reason to keep slamming everything into one file. The ever-growing tokenizer stuff should probably also be split out, leaving GBayes.py a pure driver. Also repaired _test() (Skip's checkin left it without a binding for the tokenize function). --- NEW FILE: classifier.py --- # This is an implementation of the Bayes-like spam classifier sketched # by Paul Graham at . We say # "Bayes-like" because there are many ad hoc deviations from a # "normal" Bayesian classifier. # # This implementation is due to Tim Peters et alia. import time from heapq import heapreplace HAMBIAS = 2.0 SPAMBIAS = 1.0 # "And then there is the question of what probability to assign to words # that occur in one corpus but not the other. Again by trial and error I # chose .01 and .99.". However, the code snippet clamps *all* probabilities # into this range. MIN_SPAMPROB = 0.01 MAX_SPAMPROB = 0.99 UNKNOWN_SPAMPROB = 0.20 # "I only consider words that occur more than five times in total". # But the code snippet considers words that appear at least five times. # This implementation follows the code rather than the explanation. # (In addition, the count compared is after multiplying it with the # appropriate bias factor.) MINCOUNT = 5.0 MAX_DISCRIMINATORS = 15 PICKLE_VERSION = 1 class WordInfo(object): __slots__ = ('atime', # when this record was last used by scoring(*) 'spamcount', # # of times word appears in spam 'hamcount', # # of times word appears in non-spam 'killcount', # # of times this made it to spamprob()'s nbest 'spamprob', # prob(spam | msg contains this word) ) # (*)atime is the last access time, a UTC time.time() value. It's the # most recent time this word was used by scoring (i.e., by spamprob(), # not by training via learn()); or, if the word has never been used by # scoring, the time the word record was created (i.e., by learn()). # One good criterion for identifying junk (word records that have no # value) is to delete words that haven't been used for a long time. # Perhaps they were typos, or unique identifiers, or relevant to a # once-hot topic or scam that's fallen out of favor. Whatever, if # a word is no longer being used, it's just wasting space. def __init__(self, atime): self.atime = atime self.spamcount = self.hamcount = self.killcount = 0 self.spamprob = None def __repr__(self): return "WordInfo%r" % repr((self.atime, self.spamcount, self.hamcount, self.killcount, self.spamprob)) def __getstate__(self): return (self.atime, self.spamcount, self.hamcount, self.killcount, self.spamprob) def __setstate__(self, t): (self.atime, self.spamcount, self.hamcount, self.killcount, self.spamprob) = t class GrahamBayes(object): __slots__ = ('wordinfo', # map word to WordInfo record 'nspam', # number of spam messages learn() has seen 'nham', # number of non-spam messages learn() has seen ) DEBUG = False def __init__(self): self.wordinfo = {} self.nspam = self.nham = 0 def __getstate__(self): return PICKLE_VERSION, self.wordinfo, self.nspam, self.nham def __setstate__(self, t): if t[0] != PICKLE_VERSION: raise ValueError("Can't unpickle -- version %s unknown" % t[0]) self.wordinfo, self.nspam, self.nham = t[1:] def spamprob(self, wordstream): """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 self.DEBUG: print "spamprob(%r)" % wordstream if not wordstream: raise ValueError("non-empty wordstream required") wordinfoget = self.wordinfo.get now = time.time() # 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 for word in wordstream: 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. Note: This is what Graham's code did, # but it's dubious for reasons explained in great detail on Python- # Dev: it's missing P(spam) and P(not-spam) adjustments that # straightforward Bayesian analysis says should be here. It's # unclear how much it matters, though, as the omissions here seem # to tend in part to cancel out distortions introduced earlier by # HAMBIAS. Experiments will decide the issue. prob_product = inverse_prob_product = 1.0 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 self.DEBUG: print 'nbest P(%r) = %g' % (word, prob) prob_product *= prob inverse_prob_product *= 1.0 - prob return prob_product / (prob_product + inverse_prob_product) def learn(self, wordstream, is_spam, update_probabilities=True): """Teach the classifier by example. wordstream is a word stream representing a message. If is_spam is True, you're telling the classifier this message is definitely spam, else that it's definitely not spam. If optional arg update_probabilities is False (the default is True), don't update word probabilities. Updating them is expensive, and if you're going to pass many messages to learn(), it's more efficient to pass False here and call update_probabilities() once when you're done -- or to call learn() with update_probabilities=True when passing the last new example. The important thing is that the probabilities get updated before calling spamprob() again. """ self._add_msg(wordstream, is_spam) if update_probabilities: self.update_probabilities() def unlearn(self, wordstream, is_spam, update_probabilities=True): """In case of pilot error, call unlearn ASAP after screwing up. Pass the same arguments you passed to learn(). """ self._remove_msg(wordstream, is_spam) if update_probabilities: self.update_probabilities() def update_probabilities(self): """Update the word probabilities in the spam database. This computes a new probability for every word in the database, so can be expensive. learn() and unlearn() update the probabilities each time by default. Thay have an optional argument that allows to skip this step when feeding in many messages, and in that case you should call update_probabilities() after feeding the last message and before calling spamprob(). """ nham = float(self.nham or 1) nspam = float(self.nspam or 1) for record in self.wordinfo.itervalues(): # Compute prob(msg is spam | msg contains word). hamcount = HAMBIAS * record.hamcount spamcount = SPAMBIAS * record.spamcount if hamcount + spamcount < MINCOUNT: prob = UNKNOWN_SPAMPROB else: hamratio = min(1.0, hamcount / nham) spamratio = min(1.0, spamcount / nspam) prob = spamratio / (hamratio + spamratio) if prob < MIN_SPAMPROB: prob = MIN_SPAMPROB elif prob > MAX_SPAMPROB: prob = MAX_SPAMPROB record.spamprob = prob if self.DEBUG: print 'New probabilities:' for w, r in self.wordinfo.iteritems(): print "P(%r) = %g" % (w, r.spamprob) def clearjunk(self, oldesttime, mincount=MINCOUNT): """Forget useless wordinfo records. This can shrink the database size. A record for a word will be retained only if the word was accessed at or after oldesttime, or appeared at least mincount times in messages passed to learn(). mincount is optional, and defaults to the value an internal algorithm uses to decide that a word is so rare that it has no predictive value. """ wordinfo = self.wordinfo mincount = float(mincount) tonuke = [w for w, r in wordinfo.iteritems() if r.atime < oldesttime and SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount] for w in tonuke: if self.DEBUG: print "clearjunk removing word %r: %r" % (w, r) del wordinfo[w] def _add_msg(self, wordstream, is_spam): if self.DEBUG: print "_add_msg(%r, %r)" % (wordstream, is_spam) if is_spam: self.nspam += 1 else: self.nham += 1 wordinfo = self.wordinfo wordinfoget = wordinfo.get now = time.time() for word in wordstream: record = wordinfoget(word) if record is None: record = wordinfo[word] = WordInfo(now) if is_spam: record.spamcount += 1 else: record.hamcount += 1 if self.DEBUG: print "new count for %r = %d" % (word, is_spam and record.spamcount or record.hamcount) def _remove_msg(self, wordstream, is_spam): if self.DEBUG: print "_remove_msg(%r, %r)" % (wordstream, is_spam) if is_spam: if self.nspam <= 0: raise ValueError("spam count would go negative!") self.nspam -= 1 else: if self.nham <= 0: raise ValueError("non-spam count would go negative!") self.nham -= 1 wordinfoget = self.wordinfo.get for word in wordstream: record = wordinfoget(word) if record is not None: if is_spam: if record.spamcount > 0: record.spamcount -= 1 else: if record.hamcount > 0: record.hamcount -= 1 Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GBayes.py 23 Aug 2002 14:25:39 -0000 1.11 --- GBayes.py 23 Aug 2002 15:42:48 -0000 1.12 *************** *** 1,13 **** #!/usr/bin/env python ! # This is an implementation of the Bayes-like spam classifier sketched ! # by Paul Graham at . We say ! # "Bayes-like" because there are many ad hoc deviations from a ! # "normal" Bayesian classifier. ! # ! # Tim Peters wrote the algorithmic part of the code. ! # ! # Barry Warsaw added integration infrastructure like command line ! # options and a pickled database. """Usage: %(program)s [options] --- 1,5 ---- #!/usr/bin/env python ! # A driver for the classifier module. Barry Warsaw is the primary author. """Usage: %(program)s [options] *************** *** 44,49 **** import sys import getopt - import time - from heapq import heapreplace import cPickle as pickle import mailbox --- 36,39 ---- *************** *** 51,337 **** import errno ! program = sys.argv[0] ! ! HAMBIAS = 2.0 ! SPAMBIAS = 1.0 ! ! # "And then there is the question of what probability to assign to words ! # that occur in one corpus but not the other. Again by trial and error I ! # chose .01 and .99.". However, the code snippet clamps *all* probabilities ! # into this range. ! MIN_SPAMPROB = 0.01 ! MAX_SPAMPROB = 0.99 ! ! UNKNOWN_SPAMPROB = 0.20 ! ! # "I only consider words that occur more than five times in total". ! # But the code snippet considers words that appear at least five times. ! # This implementation follows the code rather than the explanation. ! # (In addition, the count compared is after multiplying it with the ! # appropriate bias factor.) ! MINCOUNT = 5.0 ! ! MAX_DISCRIMINATORS = 15 ! ! PICKLE_VERSION = 1 ! ! class WordInfo(object): ! __slots__ = ('atime', # when this record was last used by scoring(*) ! 'spamcount', # # of times word appears in spam ! 'hamcount', # # of times word appears in non-spam ! 'killcount', # # of times this made it to spamprob()'s nbest ! 'spamprob', # prob(spam | msg contains this word) ! ) ! # (*)atime is the last access time, a UTC time.time() value. It's the ! # most recent time this word was used by scoring (i.e., by spamprob(), ! # not by training via learn()); or, if the word has never been used by ! # scoring, the time the word record was created (i.e., by learn()). ! # One good criterion for identifying junk (word records that have no ! # value) is to delete words that haven't been used for a long time. ! # Perhaps they were typos, or unique identifiers, or relevant to a ! # once-hot topic or scam that's fallen out of favor. Whatever, if ! # a word is no longer being used, it's just wasting space. ! ! def __init__(self, atime): ! self.atime = atime ! self.spamcount = self.hamcount = self.killcount = 0 ! self.spamprob = None ! ! def __repr__(self): ! return "WordInfo%r" % repr((self.atime, self.spamcount, ! self.hamcount, self.killcount, ! self.spamprob)) ! ! def __getstate__(self): ! return (self.atime, self.spamcount, self.hamcount, self.killcount, ! self.spamprob) ! ! def __setstate__(self, t): ! (self.atime, self.spamcount, self.hamcount, self.killcount, ! self.spamprob) = t ! ! class GrahamBayes(object): ! __slots__ = ('wordinfo', # map word to WordInfo record ! 'nspam', # number of spam messages learn() has seen ! 'nham', # number of non-spam messages learn() has seen ! ) ! ! DEBUG = False ! ! def __init__(self): ! self.wordinfo = {} ! self.nspam = self.nham = 0 ! ! def __getstate__(self): ! return PICKLE_VERSION, self.wordinfo, self.nspam, self.nham ! ! def __setstate__(self, t): ! if t[0] != PICKLE_VERSION: ! raise ValueError("Can't unpickle -- version %s unknown" % t[0]) ! self.wordinfo, self.nspam, self.nham = t[1:] ! ! def spamprob(self, wordstream): ! """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 self.DEBUG: ! print "spamprob(%r)" % wordstream ! ! if not wordstream: ! raise ValueError("non-empty wordstream required") ! ! wordinfoget = self.wordinfo.get ! now = time.time() ! ! # 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 ! ! for word in wordstream: ! 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. Note: This is what Graham's code did, ! # but it's dubious for reasons explained in great detail on Python- ! # Dev: it's missing P(spam) and P(not-spam) adjustments that ! # straightforward Bayesian analysis says should be here. It's ! # unclear how much it matters, though, as the omissions here seem ! # to tend in part to cancel out distortions introduced earlier by ! # HAMBIAS. Experiments will decide the issue. ! prob_product = inverse_prob_product = 1.0 ! 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 self.DEBUG: ! print 'nbest P(%r) = %g' % (word, prob) ! prob_product *= prob ! inverse_prob_product *= 1.0 - prob ! ! return prob_product / (prob_product + inverse_prob_product) ! ! def learn(self, wordstream, is_spam, update_probabilities=True): ! """Teach the classifier by example. ! ! wordstream is a word stream representing a message. If is_spam is ! True, you're telling the classifier this message is definitely spam, ! else that it's definitely not spam. ! ! If optional arg update_probabilities is False (the default is True), ! don't update word probabilities. Updating them is expensive, and if ! you're going to pass many messages to learn(), it's more efficient ! to pass False here and call update_probabilities() once when you're ! done -- or to call learn() with update_probabilities=True when ! passing the last new example. The important thing is that the ! probabilities get updated before calling spamprob() again. ! """ ! ! self._add_msg(wordstream, is_spam) ! if update_probabilities: ! self.update_probabilities() ! ! def unlearn(self, wordstream, is_spam, update_probabilities=True): ! """In case of pilot error, call unlearn ASAP after screwing up. ! ! Pass the same arguments you passed to learn(). ! """ ! ! self._remove_msg(wordstream, is_spam) ! if update_probabilities: ! self.update_probabilities() ! ! def update_probabilities(self): ! """Update the word probabilities in the spam database. ! ! This computes a new probability for every word in the database, ! so can be expensive. learn() and unlearn() update the probabilities ! each time by default. Thay have an optional argument that allows ! to skip this step when feeding in many messages, and in that case ! you should call update_probabilities() after feeding the last ! message and before calling spamprob(). ! """ ! ! nham = float(self.nham or 1) ! nspam = float(self.nspam or 1) ! for record in self.wordinfo.itervalues(): ! # Compute prob(msg is spam | msg contains word). ! hamcount = HAMBIAS * record.hamcount ! spamcount = SPAMBIAS * record.spamcount ! if hamcount + spamcount < MINCOUNT: ! prob = UNKNOWN_SPAMPROB ! else: ! hamratio = min(1.0, hamcount / nham) ! spamratio = min(1.0, spamcount / nspam) ! ! prob = spamratio / (hamratio + spamratio) ! if prob < MIN_SPAMPROB: ! prob = MIN_SPAMPROB ! elif prob > MAX_SPAMPROB: ! prob = MAX_SPAMPROB ! ! record.spamprob = prob ! ! if self.DEBUG: ! print 'New probabilities:' ! for w, r in self.wordinfo.iteritems(): ! print "P(%r) = %g" % (w, r.spamprob) ! ! def clearjunk(self, oldesttime, mincount=MINCOUNT): ! """Forget useless wordinfo records. This can shrink the database size. ! ! A record for a word will be retained only if the word was accessed ! at or after oldesttime, or appeared at least mincount times in ! messages passed to learn(). mincount is optional, and defaults ! to the value an internal algorithm uses to decide that a word is so ! rare that it has no predictive value. ! """ ! ! wordinfo = self.wordinfo ! mincount = float(mincount) ! tonuke = [w for w, r in wordinfo.iteritems() ! if r.atime < oldesttime and ! SPAMBIAS*r.spamcount + HAMBIAS*r.hamcount < mincount] ! for w in tonuke: ! if self.DEBUG: ! print "clearjunk removing word %r: %r" % (w, r) ! del wordinfo[w] ! ! def _add_msg(self, wordstream, is_spam): ! if self.DEBUG: ! print "_add_msg(%r, %r)" % (wordstream, is_spam) ! ! if is_spam: ! self.nspam += 1 ! else: ! self.nham += 1 ! ! wordinfo = self.wordinfo ! wordinfoget = wordinfo.get ! now = time.time() ! for word in wordstream: ! record = wordinfoget(word) ! if record is None: ! record = wordinfo[word] = WordInfo(now) ! ! if is_spam: ! record.spamcount += 1 ! else: ! record.hamcount += 1 ! ! if self.DEBUG: ! print "new count for %r = %d" % (word, ! is_spam and record.spamcount or record.hamcount) ! ! def _remove_msg(self, wordstream, is_spam): ! if self.DEBUG: ! print "_remove_msg(%r, %r)" % (wordstream, is_spam) ! ! if is_spam: ! if self.nspam <= 0: ! raise ValueError("spam count would go negative!") ! self.nspam -= 1 ! else: ! if self.nham <= 0: ! raise ValueError("non-spam count would go negative!") ! self.nham -= 1 ! ! wordinfoget = self.wordinfo.get ! for word in wordstream: ! record = wordinfoget(word) ! if record is not None: ! if is_spam: ! if record.spamcount > 0: ! record.spamcount -= 1 ! else: ! if record.hamcount > 0: ! record.hamcount -= 1 ! ############################################################################# ! # The rest of this is just for playing around and testing. # For the heck of it, a simple tokenizer to create word streams. --- 41,47 ---- import errno ! from classifier import GrahamBayes ! program = sys.argv[0] # For the heck of it, a simple tokenizer to create word streams. *************** *** 615,618 **** --- 325,329 ---- def _test(): b = GrahamBayes() + tokenize = tokenize_words_foldcase b.learn(tokenize(spam1), True) b.learn(tokenize(spam2), True) From mwh@users.sourceforge.net Fri Aug 23 16:50:59 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:50:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mmap.py,1.19.8.1,1.19.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6764 Modified Files: Tag: release22-maint test_mmap.py Log Message: backport tim_one's checkin of revision 1.21 of test_mmap.py SF bug 544733: Cygwin test_mmap fix for Python 2.2.1 Close a file before trying to unlink it, and apparently Cygwin needs writes to an mmap'ed file to get flushed before they're visible. Bugfix candidate, but I think only for the 2.2 line (it's testing features that I think were new in 2.2). Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.19.8.1 retrieving revision 1.19.8.2 diff -C2 -d -r1.19.8.1 -r1.19.8.2 *** test_mmap.py 8 Mar 2002 13:39:25 -0000 1.19.8.1 --- test_mmap.py 23 Aug 2002 15:50:57 -0000 1.19.8.2 *************** *** 239,242 **** --- 239,243 ---- else: verify(0, "Incompatible parameters should raise ValueError.") + f.close() finally: try: *************** *** 253,256 **** --- 254,258 ---- n = len(data) f.write(data) + f.flush() m = mmap.mmap(f.fileno(), n) f.close() From mwh@users.sourceforge.net Fri Aug 23 16:53:07 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 08:53:07 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle CallTipWindow.py,1.3,1.3.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv7655 Modified Files: Tag: release22-maint CallTipWindow.py Log Message: backport tim_one's checkin of revision 1.4 of CallTipWindow.py SF bug 546078: IDLE calltips cause application error. Assorted crashes on Windows and Linux when trying to display a very long calltip, most likely a Tk bug. Wormed around by clamping the calltip display to a maximum of 79 characters (why 79? why not ...). Bugfix candidate, for all Python releases. Index: CallTipWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTipWindow.py,v retrieving revision 1.3 retrieving revision 1.3.22.1 diff -C2 -d -r1.3 -r1.3.22.1 *** CallTipWindow.py 17 Jan 2001 08:48:39 -0000 1.3 --- CallTipWindow.py 23 Aug 2002 15:53:05 -0000 1.3.22.1 *************** *** 15,19 **** --- 15,25 ---- def showtip(self, text): + # SF bug 546078: IDLE calltips cause application error. + # There were crashes on various Windows flavors, and even a + # crashing X server on Linux, with very long calltips. + if len(text) >= 79: + text = text[:75] + ' ...' self.text = text + if self.tipwindow or not self.text: return From mwh@users.sourceforge.net Fri Aug 23 17:05:52 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:05:52 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.73.4.2,1.73.4.3 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12132 Modified Files: Tag: release22-maint Makefile.pre.in Log Message: backport loewis' checkin of revision 1.83 of Makefile.pre.in Patch #553230: Create LIBDIR if necessary. Bugfix candidate. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.73.4.2 retrieving revision 1.73.4.3 diff -C2 -d -r1.73.4.2 -r1.73.4.3 *** Makefile.pre.in 5 Mar 2002 13:52:29 -0000 1.73.4.2 --- Makefile.pre.in 23 Aug 2002 16:05:49 -0000 1.73.4.3 *************** *** 548,552 **** # This goes into $(exec_prefix) altbininstall: $(BUILDPYTHON) ! @for i in $(BINDIR); \ do \ if test ! -d $$i; then \ --- 548,552 ---- # This goes into $(exec_prefix) altbininstall: $(BUILDPYTHON) ! @for i in $(BINDIR) $(LIBDIR); \ do \ if test ! -d $$i; then \ From mwh@users.sourceforge.net Fri Aug 23 17:06:48 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:06:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_fcntl.py,1.20,1.20.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12453 Modified Files: Tag: release22-maint test_fcntl.py Log Message: backport gvanrossum's checkin of revision 1.22 of test_fcntl.py SF 554663. Add OpenBSD3. Bugfix candidate if anyone cares. Index: test_fcntl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fcntl.py,v retrieving revision 1.20 retrieving revision 1.20.6.1 diff -C2 -d -r1.20 -r1.20.6.1 *** test_fcntl.py 5 Dec 2001 23:27:32 -0000 1.20 --- test_fcntl.py 23 Aug 2002 16:06:46 -0000 1.20.6.1 *************** *** 20,24 **** 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'bsdos2', 'bsdos3', 'bsdos4', ! 'openbsd', 'openbsd2'): lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, fcntl.F_WRLCK, 0) elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: --- 20,24 ---- 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'bsdos2', 'bsdos3', 'bsdos4', ! 'openbsd', 'openbsd2', 'openbsd3'): lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, fcntl.F_WRLCK, 0) elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: From mwh@users.sourceforge.net Fri Aug 23 17:09:56 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:09:56 -0700 Subject: [Python-checkins] python/dist/src/Lib gzip.py,1.28,1.28.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13606 Modified Files: Tag: release22-maint gzip.py Log Message: backport montanaro's checkin of revision 1.33 of gzip.py force gzip module to open files using 'b'inary mode. closes patch #536278. This looked like a bugfix candidate to me at some point... Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.28 retrieving revision 1.28.10.1 diff -C2 -d -r1.28 -r1.28.10.1 *** gzip.py 13 Oct 2001 18:33:51 -0000 1.28 --- gzip.py 23 Aug 2002 16:09:52 -0000 1.28.10.1 *************** *** 36,39 **** --- 36,43 ---- def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None): + # guarantee the file is opened in binary mode on platforms + # that care about that sort of thing + if mode and 'b' not in mode: + mode += 'b' if fileobj is None: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') From mwh@users.sourceforge.net Fri Aug 23 17:10:15 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:10:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gzip.py,1.8,1.8.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13774 Modified Files: Tag: release22-maint test_gzip.py Log Message: backport montanaro's checkin of revision 1.9 of test_gzip.py force gzip module to open files using 'b'inary mode. closes patch #536278. Index: test_gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gzip.py,v retrieving revision 1.8 retrieving revision 1.8.16.1 diff -C2 -d -r1.8 -r1.8.16.1 *** test_gzip.py 9 Aug 2001 21:40:30 -0000 1.8 --- test_gzip.py 23 Aug 2002 16:10:13 -0000 1.8.16.1 *************** *** 19,23 **** f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close() ! f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close() verify(d == data1*50) --- 19,23 ---- f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close() ! f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close() verify(d == data1*50) *************** *** 74,77 **** --- 74,81 ---- f.seek(pos) f.write('GZ\n') + f.close() + + f = gzip.GzipFile(filename, 'r') + verify(f.myfileobj.mode == 'rb') f.close() From mwh@users.sourceforge.net Fri Aug 23 17:08:40 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:08:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib emailutil.tex,1.5,1.5.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13120 Modified Files: Tag: release22-maint emailutil.tex Log Message: backport bwarsaw's checkin of revision 1.6 of emailutil.tex Minor typo: Message.getall() -> Message.get_all() Index: emailutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailutil.tex,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** emailutil.tex 9 Nov 2001 17:08:13 -0000 1.5 --- emailutil.tex 23 Aug 2002 16:08:38 -0000 1.5.8.1 *************** *** 35,39 **** This method returns a list of 2-tuples of the form returned by \code{parseaddr()}. \var{fieldvalues} is a sequence of header field ! values as might be returned by \method{Message.getall()}. Here's a simple example that gets all the recipients of a message: --- 35,39 ---- This method returns a list of 2-tuples of the form returned by \code{parseaddr()}. \var{fieldvalues} is a sequence of header field ! values as might be returned by \method{Message.get_all()}. Here's a simple example that gets all the recipients of a message: From mwh@users.sourceforge.net Fri Aug 23 17:26:22 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:26:22 -0700 Subject: [Python-checkins] python/dist/src configure,1.279.6.6,1.279.6.7 configure.in,1.288.6.6,1.288.6.7 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv18227 Modified Files: Tag: release22-maint configure configure.in Log Message: backport loewis' checkin of revision 1.309 of configure revision 1.319 of configure.in Use somewhat longer C++ program to detect whether linking requires the C++ compiler. Fixes #559429. 2.2 bugfix candidate. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.279.6.6 retrieving revision 1.279.6.7 diff -C2 -d -r1.279.6.6 -r1.279.6.7 *** configure 2 Jun 2002 17:34:45 -0000 1.279.6.6 --- configure 23 Aug 2002 16:26:06 -0000 1.279.6.7 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.288.6.5 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.288.6.6 # Guess values for system-dependent variables and create Makefiles. *************** *** 1416,1420 **** LINKCC="\$(PURIFY) \$(CC)" else ! echo 'int main(){return 0;}' > conftest.$ac_ext $CXX -c conftest.$ac_ext 2>&5 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ --- 1416,1420 ---- LINKCC="\$(PURIFY) \$(CC)" else ! echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext $CXX -c conftest.$ac_ext 2>&5 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.288.6.6 retrieving revision 1.288.6.7 diff -C2 -d -r1.288.6.6 -r1.288.6.7 *** configure.in 2 Jun 2002 17:34:47 -0000 1.288.6.6 --- configure.in 23 Aug 2002 16:26:17 -0000 1.288.6.7 *************** *** 280,284 **** LINKCC="\$(PURIFY) \$(CC)" else ! echo 'int main(){return 0;}' > conftest.$ac_ext $CXX -c conftest.$ac_ext 2>&5 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ --- 280,284 ---- LINKCC="\$(PURIFY) \$(CC)" else ! echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext $CXX -c conftest.$ac_ext 2>&5 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ From mwh@users.sourceforge.net Fri Aug 23 17:27:43 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:27:43 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.216.4.7,2.216.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18661 Modified Files: Tag: release22-maint posixmodule.c Log Message: backport gvanrossum's checkin of revision 2.234 of posixmodule.c SF bug 563750 (Alex Martelli): posix_tmpfile(): The file returned by tmpfile() has mode w+b, so use that in the call to PyFile_FromFile(). Bugfix candidate. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.216.4.7 retrieving revision 2.216.4.8 diff -C2 -d -r2.216.4.7 -r2.216.4.8 *** posixmodule.c 19 Aug 2002 00:43:06 -0000 2.216.4.7 --- posixmodule.c 23 Aug 2002 16:27:40 -0000 2.216.4.8 *************** *** 4479,4483 **** if (fp == NULL) return posix_error(); ! return PyFile_FromFile(fp, "", "w+", fclose); } #endif --- 4479,4483 ---- if (fp == NULL) return posix_error(); ! return PyFile_FromFile(fp, "", "w+b", fclose); } #endif From mwh@users.sourceforge.net Fri Aug 23 17:28:20 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:28:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.74.2.1.2.6,1.74.2.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18882 Modified Files: Tag: release22-maint libos.tex Log Message: backport gvanrossum's checkin of revision 1.86 of libos.tex SF bug 563750 (Alex Martelli): posix_tmpfile(): The file returned by tmpfile() has mode w+b, so use that in the call to PyFile_FromFile(). Bugfix candidate. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.6 retrieving revision 1.74.2.1.2.7 diff -C2 -d -r1.74.2.1.2.6 -r1.74.2.1.2.7 *** libos.tex 7 Aug 2002 15:49:45 -0000 1.74.2.1.2.6 --- libos.tex 23 Aug 2002 16:28:16 -0000 1.74.2.1.2.7 *************** *** 312,316 **** \begin{funcdesc}{tmpfile}{} ! Return a new file object opened in update mode (\samp{w+}). The file has no directory entries associated with it and will be automatically deleted once there are no file descriptors for the file. --- 312,316 ---- \begin{funcdesc}{tmpfile}{} ! Return a new file object opened in update mode (\samp{w+b}). The file has no directory entries associated with it and will be automatically deleted once there are no file descriptors for the file. From mwh@users.sourceforge.net Fri Aug 23 17:29:04 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:29:04 -0700 Subject: [Python-checkins] python/dist/src/Lib weakref.py,1.15,1.15.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19097 Modified Files: Tag: release22-maint weakref.py Log Message: backport gvanrossum's checkin of revision 1.17 of weakref.py SF patch 564549 (Erik Andersén). The WeakKeyDictionary constructor didn't work when a dict arg was given. Fixed by moving a line. Also adding a unit test. Bugfix candidate. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.15 retrieving revision 1.15.8.1 diff -C2 -d -r1.15 -r1.15.8.1 *** weakref.py 6 Nov 2001 16:36:53 -0000 1.15 --- weakref.py 23 Aug 2002 16:29:01 -0000 1.15.8.1 *************** *** 145,149 **** def __init__(self, dict=None): self.data = {} - if dict is not None: self.update(dict) def remove(k, selfref=ref(self)): self = selfref() --- 145,148 ---- *************** *** 151,154 **** --- 150,154 ---- del self.data[k] self._remove = remove + if dict is not None: self.update(dict) def __delitem__(self, key): From mwh@users.sourceforge.net Fri Aug 23 17:29:30 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:29:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.17,1.17.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19232 Modified Files: Tag: release22-maint test_weakref.py Log Message: backport gvanrossum's checkin of revision 1.19 of test_weakref.py SF patch 564549 (Erik Andersén). The WeakKeyDictionary constructor didn't work when a dict arg was given. Fixed by moving a line. Also adding a unit test. Bugfix candidate. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.17 retrieving revision 1.17.4.1 diff -C2 -d -r1.17 -r1.17.4.1 *** test_weakref.py 19 Dec 2001 16:54:23 -0000 1.17 --- test_weakref.py 23 Aug 2002 16:29:27 -0000 1.17.4.1 *************** *** 376,379 **** --- 376,390 ---- self.assert_(len(values) == 0, "itervalues() did not touch all values") + def test_make_weak_keyed_dict_from_dict(self): + o = Object(3) + dict = weakref.WeakKeyDictionary({o:364}) + self.assert_(dict[o] == 364) + + def test_make_weak_keyed_dict_from_weak_keyed_dict(self): + o = Object(3) + dict = weakref.WeakKeyDictionary({o:364}) + dict2 = weakref.WeakKeyDictionary(dict) + self.assert_(dict[o] == 364) + def make_weak_keyed_dict(self): dict = weakref.WeakKeyDictionary() From mwh@users.sourceforge.net Fri Aug 23 17:30:10 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:30:10 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.149.4.9,1.149.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19500 Modified Files: Tag: release22-maint ACKS Log Message: backport gvanrossum's checkin of revision 1.180 of ACKS date: 2002/06/10 20:00:52; author: gvanrossum; state: Exp; lines: +1 -0 SF patch 564549 (Erik Andersén). The WeakKeyDictionary constructor didn't work when a dict arg was given. Fixed by moving a line. Also adding a unit test. Bugfix candidate. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.149.4.9 retrieving revision 1.149.4.10 diff -C2 -d -r1.149.4.9 -r1.149.4.10 *** ACKS 20 Aug 2002 16:57:57 -0000 1.149.4.9 --- ACKS 23 Aug 2002 16:30:07 -0000 1.149.4.10 *************** *** 17,20 **** --- 17,21 ---- Mark Anacker Anders Andersen + Erik Andersén Oliver Andrich Ross Andrus From mwh@users.sourceforge.net Fri Aug 23 17:34:11 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 23 Aug 2002 09:34:11 -0700 Subject: [Python-checkins] python/dist/src/Lib pre.py,1.10,1.10.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20709 Modified Files: Tag: release22-maint pre.py Log Message: backport effbot's checkin of revision 1.13 of pre.py Fix bug #570057: Broken pre.subn() (and pre.sub()) This should be backported to the 2.2.X series (how do I do that?) Index: pre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pre.py,v retrieving revision 1.10 retrieving revision 1.10.18.1 diff -C2 -d -r1.10 -r1.10.18.1 *** pre.py 11 May 2001 19:20:17 -0000 1.10 --- pre.py 23 Aug 2002 16:34:08 -0000 1.10.18.1 *************** *** 362,369 **** if type(repl) is type(''): ! # See if repl contains group references try: repl = pcre_expand(_Dummy, repl) ! except error: m = MatchObject(self, source, 0, end, []) repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl) --- 362,371 ---- if type(repl) is type(''): ! # See if repl contains group references (if it does, ! # pcre_expand will attempt to call _Dummy.group, which ! # results in a TypeError) try: repl = pcre_expand(_Dummy, repl) ! except (error, TypeError): m = MatchObject(self, source, 0, end, []) repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl) From fdrake@users.sourceforge.net Fri Aug 23 18:22:38 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 23 Aug 2002 10:22:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3097 Modified Files: libsets.tex Log Message: Adjust the markup in a few places so this will actually format. Remove the third column in the tables since it isn't used. Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libsets.tex 23 Aug 2002 15:18:38 -0000 1.1 --- libsets.tex 23 Aug 2002 17:22:36 -0000 1.2 *************** *** 17,24 **** difference. ! Like other collections, sets support \code{x in s}, \code{len(s)}, and ! \code{for x in s}. Being an unordered collection, sets do not record element ! position or order of insertion. Accordingly, sets do not support indexing, ! slicing or other sequence-like behavior. Most set applications use the \class{Set} class which provides every set --- 17,25 ---- difference. ! Like other collections, sets support \code{\var{x} in \var{set}}, ! \code{len(\var{set})}, and \code{for \var{x} in \var{set}}. Being an ! unordered collection, sets do not record element position or order of ! insertion. Accordingly, sets do not support indexing, slicing, or ! other sequence-like behavior. Most set applications use the \class{Set} class which provides every set *************** *** 28,39 **** \class{Set} and \class{ImmutableSet} derive from \class{BaseSet}, an abstract class useful for determining whether something is a set: ! \code{isinstance(x, BaseSet)}. ! The set classes are implemented using dictionaries. As a result, sets cannot ! contain mutable elements such as lists or dictionaries. However, they can ! contain immutable collections such as tuples or instances of ! \class(ImmutableSet). For convenience in implementing sets of sets, ! inner sets are automatically converted to immutable form, for example, ! \code{Set([Set(['dog'])])} is transformed to \code{Set([ImmutableSet(['dog'])])}. --- 29,40 ---- \class{Set} and \class{ImmutableSet} derive from \class{BaseSet}, an abstract class useful for determining whether something is a set: ! \code{isinstance(\var{obj}, BaseSet)}. ! The set classes are implemented using dictionaries. As a result, sets ! cannot contain mutable elements such as lists or dictionaries. ! However, they can contain immutable collections such as tuples or ! instances of \class(ImmutableSet). For convenience in implementing ! sets of sets, inner sets are automatically converted to immutable ! form, for example, \code{Set([Set(['dog'])])} is transformed to \code{Set([ImmutableSet(['dog'])])}. *************** *** 42,46 **** parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or be transformable ! to an immutable using the protocol described at \ref{immutable-transforms}. \end{classdesc} --- 43,48 ---- parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or be transformable ! to an immutable using the protocol described in ! section~\ref{immutable-transforms}. \end{classdesc} *************** *** 49,54 **** \var{iterable} parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or ! be transformable to an immutable using the protocol described at ! \ref{immutable-transforms}. Because \class{ImmutableSet} objects provide a \method{__hash__()} method, --- 51,56 ---- \var{iterable} parameter is supplied, updates the set with elements obtained from iteration. All of the elements in \var{iterable} should be immutable or ! be transformable to an immutable using the protocol described in ! section~\ref{immutable-transforms}. Because \class{ImmutableSet} objects provide a \method{__hash__()} method, *************** *** 59,100 **** ! \subsection{set Objects} Instances of \class{Set} and \class{ImmutableSet} both provide the following operations: ! \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{len(\var{s})}{cardinality of set \var{s}}{} \hline ! \lineiii{\var{x} in \var{s}} ! {test \var{x} for membership in \var{s}}{} ! \lineiii{\var{x} not in \var{s}} ! {test \var{x} for non-membership in \var{s}}{} ! \lineiii{\var{s}.issubset(\var{t})} ! {test whether every element in \var{s} is in \var{t}}{} ! \lineiii{\var{s}.issuperset(\var{t})} ! {test whether every element in \var{t} is in \var{s}}{} \hline ! \lineiii{\var{s} | \var{t}} ! {new set with elements from both \var{s} and \var{t}}{} ! \lineiii{\var{s}.union(\var{t})} ! {new set with elements from both \var{s} and \var{t}}{} ! \lineiii{\var{s} & \var{t}} ! {new set with elements common to \var{s} and \var{t}}{} ! \lineiii{\var{s}.intersection(\var{t})} ! {new set with elements common to \var{s} and \var{t}}{} ! \lineiii{\var{s} - \var{t}} ! {new set with elements in \var{s} but not in \var{t}}{} ! \lineiii{\var{s}.difference(\var{t})} ! {new set with elements in \var{s} but not in \var{t}}{} ! \lineiii{\var{s} ^ \var{t}} ! {new set with elements in either \var{s} or \var{t} but not both}{} ! \lineiii{\var{s}.symmetric_difference(\var{t})} ! {new set with elements in either \var{s} or \var{t} but not both}{} ! \lineiii{\var{s}.copy()} ! {new set with a shallow copy of \var{s}}{} ! \end{tableiii} In addition to the above operations, both \class{Set} and \class{ImmutableSet} --- 61,102 ---- ! \subsection{Set Objects} Instances of \class{Set} and \class{ImmutableSet} both provide the following operations: ! \begin{tableii}{c|l}{code}{Operation}{Result} ! \lineii{len(\var{s})}{cardinality of set \var{s}} \hline ! \lineii{\var{x} in \var{s}} ! {test \var{x} for membership in \var{s}} ! \lineii{\var{x} not in \var{s}} ! {test \var{x} for non-membership in \var{s}} ! \lineii{\var{s}.issubset(\var{t})} ! {test whether every element in \var{s} is in \var{t}} ! \lineii{\var{s}.issuperset(\var{t})} ! {test whether every element in \var{t} is in \var{s}} \hline ! \lineii{\var{s} | \var{t}} ! {new set with elements from both \var{s} and \var{t}} ! \lineii{\var{s}.union(\var{t})} ! {new set with elements from both \var{s} and \var{t}} ! \lineii{\var{s} \&\ \var{t}} ! {new set with elements common to \var{s} and \var{t}} ! \lineii{\var{s}.intersection(\var{t})} ! {new set with elements common to \var{s} and \var{t}} ! \lineii{\var{s} - \var{t}} ! {new set with elements in \var{s} but not in \var{t}} ! \lineii{\var{s}.difference(\var{t})} ! {new set with elements in \var{s} but not in \var{t}} ! \lineii{\var{s} \textasciicircum\ \var{t}} ! {new set with elements in either \var{s} or \var{t} but not both} ! \lineii{\var{s}.symmetric_difference(\var{t})} ! {new set with elements in either \var{s} or \var{t} but not both} ! \lineii{\var{s}.copy()} ! {new set with a shallow copy of \var{s}} ! \end{tableii} In addition to the above operations, both \class{Set} and \class{ImmutableSet} *************** *** 106,149 **** but not found in \class{Set}: ! \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{hash(\var{s})}{returns a hash value for \var{s}}{} ! \end{tableiii} The following table lists operations available in \class{Set} but not found in \class{ImmutableSet}: ! \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} ! \lineiii{\var{s} |= \var{t}} ! {return set \var{s} with elements added from \var{t}}{} ! \lineiii{\var{s}.union_update(\var{t})} ! {return set \var{s} with elements added from \var{t}}{} ! \lineiii{\var{s} &= \var{t}} ! {return set \var{s} keeping only elements also found in \var{t}}{} ! \lineiii{\var{s}.intersection_update(\var{t})} ! {return set \var{s} keeping only elements also found in \var{t}}{} ! \lineiii{\var{s} -= \var{t}} ! {return set \var{s} after removing elements found in \var{t}}{} ! \lineiii{\var{s}.difference_update(\var{t})} ! {return set \var{s} after removing elements found in \var{t}}{} ! \lineiii{\var{s} ^= \var{t}} ! {return set \var{s} with elements from \var{s} or \var{t} but not both}{} ! \lineiii{\var{s}.symmetric_difference_update(\var{t})} ! {return set \var{s} with elements from \var{s} or \var{t} but not both}{} \hline ! \lineiii{\var{s}.add(\var{x})} ! {Add element \var{x} to set \var{s}}{} ! \lineiii{\var{s}.remove(\var{x})} ! {Remove element \var{x} from set \var{s}}{} ! \lineiii{\var{s}.discard(\var{x})} ! {Removes element \var{x} from set \var{s} like \var{s}.remove(\var{x}) ! but does not raise a KeyError if \var{x} is not in \var{s}}{} ! \lineiii{\var{s}.pop()} ! {Remove and return a randomly-chosen element from \var{s}}{} ! \lineiii{\var{s}.update(\var{t})} ! {Add elements from \var{t} to set \var{s}}{} ! \lineiii{\var{s}.clear()} ! {Remove all elements from set \var{s}}{} ! \end{tableiii} --- 108,153 ---- but not found in \class{Set}: ! \begin{tableii}{c|l|c}{code}{Operation}{Result} ! \lineii{hash(\var{s})}{returns a hash value for \var{s}} ! \end{tableii} The following table lists operations available in \class{Set} but not found in \class{ImmutableSet}: ! \begin{tableii}{c|l}{code}{Operation}{Result} ! \lineii{\var{s} |= \var{t}} ! {return set \var{s} with elements added from \var{t}} ! \lineii{\var{s}.union_update(\var{t})} ! {return set \var{s} with elements added from \var{t}} ! \lineii{\var{s} \&= \var{t}} ! {return set \var{s} keeping only elements also found in \var{t}} ! \lineii{\var{s}.intersection_update(\var{t})} ! {return set \var{s} keeping only elements also found in \var{t}} ! \lineii{\var{s} -= \var{t}} ! {return set \var{s} after removing elements found in \var{t}} ! \lineii{\var{s}.difference_update(\var{t})} ! {return set \var{s} after removing elements found in \var{t}} ! \lineii{\var{s} \textasciicircum= \var{t}} ! {return set \var{s} with elements from \var{s} or \var{t} ! but not both} ! \lineii{\var{s}.symmetric_difference_update(\var{t})} ! {return set \var{s} with elements from \var{s} or \var{t} ! but not both} \hline ! \lineii{\var{s}.add(\var{x})} ! {Add element \var{x} to set \var{s}} ! \lineii{\var{s}.remove(\var{x})} ! {Remove element \var{x} from set \var{s}} ! \lineii{\var{s}.discard(\var{x})} ! {Removes element \var{x} from set \var{s} like \var{s}.remove(\var{x}) ! but does not raise a KeyError if \var{x} is not in \var{s}} ! \lineii{\var{s}.pop()} ! {Remove and return a randomly-chosen element from \var{s}} ! \lineii{\var{s}.update(\var{t})} ! {Add elements from \var{t} to set \var{s}} ! \lineii{\var{s}.clear()} ! {Remove all elements from set \var{s}} ! \end{tableii} *************** *** 184,190 **** before being added as a set element. ! The mechanism is to always add a hashable element, or if it is not hashable, ! the element is checked to see if it has an \method{_as_immutable()} method ! which returns an immutable equivalent. Since \class{Set} objects have a \method{_as_immutable()} method --- 188,194 ---- before being added as a set element. ! The mechanism is to always add a hashable element, or if it is not ! hashable, the element is checked to see if it has an ! \method{_as_immutable()} method which returns an immutable equivalent. Since \class{Set} objects have a \method{_as_immutable()} method *************** *** 195,199 **** \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability ! and, if not, check for a \method{_as_Temporarily_Immutable} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. --- 199,203 ---- \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability ! and, if not, check for a \method{_as_Temporarily_Immutable()} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. *************** *** 202,207 **** the original mutable object. ! \class{Set} objects implement the \method{_as_Temporarily_Immutable} method ! which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. --- 206,211 ---- the original mutable object. ! \class{Set} objects implement the \method{_as_Temporarily_Immutable()} ! method which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. *************** *** 211,219 **** in \class{_TemporarilyImmutableSet}. In other words, sets of mutable sets are not thread-safe. - - - - - - - --- 215,216 ---- From tim_one@users.sourceforge.net Fri Aug 23 18:45:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 10:45:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10194/lib Modified Files: libsets.tex Log Message: pop(): An arbitrary element is removed, not a random element. Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libsets.tex 23 Aug 2002 17:22:36 -0000 1.2 --- libsets.tex 23 Aug 2002 17:45:43 -0000 1.3 *************** *** 144,148 **** but does not raise a KeyError if \var{x} is not in \var{s}} \lineii{\var{s}.pop()} ! {Remove and return a randomly-chosen element from \var{s}} \lineii{\var{s}.update(\var{t})} {Add elements from \var{t} to set \var{s}} --- 144,149 ---- but does not raise a KeyError if \var{x} is not in \var{s}} \lineii{\var{s}.pop()} ! {Remove and return an element from \var{s}; no guarantee is ! made about which element is removed} \lineii{\var{s}.update(\var{t})} {Add elements from \var{t} to set \var{s}} From tim_one@users.sourceforge.net Fri Aug 23 18:48:25 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 10:48:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10849/lib Modified Files: libsets.tex Log Message: s/_as_Temporarily_Immutable/_as_temporarily_immutable/g, because the latter is what the code actually does. Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libsets.tex 23 Aug 2002 17:45:43 -0000 1.3 --- libsets.tex 23 Aug 2002 17:48:23 -0000 1.4 *************** *** 200,204 **** \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability ! and, if not, check for a \method{_as_Temporarily_Immutable()} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. --- 200,204 ---- \method{remove()} methods which need to hash an element to check for membership in a set. Those methods check an element for hashability ! and, if not, check for a \method{_as_temporarily_immutable()} method which returns the element wrapped by a class that provides temporary methods for \method{__hash__()}, \method{__eq__()}, and \method{__ne__()}. *************** *** 207,211 **** the original mutable object. ! \class{Set} objects implement the \method{_as_Temporarily_Immutable()} method which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. --- 207,211 ---- the original mutable object. ! \class{Set} objects implement the \method{_as_temporarily_immutable()} method which returns the \class{Set} object wrapped by a new class \class{_TemporarilyImmutableSet}. From jhylton@users.sourceforge.net Fri Aug 23 18:54:53 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 10:54:53 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.86.2.2,1.86.2.3 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12769 Modified Files: Tag: ast-branch Makefile.pre.in Log Message: Don't build the old compile.c. XXX newcompile.c will be renamed to compile.c when all is said and done. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.86.2.2 retrieving revision 1.86.2.3 diff -C2 -d -r1.86.2.2 -r1.86.2.3 *** Makefile.pre.in 9 Jul 2002 13:24:45 -0000 1.86.2.2 --- Makefile.pre.in 23 Aug 2002 17:54:50 -0000 1.86.2.3 *************** *** 228,232 **** Python/ceval.o \ Python/newcompile.o \ - Python/compile.o \ Python/codecs.o \ Python/errors.o \ --- 228,231 ---- From tim_one@users.sourceforge.net Fri Aug 23 18:55:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 10:55:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12991/python/Lib/test Modified Files: regrtest.py Log Message: Got rid of the toy _Set class, in favor of sets.Set. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** regrtest.py 14 Aug 2002 17:54:48 -0000 1.94 --- regrtest.py 23 Aug 2002 17:55:54 -0000 1.95 *************** *** 65,68 **** --- 65,69 ---- import StringIO import warnings + from sets import Set # I see no other way to suppress these warnings; *************** *** 263,267 **** plat = sys.platform if e.isvalid(): ! surprise = _Set(skipped) - e.getexpected() if surprise: print count(len(surprise), "skip"), \ --- 264,268 ---- plat = sys.platform if e.isvalid(): ! surprise = Set(skipped) - e.getexpected() if surprise: print count(len(surprise), "skip"), \ *************** *** 469,473 **** def printlist(x, width=70, indent=4): ! """Print the elements of a sequence to stdout. Optional arg width (default 70) is the maximum line length. --- 470,474 ---- def printlist(x, width=70, indent=4): ! """Print the elements of iterable x to stdout. Optional arg width (default 70) is the maximum line length. *************** *** 481,512 **** initial_indent=blanks, subsequent_indent=blanks) - class _Set: - def __init__(self, seq=[]): - data = self.data = {} - for x in seq: - data[x] = 1 - - def __len__(self): - return len(self.data) - - def __sub__(self, other): - "Return set of all elements in self not in other." - result = _Set() - data = result.data = self.data.copy() - for x in other.data: - if x in data: - del data[x] - return result - - def __iter__(self): - return iter(self.data) - - def tolist(self, sorted=1): - "Return _Set elements as a list." - data = self.data.keys() - if sorted: - data.sort() - return data - # Map sys.platform to a string containing the basenames of tests # expected to be skipped on that platform. --- 482,485 ---- *************** *** 777,785 **** class _ExpectedSkips: def __init__(self): ! self.valid = 0 if sys.platform in _expectations: s = _expectations[sys.platform] ! self.expected = _Set(s.split()) ! self.valid = 1 def isvalid(self): --- 750,758 ---- class _ExpectedSkips: def __init__(self): ! self.valid = False if sys.platform in _expectations: s = _expectations[sys.platform] ! self.expected = Set(s.split()) ! self.valid = True def isvalid(self): From jhylton@users.sourceforge.net Fri Aug 23 18:57:28 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 10:57:28 -0700 Subject: [Python-checkins] python/dist/src/Include compile.h,2.37.2.1,2.37.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv13576/Include Modified Files: Tag: ast-branch compile.h Log Message: Remove old node * interfaces. Add next member to a basicblock to represent an implicit jump. Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.37.2.1 retrieving revision 2.37.2.2 diff -C2 -d -r2.37.2.1 -r2.37.2.2 *** compile.h 9 Jul 2002 13:22:00 -0000 2.37.2.1 --- compile.h 23 Aug 2002 17:57:26 -0000 2.37.2.2 *************** *** 17,24 **** } PyFutureFeatures; - DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *); - DL_IMPORT(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, - PyCompilerFlags *); - #define FUTURE_NESTED_SCOPES "nested_scopes" #define FUTURE_GENERATORS "generators" --- 17,20 ---- *************** *** 42,45 **** --- 38,42 ---- size_t b_iused; size_t b_ialloc; + int next; struct instr b_instr[DEFAULT_BLOCK_SIZE]; }; From jhylton@users.sourceforge.net Fri Aug 23 19:09:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:09:44 -0700 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.9.18.3,2.9.18.4 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17954/Include Modified Files: Tag: ast-branch symtable.h Log Message: Misc cleanup. Remove st_pass and st_errors, which are no longer needed. Change prototype of PyST_GetScope(). Revert const int change back to #define, since I want to use the names in a switch(). Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9.18.3 retrieving revision 2.9.18.4 diff -C2 -d -r2.9.18.3 -r2.9.18.4 *** symtable.h 4 Aug 2002 20:53:33 -0000 2.9.18.3 --- symtable.h 23 Aug 2002 18:09:41 -0000 2.9.18.4 *************** *** 11,15 **** struct symtable { - int st_pass; /* pass == 1 or 2 */ const char *st_filename; /* name of file being compiled */ struct _symtable_entry *st_cur; /* current symbol table entry */ --- 11,14 ---- *************** *** 18,22 **** PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ int st_nblocks; /* number of blocks */ - int st_errors; /* number of errors */ char *st_private; /* name of current class or NULL */ int st_tmpname; /* temporary name counter */ --- 17,20 ---- *************** *** 48,52 **** extern DL_IMPORT(PySTEntryObject *) \ PySTEntry_New(struct symtable *, identifier, block_ty, void *, int); ! DL_IMPORT(int) PyST_GetScope(PyObject *, PyObject *); DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); --- 46,50 ---- extern DL_IMPORT(PySTEntryObject *) \ PySTEntry_New(struct symtable *, identifier, block_ty, void *, int); ! DL_IMPORT(int) PyST_GetScope(PySTEntryObject *, PyObject *); DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); *************** *** 78,83 **** #define SCOPE_OFF 11 #define SCOPE_MASK 7 ! const int LOCAL = 1, GLOBAL_EXPLICIT = 2, GLOBAL_IMPLICIT = 3, FREE = 4, ! CELL = 5; #define OPT_IMPORT_STAR 1 --- 76,85 ---- #define SCOPE_OFF 11 #define SCOPE_MASK 7 ! ! #define LOCAL 1 ! #define GLOBAL_EXPLICIT 2 ! #define GLOBAL_IMPLICIT 3 ! #define FREE 4 ! #define CELL 5 #define OPT_IMPORT_STAR 1 From rhettinger@users.sourceforge.net Fri Aug 23 19:10:57 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:10:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18437 Modified Files: libsets.tex Log Message: Fix markup and punctuation Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libsets.tex 23 Aug 2002 17:48:23 -0000 1.4 --- libsets.tex 23 Aug 2002 18:10:54 -0000 1.5 *************** *** 34,38 **** cannot contain mutable elements such as lists or dictionaries. However, they can contain immutable collections such as tuples or ! instances of \class(ImmutableSet). For convenience in implementing sets of sets, inner sets are automatically converted to immutable form, for example, \code{Set([Set(['dog'])])} is transformed to --- 34,38 ---- cannot contain mutable elements such as lists or dictionaries. However, they can contain immutable collections such as tuples or ! instances of \class{ImmutableSet}. For convenience in implementing sets of sets, inner sets are automatically converted to immutable form, for example, \code{Set([Set(['dog'])])} is transformed to *************** *** 141,146 **** {Remove element \var{x} from set \var{s}} \lineii{\var{s}.discard(\var{x})} ! {Removes element \var{x} from set \var{s} like \var{s}.remove(\var{x}) ! but does not raise a KeyError if \var{x} is not in \var{s}} \lineii{\var{s}.pop()} {Remove and return an element from \var{s}; no guarantee is --- 141,146 ---- {Remove element \var{x} from set \var{s}} \lineii{\var{s}.discard(\var{x})} ! {Removes element \var{x} from set \var{s}. Like \var{s}.remove(\var{x}) ! but does not raise KeyError if \var{x} is not in \var{s}} \lineii{\var{s}.pop()} {Remove and return an element from \var{s}; no guarantee is *************** *** 213,217 **** The two mechanisms for adding hashability are normally invisible to the user; however, a conflict can arise in a multi-threaded environment ! where one thread is updating a Set while another has temporarily wrapped it in \class{_TemporarilyImmutableSet}. In other words, sets of mutable sets are not thread-safe. --- 213,217 ---- The two mechanisms for adding hashability are normally invisible to the user; however, a conflict can arise in a multi-threaded environment ! where one thread is updating a set while another has temporarily wrapped it in \class{_TemporarilyImmutableSet}. In other words, sets of mutable sets are not thread-safe. From jhylton@users.sourceforge.net Fri Aug 23 19:13:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:13:29 -0700 Subject: [Python-checkins] python/dist/src/Include pythonrun.h,2.49.2.1,2.49.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv19542/Include Modified Files: Tag: ast-branch pythonrun.h Log Message: Replace many obsolete functions with #defines that call the right function. There are so many variants of Flags, Ex, ExFlags, ExFlagsEx. (You can hear the vikings singing.) All but the longest names are effectively obsolete, so replace them with macros. Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.49.2.1 retrieving revision 2.49.2.2 diff -C2 -d -r2.49.2.1 -r2.49.2.2 *** pythonrun.h 7 Jul 2002 18:18:18 -0000 2.49.2.1 --- pythonrun.h 23 Aug 2002 18:13:27 -0000 2.49.2.2 *************** *** 27,47 **** DL_IMPORT(void) Py_EndInterpreter(PyThreadState *); - DL_IMPORT(int) PyRun_AnyFile(FILE *, char *); - DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int); - DL_IMPORT(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); DL_IMPORT(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); - - DL_IMPORT(int) PyRun_SimpleString(char *); DL_IMPORT(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *); - DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *); - DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); DL_IMPORT(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); - DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); DL_IMPORT(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); - DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); - DL_IMPORT(struct _mod *) PyParser_ASTFromString(const char *, const char *, int, int); --- 27,37 ---- *************** *** 55,70 **** int, int); - DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); - DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); - DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int, - PyObject *, PyObject *, int); DL_IMPORT(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, PyCompilerFlags *); ! DL_IMPORT(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, ! PyObject *, PyCompilerFlags *); DL_IMPORT(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, PyObject *, int, PyCompilerFlags *); ! DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int); DL_IMPORT(PyObject *) Py_CompileStringFlags(char *, char *, int, PyCompilerFlags *); --- 45,55 ---- int, int); DL_IMPORT(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, PyCompilerFlags *); ! DL_IMPORT(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, PyObject *, int, PyCompilerFlags *); ! #define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL) DL_IMPORT(PyObject *) Py_CompileStringFlags(char *, char *, int, PyCompilerFlags *); *************** *** 80,83 **** --- 65,91 ---- DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *); + + /* Use macros for a bunch of old variants */ + #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) + #define PyRun_FileEx(f, p, s, g, l, c) \ + PyRun_FileExFlags(f, p, s, g, l, c, NULL) + #define PyRun_FileFlags(f, p, s, g, l, flags) \ + PyRun_FileExFlags(f, p, s, g, l, 0, flags) + #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) + #define PyRun_AnyFileEx(fp, name, closeit) \ + PyRun_AnyFileExFlags(fp, name, closeit, NULL) + #define PyRun_AnyFileFlags(fp, name, flags) \ + PyRun_AnyFileExFlags(fp, name, 0, flags) + #define PyRun_SimpleString(s, f) PyRunSimpleStringFlags(s, f, NULL) + #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) + #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) + #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) + #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) + #define PyRun_File(fp, p, s, g, l) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) + #define PyRun_FileEx(fp, p, s, g, l, c) \ + PyRun_FileExFlags(fp, p, s, g, l, c, NULL) + #define PyRun_FileFlags(fp, p, s, g, l, flags) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, flags) /* In getpath.c */ From jhylton@users.sourceforge.net Fri Aug 23 19:13:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:13:29 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.161.2.3,2.161.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19542/Python Modified Files: Tag: ast-branch pythonrun.c Log Message: Replace many obsolete functions with #defines that call the right function. There are so many variants of Flags, Ex, ExFlags, ExFlagsEx. (You can hear the vikings singing.) All but the longest names are effectively obsolete, so replace them with macros. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.3 retrieving revision 2.161.2.4 diff -C2 -d -r2.161.2.3 -r2.161.2.4 *** pythonrun.c 9 Jul 2002 13:22:01 -0000 2.161.2.3 --- pythonrun.c 23 Aug 2002 18:13:27 -0000 2.161.2.4 *************** *** 36,44 **** static void initmain(void); static void initsite(void); ! static PyObject *run_err_node(node *, char *, PyObject *, PyObject *, PyCompilerFlags *); ! static PyObject *run_node(node *, char *, PyObject *, PyObject *, PyCompilerFlags *); ! static PyObject *run_pyc_file(FILE *, char *, PyObject *, PyObject *, PyCompilerFlags *); static void err_input(perrdetail *); --- 36,44 ---- static void initmain(void); static void initsite(void); ! static PyObject *run_err_mod(mod_ty, const char *, PyObject *, PyObject *, PyCompilerFlags *); ! static PyObject *run_mod(mod_ty, const char *, PyObject *, PyObject *, PyCompilerFlags *); ! static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *, PyCompilerFlags *); static void err_input(perrdetail *); *************** *** 471,492 **** int - PyRun_AnyFile(FILE *fp, char *filename) - { - return PyRun_AnyFileExFlags(fp, filename, 0, NULL); - } - - int - PyRun_AnyFileFlags(FILE *fp, char *filename, PyCompilerFlags *flags) - { - return PyRun_AnyFileExFlags(fp, filename, 0, flags); - } - - int - PyRun_AnyFileEx(FILE *fp, char *filename, int closeit) - { - return PyRun_AnyFileExFlags(fp, filename, closeit, NULL); - } - - int PyRun_AnyFileExFlags(FILE *fp, char *filename, int closeit, PyCompilerFlags *flags) --- 471,474 ---- *************** *** 505,514 **** int - PyRun_InteractiveLoop(FILE *fp, char *filename) - { - return PyRun_InteractiveLoopFlags(fp, filename, NULL); - } - - int PyRun_InteractiveLoopFlags(FILE *fp, char *filename, PyCompilerFlags *flags) { --- 487,490 ---- *************** *** 545,554 **** } - int - PyRun_InteractiveOne(FILE *fp, char *filename) - { - return PyRun_InteractiveOneFlags(fp, filename, NULL); - } - /* compute parser flags based on compiler flags */ #if 0 /* future keyword */ --- 521,524 ---- *************** *** 564,568 **** { PyObject *m, *d, *v, *w; ! node *n; perrdetail err; char *ps1 = "", *ps2 = ""; --- 534,538 ---- { PyObject *m, *d, *v, *w; ! mod_ty mod; perrdetail err; char *ps1 = "", *ps2 = ""; *************** *** 584,593 **** ps2 = PyString_AsString(w); } ! n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, ! Py_single_input, ps1, ps2, &err, ! PARSER_FLAGS(flags)); Py_XDECREF(v); Py_XDECREF(w); ! if (n == NULL) { if (err.error == E_EOF) { if (err.text) --- 554,563 ---- ps2 = PyString_AsString(w); } ! mod = PyParser_ASTFromFile(fp, filename, ! Py_single_input, ps1, ps2, ! PARSER_FLAGS(flags)); Py_XDECREF(v); Py_XDECREF(w); ! if (mod == NULL) { if (err.error == E_EOF) { if (err.text) *************** *** 603,607 **** return -1; d = PyModule_GetDict(m); ! v = run_node(n, filename, d, d, flags); if (v == NULL) { PyErr_Print(); --- 573,577 ---- return -1; d = PyModule_GetDict(m); ! v = run_mod(mod, filename, d, d, flags); if (v == NULL) { PyErr_Print(); *************** *** 614,623 **** } - int - PyRun_SimpleFile(FILE *fp, char *filename) - { - return PyRun_SimpleFileEx(fp, filename, 0); - } - /* Check whether a file maybe a pyc file: Look at the extension, the file type, and, if we may close it, at the first few bytes. */ --- 584,587 ---- *************** *** 668,677 **** int - PyRun_SimpleFileEx(FILE *fp, char *filename, int closeit) - { - return PyRun_SimpleFileExFlags(fp, filename, closeit, NULL); - } - - int PyRun_SimpleFileExFlags(FILE *fp, char *filename, int closeit, PyCompilerFlags *flags) --- 632,635 ---- *************** *** 712,721 **** int - PyRun_SimpleString(char *command) - { - return PyRun_SimpleStringFlags(command, NULL); - } - - int PyRun_SimpleStringFlags(char *command, PyCompilerFlags *flags) { --- 670,673 ---- *************** *** 1019,1060 **** PyObject * - PyRun_String(char *str, int start, PyObject *globals, PyObject *locals) - { - return run_err_node(PyParser_SimpleParseString(str, start), - "", globals, locals, NULL); - } - - PyObject * - PyRun_File(FILE *fp, char *filename, int start, PyObject *globals, - PyObject *locals) - { - return PyRun_FileEx(fp, filename, start, globals, locals, 0); - } - - PyObject * - PyRun_FileEx(FILE *fp, char *filename, int start, PyObject *globals, - PyObject *locals, int closeit) - { - node *n = PyParser_SimpleParseFile(fp, filename, start); - if (closeit) - fclose(fp); - return run_err_node(n, filename, globals, locals, NULL); - } - - PyObject * PyRun_StringFlags(char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) { ! return run_err_node(PyParser_SimpleParseStringFlags( ! str, start, PARSER_FLAGS(flags)), ! "", globals, locals, flags); ! } ! ! PyObject * ! PyRun_FileFlags(FILE *fp, char *filename, int start, PyObject *globals, ! PyObject *locals, PyCompilerFlags *flags) ! { ! return PyRun_FileExFlags(fp, filename, start, globals, locals, 0, ! flags); } --- 971,980 ---- PyObject * PyRun_StringFlags(char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) { ! mod_ty mod = PyParser_ASTFromString(str, "", start, ! PARSER_FLAGS(flags)); ! return run_err_mod(mod, "", globals, locals, flags); } *************** *** 1063,1090 **** PyObject *locals, int closeit, PyCompilerFlags *flags) { ! node *n = PyParser_SimpleParseFileFlags(fp, filename, start, ! PARSER_FLAGS(flags)); if (closeit) fclose(fp); ! return run_err_node(n, filename, globals, locals, flags); } static PyObject * ! run_err_node(node *n, char *filename, PyObject *globals, PyObject *locals, ! PyCompilerFlags *flags) { ! if (n == NULL) return NULL; ! return run_node(n, filename, globals, locals, flags); } static PyObject * ! run_node(node *n, char *filename, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) { PyCodeObject *co; PyObject *v; ! co = PyNode_CompileFlags(n, filename, flags); ! PyNode_Free(n); if (co == NULL) return NULL; --- 983,1009 ---- PyObject *locals, int closeit, PyCompilerFlags *flags) { ! mod_ty mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, ! PARSER_FLAGS(flags)); if (closeit) fclose(fp); ! return run_err_mod(mod, filename, globals, locals, flags); } static PyObject * ! run_err_mod(mod_ty mod, const char *filename, PyObject *globals, ! PyObject *locals, PyCompilerFlags *flags) { ! if (mod == NULL) return NULL; ! return run_mod(mod, filename, globals, locals, flags); } static PyObject * ! run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) { PyCodeObject *co; PyObject *v; ! co = PyAST_Compile(mod, filename, flags); if (co == NULL) return NULL; *************** *** 1095,1100 **** static PyObject * ! run_pyc_file(FILE *fp, char *filename, PyObject *globals, PyObject *locals, ! PyCompilerFlags *flags) { PyCodeObject *co; --- 1014,1019 ---- static PyObject * ! run_pyc_file(FILE *fp, const char *filename, PyObject *globals, ! PyObject *locals, PyCompilerFlags *flags) { PyCodeObject *co; *************** *** 1127,1146 **** PyObject * - Py_CompileString(char *str, char *filename, int start) - { - return Py_CompileStringFlags(str, filename, start, NULL); - } - - PyObject * Py_CompileStringFlags(char *str, char *filename, int start, PyCompilerFlags *flags) { ! node *n; PyCodeObject *co; ! n = PyParser_SimpleParseStringFlags(str, start, PARSER_FLAGS(flags)); ! if (n == NULL) return NULL; ! co = PyNode_CompileFlags(n, filename, flags); ! PyNode_Free(n); return (PyObject *)co; } --- 1046,1059 ---- PyObject * Py_CompileStringFlags(char *str, char *filename, int start, PyCompilerFlags *flags) { ! mod_ty mod; PyCodeObject *co; ! mod = PyParser_ASTFromString(str, filename, start, ! PARSER_FLAGS(flags)); ! if (mod == NULL) return NULL; ! co = PyAST_Compile(mod, filename, flags); return (PyObject *)co; } *************** *** 1149,1159 **** Py_SymtableString(char *str, char *filename, int start) { ! node *n; struct symtable *st; ! n = PyParser_SimpleParseString(str, start); ! if (n == NULL) return NULL; ! st = PyNode_CompileSymtable(n, filename); ! PyNode_Free(n); return st; } --- 1062,1073 ---- Py_SymtableString(char *str, char *filename, int start) { ! /* XXX flags? */ ! ! mod_ty mod; struct symtable *st; ! mod = PyParser_ASTFromString(str, filename, start, 0); ! if (mod == NULL) return NULL; ! st = PySymtable_Build(mod, filename, 0); return st; } From jhylton@users.sourceforge.net Fri Aug 23 19:20:27 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:20:27 -0700 Subject: [Python-checkins] python/dist/src/Objects codeobject.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22074/Objects Modified Files: Tag: ast-branch codeobject.c Log Message: Add PyCode_New() and PyCode_Addr2Line(). These used to live in compile.c. Index: codeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/codeobject.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** codeobject.c 9 Jul 2002 13:22:00 -0000 1.1.2.1 --- codeobject.c 23 Aug 2002 18:20:24 -0000 1.1.2.2 *************** *** 3,6 **** --- 3,113 ---- #include "structmember.h" + #define NAME_CHARS \ + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" + + /* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */ + + static int + all_name_chars(unsigned char *s) + { + static char ok_name_char[256]; + static unsigned char *name_chars = (unsigned char *)NAME_CHARS; + + if (ok_name_char[*name_chars] == 0) { + unsigned char *p; + for (p = name_chars; *p; p++) + ok_name_char[*p] = 1; + } + while (*s) { + if (ok_name_char[*s++] == 0) + return 0; + } + return 1; + } + + static int + intern_strings(PyObject *tuple) + { + int i; + + for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { + PyObject *v = PyTuple_GET_ITEM(tuple, i); + if (v == NULL || !PyString_Check(v)) { + Py_FatalError("non-string found in code slot"); + PyErr_BadInternalCall(); + return -1; + } + PyString_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); + } + return 0; + } + + PyCodeObject * + PyCode_New(int argcount, int nlocals, int stacksize, int flags, + PyObject *code, PyObject *consts, PyObject *names, + PyObject *varnames, PyObject *freevars, PyObject *cellvars, + PyObject *filename, PyObject *name, int firstlineno, + PyObject *lnotab) + { + PyCodeObject *co; + int i; + /* Check argument types */ + if (argcount < 0 || nlocals < 0 || + code == NULL || + consts == NULL || !PyTuple_Check(consts) || + names == NULL || !PyTuple_Check(names) || + varnames == NULL || !PyTuple_Check(varnames) || + freevars == NULL || !PyTuple_Check(freevars) || + cellvars == NULL || !PyTuple_Check(cellvars) || + name == NULL || !PyString_Check(name) || + filename == NULL || !PyString_Check(filename) || + lnotab == NULL || !PyString_Check(lnotab) || + !PyObject_CheckReadBuffer(code)) { + PyErr_BadInternalCall(); + return NULL; + } + intern_strings(names); + intern_strings(varnames); + intern_strings(freevars); + intern_strings(cellvars); + /* Intern selected string constants */ + for (i = PyTuple_Size(consts); --i >= 0; ) { + PyObject *v = PyTuple_GetItem(consts, i); + if (!PyString_Check(v)) + continue; + if (!all_name_chars((unsigned char *)PyString_AS_STRING(v))) + continue; + PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i)); + } + co = PyObject_NEW(PyCodeObject, &PyCode_Type); + if (co != NULL) { + co->co_argcount = argcount; + co->co_nlocals = nlocals; + co->co_stacksize = stacksize; + co->co_flags = flags; + Py_INCREF(code); + co->co_code = code; + Py_INCREF(consts); + co->co_consts = consts; + Py_INCREF(names); + co->co_names = names; + Py_INCREF(varnames); + co->co_varnames = varnames; + Py_INCREF(freevars); + co->co_freevars = freevars; + Py_INCREF(cellvars); + co->co_cellvars = cellvars; + Py_INCREF(filename); + co->co_filename = filename; + Py_INCREF(name); + co->co_name = name; + co->co_firstlineno = firstlineno; + Py_INCREF(lnotab); + co->co_lnotab = lnotab; + } + return co; + } + + #define OFF(x) offsetof(PyCodeObject, x) *************** *** 214,215 **** --- 321,382 ---- code_new, /* tp_new */ }; + + /* All about c_lnotab. + + c_lnotab is an array of unsigned bytes disguised as a Python string. In -O + mode, SET_LINENO opcodes aren't generated, and bytecode offsets are mapped + to source code line #s (when needed for tracebacks) via c_lnotab instead. + The array is conceptually a list of + (bytecode offset increment, line number increment) + pairs. The details are important and delicate, best illustrated by example: + + byte code offset source code line number + 0 1 + 6 2 + 50 7 + 350 307 + 361 308 + + The first trick is that these numbers aren't stored, only the increments + from one row to the next (this doesn't really work, but it's a start): + + 0, 1, 6, 1, 44, 5, 300, 300, 11, 1 + + The second trick is that an unsigned byte can't hold negative values, or + values larger than 255, so (a) there's a deep assumption that byte code + offsets and their corresponding line #s both increase monotonically, and (b) + if at least one column jumps by more than 255 from one row to the next, more + than one pair is written to the table. In case #b, there's no way to know + from looking at the table later how many were written. That's the delicate + part. A user of c_lnotab desiring to find the source line number + corresponding to a bytecode address A should do something like this + + lineno = addr = 0 + for addr_incr, line_incr in c_lnotab: + addr += addr_incr + if addr > A: + return lineno + lineno += line_incr + + In order for this to work, when the addr field increments by more than 255, + the line # increment in each pair generated must be 0 until the remaining addr + increment is < 256. So, in the example above, com_set_lineno should not (as + was actually done until 2.2) expand 300, 300 to 255, 255, 45, 45, but to + 255, 0, 45, 255, 0, 45. + */ + + int + PyCode_Addr2Line(PyCodeObject *co, int addrq) + { + int size = PyString_Size(co->co_lnotab) / 2; + unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab); + int line = co->co_firstlineno; + int addr = 0; + while (--size >= 0) { + addr += *p++; + if (addr > addrq) + break; + line += *p++; + } + return line; + } From tim_one@users.sourceforge.net Fri Aug 23 19:19:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:19:32 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle CallTips.py,1.10,1.11 IOBinding.py,1.9,1.10 ScriptBinding.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv21671/python/Tools/idle Modified Files: CallTips.py IOBinding.py ScriptBinding.py Log Message: Whitespace normalization. Index: CallTips.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/CallTips.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CallTips.py 5 Aug 2002 14:53:52 -0000 1.10 --- CallTips.py 23 Aug 2002 18:19:30 -0000 1.11 *************** *** 80,84 **** # 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. --- 80,84 ---- # 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. Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IOBinding.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** IOBinding.py 9 Aug 2002 16:37:36 -0000 1.9 --- IOBinding.py 23 Aug 2002 18:19:30 -0000 1.10 *************** *** 210,214 **** master = self.text) enc = None ! if enc: try: --- 210,214 ---- master = self.text) enc = None ! if enc: try: Index: ScriptBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ScriptBinding.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ScriptBinding.py 21 May 2002 17:00:20 -0000 1.12 --- ScriptBinding.py 23 Aug 2002 18:19:30 -0000 1.13 *************** *** 54,58 **** if not editwin.runnable: self.menudefs = [] ! self.keydefs = {} self.editwin = editwin # Provide instance variables referenced by Debugger --- 54,58 ---- if not editwin.runnable: self.menudefs = [] ! self.keydefs = {} self.editwin = editwin # Provide instance variables referenced by Debugger From tim_one@users.sourceforge.net Fri Aug 23 19:19:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:19:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Charset.py,1.4,1.5 Message.py,1.18,1.19 Parser.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv21671/python/Lib/email Modified Files: Charset.py Message.py Parser.py Log Message: Whitespace normalization. Index: Charset.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Charset.py 1 Jun 2002 03:56:07 -0000 1.4 --- Charset.py 23 Aug 2002 18:19:30 -0000 1.5 *************** *** 12,16 **** def _is_unicode(x): return isinstance(x, UnicodeType) ! from email.Encoders import encode_7or8bit import email.base64MIME --- 12,16 ---- def _is_unicode(x): return isinstance(x, UnicodeType) ! from email.Encoders import encode_7or8bit import email.base64MIME Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Message.py 20 Aug 2002 14:50:09 -0000 1.18 --- Message.py 23 Aug 2002 18:19:30 -0000 1.19 *************** *** 53,62 **** def _unquotevalue(value): if isinstance(value, TupleType): ! return (value[0], value[1], Utils.unquote(value[2])) else: ! return Utils.unquote(value) ! class Message: """Basic message object for use inside the object tree. --- 53,62 ---- def _unquotevalue(value): if isinstance(value, TupleType): ! return (value[0], value[1], Utils.unquote(value[2])) else: ! return Utils.unquote(value) ! class Message: """Basic message object for use inside the object tree. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Parser.py 19 Jul 2002 22:25:34 -0000 1.12 --- Parser.py 23 Aug 2002 18:19:30 -0000 1.13 *************** *** 130,134 **** separator = '--' + boundary payload = fp.read() ! # We use an RE here because boundaries can have trailing # whitespace. mo = re.search( --- 130,134 ---- separator = '--' + boundary payload = fp.read() ! # We use an RE here because boundaries can have trailing # whitespace. mo = re.search( *************** *** 177,183 **** # We split the textual payload on the boundary separator, which # includes the trailing newline. If the container is a ! # multipart/digest then the subparts are by default message/rfc822 ! # instead of text/plain. In that case, they'll have a optional ! # block of MIME headers, then an empty line followed by the # message headers. parts = re.split( --- 177,183 ---- # We split the textual payload on the boundary separator, which # includes the trailing newline. If the container is a ! # multipart/digest then the subparts are by default message/rfc822 ! # instead of text/plain. In that case, they'll have a optional ! # block of MIME headers, then an empty line followed by the # message headers. parts = re.split( *************** *** 185,189 **** payload[start:terminator]) for part in parts: ! if isdigest: if part[0] == linesep: # There's no header block so create an empty message --- 185,189 ---- payload[start:terminator]) for part in parts: ! if isdigest: if part[0] == linesep: # There's no header block so create an empty message From jhylton@users.sourceforge.net Fri Aug 23 19:21:25 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:21:25 -0700 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22502/Python Modified Files: Tag: ast-branch ast.c Log Message: Add primitive support for different kinds of compiled source. Also handle []. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** ast.c 7 Jul 2002 17:34:44 -0000 1.1.2.1 --- ast.c 23 Aug 2002 18:21:22 -0000 1.1.2.2 *************** *** 31,51 **** stmt_ty s; ! REQ(n, file_input); ! stmts = asdl_seq_new(NCH(n) / 2); ! for (i = 0; i < NCH(n); i++) { ! if (TYPE(CHILD(n, i)) == stmt) { ! s = ast_for_stmt(CHILD(n, i)); ! if (!s) { ! asdl_seq_free(stmts); ! return NULL; ! } ! if (asdl_seq_append(stmts, s) < 0) { ! return NULL; } ! } ! else ! fprintf(stderr, "skipping %d\n", TYPE(CHILD(n, i))); } ! return Module(stmts); } --- 31,61 ---- stmt_ty s; ! switch (TYPE(n)) { ! case file_input: ! stmts = asdl_seq_new(NCH(n) / 2); ! for (i = 0; i < NCH(n); i++) { ! if (TYPE(CHILD(n, i)) == stmt) { ! s = ast_for_stmt(CHILD(n, i)); ! if (!s) { ! asdl_seq_free(stmts); ! return NULL; ! } ! if (asdl_seq_append(stmts, s) < 0) { ! return NULL; ! } ! } ! else ! fprintf(stderr, "skipping %d\n", ! TYPE(CHILD(n, i))); } ! return Module(stmts); ! case eval_input: ! return Expression(ast_for_testlist(CHILD(n, 0))); ! break; ! default: ! return NULL; } ! /* Can't get here */ ! return NULL; } *************** *** 443,446 **** --- 453,458 ---- case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); + if (TYPE(ch) == RSQB) + return List(NULL, Load); REQ(ch, listmaker); if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) From gvanrossum@users.sourceforge.net Fri Aug 23 19:21:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:21:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.23,1.24 test_descr.py,1.155,1.156 test_unicode.py,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21447/Lib/test Modified Files: string_tests.py test_descr.py test_unicode.py Log Message: Code by Inyeol Lee, submitted to SF bug 595350, to implement the string/unicode method .replace() with a zero-lengt first argument. Inyeol contributed tests for this too. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** string_tests.py 9 Aug 2002 01:37:06 -0000 1.23 --- string_tests.py 23 Aug 2002 18:21:26 -0000 1.24 *************** *** 203,206 **** --- 203,210 ---- test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2) + test('replace', 'abc', '-a-b-c-', '', '-') + test('replace', 'abc', '-a-b-c', '', '-', 3) + test('replace', 'abc', 'abc', '', '-', 0) + test('replace', '', '', '', '') # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with # MemoryError due to empty result (platform malloc issue when requesting Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** test_descr.py 13 Aug 2002 18:26:26 -0000 1.155 --- test_descr.py 23 Aug 2002 18:21:26 -0000 1.156 *************** *** 2997,3004 **** else: raise TestFailed, "''.rindex('5') doesn't raise ValueError" - try: ''.replace('', '') - except ValueError: pass - else: raise TestFailed, "''.replace('', '') doesn't raise ValueError" - try: '%(n)s' % None except TypeError: pass --- 2997,3000 ---- Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** test_unicode.py 20 Aug 2002 17:29:28 -0000 1.66 --- test_unicode.py 23 Aug 2002 18:21:26 -0000 1.67 *************** *** 211,220 **** 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) ! try: ! u"abc".replace(u"", u"x") ! except ValueError: ! pass ! else: ! raise TestFailed, "u.replace('', ...) should raise ValueError" test('startswith', u'hello', True, u'he') --- 211,218 ---- 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'-a-b-c-', u'', u'-') ! test('replace', u'abc', u'-a-b-c', u'', u'-', 3) ! test('replace', u'abc', u'abc', u'', u'-', 0) ! test('replace', u'', u'', u'', u'') test('startswith', u'hello', True, u'he') From gvanrossum@users.sourceforge.net Fri Aug 23 19:21:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:21:30 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.183,2.184 unicodeobject.c,2.164,2.165 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21447/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Code by Inyeol Lee, submitted to SF bug 595350, to implement the string/unicode method .replace() with a zero-lengt first argument. Inyeol contributed tests for this too. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.183 retrieving revision 2.184 diff -C2 -d -r2.183 -r2.184 *** stringobject.c 20 Aug 2002 17:29:29 -0000 2.183 --- stringobject.c 23 Aug 2002 18:21:28 -0000 2.184 *************** *** 2216,2224 **** int nfound, offset, new_len; ! if (len == 0 || pat_len > len) goto return_same; /* find length of output string */ ! nfound = mymemcnt(str, len, pat, pat_len); if (count < 0) count = INT_MAX; --- 2216,2224 ---- int nfound, offset, new_len; ! if (len == 0 || (pat_len == 0 && sub_len == 0) || pat_len > len) goto return_same; /* find length of output string */ ! nfound = (pat_len > 0) ? mymemcnt(str, len, pat, pat_len) : len + 1; if (count < 0) count = INT_MAX; *************** *** 2243,2265 **** out_s = new_s; ! for (; count > 0 && len > 0; --count) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! if (offset == -1) ! break; ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); ! str += offset + pat_len; ! len -= offset + pat_len; ! /* copy substitute into the output string */ ! new_s += offset; ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; } - /* copy any remaining values into output string */ - if (len > 0) - memcpy(new_s, str, len); } *out_len = new_len; --- 2243,2278 ---- out_s = new_s; ! if (pat_len > 0) { ! for (; nfound > 0; --nfound) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! if (offset == -1) ! break; ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); ! str += offset + pat_len; ! len -= offset + pat_len; ! /* copy substitute into the output string */ ! new_s += offset; ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; ! } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); ! } ! else { ! for (;;++str, --len) { ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; ! if (--nfound <= 0) { ! memcpy(new_s, str, len); ! break; ! } ! *new_s++ = *str; ! } } } *out_len = new_len; *************** *** 2318,2325 **** return NULL; - if (sub_len <= 0) { - PyErr_SetString(PyExc_ValueError, "empty pattern string"); - return NULL; - } new_s = mymemreplace(str,len,sub,sub_len,repl,repl_len,count,&out_len); if (new_s == NULL) { --- 2331,2334 ---- Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.164 retrieving revision 2.165 diff -C2 -d -r2.164 -r2.165 *** unicodeobject.c 20 Aug 2002 17:29:29 -0000 2.164 --- unicodeobject.c 23 Aug 2002 18:21:28 -0000 2.165 *************** *** 3495,3503 **** PyUnicodeObject *u; - if (str1->length == 0) { - PyErr_SetString(PyExc_ValueError, "empty pattern string"); - return NULL; - } - if (maxcount < 0) maxcount = INT_MAX; --- 3495,3498 ---- *************** *** 3550,3566 **** i = 0; p = u->str; ! while (i <= self->length - str1->length) ! if (Py_UNICODE_MATCH(self, i, str1)) { ! /* replace string segment */ Py_UNICODE_COPY(p, str2->str, str2->length); p += str2->length; ! i += str1->length; ! if (--n <= 0) { ! /* copy remaining part */ ! Py_UNICODE_COPY(p, self->str+i, self->length-i); break; - } - } else *p++ = self->str[i++]; } } --- 3545,3572 ---- i = 0; p = u->str; ! if (str1->length > 0) { ! while (i <= self->length - str1->length) ! if (Py_UNICODE_MATCH(self, i, str1)) { ! /* replace string segment */ ! Py_UNICODE_COPY(p, str2->str, str2->length); ! p += str2->length; ! i += str1->length; ! if (--n <= 0) { ! /* copy remaining part */ ! Py_UNICODE_COPY(p, self->str+i, self->length-i); ! break; ! } ! } else ! *p++ = self->str[i++]; ! } else { ! while (n > 0) { Py_UNICODE_COPY(p, str2->str, str2->length); p += str2->length; ! if (--n <= 0) break; *p++ = self->str[i++]; + } + Py_UNICODE_COPY(p, self->str+i, self->length-i); + } } } From tim_one@users.sourceforge.net Fri Aug 23 19:19:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:19:32 -0700 Subject: [Python-checkins] python/dist/src/Lib dis.py,1.42,1.43 pdb.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21671/python/Lib Modified Files: dis.py pdb.py Log Message: Whitespace normalization. Index: dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** dis.py 15 Aug 2002 14:59:00 -0000 1.42 --- dis.py 23 Aug 2002 18:19:29 -0000 1.43 *************** *** 69,73 **** addr = 0 line_incr = 0 ! labels = findlabels(code) n = len(code) --- 69,73 ---- addr = 0 line_incr = 0 ! labels = findlabels(code) n = len(code) Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** pdb.py 15 Aug 2002 14:59:00 -0000 1.55 --- pdb.py 23 Aug 2002 18:19:30 -0000 1.56 *************** *** 106,110 **** self.onecmd(line) ! # Override Bdb methods def user_call(self, frame, argument_list): --- 106,110 ---- self.onecmd(line) ! # Override Bdb methods def user_call(self, frame, argument_list): From tim_one@users.sourceforge.net Fri Aug 23 19:19:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:19:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings string_escape.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv21671/python/Lib/encodings Modified Files: string_escape.py Log Message: Whitespace normalization. Index: string_escape.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/string_escape.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** string_escape.py 14 Aug 2002 07:46:22 -0000 1.1 --- string_escape.py 23 Aug 2002 18:19:30 -0000 1.2 *************** *** 15,19 **** class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass --- 15,19 ---- class StreamWriter(Codec,codecs.StreamWriter): pass ! class StreamReader(Codec,codecs.StreamReader): pass From jhylton@users.sourceforge.net Fri Aug 23 19:22:14 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:22:14 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.261.2.1,2.261.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22771/Python Modified Files: Tag: ast-branch bltinmodule.c Log Message: Call PyRun_StringFlags() instead of the macro. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.261.2.1 retrieving revision 2.261.2.2 diff -C2 -d -r2.261.2.1 -r2.261.2.2 *** bltinmodule.c 9 Jul 2002 13:22:01 -0000 2.261.2.1 --- bltinmodule.c 23 Aug 2002 18:22:11 -0000 2.261.2.2 *************** *** 984,988 **** return NULL; } ! res = PyRun_String(str, Py_eval_input, globals, locals); Py_DECREF(line); return res; --- 984,988 ---- return NULL; } ! res = PyRun_StringFlags(str, Py_eval_input, globals, locals, NULL); Py_DECREF(line); return res; From jhylton@users.sourceforge.net Fri Aug 23 19:35:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:35:44 -0700 Subject: [Python-checkins] python/dist/src/Python newcompile.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-serv27440/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Define Py_OptimizeFlag. Add _Py_Mangle() which used to be in compile.c. Add top-level compile code to handle different Module types. Add compiler_name() to generate the appropriate opcode, which is determined from the expression context and the symbol table. Add compiler_boolop() to generate boolean expressions. Add placeholder compiler_visit_slice() and compiler_visit_arguments(). Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.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 *** newcompile.c 2 Aug 2002 17:52:59 -0000 1.1.2.2 --- newcompile.c 23 Aug 2002 18:35:41 -0000 1.1.2.3 *************** *** 7,10 **** --- 7,12 ---- #include "opcode.h" + int Py_OptimizeFlag = 0; + /* fblockinfo tracks the current frame block. *************** *** 30,34 **** /* info that changes for each code block */ ! PySymtableEntryObject *c_symbols; int c_nblocks; int c_curblock; --- 32,36 ---- /* info that changes for each code block */ ! PySTEntryObject *c_ste; int c_nblocks; int c_curblock; *************** *** 65,68 **** --- 67,98 ---- static void compiler_pop_fblock(struct compiler *, enum fblocktype, int); + int + _Py_Mangle(char *p, char *name, char *buffer, size_t maxlen) + { + /* Name mangling: __private becomes _classname__private. + This is independent from how the name is used. */ + size_t nlen, plen; + if (p == NULL || name == NULL || name[0] != '_' || name[1] != '_') + return 0; + nlen = strlen(name); + if (nlen+2 >= maxlen) + return 0; /* Don't mangle __extremely_long_names */ + if (name[nlen-1] == '_' && name[nlen-2] == '_') + return 0; /* Don't mangle __whatever__ */ + /* Strip leading underscores from class name */ + while (*p == '_') + p++; + if (*p == '\0') + return 0; /* Don't mangle if class is just underscores */ + plen = strlen(p); + if (plen + nlen >= maxlen) + plen = maxlen-nlen-2; /* Truncate class name if too long */ + /* buffer = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ + buffer[0] = '_'; + strncpy(buffer+1, p, plen); + strcpy(buffer+1+plen, name); + return 1; + } + PyCodeObject * PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags) *************** *** 123,131 **** return 0; } ! assert(PySymtableEntry_Check(v)); ! c->c_symbols = (PySymtableEntryObject *)v; c->c_nblocks = 0; ! c->c_blocks = (struct basicblock **)malloc(sizeof(struct basicblock *) * DEFAULT_BLOCKS); if (!c->c_blocks) --- 153,161 ---- return 0; } ! assert(PySTEntry_Check(v)); ! c->c_ste = (PySTEntryObject *)v; c->c_nblocks = 0; ! c->c_blocks = (struct basicblock **)malloc(sizeof(struct basicblock *) * DEFAULT_BLOCKS); if (!c->c_blocks) *************** *** 145,150 **** { /* get the code object for the current block. ! XXX may want to return a thunk insttead ! to allow later passes */ return NULL; --- 175,179 ---- { /* get the code object for the current block. ! XXX may want to return a thunk instead to allow later passes */ return NULL; *************** *** 316,325 **** --- 345,359 ---- switch (mod->kind) { case Module_kind: + VISIT_SEQ(c, stmt, mod->v.Module.body); break; case Interactive_kind: + VISIT(c, stmt, mod->v.Interactive.body); break; case Expression_kind: + VISIT(c, expr, mod->v.Expression.body); break; case Suite_kind: + assert(0); + VISIT_SEQ(c, stmt, mod->v.Suite.body); break; } *************** *** 568,572 **** break; case While_kind: ! return compiler_if(c, s); break; case If_kind: --- 602,606 ---- break; case While_kind: ! return compiler_while(c, s); break; case If_kind: *************** *** 688,691 **** --- 722,820 ---- return 0; } + + static int + compiler_name(struct compiler *c, expr_ty e) + { + int op, scope; + enum { OP_FAST, OP_GLOBAL, OP_DEREF, OP_NAME } optype; + + /* XXX AugStore isn't used anywhere! */ + op = 0; + optype = OP_NAME; + scope = PyST_GetScope(c->c_ste, e->v.Name.id); + switch (scope) { + case FREE: + case CELL: + optype = OP_DEREF; + break; + case LOCAL: + if (c->c_ste->ste_type == FunctionBlock) + optype = OP_FAST; + break; + case GLOBAL_IMPLICIT: + if (c->c_ste->ste_optimized) + optype = OP_GLOBAL; + break; + case GLOBAL_EXPLICIT: + optype = OP_GLOBAL; + break; + } + + switch (optype) { + case OP_DEREF: + switch (e->v.Name.ctx) { + case Load: op = LOAD_DEREF; break; + case Store: op = STORE_DEREF; break; + case AugStore: + break; + case Del: + assert(0); /* impossible */ + } + case OP_FAST: + switch (e->v.Name.ctx) { + case Load: op = LOAD_FAST; break; + case Store: op = STORE_FAST; break; + case Del: op = DELETE_FAST; break; + case AugStore: + break; + } + case OP_GLOBAL: + switch (e->v.Name.ctx) { + case Load: op = LOAD_GLOBAL; break; + case Store: op = STORE_GLOBAL; break; + case Del: op = DELETE_GLOBAL; break; + case AugStore: + break; + } + case OP_NAME: + switch (e->v.Name.ctx) { + case Load: op = LOAD_NAME; break; + case Store: op = STORE_NAME; break; + case Del: op = DELETE_NAME; break; + case AugStore: + break; + } + } + + assert(op); + ADDOP_O(c, op, e->v.Name.id); + return 1; + } + + static int + compiler_boolop(struct compiler *c, expr_ty e) + { + int end, jumpi, i, n; + asdl_seq *s; + + if (e->v.BoolOp.op == And) + jumpi = JUMP_IF_FALSE; + else + jumpi = JUMP_IF_TRUE; + end = compiler_new_block(c); + if (!end) + return 0; + s = e->v.BoolOp.values; + n = asdl_seq_LEN(s) - 1; + for (i = 0; i < n; ++i) { + VISIT(c, expr, asdl_seq_get(s, i)); + ADDOP_I(c, jumpi, end); + NEW_BLOCK(c); + ADDOP(c, POP_TOP) + } + VISIT(c, expr, asdl_seq_get(s, n)); + compiler_use_block(c, end); + return 1; + } static int *************** *** 695,699 **** switch (e->kind) { ! case BoolOp_kind: break; case BinOp_kind: --- 824,829 ---- switch (e->kind) { ! case BoolOp_kind: ! return compiler_boolop(c, e); break; case BinOp_kind: *************** *** 758,762 **** VISIT(c, slice, e->v.Subscript.slice); break; ! case Name_kind: break; /* child nodes of List and Tuple will have expr_context set */ --- 888,893 ---- VISIT(c, slice, e->v.Subscript.slice); break; ! case Name_kind: ! return compiler_name(c, e); break; /* child nodes of List and Tuple will have expr_context set */ *************** *** 819,821 **** --- 950,964 ---- Py_XDECREF(v); return 0; + } + + static int + compiler_visit_slice(struct compiler *c, slice_ty s) + { + return 1; + } + + static int + compiler_visit_arguments(struct compiler *c, arguments_ty a) + { + return 1; } From gvanrossum@users.sourceforge.net Fri Aug 23 19:50:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:50:23 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.165,2.166 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31023/Objects Modified Files: unicodeobject.c Log Message: 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. (I wonder how many more of these are lurking? The unicode code base is full of wonders.) Bugfix candidate; this same bug is present in 2.2.1. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.165 retrieving revision 2.166 diff -C2 -d -r2.165 -r2.166 *** unicodeobject.c 23 Aug 2002 18:21:28 -0000 2.165 --- unicodeobject.c 23 Aug 2002 18:50:20 -0000 2.166 *************** *** 3535,3542 **** 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( --- 3535,3548 ---- 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 Fri Aug 23 19:50:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 11:50:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31023/Lib/test Modified Files: test_unicode.py Log Message: 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. (I wonder how many more of these are lurking? The unicode code base is full of wonders.) Bugfix candidate; this same bug is present in 2.2.1. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** test_unicode.py 23 Aug 2002 18:21:26 -0000 1.67 --- test_unicode.py 23 Aug 2002 18:50:21 -0000 1.68 *************** *** 214,217 **** --- 214,219 ---- test('replace', u'abc', u'-a-b-c', u'', u'-', 3) test('replace', u'abc', u'abc', u'', u'-', 0) + test('replace', u'abc', u'abc', u'ab', u'--', 0) + test('replace', u'abc', u'abc', u'xy', u'--') test('replace', u'', u'', u'', u'') From tim_one@users.sourceforge.net Fri Aug 23 21:06:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 13:06:44 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26687/python/Lib Modified Files: sets.py Log Message: Comment repair. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** sets.py 23 Aug 2002 14:45:02 -0000 1.14 --- sets.py 23 Aug 2002 20:06:42 -0000 1.15 *************** *** 298,305 **** def _compute_hash(self): # Calculate hash code for a set by xor'ing the hash codes of ! # the elements. This algorithm ensures that the hash code ! # does not depend on the order in which elements are added to ! # the code. This is not called __hash__ because a BaseSet ! # should not be hashable; only an ImmutableSet is hashable. result = 0 for elt in self: --- 298,305 ---- def _compute_hash(self): # Calculate hash code for a set by xor'ing the hash codes of ! # the elements. This ensures that the hash code does not depend ! # on the order in which elements are added to the set. This is ! # not called __hash__ because a BaseSet should not be hashable; ! # only an ImmutableSet is hashable. result = 0 for elt in self: From tim_one@users.sourceforge.net Fri Aug 23 21:37:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 23 Aug 2002 13:37:00 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4091/python/Lib Modified Files: sets.py Log Message: pop() docstring: this isn't a randomly-chosen element, it's merely arbitrary. I already changed the docs for this. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sets.py 23 Aug 2002 20:06:42 -0000 1.15 --- sets.py 23 Aug 2002 20:36:58 -0000 1.16 *************** *** 456,460 **** def pop(self): ! """Remove and return a randomly-chosen set element.""" return self._data.popitem()[0] --- 456,460 ---- def pop(self): ! """Remove and return an arbitrary set element.""" return self._data.popitem()[0] From fdrake@users.sourceforge.net Fri Aug 23 22:19:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 23 Aug 2002 14:19:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17168 Modified Files: libcgi.tex Log Message: Fix typo reported to python-docs. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** libcgi.tex 21 Aug 2002 19:24:21 -0000 1.37 --- libcgi.tex 23 Aug 2002 21:19:53 -0000 1.38 *************** *** 405,409 **** true, the double-quote character (\character{"}) is also translated; this helps for inclusion in an HTML attribute value, as in \code{}. If the value to be qouted might include single- or double-quote characters, or both, consider using the \function{quoteattr()} function in the \refmodule{xml.sax.saxutils} --- 405,409 ---- true, the double-quote character (\character{"}) is also translated; this helps for inclusion in an HTML attribute value, as in \code{}. If the value to be quoted might include single- or double-quote characters, or both, consider using the \function{quoteattr()} function in the \refmodule{xml.sax.saxutils} From fdrake@users.sourceforge.net Fri Aug 23 22:20:13 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 23 Aug 2002 14:20:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.35.4.2,1.35.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17340 Modified Files: Tag: release22-maint libcgi.tex Log Message: Fix typo reported to python-docs. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.35.4.2 retrieving revision 1.35.4.3 diff -C2 -d -r1.35.4.2 -r1.35.4.3 *** libcgi.tex 21 Aug 2002 19:24:43 -0000 1.35.4.2 --- libcgi.tex 23 Aug 2002 21:20:11 -0000 1.35.4.3 *************** *** 405,409 **** true, the double-quote character (\character{"}) is also translated; this helps for inclusion in an HTML attribute value, as in \code{}. If the value to be qouted might include single- or double-quote characters, or both, consider using the \function{quoteattr()} function in the \refmodule{xml.sax.saxutils} --- 405,409 ---- true, the double-quote character (\character{"}) is also translated; this helps for inclusion in an HTML attribute value, as in \code{}. If the value to be quoted might include single- or double-quote characters, or both, consider using the \function{quoteattr()} function in the \refmodule{xml.sax.saxutils} From jhylton@users.sourceforge.net Fri Aug 23 23:51:53 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 23 Aug 2002 15:51:53 -0700 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.4,2.10.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11495/Python Modified Files: Tag: ast-branch symtable.c Log Message: Remove use of old members. Don't restore st_cur on exit from the top-level scope. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.4 retrieving revision 2.10.8.5 diff -C2 -d -r2.10.8.4 -r2.10.8.5 *** symtable.c 4 Aug 2002 21:12:15 -0000 2.10.8.4 --- symtable.c 23 Aug 2002 22:51:51 -0000 2.10.8.5 *************** *** 188,192 **** goto fail; st->st_cur = NULL; - st->st_errors = 0; st->st_tmpname = 0; st->st_private = NULL; --- 188,191 ---- *************** *** 218,222 **** (void *)mod, 0); /* Any other top-level initialization? */ ! if (mod->kind == Module_kind) { int i; asdl_seq *seq = mod->v.Module.body; --- 217,223 ---- (void *)mod, 0); /* Any other top-level initialization? */ ! switch (mod->kind) { ! case Module_kind: ! { int i; asdl_seq *seq = mod->v.Module.body; *************** *** 227,230 **** --- 228,238 ---- } } + break; + case Expression_kind: + symtable_visit_expr(st, mod->v.Expression.body); + break; + default: + return NULL; + } symtable_exit_block(st, (void *)mod); return st; *************** *** 232,236 **** int ! PySTEntry_GetScope(PySTEntryObject *ste, PyObject *name) { PyObject *v; --- 240,244 ---- int ! PyST_GetScope(PySTEntryObject *ste, PyObject *name) { PyObject *v; *************** *** 475,483 **** Py_DECREF(st->st_cur); end = PyList_GET_SIZE(st->st_stack) - 1; ! st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, ! end); ! if (PySequence_DelItem(st->st_stack, end) < 0) ! return -1; ! return 0; } --- 483,493 ---- Py_DECREF(st->st_cur); end = PyList_GET_SIZE(st->st_stack) - 1; ! if (end >= 0) { ! st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, ! end); ! if (PySequence_DelItem(st->st_stack, end) < 0) ! return 0; ! } ! return 1; } *************** *** 492,496 **** if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { Py_DECREF(st->st_cur); - st->st_errors++; return 0; } --- 502,505 ---- *************** *** 499,506 **** if (name == GET_IDENTIFIER(top)) st->st_global = st->st_cur->ste_symbols; ! if (prev && st->st_pass == 1) { if (PyList_Append(prev->ste_children, (PyObject *)st->st_cur) < 0) { - st->st_errors++; return 0; } --- 508,514 ---- if (name == GET_IDENTIFIER(top)) st->st_global = st->st_cur->ste_symbols; ! if (prev) { if (PyList_Append(prev->ste_children, (PyObject *)st->st_cur) < 0) { return 0; } From rhettinger@users.sourceforge.net Sat Aug 24 03:35:50 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 19:35:50 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21371 Modified Files: sets.py Log Message: 1. Removed module self test in favor of unittests -- Timbot's suggestion. 2. Replaced calls to Set([]) with Set() -- Timbot's suggestion 3. Fixed subtle bug in sets of sets: The following code did not work (will add to test suite): d = Set('d') s = Set([d]) # Stores inner set as an ImmutableSet s.remove(d) # For comparison, wraps d in _TemporarilyImmutableSet The comparison proceeds by computing the hash of the _TemporarilyImmutableSet and finding it in the dictionary. It then verifies equality by calling ImmutableSet.__eq__() and crashes from the binary sanity check. The problem is that the code assumed equality would be checked with _TemporarilyImmutableSet.__eq__(). The solution is to let _TemporarilyImmutableSet derive from BaseSet so it will pass the sanity check and then to provide it with the ._data element from the wrapped set so that ImmutableSet.__eq__() will find ._data where it expects. Since ._data is now provided and because BaseSet is the base class, _TemporarilyImmutableSet no longer needs .__eq__() or .__ne__(). Note that inheriting all of BaseSet's methods is harmless because none of those methods (except ones starting with an underscore) can mutate the .data element. Also _TemporarilyImmutableSet is only used internally as is not otherwise visible. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** sets.py 23 Aug 2002 20:36:58 -0000 1.16 --- sets.py 24 Aug 2002 02:35:48 -0000 1.17 *************** *** 134,138 **** def copy(self): """Return a shallow copy of a set.""" ! result = self.__class__([]) result._data.update(self._data) return result --- 134,138 ---- def copy(self): """Return a shallow copy of a set.""" ! result = self.__class__() result._data.update(self._data) return result *************** *** 148,152 **** # itself. from copy import deepcopy ! result = self.__class__([]) memo[id(self)] = result data = result._data --- 148,152 ---- # itself. from copy import deepcopy ! result = self.__class__() memo[id(self)] = result data = result._data *************** *** 189,193 **** else: little, big = other, self ! result = self.__class__([]) data = result._data value = True --- 189,193 ---- else: little, big = other, self ! result = self.__class__() data = result._data value = True *************** *** 211,215 **** if not isinstance(other, BaseSet): return NotImplemented ! result = self.__class__([]) data = result._data value = True --- 211,215 ---- if not isinstance(other, BaseSet): return NotImplemented ! result = self.__class__() data = result._data value = True *************** *** 236,240 **** if not isinstance(other, BaseSet): return NotImplemented ! result = self.__class__([]) data = result._data value = True --- 236,240 ---- if not isinstance(other, BaseSet): return NotImplemented ! result = self.__class__() data = result._data value = True *************** *** 468,472 **** ! class _TemporarilyImmutableSet(object): # Wrap a mutable set as if it was temporarily immutable. # This only supplies hashing and equality comparisons. --- 468,472 ---- ! class _TemporarilyImmutableSet(BaseSet): # Wrap a mutable set as if it was temporarily immutable. # This only supplies hashing and equality comparisons. *************** *** 476,479 **** --- 476,480 ---- def __init__(self, set): self._set = set + self._data = set._data # Needed by ImmutableSet.__eq__() def __hash__(self): *************** *** 481,585 **** self._hashcode = self._set._compute_hash() return self._hashcode - - def __eq__(self, other): - return self._set == other - - def __ne__(self, other): - return self._set != other - - - # Rudimentary self-tests - - def _test(): - - # Empty set - red = Set() - assert `red` == "Set([])", "Empty set: %s" % `red` - - # Unit set - green = Set((0,)) - assert `green` == "Set([0])", "Unit set: %s" % `green` - - # 3-element set - blue = Set([0, 1, 2]) - assert blue._repr(True) == "Set([0, 1, 2])", "3-element set: %s" % `blue` - - # 2-element set with other values - black = Set([0, 5]) - assert black._repr(True) == "Set([0, 5])", "2-element set: %s" % `black` - - # All elements from all sets - white = Set([0, 1, 2, 5]) - assert white._repr(True) == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` - - # Add element to empty set - red.add(9) - assert `red` == "Set([9])", "Add to empty set: %s" % `red` - - # Remove element from unit set - red.remove(9) - assert `red` == "Set([])", "Remove from unit set: %s" % `red` - - # Remove element from empty set - try: - red.remove(0) - assert 0, "Remove element from empty set: %s" % `red` - except LookupError: - pass - - # Length - assert len(red) == 0, "Length of empty set" - assert len(green) == 1, "Length of unit set" - assert len(blue) == 3, "Length of 3-element set" - - # Compare - assert green == Set([0]), "Equality failed" - assert green != Set([1]), "Inequality failed" - - # Union - assert blue | red == blue, "Union non-empty with empty" - assert red | blue == blue, "Union empty with non-empty" - assert green | blue == blue, "Union non-empty with non-empty" - assert blue | black == white, "Enclosing union" - - # Intersection - assert blue & red == red, "Intersect non-empty with empty" - assert red & blue == red, "Intersect empty with non-empty" - assert green & blue == green, "Intersect non-empty with non-empty" - assert blue & black == green, "Enclosing intersection" - - # Symmetric difference - assert red ^ green == green, "Empty symdiff non-empty" - assert green ^ blue == Set([1, 2]), "Non-empty symdiff" - assert white ^ white == red, "Self symdiff" - - # Difference - assert red - green == red, "Empty - non-empty" - assert blue - red == blue, "Non-empty - empty" - assert white - black == Set([1, 2]), "Non-empty - non-empty" - - # In-place union - orange = Set([]) - orange |= Set([1]) - assert orange == Set([1]), "In-place union" - - # In-place intersection - orange = Set([1, 2]) - orange &= Set([2]) - assert orange == Set([2]), "In-place intersection" - - # In-place difference - orange = Set([1, 2, 3]) - orange -= Set([2, 4]) - assert orange == Set([1, 3]), "In-place difference" - - # In-place symmetric difference - orange = Set([1, 2, 3]) - orange ^= Set([3, 4]) - assert orange == Set([1, 2, 4]), "In-place symmetric difference" - - print "All tests passed" - - - if __name__ == "__main__": - _test() --- 482,483 ---- From rhettinger@users.sourceforge.net Sat Aug 24 03:56:05 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 19:56:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28239 Modified Files: test_sets.py Log Message: Expanded tests for sets of sets. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_sets.py 21 Aug 2002 06:38:44 -0000 1.3 --- test_sets.py 24 Aug 2002 02:56:01 -0000 1.4 *************** *** 139,142 **** --- 139,146 ---- element = outer.pop() assert type(element) == ImmutableSet, "Construct set of sets" + outer.add(inner) # Rebuild set of sets with .add method + outer.remove(inner) + assert outer == Set() # Verify that remove worked + outer.discard(inner) # Absence of KeyError indicates working fine #============================================================================== From rhettinger@users.sourceforge.net Sat Aug 24 05:47:44 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 21:47:44 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16658 Modified Files: sets.py Log Message: Since instances of _TemporarilyImmutableSet are always thrown away immediately after the comparison, there in no use in caching the hashcode. The test, 'if self._hashcode is None', never fails. Removing the caching saves a few lines and a little time. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** sets.py 24 Aug 2002 02:35:48 -0000 1.17 --- sets.py 24 Aug 2002 04:47:42 -0000 1.18 *************** *** 472,477 **** # This only supplies hashing and equality comparisons. - _hashcode = None - def __init__(self, set): self._set = set --- 472,475 ---- *************** *** 479,483 **** def __hash__(self): ! if self._hashcode is None: ! self._hashcode = self._set._compute_hash() ! return self._hashcode --- 477,479 ---- def __hash__(self): ! return self._set._compute_hash() From gvanrossum@users.sourceforge.net Sat Aug 24 06:33:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 22:33:30 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.190,2.191 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23873 Modified Files: object.c Log Message: Speedup for PyObject_RichCompareBool(): PyObject_RichCompare() almost always returns a bool, so avoid calling PyObject_IsTrue() in that case. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.190 retrieving revision 2.191 diff -C2 -d -r2.190 -r2.191 *** object.c 19 Aug 2002 19:22:50 -0000 2.190 --- object.c 24 Aug 2002 05:33:28 -0000 2.191 *************** *** 999,1003 **** if (res == NULL) return -1; ! ok = PyObject_IsTrue(res); Py_DECREF(res); return ok; --- 999,1006 ---- if (res == NULL) return -1; ! if (PyBool_Check(res)) ! ok = (res == Py_True); ! else ! ok = PyObject_IsTrue(res); Py_DECREF(res); return ok; From rhettinger@users.sourceforge.net Sat Aug 24 07:19:05 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 23:19:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29560/test Modified Files: test_sets.py Log Message: At Tim Peter's suggestion, propagated GvR's binary operator changes to the inplace operators. The strategy is to have the operator overloading code do the work and then to define equivalent method calls which rely on the operators. The changes facilitate proper application of TypeError and NonImplementedErrors. Added corresponding tests to the test suite to make sure both the operator and method call versions get exercised. Add missing tests for difference_update(). Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_sets.py 24 Aug 2002 02:56:01 -0000 1.4 --- test_sets.py 24 Aug 2002 06:19:02 -0000 1.5 *************** *** 220,223 **** --- 220,227 ---- assert self.set == Set([2, 4, 6, 8]), "Non-overlapping union" + def test_union_method_call(self): + self.set.union_update(Set([3, 4, 5])) + assert self.set == Set([2, 3, 4, 5, 6]), "Union method call" + def test_intersection_subset(self): self.set &= Set((2, 4)) *************** *** 236,239 **** --- 240,247 ---- assert self.set == empty_set, "Non-overlapping intersection" + def test_intersection_method_call(self): + self.set.intersection_update(Set([3, 4, 5])) + assert self.set == Set([4]), "Intersection method call" + def test_sym_difference_subset(self): self.set ^= Set((2, 4)) *************** *** 251,254 **** --- 259,286 ---- self.set ^= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" + + def test_sym_difference_method_call(self): + self.set.symmetric_difference_update(Set([3, 4, 5])) + assert self.set == Set([2, 3, 5, 6]), "Symmetric difference method call" + + def test_difference_subset(self): + self.set -= Set((2, 4)) + assert self.set == Set([6]), "Subset difference" + + def test_difference_superset(self): + self.set -= Set((2, 4, 6, 8)) + assert self.set == Set([]), "Superset difference" + + def test_difference_overlap(self): + self.set -= Set((3, 4, 5)) + assert self.set == Set([2, 6]), "Overlapping difference" + + def test_difference_non_overlap(self): + self.set -= Set([8]) + assert self.set == Set([2, 4, 6]), "Non-overlapping difference" + + def test_difference_method_call(self): + self.set.difference_update(Set([3, 4, 5])) + assert self.set == Set([2, 6]), "Difference method call" #============================================================================== From rhettinger@users.sourceforge.net Sat Aug 24 07:19:05 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 Aug 2002 23:19:05 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29560 Modified Files: sets.py Log Message: At Tim Peter's suggestion, propagated GvR's binary operator changes to the inplace operators. The strategy is to have the operator overloading code do the work and then to define equivalent method calls which rely on the operators. The changes facilitate proper application of TypeError and NonImplementedErrors. Added corresponding tests to the test suite to make sure both the operator and method call versions get exercised. Add missing tests for difference_update(). Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** sets.py 24 Aug 2002 04:47:42 -0000 1.18 --- sets.py 24 Aug 2002 06:19:02 -0000 1.19 *************** *** 364,368 **** # In-place union, intersection, differences ! def union_update(self, other): """Update a set with the union of itself and another.""" self._binary_sanity_check(other) --- 364,368 ---- # In-place union, intersection, differences ! def __ior__(self, other): """Update a set with the union of itself and another.""" self._binary_sanity_check(other) *************** *** 370,376 **** return self ! __ior__ = union_update ! def intersection_update(self, other): """Update a set with the intersection of itself and another.""" self._binary_sanity_check(other) --- 370,378 ---- return self ! def union_update(self, other): ! """Update a set with the union of itself and another.""" ! self |= other ! def __iand__(self, other): """Update a set with the intersection of itself and another.""" self._binary_sanity_check(other) *************** *** 380,386 **** return self ! __iand__ = intersection_update ! def symmetric_difference_update(self, other): """Update a set with the symmetric difference of itself and another.""" self._binary_sanity_check(other) --- 382,390 ---- return self ! def intersection_update(self, other): ! """Update a set with the intersection of itself and another.""" ! self &= other ! def __ixor__(self, other): """Update a set with the symmetric difference of itself and another.""" self._binary_sanity_check(other) *************** *** 394,400 **** return self ! __ixor__ = symmetric_difference_update ! def difference_update(self, other): """Remove all elements of another set from this set.""" self._binary_sanity_check(other) --- 398,406 ---- return self ! def symmetric_difference_update(self, other): ! """Update a set with the symmetric difference of itself and another.""" ! self ^= other ! def __isub__(self, other): """Remove all elements of another set from this set.""" self._binary_sanity_check(other) *************** *** 405,409 **** return self ! __isub__ = difference_update # Python dict-like mass mutations: update, clear --- 411,417 ---- return self ! def difference_update(self, other): ! """Remove all elements of another set from this set.""" ! self -= other # Python dict-like mass mutations: update, clear From gvanrossum@users.sourceforge.net Sat Aug 24 07:31:37 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 23:31:37 -0700 Subject: [Python-checkins] python/dist/src/Objects object.c,2.191,2.192 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32176 Modified Files: object.c Log Message: Speedup for PyObject_IsTrue(): check for True and False first. Because all built-in tests return bools now, this is the most common path! Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.191 retrieving revision 2.192 diff -C2 -d -r2.191 -r2.192 *** object.c 24 Aug 2002 05:33:28 -0000 2.191 --- object.c 24 Aug 2002 06:31:34 -0000 2.192 *************** *** 1498,1501 **** --- 1498,1505 ---- { int res; + if (v == Py_True) + return 1; + if (v == Py_False) + return 0; if (v == Py_None) return 0; From gvanrossum@users.sourceforge.net Sat Aug 24 07:54:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 23:54:21 -0700 Subject: [Python-checkins] python/dist/src/Lib tokenize.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3280 Modified Files: tokenize.py Log Message: Speed up the most egregious "if token in (long tuple)" cases by using a dict instead. (Alas, using a Set would be slower instead of faster.) Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tokenize.py 23 May 2002 15:15:29 -0000 1.32 --- tokenize.py 24 Aug 2002 06:54:19 -0000 1.33 *************** *** 111,114 **** --- 111,129 ---- 'r': None, 'R': None, 'u': None, 'U': None} + triple_quoted = {} + for t in ("'''", '"""', + "r'''", 'r"""', "R'''", 'R"""', + "u'''", 'u"""', "U'''", 'U"""', + "ur'''", 'ur"""', "Ur'''", 'Ur"""', + "uR'''", 'uR"""', "UR'''", 'UR"""'): + triple_quoted[t] = t + single_quoted = {} + for t in ("'", '"', + "r'", 'r"', "R'", 'R"', + "u'", 'u"', "U'", 'U"', + "ur'", 'ur"', "Ur'", 'Ur"', + "uR'", 'uR"', "UR'", 'UR"' ): + single_quoted[t] = t + tabsize = 8 *************** *** 233,241 **** elif initial == '#': yield (COMMENT, token, spos, epos, line) ! elif token in ("'''", '"""', # triple-quoted ! "r'''", 'r"""', "R'''", 'R"""', ! "u'''", 'u"""', "U'''", 'U"""', ! "ur'''", 'ur"""', "Ur'''", 'Ur"""', ! "uR'''", 'uR"""', "UR'''", 'UR"""'): endprog = endprogs[token] endmatch = endprog.match(line, pos) --- 248,252 ---- elif initial == '#': yield (COMMENT, token, spos, epos, line) ! elif token in triple_quoted: endprog = endprogs[token] endmatch = endprog.match(line, pos) *************** *** 249,257 **** contline = line break ! elif initial in ("'", '"') or \ ! token[:2] in ("r'", 'r"', "R'", 'R"', ! "u'", 'u"', "U'", 'U"') or \ ! token[:3] in ("ur'", 'ur"', "Ur'", 'Ur"', ! "uR'", 'uR"', "UR'", 'UR"' ): if token[-1] == '\n': # continued string strstart = (lnum, start) --- 260,266 ---- contline = line break ! elif initial in single_quoted or \ ! token[:2] in single_quoted or \ ! token[:3] in single_quoted: if token[-1] == '\n': # continued string strstart = (lnum, start) From gvanrossum@users.sourceforge.net Sat Aug 24 07:57:51 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 23 Aug 2002 23:57:51 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.184,2.185 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3867 Modified Files: stringobject.c Log Message: string_contains(): speed up by avoiding function calls where possible. This always called PyUnicode_Check() and PyString_Check(), at least one of which would call PyType_IsSubtype(). Also, this would call PyString_Size() on known string objects. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -d -r2.184 -r2.185 *** stringobject.c 23 Aug 2002 18:21:28 -0000 2.184 --- stringobject.c 24 Aug 2002 06:57:49 -0000 2.185 *************** *** 992,1005 **** const char *lhs, *rhs, *end; int size; #ifdef Py_USING_UNICODE ! if (PyUnicode_Check(el)) ! return PyUnicode_Contains(a, el); #endif ! if (!PyString_Check(el)) { ! PyErr_SetString(PyExc_TypeError, ! "'in ' requires string as left operand"); ! return -1; } ! size = PyString_Size(el); rhs = PyString_AS_STRING(el); lhs = PyString_AS_STRING(a); --- 992,1008 ---- const char *lhs, *rhs, *end; int size; + + if (!PyString_CheckExact(el)) { #ifdef Py_USING_UNICODE ! if (PyUnicode_Check(el)) ! return PyUnicode_Contains(a, el); #endif ! if (!PyString_Check(el)) { ! PyErr_SetString(PyExc_TypeError, ! "'in ' requires string as left operand"); ! return -1; ! } } ! size = PyString_GET_SIZE(el); rhs = PyString_AS_STRING(el); lhs = PyString_AS_STRING(a); *************** *** 1007,1013 **** /* optimize for a single character */ if (size == 1) ! return memchr(lhs, *rhs, PyString_Size(a)) != NULL; ! end = lhs + (PyString_Size(a) - size); while (lhs <= end) { if (memcmp(lhs++, rhs, size) == 0) --- 1010,1016 ---- /* optimize for a single character */ if (size == 1) ! return memchr(lhs, *rhs, PyString_GET_SIZE(a)) != NULL; ! end = lhs + (PyString_GET_SIZE(a) - size); while (lhs <= end) { if (memcmp(lhs++, rhs, size) == 0) From rhettinger@users.sourceforge.net Sat Aug 24 08:33:08 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Aug 2002 00:33:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8853/lib/test Modified Files: test_sets.py Log Message: Removed < <= > >= from the API. Implemented as comparisons of the underlying dictionaries, there were no reasonable use cases (lexicographic sorting of a list of sets is somewhat esoteric). Frees the operators for other uses (such as strict subset and superset comparisons). Updated documentation and test suite accordingly. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_sets.py 24 Aug 2002 06:19:02 -0000 1.5 --- test_sets.py 24 Aug 2002 07:33:06 -0000 1.6 *************** *** 420,429 **** def test_cmp(self): try: ! self.other < self.set assert 0, "Comparison with non-set on left" except TypeError: pass try: ! self.set >= self.other assert 0, "Comparison with non-set on right" except TypeError: --- 420,429 ---- def test_cmp(self): try: ! self.other == self.set assert 0, "Comparison with non-set on left" except TypeError: pass try: ! self.set != self.other assert 0, "Comparison with non-set on right" except TypeError: From rhettinger@users.sourceforge.net Sat Aug 24 08:33:08 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Aug 2002 00:33:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8853/doc/lib Modified Files: libsets.tex Log Message: Removed < <= > >= from the API. Implemented as comparisons of the underlying dictionaries, there were no reasonable use cases (lexicographic sorting of a list of sets is somewhat esoteric). Frees the operators for other uses (such as strict subset and superset comparisons). Updated documentation and test suite accordingly. Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libsets.tex 23 Aug 2002 18:10:54 -0000 1.5 --- libsets.tex 24 Aug 2002 07:33:06 -0000 1.6 *************** *** 101,107 **** In addition to the above operations, both \class{Set} and \class{ImmutableSet} ! support set to set comparison operators based on the contents of their ! internal dictionaries. Two sets are equal if and only if every element of ! each set is contained in the other. The following table lists operations available in \class{ImmutableSet} --- 101,106 ---- In addition to the above operations, both \class{Set} and \class{ImmutableSet} ! support set to set equality comparisons. Two sets are equal if and only if ! every element of each set is contained in the other. The following table lists operations available in \class{ImmutableSet} From rhettinger@users.sourceforge.net Sat Aug 24 08:33:08 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 Aug 2002 00:33:08 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8853/lib Modified Files: sets.py Log Message: Removed < <= > >= from the API. Implemented as comparisons of the underlying dictionaries, there were no reasonable use cases (lexicographic sorting of a list of sets is somewhat esoteric). Frees the operators for other uses (such as strict subset and superset comparisons). Updated documentation and test suite accordingly. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** sets.py 24 Aug 2002 06:19:02 -0000 1.19 --- sets.py 24 Aug 2002 07:33:06 -0000 1.20 *************** *** 103,116 **** return self._data.iterkeys() ! # Comparisons. Ordering is determined by the ordering of the ! # underlying dicts (which is consistent though unpredictable). ! ! def __lt__(self, other): ! self._binary_sanity_check(other) ! return self._data < other._data ! ! def __le__(self, other): ! self._binary_sanity_check(other) ! return self._data <= other._data def __eq__(self, other): --- 103,107 ---- return self._data.iterkeys() ! # Equality comparisons using the underlying dicts def __eq__(self, other): *************** *** 121,132 **** self._binary_sanity_check(other) return self._data != other._data - - def __gt__(self, other): - self._binary_sanity_check(other) - return self._data > other._data - - def __ge__(self, other): - self._binary_sanity_check(other) - return self._data >= other._data # Copying operations --- 112,115 ---- From rhettinger@users.sourceforge.net Sun Aug 25 17:27:35 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 25 Aug 2002 09:27:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocksvr.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25848 Modified Files: libsocksvr.tex Log Message: Correct documentation of allow_reuse_address to match the actual script. Closes SF bug 599681. Index: libsocksvr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocksvr.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libsocksvr.tex 13 Dec 2000 20:39:22 -0000 1.14 --- libsocksvr.tex 25 Aug 2002 16:27:33 -0000 1.15 *************** *** 97,101 **** \begin{datadesc}{allow_reuse_address} Whether the server will allow the reuse of an address. This defaults ! to true, and can be set in subclasses to change the policy. \end{datadesc} --- 97,101 ---- \begin{datadesc}{allow_reuse_address} Whether the server will allow the reuse of an address. This defaults ! to \code{False}, and can be set in subclasses to change the policy. \end{datadesc} From rhettinger@users.sourceforge.net Sun Aug 25 17:31:29 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 25 Aug 2002 09:31:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocksvr.tex,1.14,1.14.22.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv26822 Modified Files: Tag: release22-maint libsocksvr.tex Log Message: Correct documentation of allow_reuse_address to match the actual script. Closes SF bug 599681. Index: libsocksvr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocksvr.tex,v retrieving revision 1.14 retrieving revision 1.14.22.1 diff -C2 -d -r1.14 -r1.14.22.1 *** libsocksvr.tex 13 Dec 2000 20:39:22 -0000 1.14 --- libsocksvr.tex 25 Aug 2002 16:31:27 -0000 1.14.22.1 *************** *** 97,101 **** \begin{datadesc}{allow_reuse_address} Whether the server will allow the reuse of an address. This defaults ! to true, and can be set in subclasses to change the policy. \end{datadesc} --- 97,101 ---- \begin{datadesc}{allow_reuse_address} Whether the server will allow the reuse of an address. This defaults ! to \code{False}, and can be set in subclasses to change the policy. \end{datadesc} From rhettinger@users.sourceforge.net Sun Aug 25 17:36:52 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 25 Aug 2002 09:36:52 -0700 Subject: [Python-checkins] python/dist/src/Lib SocketServer.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27888 Modified Files: SocketServer.py Log Message: Replace 0 with False to match working in documentation. SF 599681. Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** SocketServer.py 15 Apr 2002 00:36:48 -0000 1.31 --- SocketServer.py 25 Aug 2002 16:36:49 -0000 1.32 *************** *** 320,324 **** request_queue_size = 5 ! allow_reuse_address = 0 def __init__(self, server_address, RequestHandlerClass): --- 320,324 ---- request_queue_size = 5 ! allow_reuse_address = False def __init__(self, server_address, RequestHandlerClass): *************** *** 381,385 **** """UDP server class.""" ! allow_reuse_address = 0 socket_type = socket.SOCK_DGRAM --- 381,385 ---- """UDP server class.""" ! allow_reuse_address = False socket_type = socket.SOCK_DGRAM From tim_one@users.sourceforge.net Sun Aug 25 18:10:19 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 10:10:19 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4845/python/lib Modified Files: sets.py Log Message: Record a clue about why __or__ is not union, etc. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** sets.py 24 Aug 2002 07:33:06 -0000 1.20 --- sets.py 25 Aug 2002 17:10:17 -0000 1.21 *************** *** 142,145 **** --- 142,150 ---- # Each has an operator version (e.g. __or__, invoked with |) and a # method version (e.g. union). + # Subtle: Each pair requires distinct code so that the outcome is + # correct when the type of other isn't suitable. For example, if + # we did "union = __or__" instead, then Set().union(3) would return + # NotImplemented instead of raising TypeError (albeit that *why* it + # raises TypeError as-is is also a bit subtle). def __or__(self, other): From tim_one@users.sourceforge.net Sun Aug 25 18:22:27 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 10:22:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7683/python/lib/test Modified Files: test_sets.py Log Message: Simplified the setup for is-subset testing. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_sets.py 24 Aug 2002 07:33:06 -0000 1.6 --- test_sets.py 25 Aug 2002 17:22:23 -0000 1.7 *************** *** 372,416 **** class TestSubsetEqualEmpty(TestSubsets): ! def setUp(self): ! self.left = Set() ! self.right = Set() ! self.name = "both empty" ! self.cases = "<>" #------------------------------------------------------------------------------ class TestSubsetEqualNonEmpty(TestSubsets): ! def setUp(self): ! self.left = Set([1, 2]) ! self.right = Set([1, 2]) ! self.name = "equal pair" ! self.cases = "<>" #------------------------------------------------------------------------------ class TestSubsetEmptyNonEmpty(TestSubsets): ! def setUp(self): ! self.left = Set() ! self.right = Set([1, 2]) ! self.name = "one empty, one non-empty" ! self.cases = "<" #------------------------------------------------------------------------------ class TestSubsetPartial(TestSubsets): ! def setUp(self): ! self.left = Set([1]) ! self.right = Set([1, 2]) ! self.name = "one a non-empty subset of other" ! self.cases = "<" #------------------------------------------------------------------------------ class TestSubsetNonOverlap(TestSubsets): ! def setUp(self): ! self.left = Set([1]) ! self.right = Set([2]) ! self.name = "neither empty, neither contains" ! self.cases = "" #============================================================================== --- 372,411 ---- class TestSubsetEqualEmpty(TestSubsets): ! left = Set() ! right = Set() ! name = "both empty" ! cases = "<>" #------------------------------------------------------------------------------ class TestSubsetEqualNonEmpty(TestSubsets): ! left = Set([1, 2]) ! right = Set([1, 2]) ! name = "equal pair" ! cases = "<>" #------------------------------------------------------------------------------ class TestSubsetEmptyNonEmpty(TestSubsets): ! left = Set() ! right = Set([1, 2]) ! name = "one empty, one non-empty" ! cases = "<" #------------------------------------------------------------------------------ class TestSubsetPartial(TestSubsets): ! left = Set([1]) ! right = Set([1, 2]) ! name = "one a non-empty subset of other" ! cases = "<" #------------------------------------------------------------------------------ class TestSubsetNonOverlap(TestSubsets): ! left = Set([1]) ! right = Set([2]) ! name = "neither empty, neither contains" ! cases = "" #============================================================================== From tim_one@users.sourceforge.net Sun Aug 25 18:38:51 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 10:38:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11998/python/lib/test Modified Files: test_sets.py Log Message: Ack! Virtually every test here relied on an assert stmt. assert stmts should never be used in tests. Repaired dozens, but more is needed. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_sets.py 25 Aug 2002 17:22:23 -0000 1.7 --- test_sets.py 25 Aug 2002 17:38:49 -0000 1.8 *************** *** 13,73 **** def test_repr(self): if self.repr is not None: ! assert `self.set` == self.repr, "Wrong representation for " + self.case def test_length(self): ! assert len(self.set) == self.length, "Wrong length for " + self.case def test_self_equality(self): ! assert self.set == self.set, "Self-equality failed for " + self.case def test_equivalent_equality(self): ! assert self.set == self.dup, "Equivalent equality failed for " + self.case def test_copy(self): ! assert self.set.copy() == self.dup, "Copy and comparison failed for " + self.case def test_self_union(self): result = self.set | self.set ! assert result == self.dup, "Self-union failed for " + self.case def test_empty_union(self): result = self.set | empty_set ! assert result == self.dup, "Union with empty failed for " + self.case def test_union_empty(self): result = empty_set | self.set ! assert result == self.dup, "Union with empty failed for " + self.case def test_self_intersection(self): result = self.set & self.set ! assert result == self.dup, "Self-intersection failed for " + self.case def test_empty_intersection(self): result = self.set & empty_set ! assert result == empty_set, "Intersection with empty failed for " + self.case def test_intersection_empty(self): result = empty_set & self.set ! assert result == empty_set, "Intersection with empty failed for " + self.case def test_self_symmetric_difference(self): result = self.set ^ self.set ! assert result == empty_set, "Self-symdiff failed for " + self.case def checkempty_symmetric_difference(self): result = self.set ^ empty_set ! assert result == self.set, "Symdiff with empty failed for " + self.case def test_self_difference(self): result = self.set - self.set ! assert result == empty_set, "Self-difference failed for " + self.case def test_empty_difference(self): result = self.set - empty_set ! assert result == self.dup, "Difference with empty failed for " + self.case def test_empty_difference_rev(self): result = empty_set - self.set ! assert result == empty_set, "Difference from empty failed for " + self.case def test_iteration(self): --- 13,73 ---- def test_repr(self): if self.repr is not None: ! self.assertEqual(`self.set`, self.repr) def test_length(self): ! self.assertEqual(len(self.set), self.length) def test_self_equality(self): ! self.assertEqual(self.set, self.set) def test_equivalent_equality(self): ! self.assertEqual(self.set, self.dup) def test_copy(self): ! self.assertEqual(self.set.copy(), self.dup) def test_self_union(self): result = self.set | self.set ! self.assertEqual(result, self.dup) def test_empty_union(self): result = self.set | empty_set ! self.assertEqual(result, self.dup) def test_union_empty(self): result = empty_set | self.set ! self.assertEqual(result, self.dup) def test_self_intersection(self): result = self.set & self.set ! self.assertEqual(result, self.dup) def test_empty_intersection(self): result = self.set & empty_set ! self.assertEqual(result, empty_set) def test_intersection_empty(self): result = empty_set & self.set ! self.assertEqual(result, empty_set) def test_self_symmetric_difference(self): result = self.set ^ self.set ! self.assertEqual(result, empty_set) def checkempty_symmetric_difference(self): result = self.set ^ empty_set ! self.assertEqual(result, self.set) def test_self_difference(self): result = self.set - self.set ! self.assertEqual(result, empty_set) def test_empty_difference(self): result = self.set - empty_set ! self.assertEqual(result, self.dup) def test_empty_difference_rev(self): result = empty_set - self.set ! self.assertEqual(result, empty_set) def test_iteration(self): *************** *** 152,200 **** def test_union_subset(self): result = self.set | Set([2]) ! assert result == Set((2, 4, 6)), "Subset union" def test_union_superset(self): result = self.set | Set([2, 4, 6, 8]) ! assert result == Set([2, 4, 6, 8]), "Superset union" def test_union_overlap(self): result = self.set | Set([3, 4, 5]) ! assert result == Set([2, 3, 4, 5, 6]), "Overlapping union" def test_union_non_overlap(self): result = self.set | Set([8]) ! assert result == Set([2, 4, 6, 8]), "Non-overlapping union" def test_intersection_subset(self): result = self.set & Set((2, 4)) ! assert result == Set((2, 4)), "Subset intersection" def test_intersection_superset(self): result = self.set & Set([2, 4, 6, 8]) ! assert result == Set([2, 4, 6]), "Superset intersection" def test_intersection_overlap(self): result = self.set & Set([3, 4, 5]) ! assert result == Set([4]), "Overlapping intersection" def test_intersection_non_overlap(self): result = self.set & Set([8]) ! assert result == empty_set, "Non-overlapping intersection" def test_sym_difference_subset(self): result = self.set ^ Set((2, 4)) ! assert result == Set([6]), "Subset symmetric difference" def test_sym_difference_superset(self): result = self.set ^ Set((2, 4, 6, 8)) ! assert result == Set([8]), "Superset symmetric difference" def test_sym_difference_overlap(self): result = self.set ^ Set((3, 4, 5)) ! assert result == Set([2, 3, 5, 6]), "Overlapping symmetric difference" def test_sym_difference_non_overlap(self): result = self.set ^ Set([8]) ! assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" #============================================================================== --- 152,200 ---- def test_union_subset(self): result = self.set | Set([2]) ! self.assertEqual(result, Set((2, 4, 6))) def test_union_superset(self): result = self.set | Set([2, 4, 6, 8]) ! self.assertEqual(result, Set([2, 4, 6, 8])) def test_union_overlap(self): result = self.set | Set([3, 4, 5]) ! self.assertEqual(result, Set([2, 3, 4, 5, 6])) def test_union_non_overlap(self): result = self.set | Set([8]) ! self.assertEqual(result, Set([2, 4, 6, 8])) def test_intersection_subset(self): result = self.set & Set((2, 4)) ! self.assertEqual(result, Set((2, 4))) def test_intersection_superset(self): result = self.set & Set([2, 4, 6, 8]) ! self.assertEqual(result, Set([2, 4, 6])) def test_intersection_overlap(self): result = self.set & Set([3, 4, 5]) ! self.assertEqual(result, Set([4])) def test_intersection_non_overlap(self): result = self.set & Set([8]) ! self.assertEqual(result, empty_set) def test_sym_difference_subset(self): result = self.set ^ Set((2, 4)) ! self.assertEqual(result, Set([6])) def test_sym_difference_superset(self): result = self.set ^ Set((2, 4, 6, 8)) ! self.assertEqual(result, Set([8])) def test_sym_difference_overlap(self): result = self.set ^ Set((3, 4, 5)) ! self.assertEqual(result, Set([2, 3, 5, 6])) def test_sym_difference_non_overlap(self): result = self.set ^ Set([8]) ! self.assertEqual(result, Set([2, 4, 6, 8])) #============================================================================== *************** *** 206,286 **** def test_union_subset(self): self.set |= Set([2]) ! assert self.set == Set((2, 4, 6)), "Subset union" def test_union_superset(self): self.set |= Set([2, 4, 6, 8]) ! assert self.set == Set([2, 4, 6, 8]), "Superset union" def test_union_overlap(self): self.set |= Set([3, 4, 5]) ! assert self.set == Set([2, 3, 4, 5, 6]), "Overlapping union" def test_union_non_overlap(self): self.set |= Set([8]) ! assert self.set == Set([2, 4, 6, 8]), "Non-overlapping union" def test_union_method_call(self): self.set.union_update(Set([3, 4, 5])) ! assert self.set == Set([2, 3, 4, 5, 6]), "Union method call" def test_intersection_subset(self): self.set &= Set((2, 4)) ! assert self.set == Set((2, 4)), "Subset intersection" def test_intersection_superset(self): self.set &= Set([2, 4, 6, 8]) ! assert self.set == Set([2, 4, 6]), "Superset intersection" def test_intersection_overlap(self): self.set &= Set([3, 4, 5]) ! assert self.set == Set([4]), "Overlapping intersection" def test_intersection_non_overlap(self): self.set &= Set([8]) ! assert self.set == empty_set, "Non-overlapping intersection" def test_intersection_method_call(self): self.set.intersection_update(Set([3, 4, 5])) ! assert self.set == Set([4]), "Intersection method call" def test_sym_difference_subset(self): self.set ^= Set((2, 4)) ! assert self.set == Set([6]), "Subset symmetric difference" def test_sym_difference_superset(self): self.set ^= Set((2, 4, 6, 8)) ! assert self.set == Set([8]), "Superset symmetric difference" def test_sym_difference_overlap(self): self.set ^= Set((3, 4, 5)) ! assert self.set == Set([2, 3, 5, 6]), "Overlapping symmetric difference" def test_sym_difference_non_overlap(self): self.set ^= Set([8]) ! assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" def test_sym_difference_method_call(self): self.set.symmetric_difference_update(Set([3, 4, 5])) ! assert self.set == Set([2, 3, 5, 6]), "Symmetric difference method call" def test_difference_subset(self): self.set -= Set((2, 4)) ! assert self.set == Set([6]), "Subset difference" def test_difference_superset(self): self.set -= Set((2, 4, 6, 8)) ! assert self.set == Set([]), "Superset difference" def test_difference_overlap(self): self.set -= Set((3, 4, 5)) ! assert self.set == Set([2, 6]), "Overlapping difference" def test_difference_non_overlap(self): self.set -= Set([8]) ! assert self.set == Set([2, 4, 6]), "Non-overlapping difference" def test_difference_method_call(self): self.set.difference_update(Set([3, 4, 5])) ! assert self.set == Set([2, 6]), "Difference method call" #============================================================================== --- 206,286 ---- def test_union_subset(self): self.set |= Set([2]) ! self.assertEqual(self.set, Set((2, 4, 6))) def test_union_superset(self): self.set |= Set([2, 4, 6, 8]) ! self.assertEqual(self.set, Set([2, 4, 6, 8])) def test_union_overlap(self): self.set |= Set([3, 4, 5]) ! self.assertEqual(self.set, Set([2, 3, 4, 5, 6])) def test_union_non_overlap(self): self.set |= Set([8]) ! self.assertEqual(self.set, Set([2, 4, 6, 8])) def test_union_method_call(self): self.set.union_update(Set([3, 4, 5])) ! self.assertEqual(self.set, Set([2, 3, 4, 5, 6])) def test_intersection_subset(self): self.set &= Set((2, 4)) ! self.assertEqual(self.set, Set((2, 4))) def test_intersection_superset(self): self.set &= Set([2, 4, 6, 8]) ! self.assertEqual(self.set, Set([2, 4, 6])) def test_intersection_overlap(self): self.set &= Set([3, 4, 5]) ! self.assertEqual(self.set, Set([4])) def test_intersection_non_overlap(self): self.set &= Set([8]) ! self.assertEqual(self.set, empty_set) def test_intersection_method_call(self): self.set.intersection_update(Set([3, 4, 5])) ! self.assertEqual(self.set, Set([4])) def test_sym_difference_subset(self): self.set ^= Set((2, 4)) ! self.assertEqual(self.set, Set([6])) def test_sym_difference_superset(self): self.set ^= Set((2, 4, 6, 8)) ! self.assertEqual(self.set, Set([8])) def test_sym_difference_overlap(self): self.set ^= Set((3, 4, 5)) ! self.assertEqual(self.set, Set([2, 3, 5, 6])) def test_sym_difference_non_overlap(self): self.set ^= Set([8]) ! self.assertEqual(self.set, Set([2, 4, 6, 8])) def test_sym_difference_method_call(self): self.set.symmetric_difference_update(Set([3, 4, 5])) ! self.assertEqual(self.set, Set([2, 3, 5, 6])) def test_difference_subset(self): self.set -= Set((2, 4)) ! self.assertEqual(self.set, Set([6])) def test_difference_superset(self): self.set -= Set((2, 4, 6, 8)) ! self.assertEqual(self.set, Set([])) def test_difference_overlap(self): self.set -= Set((3, 4, 5)) ! self.assertEqual(self.set, Set([2, 6])) def test_difference_non_overlap(self): self.set -= Set([8]) ! self.assertEqual(self.set, Set([2, 4, 6])) def test_difference_method_call(self): self.set.difference_update(Set([3, 4, 5])) ! self.assertEqual(self.set, Set([2, 6])) #============================================================================== *************** *** 293,301 **** def test_add_present(self): self.set.add("c") ! assert self.set == Set(("a", "b", "c")), "Adding present element" def test_add_absent(self): self.set.add("d") ! assert self.set == Set(("a", "b", "c", "d")), "Adding missing element" def test_add_until_full(self): --- 293,301 ---- def test_add_present(self): self.set.add("c") ! self.assertEqual(self.set, Set(("a", "b", "c"))) def test_add_absent(self): self.set.add("d") ! self.assertEqual(self.set, Set(("a", "b", "c", "d"))) def test_add_until_full(self): *************** *** 305,314 **** tmp.add(v) expected_len += 1 ! assert len(tmp) == expected_len, "Adding values one by one to temporary" ! assert tmp == self.set, "Adding values one by one" def test_remove_present(self): self.set.remove("b") ! assert self.set == Set(("a", "c")), "Removing present element" def test_remove_absent(self): --- 305,314 ---- tmp.add(v) expected_len += 1 ! self.assertEqual(len(tmp), expected_len) ! self.assertEqual(tmp, self.set) def test_remove_present(self): self.set.remove("b") ! self.assertEqual(self.set, Set(("a", "c"))) def test_remove_absent(self): *************** *** 328,340 **** def test_discard_present(self): self.set.discard("c") ! assert self.set == Set(("a", "b")), "Discarding present element" def test_discard_absent(self): self.set.discard("d") ! assert self.set == Set(("a", "b", "c")), "Discarding missing element" def test_clear(self): self.set.clear() ! assert len(self.set) == 0, "Clearing set" def test_pop(self): --- 328,340 ---- def test_discard_present(self): self.set.discard("c") ! self.assertEqual(self.set, Set(("a", "b"))) def test_discard_absent(self): self.set.discard("d") ! self.assertEqual(self.set, Set(("a", "b", "c"))) def test_clear(self): self.set.clear() ! self.assertEqual(len(self.set), 0) def test_pop(self): *************** *** 342,346 **** while self.set: popped[self.set.pop()] = None ! assert len(popped) == len(self.values), "Popping items" for v in self.values: assert v in popped, "Popping items" --- 342,346 ---- while self.set: popped[self.set.pop()] = None ! self.assertEqual(len(popped), len(self.values)) for v in self.values: assert v in popped, "Popping items" *************** *** 348,360 **** def test_update_empty_tuple(self): self.set.update(()) ! assert self.set == Set(self.values), "Updating with empty tuple" def test_update_unit_tuple_overlap(self): self.set.update(("a",)) ! assert self.set == Set(self.values), "Updating with overlapping unit tuple" def test_update_unit_tuple_non_overlap(self): self.set.update(("a", "z")) ! assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" #============================================================================== --- 348,360 ---- def test_update_empty_tuple(self): self.set.update(()) ! self.assertEqual(self.set, Set(self.values)) def test_update_unit_tuple_overlap(self): self.set.update(("a",)) ! self.assertEqual(self.set, Set(self.values)) def test_update_unit_tuple_non_overlap(self): self.set.update(("a", "z")) ! self.assertEqual(self.set, Set(self.values + ["z"])) #============================================================================== From tim_one@users.sourceforge.net Sun Aug 25 18:40:31 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 10:40:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12744/python/lib/test Modified Files: test_sets.py Log Message: Simplified code building sets of characters. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_sets.py 25 Aug 2002 17:38:49 -0000 1.8 --- test_sets.py 25 Aug 2002 17:40:29 -0000 1.9 *************** *** 293,301 **** def test_add_present(self): self.set.add("c") ! self.assertEqual(self.set, Set(("a", "b", "c"))) def test_add_absent(self): self.set.add("d") ! self.assertEqual(self.set, Set(("a", "b", "c", "d"))) def test_add_until_full(self): --- 293,301 ---- def test_add_present(self): self.set.add("c") ! self.assertEqual(self.set, Set("abc")) def test_add_absent(self): self.set.add("d") ! self.assertEqual(self.set, Set("abcd")) def test_add_until_full(self): *************** *** 310,314 **** def test_remove_present(self): self.set.remove("b") ! self.assertEqual(self.set, Set(("a", "c"))) def test_remove_absent(self): --- 310,314 ---- def test_remove_present(self): self.set.remove("b") ! self.assertEqual(self.set, Set("ac")) def test_remove_absent(self): *************** *** 328,336 **** def test_discard_present(self): self.set.discard("c") ! self.assertEqual(self.set, Set(("a", "b"))) def test_discard_absent(self): self.set.discard("d") ! self.assertEqual(self.set, Set(("a", "b", "c"))) def test_clear(self): --- 328,336 ---- def test_discard_present(self): self.set.discard("c") ! self.assertEqual(self.set, Set("ab")) def test_discard_absent(self): self.set.discard("d") ! self.assertEqual(self.set, Set("abc")) def test_clear(self): From tim_one@users.sourceforge.net Sun Aug 25 18:49:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 10:49:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14613/python/lib/test Modified Files: test_sets.py Log Message: Simplified construction of the test suite. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_sets.py 25 Aug 2002 17:40:29 -0000 1.9 --- test_sets.py 25 Aug 2002 17:49:04 -0000 1.10 *************** *** 577,601 **** def makeAllTests(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestSetOfSets)) ! suite.addTest(unittest.makeSuite(TestBasicOpsEmpty)) ! suite.addTest(unittest.makeSuite(TestBasicOpsSingleton)) ! suite.addTest(unittest.makeSuite(TestBasicOpsTuple)) ! suite.addTest(unittest.makeSuite(TestBasicOpsTriple)) ! suite.addTest(unittest.makeSuite(TestBinaryOps)) ! suite.addTest(unittest.makeSuite(TestUpdateOps)) ! suite.addTest(unittest.makeSuite(TestMutate)) ! suite.addTest(unittest.makeSuite(TestSubsetEqualEmpty)) ! suite.addTest(unittest.makeSuite(TestSubsetEqualNonEmpty)) ! suite.addTest(unittest.makeSuite(TestSubsetEmptyNonEmpty)) ! suite.addTest(unittest.makeSuite(TestSubsetPartial)) ! suite.addTest(unittest.makeSuite(TestSubsetNonOverlap)) ! suite.addTest(unittest.makeSuite(TestOnlySetsNumeric)) ! suite.addTest(unittest.makeSuite(TestOnlySetsDict)) ! suite.addTest(unittest.makeSuite(TestOnlySetsOperator)) ! suite.addTest(unittest.makeSuite(TestCopyingEmpty)) ! suite.addTest(unittest.makeSuite(TestCopyingSingleton)) ! suite.addTest(unittest.makeSuite(TestCopyingTriple)) ! suite.addTest(unittest.makeSuite(TestCopyingTuple)) ! suite.addTest(unittest.makeSuite(TestCopyingNested)) return suite --- 577,603 ---- def makeAllTests(): suite = unittest.TestSuite() ! for klass in (TestSetOfSets, ! TestBasicOpsEmpty, ! TestBasicOpsSingleton, ! TestBasicOpsTuple, ! TestBasicOpsTriple, ! TestBinaryOps, ! TestUpdateOps, ! TestMutate, ! TestSubsetEqualEmpty, ! TestSubsetEqualNonEmpty, ! TestSubsetEmptyNonEmpty, ! TestSubsetPartial, ! TestSubsetNonOverlap, ! TestOnlySetsNumeric, ! TestOnlySetsDict, ! TestOnlySetsOperator, ! TestCopyingEmpty, ! TestCopyingSingleton, ! TestCopyingTriple, ! TestCopyingTuple, ! TestCopyingNested, ! ): ! suite.addTest(unittest.makeSuite(klass)) return suite From tim_one@users.sourceforge.net Sun Aug 25 19:02:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 11:02:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17582/python/lib/test Modified Files: test_sets.py Log Message: Rewrote all remaining assert stmts. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_sets.py 25 Aug 2002 17:49:04 -0000 1.10 --- test_sets.py 25 Aug 2002 18:02:29 -0000 1.11 *************** *** 73,77 **** def test_iteration(self): for v in self.set: ! assert v in self.values, "Missing item in iteration for " + self.case #------------------------------------------------------------------------------ --- 73,77 ---- def test_iteration(self): for v in self.set: ! self.assert_(v in self.values) #------------------------------------------------------------------------------ *************** *** 98,105 **** def test_in(self): ! assert 3 in self.set, "Valueship for unit set" def test_not_in(self): ! assert 2 not in self.set, "Non-valueship for unit set" #------------------------------------------------------------------------------ --- 98,105 ---- def test_in(self): ! self.failUnless(3 in self.set) def test_not_in(self): ! self.failUnless(2 not in self.set) #------------------------------------------------------------------------------ *************** *** 115,122 **** def test_in(self): ! assert (0, "zero") in self.set, "Valueship for tuple set" def test_not_in(self): ! assert 9 not in self.set, "Non-valueship for tuple set" #------------------------------------------------------------------------------ --- 115,122 ---- def test_in(self): ! self.failUnless((0, "zero") in self.set) def test_not_in(self): ! self.failUnless(9 not in self.set) #------------------------------------------------------------------------------ *************** *** 138,145 **** outer = Set([inner]) element = outer.pop() ! assert type(element) == ImmutableSet, "Construct set of sets" outer.add(inner) # Rebuild set of sets with .add method outer.remove(inner) ! assert outer == Set() # Verify that remove worked outer.discard(inner) # Absence of KeyError indicates working fine --- 138,145 ---- outer = Set([inner]) element = outer.pop() ! self.assertEqual(type(element), ImmutableSet) outer.add(inner) # Rebuild set of sets with .add method outer.remove(inner) ! self.assertEqual(outer, Set()) # Verify that remove worked outer.discard(inner) # Absence of KeyError indicates working fine *************** *** 315,319 **** try: self.set.remove("d") ! assert 0, "Removing missing element" except LookupError: pass --- 315,319 ---- try: self.set.remove("d") ! self.fail("Removing missing element should have raised LookupError") except LookupError: pass *************** *** 324,328 **** self.set.remove(v) expected_len -= 1 ! assert len(self.set) == expected_len, "Removing values one by one" def test_discard_present(self): --- 324,328 ---- self.set.remove(v) expected_len -= 1 ! self.assertEqual(len(self.set), expected_len) def test_discard_present(self): *************** *** 344,348 **** self.assertEqual(len(popped), len(self.values)) for v in self.values: ! assert v in popped, "Popping items" def test_update_empty_tuple(self): --- 344,348 ---- self.assertEqual(len(popped), len(self.values)) for v in self.values: ! self.failUnless(v in popped) def test_update_empty_tuple(self): *************** *** 365,371 **** result = self.left.issubset(self.right) if "<" in self.cases: ! assert result, "subset: " + self.name else: ! assert not result, "non-subset: " + self.name #------------------------------------------------------------------------------ --- 365,371 ---- result = self.left.issubset(self.right) if "<" in self.cases: ! self.failUnless(result) else: ! self.failUnless(not result) #------------------------------------------------------------------------------ *************** *** 416,425 **** try: self.other == self.set ! assert 0, "Comparison with non-set on left" except TypeError: pass try: self.set != self.other ! assert 0, "Comparison with non-set on right" except TypeError: pass --- 416,425 ---- try: self.other == self.set ! self.fail("expected TypeError") except TypeError: pass try: self.set != self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 428,432 **** try: self.set |= self.other ! assert 0, "Union update with non-set" except TypeError: pass --- 428,432 ---- try: self.set |= self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 435,444 **** try: self.other | self.set ! assert 0, "Union with non-set on left" except TypeError: pass try: self.set | self.other ! assert 0, "Union with non-set on right" except TypeError: pass --- 435,444 ---- try: self.other | self.set ! self.fail("expected TypeError") except TypeError: pass try: self.set | self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 447,451 **** try: self.set &= self.other ! assert 0, "Intersection update with non-set" except TypeError: pass --- 447,451 ---- try: self.set &= self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 454,463 **** try: self.other & self.set ! assert 0, "Intersection with non-set on left" except TypeError: pass try: self.set & self.other ! assert 0, "Intersection with non-set on right" except TypeError: pass --- 454,463 ---- try: self.other & self.set ! self.fail("expected TypeError") except TypeError: pass try: self.set & self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 466,470 **** try: self.set ^= self.other ! assert 0, "Symmetric difference update with non-set" except TypeError: pass --- 466,470 ---- try: self.set ^= self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 473,482 **** try: self.other ^ self.set ! assert 0, "Symmetric difference with non-set on left" except TypeError: pass try: self.set ^ self.other ! assert 0, "Symmetric difference with non-set on right" except TypeError: pass --- 473,482 ---- try: self.other ^ self.set ! self.fail("expected TypeError") except TypeError: pass try: self.set ^ self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 485,489 **** try: self.set -= self.other ! assert 0, "Symmetric difference update with non-set" except TypeError: pass --- 485,489 ---- try: self.set -= self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 492,501 **** try: self.other - self.set ! assert 0, "Symmetric difference with non-set on left" except TypeError: pass try: self.set - self.other ! assert 0, "Symmetric difference with non-set on right" except TypeError: pass --- 492,501 ---- try: self.other - self.set ! self.fail("expected TypeError") except TypeError: pass try: self.set - self.other ! self.fail("expected TypeError") except TypeError: pass *************** *** 530,536 **** dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() ! assert len(dup_list) == len(set_list), "Unequal lengths after copy" for i in range(len(dup_list)): ! assert dup_list[i] is set_list[i], "Non-identical items after copy" def test_deep_copy(self): --- 530,536 ---- dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() ! self.assertEqual(len(dup_list), len(set_list)) for i in range(len(dup_list)): ! self.failUnless(dup_list[i] is set_list[i]) def test_deep_copy(self): *************** *** 539,545 **** dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() ! assert len(dup_list) == len(set_list), "Unequal lengths after deep copy" for i in range(len(dup_list)): ! assert dup_list[i] == set_list[i], "Unequal items after deep copy" #------------------------------------------------------------------------------ --- 539,545 ---- dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() ! self.assertEqual(len(dup_list), len(set_list)) for i in range(len(dup_list)): ! self.assertEqual(dup_list[i], set_list[i]) #------------------------------------------------------------------------------ From tim_one@users.sourceforge.net Sun Aug 25 19:21:49 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 11:21:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21692/python/lib/test Modified Files: test_sets.py Log Message: TestSubset(): Generalized the framework to support testing upcoming <, <=, etc methods too. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_sets.py 25 Aug 2002 18:02:29 -0000 1.11 --- test_sets.py 25 Aug 2002 18:21:47 -0000 1.12 *************** *** 362,371 **** class TestSubsets(unittest.TestCase): def test_issubset(self): ! result = self.left.issubset(self.right) ! if "<" in self.cases: ! self.failUnless(result) ! else: ! self.failUnless(not result) #------------------------------------------------------------------------------ --- 362,384 ---- class TestSubsets(unittest.TestCase): + case2method = {"<=": "issubset", + ">=": "issuperset", + } + cases_with_ops = Set(["==", "!="]) + def test_issubset(self): ! x = self.left ! y = self.right ! for case in "!=", "==", "<", "<=", ">", ">=": ! expected = case in self.cases ! if case in TestSubsets.case2method: ! # Test the method-name spelling. ! method = getattr(x, TestSubsets.case2method[case]) ! result = method(y) ! self.assertEqual(result, expected) ! if case in TestSubsets.cases_with_ops: ! # Test the binary infix spelling. ! result = eval("x" + case + "y", locals()) ! self.assertEqual(result, expected) #------------------------------------------------------------------------------ *************** *** 375,379 **** right = Set() name = "both empty" ! cases = "<>" #------------------------------------------------------------------------------ --- 388,392 ---- right = Set() name = "both empty" ! cases = "==", "<=", ">=" #------------------------------------------------------------------------------ *************** *** 383,387 **** right = Set([1, 2]) name = "equal pair" ! cases = "<>" #------------------------------------------------------------------------------ --- 396,400 ---- right = Set([1, 2]) name = "equal pair" ! cases = "==", "<=", ">=" #------------------------------------------------------------------------------ *************** *** 391,395 **** right = Set([1, 2]) name = "one empty, one non-empty" ! cases = "<" #------------------------------------------------------------------------------ --- 404,408 ---- right = Set([1, 2]) name = "one empty, one non-empty" ! cases = "!=", "<", "<=" #------------------------------------------------------------------------------ *************** *** 399,403 **** right = Set([1, 2]) name = "one a non-empty subset of other" ! cases = "<" #------------------------------------------------------------------------------ --- 412,416 ---- right = Set([1, 2]) name = "one a non-empty subset of other" ! cases = "!=", "<", "<=" #------------------------------------------------------------------------------ *************** *** 407,411 **** right = Set([2]) name = "neither empty, neither contains" ! cases = "" #============================================================================== --- 420,424 ---- right = Set([2]) name = "neither empty, neither contains" ! cases = "!=" #============================================================================== From tim_one@users.sourceforge.net Sun Aug 25 19:43:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 11:43:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv26090/doc/lib Modified Files: libsets.tex Log Message: Implemented <, <=, >, >= for sets, giving subset and proper-subset meanings. I did not add new, e.g., ispropersubset() methods; we're going nuts on those, and, e.g., there was no "friendly name" for == either. Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libsets.tex 24 Aug 2002 07:33:06 -0000 1.6 --- libsets.tex 25 Aug 2002 18:43:10 -0000 1.7 *************** *** 75,81 **** {test \var{x} for non-membership in \var{s}} \lineii{\var{s}.issubset(\var{t})} ! {test whether every element in \var{s} is in \var{t}} \lineii{\var{s}.issuperset(\var{t})} ! {test whether every element in \var{t} is in \var{s}} \hline --- 75,83 ---- {test \var{x} for non-membership in \var{s}} \lineii{\var{s}.issubset(\var{t})} ! {test whether every element in \var{s} is in \var{t}; ! \code{\var{s} <= \var{t}} is equivalent} \lineii{\var{s}.issuperset(\var{t})} ! {test whether every element in \var{t} is in \var{s}; ! \code{\var{s} >= \var{t}} is equivalent} \hline *************** *** 100,106 **** \end{tableii} ! In addition to the above operations, both \class{Set} and \class{ImmutableSet} ! support set to set equality comparisons. Two sets are equal if and only if ! every element of each set is contained in the other. The following table lists operations available in \class{ImmutableSet} --- 102,113 ---- \end{tableii} ! In addition, both \class{Set} and \class{ImmutableSet} ! support set to set comparisons. Two sets are equal if and only if ! every element of each set is contained in the other (each is a subset ! of the other). ! A set is less than another set if and only if the first set is a proper ! subset of the second set (is a subset, but is not equal). ! A set is greater than another set if and only if the first set is a proper ! superset of the second set (is a superset, but is not equal). The following table lists operations available in \class{ImmutableSet} From tim_one@users.sourceforge.net Sun Aug 25 19:43:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 11:43:12 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26090/lib Modified Files: sets.py Log Message: Implemented <, <=, >, >= for sets, giving subset and proper-subset meanings. I did not add new, e.g., ispropersubset() methods; we're going nuts on those, and, e.g., there was no "friendly name" for == either. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** sets.py 25 Aug 2002 17:10:17 -0000 1.21 --- sets.py 25 Aug 2002 18:43:10 -0000 1.22 *************** *** 276,279 **** --- 276,291 ---- return True + # Inequality comparisons using the is-subset relation. + __le__ = issubset + __ge__ = issuperset + + def __lt__(self, other): + self._binary_sanity_check(other) + return len(self) < len(other) and self.issubset(other) + + def __gt__(self, other): + self._binary_sanity_check(other) + return len(self) > len(other) and self.issuperset(other) + # Assorted helpers From tim_one@users.sourceforge.net Sun Aug 25 19:43:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 11:43:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26090/lib/test Modified Files: test_sets.py Log Message: Implemented <, <=, >, >= for sets, giving subset and proper-subset meanings. I did not add new, e.g., ispropersubset() methods; we're going nuts on those, and, e.g., there was no "friendly name" for == either. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_sets.py 25 Aug 2002 18:21:47 -0000 1.12 --- test_sets.py 25 Aug 2002 18:43:10 -0000 1.13 *************** *** 365,369 **** ">=": "issuperset", } ! cases_with_ops = Set(["==", "!="]) def test_issubset(self): --- 365,376 ---- ">=": "issuperset", } ! ! reverse = {"==": "==", ! "!=": "!=", ! "<": ">", ! ">": "<", ! "<=": ">=", ! ">=": "<=", ! } def test_issubset(self): *************** *** 372,385 **** for case in "!=", "==", "<", "<=", ">", ">=": expected = case in self.cases if case in TestSubsets.case2method: - # Test the method-name spelling. method = getattr(x, TestSubsets.case2method[case]) result = method(y) self.assertEqual(result, expected) - if case in TestSubsets.cases_with_ops: - # Test the binary infix spelling. - result = eval("x" + case + "y", locals()) - self.assertEqual(result, expected) #------------------------------------------------------------------------------ --- 379,399 ---- for case in "!=", "==", "<", "<=", ">", ">=": expected = case in self.cases + # Test the binary infix spelling. + result = eval("x" + case + "y", locals()) + self.assertEqual(result, expected) + # Test the "friendly" method-name spelling, if one exists. if case in TestSubsets.case2method: method = getattr(x, TestSubsets.case2method[case]) result = method(y) self.assertEqual(result, expected) + # Now do the same for the operands reversed. + rcase = TestSubsets.reverse[case] + result = eval("y" + rcase + "x", locals()) + self.assertEqual(result, expected) + if rcase in TestSubsets.case2method: + method = getattr(y, TestSubsets.case2method[rcase]) + result = method(x) + self.assertEqual(result, expected) #------------------------------------------------------------------------------ *************** *** 411,415 **** left = Set([1]) right = Set([1, 2]) ! name = "one a non-empty subset of other" cases = "!=", "<", "<=" --- 425,429 ---- left = Set([1]) right = Set([1, 2]) ! name = "one a non-empty proper subset of other" cases = "!=", "<", "<=" From tim_one@users.sourceforge.net Sun Aug 25 19:59:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 11:59:06 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29910/Lib Modified Files: sets.py Log Message: Added a clue about why xyz_update isn't the same as __xyz__. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** sets.py 25 Aug 2002 18:43:10 -0000 1.22 --- sets.py 25 Aug 2002 18:59:04 -0000 1.23 *************** *** 362,366 **** raise TypeError, "Can't hash a Set, only an ImmutableSet." ! # In-place union, intersection, differences def __ior__(self, other): --- 362,369 ---- raise TypeError, "Can't hash a Set, only an ImmutableSet." ! # In-place union, intersection, differences. ! # Subtle: The xyz_update() functions deliberately return None, ! # as do all mutating operations on built-in container types. ! # The __xyz__ spellings have to return self, though. def __ior__(self, other): From tim_one@users.sourceforge.net Sun Aug 25 20:12:47 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 12:12:47 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1102/python/lib Modified Files: sets.py Log Message: Sped intersection by large factors (3-5x faster than before on sets of cardinality 500; and the smaller the intersection, the bigger the speedup). Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** sets.py 25 Aug 2002 18:59:04 -0000 1.23 --- sets.py 25 Aug 2002 19:12:45 -0000 1.24 *************** *** 177,187 **** else: little, big = other, self ! result = self.__class__() ! data = result._data ! value = True ! for elt in little: ! if elt in big: ! data[elt] = value ! return result def intersection(self, other): --- 177,182 ---- else: little, big = other, self ! common = filter(big._data.has_key, little._data.iterkeys()) ! return self.__class__(common) def intersection(self, other): From tim_one@users.sourceforge.net Sun Aug 25 20:21:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 12:21:29 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3676/python/lib Modified Files: sets.py Log Message: Sped union by a factor of 3-4. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** sets.py 25 Aug 2002 19:12:45 -0000 1.24 --- sets.py 25 Aug 2002 19:21:27 -0000 1.25 *************** *** 155,159 **** if not isinstance(other, BaseSet): return NotImplemented ! result = self.__class__(self._data) result._data.update(other._data) return result --- 155,160 ---- if not isinstance(other, BaseSet): return NotImplemented ! result = self.__class__() ! result._data = self._data.copy() result._data.update(other._data) return result From tim_one@users.sourceforge.net Sun Aug 25 20:47:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 12:47:56 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9779/python/lib Modified Files: sets.py Log Message: Gave __xor__/symmetric_difference a factor of 2-5 speed boost. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** sets.py 25 Aug 2002 19:21:27 -0000 1.25 --- sets.py 25 Aug 2002 19:47:54 -0000 1.26 *************** *** 198,206 **** data = result._data value = True ! for elt in self: ! if elt not in other: data[elt] = value ! for elt in other: ! if elt not in self: data[elt] = value return result --- 198,208 ---- data = result._data value = True ! selfdata = self._data ! otherdata = other._data ! for elt in selfdata: ! if elt not in otherdata: data[elt] = value ! for elt in otherdata: ! if elt not in selfdata: data[elt] = value return result From tim_one@users.sourceforge.net Sun Aug 25 20:50:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 12:50:45 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10456/python/lib Modified Files: sets.py Log Message: Gave __sub__/difference a factor of 2-5 speed boost. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** sets.py 25 Aug 2002 19:47:54 -0000 1.26 --- sets.py 25 Aug 2002 19:50:43 -0000 1.27 *************** *** 224,230 **** result = self.__class__() data = result._data value = True for elt in self: ! if elt not in other: data[elt] = value return result --- 224,231 ---- result = self.__class__() data = result._data + otherdata = other._data value = True for elt in self: ! if elt not in otherdata: data[elt] = value return result From tim_one@users.sourceforge.net Sun Aug 25 21:12:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 13:12:21 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15409/python/lib Modified Files: sets.py Log Message: Gave issubet() and issuperset() major speed boosts. That's it for now! Someone else may want to tackle the mutating operations similarly. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** sets.py 25 Aug 2002 19:50:43 -0000 1.27 --- sets.py 25 Aug 2002 20:12:19 -0000 1.28 *************** *** 260,265 **** if len(self) > len(other): # Fast check for obvious cases return False for elt in self: ! if elt not in other: return False return True --- 260,266 ---- if len(self) > len(other): # Fast check for obvious cases return False + otherdata = other._data for elt in self: ! if elt not in otherdata: return False return True *************** *** 270,275 **** if len(self) < len(other): # Fast check for obvious cases return False for elt in other: ! if elt not in self: return False return True --- 271,277 ---- if len(self) < len(other): # Fast check for obvious cases return False + selfdata = self._data for elt in other: ! if elt not in selfdata: return False return True From tim_one@users.sourceforge.net Mon Aug 26 01:44:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 Aug 2002 17:44:10 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32108/python/lib Modified Files: sets.py Log Message: Gave intersection_update a speed boost. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** sets.py 25 Aug 2002 20:12:19 -0000 1.28 --- sets.py 26 Aug 2002 00:44:07 -0000 1.29 *************** *** 381,387 **** """Update a set with the intersection of itself and another.""" self._binary_sanity_check(other) ! for elt in self._data.keys(): ! if elt not in other: ! del self._data[elt] return self --- 381,385 ---- """Update a set with the intersection of itself and another.""" self._binary_sanity_check(other) ! self._data = (self & other)._data return self From bwarsaw@users.sourceforge.net Mon Aug 26 16:36:58 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 08:36:58 -0700 Subject: [Python-checkins] python/nondist/peps README.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30206 Added Files: README.txt Log Message: A README describing why you need Docutils and how to get and install it. --- NEW FILE: README.txt --- reStructuredText for PEPs ========================= Original PEP source may be written using two standard formats, a mildly idiomatic plain text format and a the reStructuredText format (also, technically plain text). These two formats are described in PEP 9 and PEP 12 respectively. The pep2html.py processing and installation scripts knows how to produce the html for either PEP format, however in order to process reStructuredText PEPs, you must install the Docutils package. If this package is not installed, pep2html.py will simply skip any reStructuredText PEPs. Installing Docutils for reStructuredText PEPs ============================================= :Author: David Goodger :Contact: goodger@users.sourceforge.net 1. Get the latest Docutils software (CVS snapshot): http://docutils.sourceforge.net/docutils-snapshot.tgz 2. Unpack and install the tarball:: tar -xzf docutils-snapshot.tgz cd docutils python setup.py install 3. Run the pep2html.py script from the updated nondist/peps directory as usual:: cd /nondist/peps cvs update pep2html.py ... Please report any problems or questions to docutils-develop@lists.sourceforge.net or to the author. From bwarsaw@users.sourceforge.net Mon Aug 26 16:43:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 08:43:49 -0700 Subject: [Python-checkins] python/nondist/peps docutils.conf,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv704 Added Files: docutils.conf Log Message: Docutils configuration file for reStructuredText PEPs. By David Goodger. --- NEW FILE: docutils.conf --- # Configuration file for Docutils: http://docutils.sf.net/ [options] # These entries are for the page footer: source-link: 1 datestamp: %Y-%m-%d %H:%M UTC generator: 1 # reStructuredText-style PEP setup: pep-template: pep-html-template pep-stylesheet: pep.css From bwarsaw@users.sourceforge.net Mon Aug 26 17:19:28 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:19:28 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.37,1.38 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14219 Modified Files: pep-0001.txt Log Message: David Goodger writes: * Changed the "PEP Template" section to "PEP Formats and Templates", in which plaintext and reStructuredText PEPs are described. * Added "PEP Header Preamble" heading, for the RFC 2822 header description. - Rearranged some descriptions to match the header order. - Removed the colons from header field names (e.g., "the Author header"). - Added a description of the Content-Type header. * Moved the plaintext-PEP-specific "PEP Formatting Requirements" section to PEP 9. PEP 1 now deals only with content, not format. * Minor edits, including: - Capitalized "Standards Track" and "Informational" throughout. - In "it's not like such decisions can be reversed", "can" should be "can't"; fixed. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** pep-0001.txt 30 Jul 2002 16:23:15 -0000 1.37 --- pep-0001.txt 26 Aug 2002 16:19:25 -0000 1.38 *************** *** 6,9 **** --- 6,10 ---- Status: Active Type: Informational + Content-Type: text/plain Created: 13-Jun-2000 Post-History: 21-Mar-2001, 29-Jul-2002 *************** *** 24,41 **** community and documenting dissenting opinions. ! Because the PEPs are maintained as plain text files under CVS ! control, their revision history is the historical record of the ! feature proposal[1]. ! Kinds of PEPs ! There are two kinds of PEPs. A standards track PEP describes a ! new feature or implementation for Python. An informational PEP describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new feature. Informational PEPs do not necessarily represent a Python community consensus or recommendation, so users and implementors ! are free to ignore informational PEPs or follow their advice. --- 25,42 ---- community and documenting dissenting opinions. ! Because the PEPs are maintained as text files under CVS control, ! their revision history is the historical record of the feature ! proposal[1]. ! Kinds of PEPs ! There are two kinds of PEPs. A Standards Track PEP describes a ! new feature or implementation for Python. An Informational PEP describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new feature. Informational PEPs do not necessarily represent a Python community consensus or recommendation, so users and implementors ! are free to ignore Informational PEPs or follow their advice. *************** *** 66,70 **** If the PEP editor approves, he will assign the PEP a number, label ! it as standards track or informational, give it status 'draft', and create and check-in the initial draft of the PEP. The PEP editor will not unreasonably deny a PEP. Reasons for denying PEP --- 67,71 ---- If the PEP editor approves, he will assign the PEP a number, label ! it as Standards Track or Informational, give it status "Draft", and create and check-in the initial draft of the PEP. The PEP editor will not unreasonably deny a PEP. Reasons for denying PEP *************** *** 88,92 **** the PEP editor for committing. ! Standards track PEPs consists of two parts, a design document and a reference implementation. The PEP should be reviewed and accepted before a reference implementation is begun, unless a --- 89,93 ---- the PEP editor for committing. ! Standards Track PEPs consists of two parts, a design document and a reference implementation. The PEP should be reviewed and accepted before a reference implementation is begun, unless a *************** *** 113,124 **** Once a PEP has been accepted, the reference implementation must be completed. When the reference implementation is complete and ! accepted by the BDFL, the status will be changed to `Final.' ! A PEP can also be assigned status `Deferred.' The PEP author or editor can assign the PEP this status when no progress is being made on the PEP. Once a PEP is deferred, the PEP editor can re-assign it to draft status. ! A PEP can also be `Rejected'. Perhaps after all is said and done it was not a good idea. It is still important to have a record of this fact. --- 114,125 ---- Once a PEP has been accepted, the reference implementation must be completed. When the reference implementation is complete and ! accepted by the BDFL, the status will be changed to "Final". ! A PEP can also be assigned status "Deferred". The PEP author or editor can assign the PEP this status when no progress is being made on the PEP. Once a PEP is deferred, the PEP editor can re-assign it to draft status. ! A PEP can also be "Rejected". Perhaps after all is said and done it was not a good idea. It is still important to have a record of this fact. *************** *** 136,140 **** Deferred ! Some informational PEPs may also have a status of `Active' if they are never meant to be completed. E.g. PEP 1. --- 137,141 ---- Deferred ! Some Informational PEPs may also have a status of "Active" if they are never meant to be completed. E.g. PEP 1. *************** *** 186,190 **** 8. Reference Implementation -- The reference implementation must ! be completed before any PEP is given status 'Final,' but it need not be completed before the PEP is accepted. It is better to finish the specification and rationale first and reach --- 187,191 ---- 8. Reference Implementation -- The reference implementation must ! be completed before any PEP is given status "Final", but it need not be completed before the PEP is accepted. It is better to finish the specification and rationale first and reach *************** *** 196,210 **** ! PEP Template ! PEPs are written in plain ASCII text, and should adhere to a ! rigid style. There is a Python script that parses this style and ! converts the plain text PEP to HTML for viewing on the web[5]. ! PEP 9 contains a boilerplate[7] template you can use to get ! started writing your PEP. Each PEP must begin with an RFC822 style header preamble. The headers must appear in the following order. Headers marked with ! `*' are optional and are described below. All other headers are required. --- 197,227 ---- ! PEP Formats and Templates ! There are two PEP formats available to authors: plaintext and ! reStructuredText. ! ! Plaintext PEPs are written in plain ASCII text, contain minimal ! structural markup, and should adhere to a rigid style. PEP 9 ! contains a boilerplate template[7] you can use to get started ! writing your plaintext PEP. ! ! ReStructuredText PEPs allow for rich markup that is still quite ! easy to read, but results in much better-looking and more ! functional HTML. PEP 12 contains a boilerplate template[8] for ! use with reStructuredText PEPs. ! ! There is a Python script that converts both styles of PEPs to HTML ! for viewing on the web[5]. Parsing and conversion of plaintext ! PEPs is self-contained within the script. reStructuredText PEPs ! are parsed and converted by Docutils[9] code called from the ! script. ! ! ! PEP Header Preamble Each PEP must begin with an RFC822 style header preamble. The headers must appear in the following order. Headers marked with ! "*" are optional and are described below. All other headers are required. *************** *** 217,220 **** --- 234,238 ---- Status: Type: + * Content-Type: * Requires: Created: *************** *** 224,230 **** * Replaced-By: ! The Author: header lists the names, and optionally the email addresses of all the authors/owners of the PEP. The format of the ! author entry must be Random J. User --- 242,248 ---- * Replaced-By: ! The Author header lists the names, and optionally the email addresses of all the authors/owners of the PEP. The format of the ! Author header value must be Random J. User *************** *** 237,241 **** "address@dom.ain (Random J. User)" may appear in a PEP, however new PEPs must use the mandated format above, and it is acceptable ! to change this format when PEPs are updated. If there are multiple authors, each should be on a separate line --- 255,259 ---- "address@dom.ain (Random J. User)" may appear in a PEP, however new PEPs must use the mandated format above, and it is acceptable ! to change to this format when PEPs are updated. If there are multiple authors, each should be on a separate line *************** *** 244,332 **** against spam harvesters. - Standards track PEPs must have a Python-Version: header which - indicates the version of Python that the feature will be released - with. Informational PEPs do not need a Python-Version: header. - While a PEP is in private discussions (usually during the initial ! Draft phase), a Discussions-To: header will indicate the mailing ! list or URL where the PEP is being discussed. No Discussions-To: header is necessary if the PEP is being discussed privately with the author, or on the python-list or python-dev email mailing ! lists. Note that email addresses in the Discussions-To: header will not be obscured. ! Created: records the date that the PEP was assigned a number, ! while Post-History: is used to record the dates of when new versions of the PEP are posted to python-list and/or python-dev. Both headers should be in dd-mmm-yyyy format, e.g. 14-Aug-2001. ! PEPs may have a Requires: header, indicating the PEP numbers that ! this PEP depends on. ! PEPs may also have a Replaced-By: header indicating that a PEP has been rendered obsolete by a later document; the value is the number of the PEP that replaces the current document. The newer ! PEP must have a Replaces: header containing the number of the PEP that it rendered obsolete. - PEP Formatting Requirements - - PEP headings must begin in column zero and the initial letter of - each word must be capitalized as in book titles. Acronyms should - be in all capitals. The body of each section must be indented 4 - spaces. Code samples inside body sections should be indented a - further 4 spaces, and other indentation can be used as required to - make the text readable. You must use two blank lines between the - last line of a section's body and the next section heading. - - You must adhere to the Emacs convention of adding two spaces at - the end of every sentence. You should fill your paragraphs to - column 70, but under no circumstances should your lines extend - past column 79. If your code samples spill over column 79, you - should rewrite them. - - Tab characters must never appear in the document at all. A PEP - should include the standard Emacs stanza included by example at - the bottom of this PEP. - - A PEP must contain a Copyright section, and it is strongly - recommended to put the PEP in the public domain. - - When referencing an external web page in the body of a PEP, you - should include the title of the page in the text, with a - footnote reference to the URL. Do not include the URL in the body - text of the PEP. E.g. - - Refer to the Python Language web site [1] for more details. - ... - [1] http://www.python.org - - When referring to another PEP, include the PEP number in the body - text, such as "PEP 1". The title may optionally appear. Add a - footnote reference that includes the PEP's title and author. It - may optionally include the explicit URL on a separate line, but - only in the References section. Note that the pep2html.py script - will calculate URLs automatically, e.g.: - - ... - Refer to PEP 1 [7] for more information about PEP style - ... - - References - - [7] PEP 1, PEP Purpose and Guidelines, Warsaw, Hylton - http://www.python.org/peps/pep-0001.html - - If you decide to provide an explicit URL for a PEP, please use - this as the URL template: - - http://www.python.org/peps/pep-xxxx.html - - PEP numbers in URLs must be padded with zeros from the left, so as - to be exactly 4 characters wide, however PEP numbers in text are - never padded. - - Reporting PEP Bugs, or Submitting PEP Updates --- 262,301 ---- against spam harvesters. While a PEP is in private discussions (usually during the initial ! Draft phase), a Discussions-To header will indicate the mailing ! list or URL where the PEP is being discussed. No Discussions-To header is necessary if the PEP is being discussed privately with the author, or on the python-list or python-dev email mailing ! lists. Note that email addresses in the Discussions-To header will not be obscured. ! The Type header specifies the type of PEP: Informational or ! Standards Track. ! ! The format of a PEP is specified with a Content-Type header. The ! acceptable values are "text/plain" for plaintext PEPs (see PEP 9 ! [7]) and "text/x-rst" for reStructuredText PEPs (see PEP 12 [8]). ! Plaintext ("text/plain") is the default if no Content-Type header ! is present. ! ! The Created header records the date that the PEP was assigned a ! number, while Post-History is used to record the dates of when new versions of the PEP are posted to python-list and/or python-dev. Both headers should be in dd-mmm-yyyy format, e.g. 14-Aug-2001. ! Standards Track PEPs must have a Python-Version header which ! indicates the version of Python that the feature will be released ! with. Informational PEPs do not need a Python-Version header. ! PEPs may have a Requires header, indicating the PEP numbers ! that this PEP depends on. ! ! PEPs may also have a Replaced-By header indicating that a PEP has been rendered obsolete by a later document; the value is the number of the PEP that replaces the current document. The newer ! PEP must have a Replaces header containing the number of the PEP that it rendered obsolete. Reporting PEP Bugs, or Submitting PEP Updates *************** *** 373,382 **** always submit a competing PEP. ! If you are interested assuming ownership of a PEP, send a message ! asking to take over, addressed to both the original author and the ! PEP editor . If the original author doesn't ! respond to email in a timely manner, the PEP editor will make a ! unilateral decision (it's not like such decisions can be ! reversed. :). --- 342,351 ---- always submit a competing PEP. ! If you are interested in assuming ownership of a PEP, send a ! message asking to take over, addressed to both the original author ! and the PEP editor . If the original author ! doesn't respond to email in a timely manner, the PEP editor will ! make a unilateral decision (it's not like such decisions can't be ! reversed :). *************** *** 405,410 **** [6] http://sourceforge.net/tracker/?group_id=5470&atid=305470 ! [7] PEP 9, Sample PEP Template http://www.python.org/peps/pep-0009.html --- 374,384 ---- [6] http://sourceforge.net/tracker/?group_id=5470&atid=305470 ! [7] PEP 9, Sample Plaintext PEP Template, Warsaw http://www.python.org/peps/pep-0009.html + + [8] PEP 12, Sample reStructuredText PEP Template, Goodger, Warsaw + http://www.python.org/peps/pep-0009.html + + [9] http://docutils.sourceforge.net/ From bwarsaw@users.sourceforge.net Mon Aug 26 17:32:00 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:32:00 -0700 Subject: [Python-checkins] python/nondist/peps pep-0012.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19439 Added Files: pep-0012.txt Log Message: David Goodger writes: New Meta-PEP, "Sample reStructuredText PEP Template" ==================================================== * I've presumed to use "PEP 12", as the next available Meta-PEP number; I'll change it if I'm mistaken. (Barry: PEP 12 was agreed on as fine). * Its status is "Draft". If acceptable as-is, please change the Status header to "Active". (Barry: Done) * I've listed Barry as co-author. Since much of the text was copied from PEP 9, I figure it's only fair. (Barry: thanks!) * This PEP is marked up using reStructuredText, naturally. * The "Abstract", "Rationale", and "How to Use This Template" sections are based on PEP 9. "Abstract" has a reference back to PEP 9. "Rationale" contains a one-paragraph rationale for reStructuredText PEPs. "How to Use This Template" has been marked up a bit. * The "ReStructuredText PEP Formatting Requirements" section is the big difference. Subsection "General" contains the same text-level instructions as in PEP 9: two spaces at sentence end; 70 columns; no tabs; Emacs stanza. The rest of the section describes the reStructuredText syntax and PEP-specific conventions. --- NEW FILE: pep-0012.txt --- PEP: 12 Title: Sample reStructuredText PEP Template Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/08/26 16:31:58 $ Author: David Goodger , Barry A. Warsaw Status: Active Type: Informational Content-Type: text/x-rst Created: 05-Aug-2002 Post-History: Abstract ======== This PEP provides a boilerplate or sample template for creating your own reStructuredText PEPs. In conjunction with the content guidelines in PEP 1 [1]_, this should make it easy for you to conform your own PEPs to the format outlined below. Note: if you are reading this PEP via the web, you should first grab the text (reStructuredText) version in order to complete the steps below. **DO NOT USE THE HTML FILE AS YOUR TEMPLATE!** To get the text version of this file, look at the top of the page and click on the link titled "PEP Source". If you would prefer not to use markup in your PEP, please see PEP 9, "Sample Plaintext PEP Template" [2]_. Rationale ========= PEP submissions come in a wide variety of forms, not all adhering to the format guidelines set forth below. Use this template, in conjunction with the format guidelines below, to ensure that your PEP submission won't get automatically rejected because of form. ReStructuredText is offered as an alternative to plaintext PEPs, to allow PEP authors more functionality and expressivity, while maintaining easy readability in the source text. The processed HTML form makes the functionality accessible to readers: live hyperlinks, styled text, tables, images, and automatic tables of contents, among other advantages. For an example of a PEP marked up with reStructuredText, see PEP 287. How to Use This Template ======================== To use this template you must first decide whether your PEP is going to be Informational or Standards Track. Most PEPs are Standards Track because they propose a new feature for the Python language or standard library. When in doubt, read PEP 1 for details. Once you've decided which type of PEP yours is going to be, follow the directions below. - Make a copy of this file (``.txt`` file, **not** HTML!) and perform the following edits. - Replace the "PEP: 9" header with "PEP: XXX" since you don't yet have a PEP number assignment. - Change the Title header to the title of your PEP. - Leave the Version and Last-Modified headers alone; we'll take care of those when we check your PEP into CVS. - Change the Author header to include your name, and optionally your email address. Be sure to follow the format carefully: your name must appear first, and it must not be contained in parentheses. Your email address may appear second (it can also be omitted) and if it appears, it must appear in angle brackets. - If there is a mailing list for discussion of your new feature, add a Discussions-To header right after the Author header. You should not add a Discussions-To header if the mailing list to be used is either python-list@python.org or python-dev@python.org, or if discussions should be sent to you directly. Most Informational PEPs don't have a Discussions-To header. - Change the Status header to "Draft". - For Standards Track PEPs, change the Type header to "Standards Track". - For Informational PEPs, change the Type header to "Informational". - For Standards Track PEPs, if your feature depends on the acceptance of some other currently in-development PEP, add a Requires header right after the Type header. The value should be the PEP number of the PEP yours depends on. Don't add this header if your dependent feature is described in a Final PEP. - Change the Created header to today's date. Be sure to follow the format carefully: it must be in ``dd-mmm-yyyy`` format, where the ``mmm`` is the 3 English letter month abbreviation, i.e. one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec. - For Standards Track PEPs, after the Created header, add a Python-Version header and set the value to the next planned version of Python, i.e. the one your new feature will hopefully make its first appearance in. Do not use an alpha or beta release designation here. Thus, if the last version of Python was 2.2 alpha 1 and you're hoping to get your new feature into Python 2.2, set the header to:: Python-Version: 2.2 - Leave Post-History alone for now; you'll add dates to this header each time you post your PEP to python-list@python.org or python-dev@python.org. If you posted your PEP to the lists on August 14, 2001 and September 3, 2001, the Post-History header would look like:: Post-History: 14-Aug-2001, 03-Sept-2001 You must manually add new dates and check them in. If you don't have check-in privileges, send your changes to the PEP editor. - Add a Replaces header if your PEP obsoletes an earlier PEP. The value of this header is the number of the PEP that your new PEP is replacing. Only add this header if the older PEP is in "final" form, i.e. is either Accepted, Final, or Rejected. You aren't replacing an older open PEP if you're submitting a competing idea. - Now write your Abstract, Rationale, and other content for your PEP, replacing all this gobbledygook with your own text. Be sure to adhere to the format guidelines below, specifically on the prohibition of tab characters and the indentation requirements. - Update your References and Copyright section. Usually you'll place your PEP into the public domain, in which case just leave the Copyright section alone. Alternatively, you can use the `Open Publication License`__, but public domain is still strongly preferred. __ http://www.opencontent.org/openpub/ - Leave the Emacs stanza at the end of this file alone, including the formfeed character ("^L", or ``\f``). - Send your PEP submission to the PEP editor, Barry Warsaw, at peps@python.org. ReStructuredText PEP Formatting Requirements ============================================ The following is a PEP-specific summary of reStructuredText syntax. For the sake of simplicity and brevity, much detail is omitted. For more detail, see `Resources`_ below. `Literal blocks`_ (in which no markup processing is done) are used for examples throughout, to illustrate the plaintext markup. General ------- You must adhere to the Emacs convention of adding two spaces at the end of every sentence. You should fill your paragraphs to column 70, but under no circumstances should your lines extend past column 79. If your code samples spill over column 79, you should rewrite them. Tab characters must never appear in the document at all. A PEP should include the standard Emacs stanza included by example at the bottom of this PEP. Section Headings ---------------- PEP headings must begin in column zero and the initial letter of each word must be capitalized as in book titles. Acronyms should be in all capitals. Section titles must be adorned with an underline, a single repeated punctuation character, which begins in column zero and must extend at least as far as the right edge of the title text (4 characters minimum). First-level section titles are underlined with "=" (equals signs), second-level section titles with "-" (hyphens), and third-level section titles with "'" (single quotes or apostrophes). For example:: First-Level Title ================= Second-Level Title ------------------ Third-Level Title ''''''''''''''''' If there are more than three levels of sections in your PEP, you may insert overline/underline-adorned titles for the first and second levels as follows:: ============================ First-Level Title (optional) ============================ ----------------------------- Second-Level Title (optional) ----------------------------- Third-Level Title ================= Fourth-Level Title ------------------ Fifth-Level Title ''''''''''''''''' You shouldn't have more than five levels of sections in your PEP. If you do, you should consider rewriting it. You must use two blank lines between the last line of a section's body and the next section heading. If a subsection heading immediately follows a section heading, a single blank line in-between is sufficient. The body of each section is not normally indented, although some constructs do use indentation, as described below. Blank lines are used to separate constructs. Paragraphs ---------- Paragraphs are left-aligned text blocks separated by blank lines. Paragraphs are not indented unless they are part of an indented construct (such as a block quote or a list item). Inline Markup ------------- Portions of text within paragraphs and other text blocks may be styled. For example:: Text may be marked as *emphasized* (single asterisk markup, typically shown in italics) or **strongly emphasized** (double asterisks, typically boldface). ``Inline literals`` (using double backquotes) are typically rendered in a monospaced typeface. No further markup recognition is done within the double backquotes, so they're safe for any kind of code snippets. Block Quotes ------------ Block quotes consist of indented body elements. For example:: This is a paragraph. This is a block quote. A block quote may contain many paragraphs. Block quotes are used to quote extended passages from other sources. Block quotes may be nested inside other body elements. Use 4 spaces per indent level. Literal Blocks -------------- .. In the text below, double backquotes are used to denote inline literals. "``::``" is written so that the colons will appear in a monospaced font; the backquotes (``) are markup, not part of the text. See "Inline Markup" above. By the way, this is a comment, described in "Comments" below. Literal blocks are used for code samples or preformatted ASCII art. To indicate a literal block, preface the indented text block with "``::``" (two colons). The literal block continues until the end of the indentation. Indent the text block by 4 spaces. For example:: This is a typical paragraph. A literal block follows. :: for a in [5,4,3,2,1]: # this is program code, shown as-is print a print "it's..." # a literal block continues until the indentation ends The paragraph containing only "``::``" will be completely removed from the output; no empty paragraph will remain. "``::``" is also recognized at the end of any paragraph. If immediately preceded by whitespace, both colons will be removed from the output. When text immediately precedes the "``::``", *one* colon will be removed from the output, leaving only one colon visible (i.e., "``::``" will be replaced by "``:``"). For example, one colon will remain visible here:: Paragraph:: Literal block Lists ----- Bullet list items begin with one of "-", "*", or "+" (hyphen, asterisk, or plus sign), followed by whitespace and the list item body. List item bodies must be left-aligned and indented relative to the bullet; the text immediately after the bullet determines the indentation. For example:: This paragraph is followed by a list. * This is the first bullet list item. The blank line above the first list item is required; blank lines between list items (such as below this paragraph) are optional. * This is the first paragraph in the second item in the list. This is the second paragraph in the second item in the list. The blank line above this paragraph is required. The left edge of this paragraph lines up with the paragraph above, both indented relative to the bullet. - This is a sublist. The bullet lines up with the left edge of the text blocks above. A sublist is a new list so requires a blank line above and below. * This is the third item of the main list. This paragraph is not part of the list. Enumerated (numbered) list items are similar, but use an enumerator instead of a bullet. Enumerators are numbers (1, 2, 3, ...), letters (A, B, C, ...; uppercase or lowercase), or Roman numerals (i, ii, iii, iv, ...; uppercase or lowercase), formatted with a period suffix ("1.", "2."), parentheses ("(1)", "(2)"), or a right-parenthesis suffix ("1)", "2)"). For example:: 1. As with bullet list items, the left edge of paragraphs must align. 2. Each list item may contain multiple paragraphs, sublists, etc. This is the second paragraph of the second list item. a) Enumerated lists may be nested. b) Blank lines may be omitted between list items. Definition lists are written like this:: what Definition lists associate a term with a definition. how The term is a one-line phrase, and the definition is one or more paragraphs or body elements, indented relative to the term. Tables ------ Simple tables are easy and compact:: ===== ===== ======= A B A and B ===== ===== ======= False False False True False False False True False True True True ===== ===== ======= There must be at least two columns in a table (to differentiate from section titles). Column spans use underlines of hyphens ("Inputs" spans the first two columns):: ===== ===== ====== Inputs Output ------------ ------ A B A or B ===== ===== ====== False False False True False True False True True True True True ===== ===== ====== Text in a first-column cell starts a new row. No text in the first column indicates a continuation line; the rest of the cells may consist of multiple lines. For example:: ===== ========================= col 1 col 2 ===== ========================= 1 Second column of row 1. 2 Second column of row 2. Second line of paragraph. 3 - Second column of row 3. - Second item in bullet list (row 3, column 2). ===== ========================= Hyperlinks ---------- When referencing an external web page in the body of a PEP, you should include the title of the page in the text, with either an inline hyperlink reference to the URL or a footnote reference (see `Footnotes`_ below). Do not include the URL in the body text of the PEP. Hyperlink references use backquotes and a trailing underscore to mark up the reference text; backquotes are optional if the reference text is a single word. For example:: In this paragraph, we refer to the `Python web site`_. An explicit target provides the URL. Put targets in a References section at the end of the PEP, or immediately after the reference. Hyperlink targets begin with two periods and a space (the "explicit markup start"), followed by a leading underscore, the reference text, a colon, and the URL (absolute or relative):: .. _Python web site: http://www.python.org/ The reference text and the target text must match (although the match is case-insensitive and ignores differences in whitespace). Note that the underscore trails the reference text but precedes the target text. If you think of the underscore as a right-pointing arrow, it points *away* from the reference and *toward* the target. The same mechanism can be used for internal references. Every unique section title implicitly defines an internal hyperlink target. We can make a link to the Abstract section like this:: Here is a hyperlink reference to the `Abstract`_ section. The backquotes are optional since the reference text is a single word; we can also just write: Abstract_. Footnotes containing the URLs from external targets will be generated automatically at the end of the References section of the PEP, along with footnote references linking the reference text to the footnotes. Text of the form "PEP x" or "RFC x" (where "x" is a number) will be linked automatically to the appropriate URLs. Footnotes --------- Footnote references consist of a left square bracket, a number, a right square bracket, and a trailing underscore:: This sentence ends with a footnote reference [1]_. Whitespace must precede the footnote reference. Leave a space between the footnote reference and the preceding word. When referring to another PEP, include the PEP number in the body text, such as "PEP 1". The title may optionally appear. Add a footnote reference following the title. For example:: Refer to PEP 1 [2]_ for more information. Add a footnote that includes the PEP's title and author. It may optionally include the explicit URL on a separate line, but only in the References section. Footnotes begin with ".. " (the explicit markup start), followed by the footnote marker (no underscores), followed by the footnote body. For example:: References ========== .. [2] PEP 1, "PEP Purpose and Guidelines", Warsaw, Hylton (http://www.python.org/peps/pep-0001.html) If you decide to provide an explicit URL for a PEP, please use this as the URL template:: http://www.python.org/peps/pep-xxxx.html PEP numbers in URLs must be padded with zeros from the left, so as to be exactly 4 characters wide, however PEP numbers in the text are never padded. During the course of developing your PEP, you may have to add, remove, and rearrange footnote references, possibly resulting in mismatched references, obsolete footnotes, and confusion. Auto-numbered footnotes allow more freedom. Instead of a number, use a label of the form "#word", where "word" is a mnemonic consisting of alphanumerics plus internal hyphens, underscores, and periods (no whitespace or other characters are allowed). For example:: Refer to PEP 1 [#PEP-1]_ for more information. References ========== .. [#PEP-1] PEP 1, "PEP Purpose and Guidelines", Warsaw, Hylton http://www.python.org/peps/pep-0001.html Footnotes and footnote references will be numbered automatically, and the numbers will always match. Once a PEP is finalized, auto-numbered labels should be replaced by numbers for simplicity. Images ------ If your PEP contains a diagram, you may include it in the processed output using the "image" directive:: .. image:: diagram.png Any browser-friendly graphics format is possible: .png, .jpeg, .gif, .tiff, etc. Since this image will not be visible to readers of the PEP in source text form, you should consider including a description or ASCII art alternative, using a comment (below). Comments -------- A comment block is an indented block of arbitrary text immediately following an explicit markup start: two periods and whitespace. Leave the ".." on a line by itself to ensure that the comment is not misinterpreted as another explicit markup construct. Comments are not visible in the processed document. For the benefit of those reading your PEP in source form, please consider including a descriptions of or ASCII art alternatives to any images you include. For example:: .. image:: dataflow.png .. Data flows from the input module, through the "black box" module, and finally into (and through) the output module. The Emacs stanza at the bottom of this document is inside a comment. Escaping Mechanism ------------------ reStructuredText uses backslashes ("``\``") to override the special meaning given to markup characters and get the literal characters themselves. To get a literal backslash, use an escaped backslash ("``\\``"). There are two contexts in which backslashes have no special meaning: `literal blocks`_ and inline literals (see `Inline Markup`_ above). In these contexts, no markup recognition is done, and a single backslash represents a literal backslash, without having to double up. If you find that you need to use a backslash in your text, consider using inline literals or a literal block instead. Habits to Avoid =============== Many programmers who are familiar with TeX often write quotation marks like this:: `single-quoted' or ``double-quoted'' Backquotes are significant in reStructuredText, so this practice should be avoided. For ordinary text, use ordinary 'single-quotes' or "double-quotes". For inline literal text (see `Inline Markup`_ above), use double-backquotes:: ``literal text: in here, anything goes!`` Resources ========= Many other constructs and variations are possible. For more details about the reStructuredText markup, in increasing order of thoroughness, please see: * `A ReStructuredText Primer`__, a gentle introduction. __ http://docutils.sourceforge.net/docs/rst/quickstart.html * `Quick reStructuredText`__, a users' quick reference. __ http://docutils.sourceforge.net/docs/rst/quickref.html * `reStructuredText Markup Specification`__, the final authority. __ http://docutils.sourceforge.net/spec/rst/reStructuredText.html The processing of reStructuredText PEPs is done using Docutils_. If you have a question or require assistance with reStructuredText or Docutils, please `post a message`_ to the `Docutils-Users mailing list`_. The `Docutils project web site`_ has more information. .. _Docutils: http://docutils.sourceforge.net/ .. _post a message: mailto:docutils-users@lists.sourceforge.net?subject=PEPs .. _Docutils-Users mailing list: http://lists.sourceforge.net/lists/listinfo/docutils-users .. _Docutils project web site: http://docutils.sourceforge.net/ References ========== .. [1] PEP 1, PEP Purpose and Guidelines, Warsaw, Hylton (http://www.python.org/peps/pep-0001.html) .. [2] PEP 9, Sample Plaintext PEP Template, Warsaw (http://www.python.org/peps/pep-0009.html) Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Aug 26 17:44:59 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:44:59 -0700 Subject: [Python-checkins] python/dist/src/Lib mailbox.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24366 Modified Files: mailbox.py Log Message: Fix an inaccuracy in the comment Index: mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** mailbox.py 30 Jun 2002 03:39:14 -0000 1.38 --- mailbox.py 26 Aug 2002 16:44:56 -0000 1.39 *************** *** 138,143 **** # that the two characters preceding "From " are \n\n or the beginning of # the file. Fixing this would require a more extensive rewrite than is ! # necessary. For convenience, we've added a StrictUnixMailbox class which ! # uses the older, more strict _fromlinepattern regular expression. _fromlinepattern = r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+" \ --- 138,143 ---- # that the two characters preceding "From " are \n\n or the beginning of # the file. Fixing this would require a more extensive rewrite than is ! # necessary. For convenience, we've added a PortableUnixMailbox class ! # which uses the more lenient _fromlinepattern regular expression. _fromlinepattern = r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+" \ From bwarsaw@users.sourceforge.net Mon Aug 26 17:29:34 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:29:34 -0700 Subject: [Python-checkins] python/nondist/peps pep-0009.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv18566 Modified Files: pep-0009.txt Log Message: David Goodger writes: * Changed name from "Sample PEP Template" to "Sample Plaintext PEP Template", and edited throughout to differentiate the choices: - Added "plaintext" where appropriate to make the context clear. - "Style" -> "format". - Referred to PEP 1 as "content guidelines", not "style" guidelines. * Added a "Content-Type: text/plain" header to be explicit. * Added a reference to the alternative format available in reStructuredText PEPs. * Combined "How to Use This Template for Standard Track PEPs" and "How to Use This Template for Informational PEPs" into one "How to Use This Template" section. In addition to the duplication, there were several errors and inconsistencies between the two source sections. Conditionals have been added as appropriate. * Clarified the discussion of the Replaces header as per discussions. * Added "Plaintext PEP Formatting Requirements", moved from PEP 1's "PEP Formatting Requirements". - Removed the paragraph beginning "A PEP must contain a Copyright section" as redundant; already covered in "How to Use This Template". - Minor edits. * Minor edits, including: - Fixed typos. - Removed colons from header field names (e.g., "the Author header"). (Some additional minor edits by Barry). Index: pep-0009.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0009.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0009.txt 30 Jul 2002 16:23:15 -0000 1.8 --- pep-0009.txt 26 Aug 2002 16:29:31 -0000 1.9 *************** *** 1,4 **** PEP: 9 ! Title: Sample PEP Template Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 9 ! Title: Sample Plaintext PEP Template Version: $Revision$ Last-Modified: $Date$ *************** *** 6,9 **** --- 6,10 ---- Status: Active Type: Informational + Content-Type: text/plain Created: 14-Aug-2001 Post-History: *************** *** 13,98 **** This PEP provides a boilerplate or sample template for creating ! your own PEPs. This should make it easy for you to conform your ! own PEPs to the style outlined in PEP 1, PEP Guidelines[1]. Note: if you are reading this PEP via the web, you should first ! grab the plain text version in order to complete the steps below. ! DO NOT USE THE HTML FILE AS YOUR TEMPLATE! ! To get the plain text version of this file, look at the top of the page and click on the link titled "PEP Source". Rationale PEP submissions come in a wide variety of forms, not all adhering ! to the style guidelines set forth in PEP 1. Use this template, in ! conjunction with the prose guidelines in PEP 1, to ensure that your PEP submission won't get automatically rejected because of form. - To use this template you must first decide whether your PEP is - going to be Informational or Standards Track. Most PEPs are - Standards Track because they propose a new feature for the Python - language or standard library. When in doubt, read PEP 1 for - details. ! Once you've decided which type of PEP yours is going to be, follow ! the directions in the appropriate section below. ! How to Use This Template for Standard Track PEPs ! - Make a copy of this file and perform the following edits. ! - replace the "PEP: 9" header with "PEP: XXX" since you don't yet have a PEP number assignment. ! - Change the Title: header to the title of your PEP. ! - Leave the Version: and Last-Modified: headers alone; we'll take care of those when we check your PEP into CVS. ! - Change the Author: header to include your name, and optionally your email address. Be sure to follow the format carefully: your name must appear first, and it must not be contained in ! parentheses. Your email address may appear second (it can also ! be omitted) and if it appears, it must appear in angle brackets. - If there is a mailing list for discussion of your new feature, ! add a Discussions-To: header right after the Author: header. ! You should not add a Discussions-To: header if the mailing list ! to be used is either python-list@python.org or ! python-dev@python.org, or if discussions should be sent to you ! directly. ! - Change the Status: header to "Draft". ! - Change the Type: header to "Standards Track". ! - If your feature depends on the acceptance of some other currently ! in-development PEP, add a Requires: header right after the Type: ! header. The value should be the PEP number of the PEP yours ! depends on. Don't add this header if your dependent feature is ! described in a Final PEP. ! - Change the Created: header to today's date. Be sure to follow the format carefully: it must be in dd-mmm-yyyy format, where the mmm is the 3 English letter month abbreviation, e.g. one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec. ! - After the Created: header, add a Python-Version: header and set ! the value to the next planned version of Python, i.e. the one ! your new feature will hopefully make its first appearance in. ! Do not use an alpha or beta release designation here. Thus, if ! the last version of Python was 2.2 alpha 1 and you're hoping to ! get your new feature into Python 2.2, set the header to: Python-Version: 2.2 ! - Leave Post-History: alone for now; you'll add dates to this header each time you post your PEP to python-list@python.org or python-dev@python.org. E.g. if you posted your PEP to the lists ! on August 14, 2001 and September 3, 2001, the Post-History: header would look like: --- 14,110 ---- This PEP provides a boilerplate or sample template for creating ! your own plaintext PEPs. In conjunction with the content ! guidelines in PEP 1 [1], this should make it easy for you to ! conform your own PEPs to the format outlined below. Note: if you are reading this PEP via the web, you should first ! grab the plaintext source of this PEP in order to complete the ! steps below. DO NOT USE THE HTML FILE AS YOUR TEMPLATE! ! To get the source this (or any) PEP, look at the top of the html page and click on the link titled "PEP Source". + If you would prefer to use lightweight markup in your PEP, please + see PEP 12, "Sample reStructuredText PEP Template" [2]. + Rationale PEP submissions come in a wide variety of forms, not all adhering ! to the format guidelines set forth below. Use this template, in ! conjunction with the content guidelines in PEP 1, to ensure that your PEP submission won't get automatically rejected because of form. ! How to Use This Template + To use this template you must first decide whether your PEP is + going to be an Informational or Standards Track PEP. Most PEPs + are Standards Track because they propose a new feature for the + Python language or standard library. When in doubt, read PEP 1 + for details or contact the PEP editors . ! Once you've decided which type of PEP yours is going to be, follow ! the directions below. ! - Make a copy of this file (.txt file, not HTML!) and perform the ! following edits. ! - Replace the "PEP: 9" header with "PEP: XXX" since you don't yet have a PEP number assignment. ! - Change the Title header to the title of your PEP. ! - Leave the Version and Last-Modified headers alone; we'll take care of those when we check your PEP into CVS. ! - Change the Author header to include your name, and optionally your email address. Be sure to follow the format carefully: your name must appear first, and it must not be contained in ! parentheses. Your email address may appear second (or it can be ! omitted) and if it appears, it must appear in angle brackets. ! It is okay to obfuscate your email address. - If there is a mailing list for discussion of your new feature, ! add a Discussions-To header right after the Author header. You ! should not add a Discussions-To header if the mailing list to be ! used is either python-list@python.org or python-dev@python.org, ! or if discussions should be sent to you directly. Most ! Informational PEPs don't have a Discussions-To header. ! - Change the Status header to "Draft". ! - For Standards Track PEPs, change the Type header to "Standards ! Track". ! - For Informational PEPs, change the Type header to ! "Informational". ! - For Standards Track PEPs, if your feature depends on the ! acceptance of some other currently in-development PEP, add a ! Requires header right after the Type header. The value should ! be the PEP number of the PEP yours depends on. Don't add this ! header if your dependent feature is described in a Final PEP. ! ! - Change the Created header to today's date. Be sure to follow the format carefully: it must be in dd-mmm-yyyy format, where the mmm is the 3 English letter month abbreviation, e.g. one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec. ! - For Standards Track PEPs, after the Created header, add a ! Python-Version header and set the value to the next planned ! version of Python, i.e. the one your new feature will hopefully ! make its first appearance in. Do not use an alpha or beta ! release designation here. Thus, if the last version of Python ! was 2.2 alpha 1 and you're hoping to get your new feature into ! Python 2.2, set the header to: Python-Version: 2.2 ! - Leave Post-History alone for now; you'll add dates to this header each time you post your PEP to python-list@python.org or python-dev@python.org. E.g. if you posted your PEP to the lists ! on August 14, 2001 and September 3, 2001, the Post-History header would look like: *************** *** 102,195 **** have check-in privileges, send your changes to the PEP editor. ! - Add a Replaces: header if your PEP describes a feature that will ! replace a feature described in some Final PEP. Usually you ! won't need to add this header. It's also unlikely that you'll ! ever add a Replaced-By: header. ! - Now write your abstract, rationale, and other content for your ! PEP, replacing all this gobbledygook with your own text. Be ! sure to adhere to the PEP 1 style guidelines, specifically on ! the prohibition of tab characters and the indentation ! requirements. - Update your References and Copyright section. Usually you'll place your PEP into the public domain, in which case just leave ! the Copyright section alone. Alternatively, you can use the ! Open Publication License[2], but public domain is still strongly preferred. - Leave the little Emacs turd at the end of this file alone, ! including the formfeed character (^L, or \f). ! ! - Send your PEP submission to the PEP editor, along with $100k in ! unmarked pennies. (Just kidding, I wanted to see if you were ! still awake. :) ! ! How to Use This Template for Informational PEPs - - Make a copy of this file and perform the following edits. ! - replace the "PEP: 9" header with "PEP: XXX" since you don't yet ! have a PEP number assignment. ! - Change the Title: header to the title of your PEP. ! - Leave the Version: and Last-Modified: headers alone; we'll take ! care of those when we check your PEP into CVS. ! - Change the Author: header to include your email address and ! name. Be sure to follow the format carefully: your email ! address must appear first, and it should not be contained in ! angle brackets. Your full name should appear second and it ! should appear in parentheses. ! - If there is a mailing list for discussion of your new feature, ! add a Discussions-To: header right after the Author: header. ! You should not add a Discussions-To: header if the mailing list ! to be used is either python-list@python.org or ! python-dev@python.org, or if discussions should be sent to you ! directly. Most Information PEPs don't have a Discussions-To: ! header. ! - Change the Status: header to "Active". ! - Change the Type: header to "Informational". ! - Change the Created: header to today's date. Be sure to follow ! the format carefully: it must be in dd-mmm-yyyy format, where ! the mmm is the 3 letter month abbreviation. ! - Leave Post-History: alone for now; you'll add dates to this ! header after your PEP has been assigned a number and you've ! posted your PEP to python-list@python.org or ! python-dev@python.org. ! - Now write your abstract, rationale, and other content for your ! PEP, replacing all this gobbledygook with your own text. Be ! sure to adhere to the PEP 1 style guidelines, specifically on ! the prohibition of tab characters and the indentation ! requirements. ! - Update your References and Copyright section. Usually you'll ! place your PEP into the public domain, in which case just leave ! the Copyright section alone. Alternatively, you can use the ! Open Publication License[2], but public domain is still strongly ! preferred. ! - Leave the little Emacs turd at the end of this file alone, ! including the formfeed character (^L, or \f). ! - Send your PEP submission to the PEP editor, along with $100k in ! unmarked pennies. (Just kidding, I wanted to see if you were ! still awake. :) References ! [1] PEP 1, PEP Purpose and Guidelines http://www.python.org/peps/pep-0001.html ! [2] http://www.opencontent.org/openpub/ --- 114,208 ---- have check-in privileges, send your changes to the PEP editor. ! - Add a Replaces header if your PEP obsoletes an earlier PEP. The ! value of this header is the number of the PEP that your new PEP ! is replacing. Only add this header if the older PEP is in ! "final" form, i.e. is either Accepted, Final, or Rejected. You ! aren't replacing an older open PEP if you're submitting a ! competing idea. ! - Now write your Abstract, Rationale, and other content for your ! PEP, replacing all this gobbledygook with your own text. Be sure ! to adhere to the format guidelines below, specifically on the ! prohibition of tab characters and the indentation requirements. - Update your References and Copyright section. Usually you'll place your PEP into the public domain, in which case just leave ! the "Copyright" section alone. Alternatively, you can use the ! Open Publication License[3], but public domain is still strongly preferred. - Leave the little Emacs turd at the end of this file alone, ! including the formfeed character ("^L", or \f). ! - Send your PEP submission to the PEP editors (peps@python.org), ! along with $100k in unmarked pennies. (Just kidding, I wanted ! to see if you were still awake. :) ! Plaintext PEP Formatting Requirements ! PEP headings must begin in column zero and the initial letter of ! each word must be capitalized as in book titles. Acronyms should ! be in all capitals. The body of each section must be indented 4 ! spaces. Code samples inside body sections should be indented a ! further 4 spaces, and other indentation can be used as required to ! make the text readable. You must use two blank lines between the ! last line of a section's body and the next section heading. ! You must adhere to the Emacs convention of adding two spaces at ! the end of every sentence. You should fill your paragraphs to ! column 70, but under no circumstances should your lines extend ! past column 79. If your code samples spill over column 79, you ! should rewrite them. ! Tab characters must never appear in the document at all. A PEP ! should include the standard Emacs stanza included by example at ! the bottom of this PEP. ! When referencing an external web page in the body of a PEP, you ! should include the title of the page in the text, with a ! footnote reference to the URL. Do not include the URL in the body ! text of the PEP. E.g. ! Refer to the Python Language web site [1] for more details. ! ... ! [1] http://www.python.org ! When referring to another PEP, include the PEP number in the body ! text, such as "PEP 1". The title may optionally appear. Add a ! footnote reference, a number in square brackets. The footnote ! body should include the PEP's title and author. It may optionally ! include the explicit URL on a separate line, but only in the ! References section. Note that the pep2html.py script will ! calculate URLs automatically. For example: ! ... ! Refer to PEP 1 [7] for more information about PEP style ! ... ! References ! [7] PEP 1, PEP Purpose and Guidelines, Warsaw, Hylton ! http://www.python.org/peps/pep-0001.html ! If you decide to provide an explicit URL for a PEP, please use ! this as the URL template: ! http://www.python.org/peps/pep-xxxx.html ! PEP numbers in URLs must be padded with zeros from the left, so as ! to be exactly 4 characters wide, however PEP numbers in the text ! are never padded. References ! [1] PEP 1, PEP Purpose and Guidelines, Warsaw, Hylton http://www.python.org/peps/pep-0001.html ! [2] PEP 12, Sample reStructuredText PEP Template, Goodger, Warsaw ! http://www.python.org/peps/pep-0001.html ! ! [3] http://www.opencontent.org/openpub/ From bwarsaw@users.sourceforge.net Mon Aug 26 17:50:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:50:02 -0700 Subject: [Python-checkins] python/nondist/peps pep-html-template,NONE,1.1 pep.css,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26255 Added Files: pep-html-template pep.css Log Message: Helper files for David Goodger's reStructuredText PEP support. --- NEW FILE: pep-html-template --- PEP %(pep)s -- %(title)s %(body)s %(body_suffix)s --- NEW FILE: pep.css --- /* :Author: David Goodger :Contact: goodger@users.sourceforge.net :date: $Date: 2002/08/26 16:50:00 $ :version: $Revision: 1.1 $ :copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the PEP HTML output of Docutils. */ .navigation { width: 100% ; background: #99ccff ; margin-top: 0px ; margin-bottom: 0px } .navigation .navicon { width: 150px ; height: 35 } .navigation .textlinks { padding-left: 1em ; text-align: left } .navigation td, .navigation th { padding-left: 0em ; padding-right: 0em ; vertical-align: middle } .rfc2822 { margin-top: 0.5em ; margin-left: 0.5em ; margin-right: 0.5em ; margin-bottom: 0em } .rfc2822 td { text-align: left } .rfc2822 th { text-align: right ; font-family: sans-serif ; padding-right: 0.5em ; font-weight: bold ; margin-bottom: 0em } a.footnote-reference { font-size: smaller ; vertical-align: super } a.target { color: blue } a.toc-backref { text-decoration: none ; color: black } body { margin: 0px ; margin-bottom: 1em ; padding: 0px } dd { margin-bottom: 0.5em } div.section { margin-left: 1em ; margin-right: 1em ; margin-bottom: 1.5em } div.section div.section { margin-left: 0em ; margin-right: 0em ; margin-top: 1.5em } div.abstract { margin: 2em 5em } div.abstract p.topic-title { font-weight: bold ; text-align: center } div.attention, div.caution, div.danger, div.error, div.hint, div.important, div.note, div.tip, div.warning { margin: 2em ; border: medium outset ; padding: 1em } div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, div.warning p.admonition-title { color: red ; font-weight: bold ; font-family: sans-serif } div.hint p.admonition-title, div.important p.admonition-title, div.note p.admonition-title, div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif } div.figure { margin-left: 2em } div.footer, div.header { font-size: smaller } div.footer { margin-left: 1em ; margin-right: 1em } div.system-messages { margin: 5em } div.system-messages h1 { color: red } div.system-message { border: medium outset ; padding: 1em } div.system-message p.system-message-title { color: red ; font-weight: bold } div.topic { margin: 2em } h1 { font-family: sans-serif ; font-size: large } h2 { font-family: sans-serif ; font-size: medium } h3 { font-family: sans-serif ; font-size: small } h4 { font-family: sans-serif ; font-style: italic ; font-size: small } h5 { font-family: sans-serif; font-size: x-small } h6 { font-family: sans-serif; font-style: italic ; font-size: x-small } .section hr { width: 75% } ol.simple, ul.simple { margin-bottom: 1em } ol.arabic { list-style: decimal } ol.loweralpha { list-style: lower-alpha } ol.upperalpha { list-style: upper-alpha } ol.lowerroman { list-style: lower-roman } ol.upperroman { list-style: upper-roman } p.caption { font-style: italic } p.credits { font-style: italic ; font-size: smaller } p.first { margin-top: 0 } p.label { white-space: nowrap } p.topic-title { font-family: sans-serif ; font-weight: bold } pre.literal-block, pre.doctest-block { margin-left: 2em ; margin-right: 2em ; background-color: #eeeeee } span.classifier { font-family: sans-serif ; font-style: oblique } span.classifier-delimiter { font-family: sans-serif ; font-weight: bold } span.field-argument { font-style: italic } span.interpreted { font-family: sans-serif } span.option-argument { font-style: italic } span.pre { white-space: pre } span.problematic { color: red } table { margin-top: 0.5em ; margin-bottom: 0.5em } td, th { padding-left: 0.5em ; padding-right: 0.5em ; vertical-align: baseline } td > :first-child, th > :first-child { margin-top: 0em } td.num { text-align: right } th.field-name { font-weight: bold ; text-align: right } ul.auto-toc { list-style-type: none } From bwarsaw@users.sourceforge.net Mon Aug 26 17:54:56 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:54:56 -0700 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28188 Modified Files: pep2html.py Log Message: David Goodger writes: * Refactored the file I/O model throughout, to support multiple processing paths. PEP source text is now read into a list of lines. * In ``fixfile()``: - Updated its parameters for the new I/O model. - Changed ``fo`` to ``outfile``, ``fi`` to ``inpath`` and ``input_lines``. - Input is read in by iterating over the list of input lines, rather than using "readlines()". - Opening and closing of files is done by the caller, "make_html()". - Added PEP number processing in Requires header. - Linked "Content-Type: text/plain" to PEP 9. * Added ``fix_rst_pep()``, which imports and calls Docutils code. * Added ``get_pep_type()``, which checks for a Content-Type header and returns the value, defaulting to "text/plain". If no PEP header is found, ``None`` is returned: input is not a PEP. * Added ``get_input_lines()`` to read input file into a list. * Expanded ``make_html()`` to catch errors and process the different PEP formats via the new ``PEP_TYPE_DISPATCH`` dict. * Added ``check_requirements()`` to check both Python and Docutils requirements. ``pep_type_error()`` is called if the required software is not available. * In ``main()``: - Added an ``argv`` parameter, so that pep2html.py can be imported and command-line options passed in. Yes, I use this functionality in the Docutils "buildhtml.py" front end. - Files skipped (due to an error) are not pushed onto the server. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** pep2html.py 30 Jul 2002 16:25:17 -0000 1.39 --- pep2html.py 26 Aug 2002 16:54:54 -0000 1.40 *************** *** 1,5 **** #!/usr/bin/env python ! """ ! convert PEP's to (X)HTML - courtesy of /F Usage: %(PROGRAM)s [options] [peps] --- 1,4 ---- #!/usr/bin/env python ! """Convert PEPs to (X)HTML - courtesy of /F Usage: %(PROGRAM)s [options] [peps] *************** *** 18,25 **** -i/--install ! After generating the HTML, install it and the plain text source file ! (.txt) SourceForge. In that case the user's name is used in the scp ! and ssh commands, unless -u sf_username is given (in which case, it is ! used instead). Without -i, -u is ignored. -q/--quiet --- 17,24 ---- -i/--install ! After generating the HTML, install it and the source file (.txt) ! SourceForge. In that case the user's name is used in the scp and ssh ! commands, unless -u sf_username is given (in which case, that is used ! instead). Without -i, -u is ignored. -q/--quiet *************** *** 32,37 **** """ - # Requires Python 2.2 - import sys import os --- 31,34 ---- *************** *** 43,52 **** import random import time - from email.Utils import parseaddr PROGRAM = sys.argv[0] RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html' PEPURL = 'pep-%04d.html' ! PEPCVSURL = 'http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/nondist/peps/pep-%04d.txt' PEPDIRRUL = 'http://www.python.org/peps/' --- 40,51 ---- import random import time + REQUIRES = {'python': '2.2', + 'docutils': '0.2.1'} PROGRAM = sys.argv[0] RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html' PEPURL = 'pep-%04d.html' ! PEPCVSURL = ('http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python' ! '/nondist/peps/pep-%04d.txt') PEPDIRRUL = 'http://www.python.org/peps/' *************** *** 129,151 **** ! def fixfile(infile, outfile): ! basename = os.path.basename(infile) # convert plain text pep to minimal XHTML markup ! try: ! fi = open(infile) ! except IOError, e: ! if e.errno <> errno.ENOENT: raise ! print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename ! return ! fo = open(outfile, "w") ! print >> fo, DTD ! print >> fo, '' ! print >> fo, '' # head header = [] pep = "" title = "" ! while 1: ! line = fi.readline() if not line.strip(): break --- 128,144 ---- ! def fixfile(inpath, input_lines, outfile): ! from email.Utils import parseaddr ! basename = os.path.basename(inpath) ! infile = iter(input_lines) # convert plain text pep to minimal XHTML markup ! print >> outfile, DTD ! print >> outfile, '' ! print >> outfile, '' # head header = [] pep = "" title = "" ! for line in infile: if not line.strip(): break *************** *** 168,192 **** title = "PEP " + pep + " -- " + title if title: ! print >> fo, ' %s' % cgi.escape(title) ! print >> fo, ' ' ! print >> fo, '' ! # body ! print >> fo, '' ! print >> fo, '> fo, ' width="100%" border="0">' ! print >> fo, '' ! print >> fo, '' ! print >> fo, '
\n' for k, v in header: if k.lower() in ('author', 'discussions-to'): --- 161,185 ---- title = "PEP " + pep + " -- " + title if title: ! print >> outfile, ' %s' % cgi.escape(title) r = random.choice(range(64)) ! print >> outfile, ( ! ' \n' ! '\n' ! '\n' ! '
\n' ! '\n' ! '' ! print >> outfile, '
\n' for k, v in header: if k.lower() in ('author', 'discussions-to'): *************** *** 206,214 **** mailtos.append(part) v = COMMASPACE.join(mailtos) ! elif k.lower() in ('replaces', 'replaced-by'): otherpeps = '' ! for otherpep in v.split(): otherpep = int(otherpep) ! otherpeps += '%i ' % (otherpep, otherpep) v = otherpeps --- 199,207 ---- mailtos.append(part) v = COMMASPACE.join(mailtos) ! elif k.lower() in ('replaces', 'replaced-by', 'requires'): otherpeps = '' ! for otherpep in re.split(',?\s+', v): otherpep = int(otherpep) ! otherpeps += '%i ' % (otherpep, otherpep) v = otherpeps *************** *** 216,234 **** url = PEPCVSURL % int(pep) date = v or time.strftime('%d-%b-%Y', ! time.localtime(os.stat(infile)[8])) v = '%s ' % (url, cgi.escape(date)) else: v = cgi.escape(v) ! print >> fo, ' ' \ % (cgi.escape(k), v) ! print >> fo, '
%s: %s
' ! print >> fo, '
' ! print >> fo, '
' ! print >> fo, '
' need_pre = 1 ! while 1: ! line = fi.readline() ! if not line: ! break if line[0] == '\f': continue --- 209,228 ---- url = PEPCVSURL % int(pep) date = v or time.strftime('%d-%b-%Y', ! time.localtime(os.stat(inpath)[8])) v = '%s ' % (url, cgi.escape(date)) + elif k.lower() in ('content-type',): + url = PEPURL % 9 + pep_type = v or 'text/plain' + v = '%s ' % (url, cgi.escape(pep_type)) else: v = cgi.escape(v) ! print >> outfile, ' %s: %s' \ % (cgi.escape(k), v) ! print >> outfile, '' ! print >> outfile, '
' ! print >> outfile, '
' ! print >> outfile, '
' need_pre = 1 ! for line in infile: if line[0] == '\f': continue *************** *** 239,244 **** break if not need_pre: ! print >> fo, '' ! print >> fo, '

%s

' % line.strip() need_pre = 1 elif not line.strip() and need_pre: --- 233,238 ---- break if not need_pre: ! print >> outfile, '' ! print >> outfile, '

%s

' % line.strip() need_pre = 1 elif not line.strip() and need_pre: *************** *** 252,258 **** url = PEPURL % int(parts[1]) if need_pre: ! print >> fo, '
'
                          need_pre = 0
!                     print >> fo, re.sub(
                          parts[1],
                          '%s' % (url, parts[1]),
--- 246,252 ----
                      url = PEPURL % int(parts[1])
                      if need_pre:
!                         print >> outfile, '
'
                          need_pre = 0
!                     print >> outfile, re.sub(
                          parts[1],
                          '%s' % (url, parts[1]),
***************
*** 263,284 ****
                      url = fixemail(parts[-1], pep)
                      if need_pre:
!                         print >> fo, '
'
                          need_pre = 0
!                     print >> fo, re.sub(
                          parts[-1], url, line, 1),
                      continue
!             line = fixpat.sub(lambda x, c=infile: fixanchor(c, x), line)
              if need_pre:
!                 print >> fo, '
'
                  need_pre = 0
!             fo.write(line)
      if not need_pre:
!         print >> fo, '
' ! print >> fo, '
' ! print >> fo, '' ! print >> fo, '' ! fo.close() ! os.chmod(outfile, 0664) --- 257,333 ---- url = fixemail(parts[-1], pep) if need_pre: ! print >> outfile, '
'
                          need_pre = 0
!                     print >> outfile, re.sub(
                          parts[-1], url, line, 1),
                      continue
!             line = fixpat.sub(lambda x, c=inpath: fixanchor(c, x), line)
              if need_pre:
!                 print >> outfile, '
'
                  need_pre = 0
!             outfile.write(line)
      if not need_pre:
!         print >> outfile, '
' ! print >> outfile, '
' ! print >> outfile, '' ! print >> outfile, '' + + docutils_options = None + """Option value object used by Docutils. Can be set by the client application + when this module is imported.""" + + def fix_rst_pep(inpath, input_lines, outfile): + from docutils import core, io + pub = core.Publisher() + pub.set_reader(reader_name='pep', parser_name='restructuredtext', + parser=None) + pub.set_writer(writer_name='pep_html') + if docutils_options: + options = docutils_options + pub.options = options + else: + options = pub.set_options() + options._source = inpath + options._destination = outfile.name + pub.source = io.StringInput( + options, source=''.join(input_lines), source_path=inpath) + pub.destination = io.FileOutput( + options, destination=outfile, destination_path=outfile.name, + autoclose=0) + pub.publish() + + + def get_pep_type(input_lines): + """ + Return the Content-Type of the input. "text/plain" is the default. + Return ``None`` if the input is not a PEP. + """ + pep_type = None + for line in input_lines: + line = line.rstrip().lower() + if not line: + # End of the RFC 2822 header (first blank line). + break + elif line.startswith('content-type: '): + pep_type = line.split()[1] or 'text/plain' + break + elif line.startswith('pep: '): + # Default PEP type, used if no explicit content-type specified: + pep_type = 'text/plain' + return pep_type + + + def get_input_lines(inpath): + try: + infile = open(inpath) + except IOError, e: + if e.errno <> errno.ENOENT: raise + print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename + sys.stderr.flush() + return None, None + lines = infile.read().splitlines(1) # handles x-platform line endings + infile.close() + return lines *************** *** 290,299 **** return "pep-%04d.txt" % num ! def make_html(file, verbose=0): ! newfile = os.path.splitext(file)[0] + ".html" if verbose: ! print file, "->", newfile ! fixfile(file, newfile) ! return newfile def push_pep(htmlfiles, txtfiles, username, verbose): --- 339,366 ---- return "pep-%04d.txt" % num ! def make_html(inpath, verbose=0): ! input_lines = get_input_lines(inpath) ! pep_type = get_pep_type(input_lines) ! if pep_type is None: ! print >> sys.stderr, 'Error: Input file %s is not a PEP.' % inpath ! sys.stdout.flush() ! return None ! elif not PEP_TYPE_DISPATCH.has_key(pep_type): ! print >> sys.stderr, ('Error: Unknown PEP type for input file %s: %s' ! % (inpath, pep_type)) ! sys.stdout.flush() ! return None ! elif PEP_TYPE_DISPATCH[pep_type] == None: ! pep_type_error(inpath, pep_type) ! return None ! outpath = os.path.splitext(inpath)[0] + ".html" if verbose: ! print inpath, "(%s)" % pep_type, "->", outpath ! sys.stdout.flush() ! outfile = open(outpath, "w") ! PEP_TYPE_DISPATCH[pep_type](inpath, input_lines, outfile) ! outfile.close() ! os.chmod(outfile.name, 0664) ! return outpath def push_pep(htmlfiles, txtfiles, username, verbose): *************** *** 317,320 **** --- 384,423 ---- + PEP_TYPE_DISPATCH = {'text/plain': fixfile, + 'text/x-rst': fix_rst_pep} + PEP_TYPE_MESSAGES = {} + + def check_requirements(): + # Check Python: + try: + from email.Utils import parseaddr + except ImportError: + PEP_TYPE_DISPATCH['text/plain'] = None + PEP_TYPE_MESSAGES['text/plain'] = ( + 'Python %s or better required for "%%(pep_type)s" PEP ' + 'processing; %s present (%%(inpath)s).' + % (REQUIRES['python'], sys.version.split()[0])) + # Check Docutils: + try: + import docutils + except ImportError: + PEP_TYPE_DISPATCH['text/x-rst'] = None + PEP_TYPE_MESSAGES['text/x-rst'] = ( + 'Docutils not present for "%(pep_type)s" PEP file %(inpath)s. ' + 'See README.txt for installation.') + else: + if docutils.__version__ < REQUIRES['docutils']: + PEP_TYPE_DISPATCH['text/x-rst'] = None + PEP_TYPE_MESSAGES['text/x-rst'] = ( + 'Docutils must be reinstalled for "%%(pep_type)s" PEP ' + 'processing (%%(inpath)s). Version %s or better required; ' + '%s present. See README.txt for installation.' + % (REQUIRES['docutils'], docutils.__version__)) + + def pep_type_error(inpath, pep_type): + print >> sys.stderr, 'Error: ' + PEP_TYPE_MESSAGES[pep_type] % locals() + sys.stdout.flush() + + def browse_file(pep): import webbrowser *************** *** 335,339 **** ! def main(): # defaults update = 0 --- 438,442 ---- ! def main(argv=None): # defaults update = 0 *************** *** 342,348 **** browse = 0 try: opts, args = getopt.getopt( ! sys.argv[1:], 'bihqu:', ['browse', 'install', 'help', 'quiet', 'user=']) except getopt.error, msg: --- 445,456 ---- browse = 0 + check_requirements() + + if argv is None: + argv = sys.argv[1:] + try: opts, args = getopt.getopt( ! argv, 'bihqu:', ['browse', 'install', 'help', 'quiet', 'user=']) except getopt.error, msg: *************** *** 368,372 **** peptxt.append(file) newfile = make_html(file, verbose=verbose) ! html.append(newfile) if browse and not update: browse_file(pep) --- 476,481 ---- peptxt.append(file) newfile = make_html(file, verbose=verbose) ! if newfile: ! html.append(newfile) if browse and not update: browse_file(pep) *************** *** 374,383 **** # do them all peptxt = [] files = glob.glob("pep-*.txt") files.sort() for file in files: peptxt.append(file) ! make_html(file, verbose=verbose) ! html = ["pep-*.html"] if browse and not update: browse_file("0") --- 483,494 ---- # do them all peptxt = [] + html = [] files = glob.glob("pep-*.txt") files.sort() for file in files: peptxt.append(file) ! newfile = make_html(file, verbose=verbose) ! if newfile: ! html.append(newfile) if browse and not update: browse_file("0") From bwarsaw@users.sourceforge.net Mon Aug 26 17:55:25 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:55:25 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.208,1.209 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28350 Modified Files: pep-0000.txt Log Message: PEP 9 has been renamed, and PEP 12 was added. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.208 retrieving revision 1.209 diff -C2 -d -r1.208 -r1.209 *** pep-0000.txt 5 Aug 2002 17:34:06 -0000 1.208 --- pep-0000.txt 26 Aug 2002 16:55:22 -0000 1.209 *************** *** 38,44 **** I 7 Style Guide for C Code van Rossum I 8 Style Guide for Python Code van Rossum, Warsaw ! I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw I 11 Removing support for little used platforms von Loewis Other Informational PEPs --- 38,45 ---- I 7 Style Guide for C Code van Rossum I 8 Style Guide for Python Code van Rossum, Warsaw ! I 9 Sample Plaintext PEP Template Warsaw I 10 Voting Guidelines Warsaw I 11 Removing support for little used platforms von Loewis + I 12 Sample reStructuredText PEP Template Goodger, Warsaw Other Informational PEPs *************** *** 179,185 **** I 7 Style Guide for C Code van Rossum I 8 Style Guide for Python Code van Rossum, Warsaw ! I 9 Sample PEP Template Warsaw I 10 Voting Guidelines Warsaw I 11 Removing support for little used platforms von Loewis I 42 Small Feature Requests Hylton --- 180,187 ---- I 7 Style Guide for C Code van Rossum I 8 Style Guide for Python Code van Rossum, Warsaw ! I 9 Sample Plaintext PEP Template Warsaw I 10 Voting Guidelines Warsaw I 11 Removing support for little used platforms von Loewis + I 12 Sample reStructuredText PEP Template Goodger, Warsaw I 42 Small Feature Requests Hylton From bwarsaw@users.sourceforge.net Mon Aug 26 17:55:58 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:55:58 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.209,1.210 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28531 Modified Files: pep-0000.txt Log Message: Update the emacs turd Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.209 retrieving revision 1.210 diff -C2 -d -r1.209 -r1.210 *** pep-0000.txt 26 Aug 2002 16:55:22 -0000 1.209 --- pep-0000.txt 26 Aug 2002 16:55:56 -0000 1.210 *************** *** 377,379 **** --- 377,381 ---- mode: indented-text indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Aug 26 17:58:33 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 09:58:33 -0700 Subject: [Python-checkins] python/nondist/peps .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv29272 Modified Files: .cvsignore Log Message: Ignore docutils artifacts Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/nondist/peps/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 25 Jul 2000 03:25:14 -0000 1.1 --- .cvsignore 26 Aug 2002 16:58:31 -0000 1.2 *************** *** 1 **** --- 1,2 ---- pep-????.html + docutils* From bwarsaw@users.sourceforge.net Mon Aug 26 18:02:11 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 10:02:11 -0700 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30513 Modified Files: pep2html.py Log Message: push_pep(): Be sure the reST pep.css file gets pushed out too. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** pep2html.py 26 Aug 2002 16:54:54 -0000 1.40 --- pep2html.py 26 Aug 2002 17:02:09 -0000 1.41 *************** *** 375,378 **** --- 375,379 ---- files.extend(txtfiles) files.append("style.css") + files.append("pep.css") filelist = SPACE.join(files) rc = os.system("scp %s %s %s" % (quiet, filelist, target)) From tim_one@users.sourceforge.net Mon Aug 26 18:06:07 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 26 Aug 2002 10:06:07 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes cleanarch,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv31566 Modified Files: cleanarch Log Message: "From " is a header more than a separator, so don't bump the msg count at the end. Index: cleanarch =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/cleanarch,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cleanarch 20 Aug 2002 19:08:44 -0000 1.1 --- cleanarch 26 Aug 2002 17:06:04 -0000 1.2 *************** *** 150,155 **** print >> sys.stderr statuscnt = 0 ! # We've found `messages' separators, so the number of messages is +1 ! messages += 1 print >> sys.stderr, messages, 'messages found' --- 150,154 ---- print >> sys.stderr statuscnt = 0 ! print >> sys.stderr, messages, 'messages found' From bwarsaw@users.sourceforge.net Mon Aug 26 19:11:51 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 11:11:51 -0700 Subject: [Python-checkins] python/nondist/peps pep-0299.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26432 Added Files: pep-0299.txt Log Message: PEP 299, Special __main__() function in modules, Jeff Epler --- NEW FILE: pep-0299.txt --- PEP: 299 Title: Special __main__() function in modules Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/08/26 18:11:49 $ Author: Jeff Epler Status: Draft Type: Standards Track Created: 12-Aug-2002 Python-version: 2.3 Post-History: Abstract Many Python modules are also intended to be callable as standalone scripts. This PEP proposes that a special function called __main__() should serve this purpose. Motivation There should be one simple and universal idiom for invoking a module as a standalone script. The semi-standard idiom if __name__ == '__main__': perform "standalone" functionality is unclear to programmers of languages like C and C++. It also does not permit invocation of the standalone function when the module is imported. The variant if __name__ == '__main__': main_function() is sometimes seen, but there exists no standard name for the function, and because arguments are taken from sys.argv it is not possible to pass specific arguments without changing the argument list seen by all other modules. (Imagine a threaded Python program, with two threads wishing to invoke the standalone functionality of different modules with different argument lists) Proposal The standard name of the 'main function' should be '__main__'. When a module is invoked on the command line, such as python mymodule.py then the module behaves as though the following lines existed at the end of the module (except that the attribute __sys may not be used or assumed to exist elsewhere in the script): if globals().has_key("__main__"): import sys as __sys __sys.exit(__main__(__sys.argv)) Other modules may execute import mymodule mymodule.__main__(['mymodule', ...]) It is up to mymodule to document thread-safety issues or other issues which might restrict use of __main__. (Other issues might include use of mutually exclusive GUI modules, non-sharable resources like hardware devices, reassignment of sys.stdin/stdout, etc) Implementation In modules/main.c, the block near line 385 (after the PyRun_AnyFileExFlags call) will be changed so that the above code (or its C equivalent) is executed. Open Issues - Should the return value from __main__ be treated as the exit value? Yes. Many __main__ will naturally return None, which sys.exit translates into a "success" return code. In those that return a numeric result, it behaves just like the argument to sys.exit() or the return value from C's main(). - Should the argument list to __main__ include argv[0], or just the "real" arguments argv[1:]? argv[0] is included for symmetry with sys.argv and easy transition to the new standard idiom. Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From bwarsaw@users.sourceforge.net Mon Aug 26 19:12:05 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 11:12:05 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.210,1.211 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26532 Modified Files: pep-0000.txt Log Message: Added PEP 299, Special __main__() function in modules, Jeff Epler Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.210 retrieving revision 1.211 diff -C2 -d -r1.210 -r1.211 *** pep-0000.txt 26 Aug 2002 16:55:56 -0000 1.210 --- pep-0000.txt 26 Aug 2002 18:12:03 -0000 1.211 *************** *** 104,107 **** --- 104,108 ---- S 297 Support for System Upgrades Lemburg S 298 The Locked Buffer Interface Heller + S 299 Special __main__() function in modules Epler Finished PEPs (done, implemented in CVS) *************** *** 290,293 **** --- 291,295 ---- S 297 Support for System Upgrades Lemburg S 298 The Locked Buffer Interface Heller + S 299 Special __main__() function in modules Epler SR 666 Reject Foolish Indentation Creighton *************** *** 317,320 **** --- 319,323 ---- Drake, Fred fdrake@acm.org Dubois, Paul F. paul@pfdubois.com + Epler, Jeff jepler@unpythonic.net Eppstein, David eppstein@ics.uci.edu Evans, Clark C. cce@clarkevans.com From bwarsaw@users.sourceforge.net Mon Aug 26 19:23:28 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 11:23:28 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes mboxcount.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv30428 Modified Files: mboxcount.py Log Message: _factory(): Use a marker object to designate between good messages and unparseable messages. For some reason, returning None from the except clause in _factory() caused Python 2.2.1 to exit early out of the for loop. main(): Print statistics about both the number of good messages and the number of unparseable messages. Index: mboxcount.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/mboxcount.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mboxcount.py 23 Aug 2002 02:36:07 -0000 1.1 --- mboxcount.py 26 Aug 2002 18:23:26 -0000 1.2 *************** *** 31,34 **** --- 31,36 ---- program = sys.argv[0] + _marker = object() + def usage(code, msg=''): print >> sys.stderr, __doc__ *************** *** 41,54 **** return email.message_from_file(fp) except email.Errors.MessageParseError: ! return None def count(fname): fp = open(fname, 'rb') mbox = mailbox.PortableUnixMailbox(fp, _factory) ! count = 0 for msg in mbox: ! count += 1 fp.close() ! return count def main(): --- 43,60 ---- return email.message_from_file(fp) except email.Errors.MessageParseError: ! return _marker def count(fname): fp = open(fname, 'rb') mbox = mailbox.PortableUnixMailbox(fp, _factory) ! goodcount = 0 ! badcount = 0 for msg in mbox: ! if msg is _marker: ! badcount += 1 ! else: ! goodcount += 1 fp.close() ! return goodcount, badcount def main(): *************** *** 72,77 **** for fname in fnames: ! n = count(fname) ! print "%-50s %7d" % (fname, n) if __name__ == '__main__': --- 78,83 ---- for fname in fnames: ! goodn, badn = count(fname) ! print "%-50s %7d (unparseable: %d)" % (fname, goodn, badn) if __name__ == '__main__': From bwarsaw@users.sourceforge.net Mon Aug 26 19:40:54 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 11:40:54 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes mboxcount.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv3490 Modified Files: mboxcount.py Log Message: Some stats after splitting b/w good messages and unparseable messages Index: mboxcount.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/mboxcount.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mboxcount.py 26 Aug 2002 18:23:26 -0000 1.2 --- mboxcount.py 26 Aug 2002 18:40:51 -0000 1.3 *************** *** 21,24 **** --- 21,36 ---- \code\python-list-clean.mbox 85500 \code\zope3-clean.mbox 2177 + + (zope3-clean is really zope3-dev-clean.mbox) + + On Linux: + + edu-sig-clean.mbox 252 (unparseable: 0) + python-dev-clean.mbox 8325 (unparseable: 1) + mailman-developers-clean.mbox 2427 (unparseable: 0) + python-list-clean.mbox 159052 (unparseable: 22) + zope3-clean.mbox 2177 (unparseable: 0) + + (unparseable messages are likely spam) """ From tim.one@comcast.net Mon Aug 26 19:41:05 2002 From: tim.one@comcast.net (Tim Peters) Date: Mon, 26 Aug 2002 14:41:05 -0400 Subject: [Python-checkins] python/nondist/sandbox/spambayes mboxcount.py,1.1,1.2 In-Reply-To: Message-ID: [bwarsaw@users.sourceforge.net] > Modified Files: > mboxcount.py > Log Message: > _factory(): Use a marker object to designate between good messages and > unparseable messages. For some reason, returning None from the except > clause in _factory() caused Python 2.2.1 to exit early out of the for > loop. Note that I pasted this _factory function from split.py, so if this _factory was in trouble so is that one. Ditto splitn.py. GBayes.py's _factory returns an empty string, and since we don't know why None caused a problem, perhaps *any* false value does too. From bwarsaw@users.sourceforge.net Mon Aug 26 20:09:48 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 26 Aug 2002 12:09:48 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes split.py,1.4,1.5 splitn.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv12606 Modified Files: split.py splitn.py Log Message: _factory(): Return the empty string instead of None in the except clauses, so that for-loops won't break prematurely. mailbox.py's base class defines an __iter__() that raises a StopIteration on None return. Index: split.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/split.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** split.py 23 Aug 2002 02:11:57 -0000 1.4 --- split.py 26 Aug 2002 19:09:46 -0000 1.5 *************** *** 48,52 **** return email.message_from_file(fp) except email.Errors.MessageParseError: ! return None --- 48,52 ---- return email.message_from_file(fp) except email.Errors.MessageParseError: ! return '' Index: splitn.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/splitn.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** splitn.py 23 Aug 2002 15:17:42 -0000 1.1 --- splitn.py 26 Aug 2002 19:09:46 -0000 1.2 *************** *** 58,62 **** return email.message_from_file(fp) except email.Errors.MessageParseError: ! return None def main(): --- 58,62 ---- return email.message_from_file(fp) except email.Errors.MessageParseError: ! return '' def main(): From barry@wooz.org Mon Aug 26 20:10:55 2002 From: barry@wooz.org (Barry A. Warsaw) Date: Mon, 26 Aug 2002 15:10:55 -0400 Subject: [Python-checkins] python/nondist/sandbox/spambayes mboxcount.py,1.1,1.2 References: Message-ID: <15722.32063.144365.669500@anthem.wooz.org> >>>>> "TP" == Tim Peters writes: TP> Note that I pasted this _factory function from split.py, so if TP> this _factory was in trouble so is that one. Ditto splitn.py. TP> GBayes.py's _factory returns an empty string, and since we TP> don't know why None caused a problem, perhaps *any* false TP> value does too. It's because of the __iter__() definition in the mailbox.py base class, which raises StopIterator on None return. I'll change both these other modules to return the empty string. -Barry From tim_one@users.sourceforge.net Mon Aug 26 19:55:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 26 Aug 2002 11:55:28 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.12,1.13 mboxcount.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv8109 Modified Files: GBayes.py mboxcount.py Log Message: Whitespace normalization (and some ambiguous tabs snuck into mboxcount). Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GBayes.py 23 Aug 2002 15:42:48 -0000 1.12 --- GBayes.py 26 Aug 2002 18:55:26 -0000 1.13 *************** *** 141,220 **** ! ! ! ! ! ! ! !
!

! HGH Spray
Human ! Growth Hormone ! Releaser

!
!
!


As seen on NBC, CBS, CNN, and even Oprah! The health ! discovery that actually reverses aging while burning fat, without ! dieting or exercise! This proven discovery has even been reported ! on by the New England Journal of Medicine. Forget aging and dieting ! forever! 
And it's Guaranteed!  

! Click ! Here

!
!

Would ! you like to lose weight while you sleep!
No dieting!
No hunger ! pains!
No Cravings!
No strenuous exercise!
Change your life ! forever!

!
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
1.Body Fat Loss82% improvement.
2.Wrinkle Reduction61% improvement.
3.Energy Level84% improvement.
4.Muscle Strength88% improvement.
5.Virility75% improvement.
6.Emotional Stability67% improvement.
7.Memory62% improvement.
!

!

100% ! GUARANTEED!

!

! Click ! Here


!
--- 141,220 ---- ! ! ! ! ! ! ! !
!

! HGH Spray
Human ! Growth Hormone ! Releaser

!
!
!


As seen on NBC, CBS, CNN, and even Oprah! The health ! discovery that actually reverses aging while burning fat, without ! dieting or exercise! This proven discovery has even been reported ! on by the New England Journal of Medicine. Forget aging and dieting ! forever! 
And it's Guaranteed!  

! Click ! Here

!
!

Would ! you like to lose weight while you sleep!
No dieting!
No hunger ! pains!
No Cravings!
No strenuous exercise!
Change your life ! forever!

!
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
1.Body Fat Loss82% improvement.
2.Wrinkle Reduction61% improvement.
3.Energy Level84% improvement.
4.Muscle Strength88% improvement.
5.Virility75% improvement.
6.Emotional Stability67% improvement.
7.Memory62% improvement.
!

!

100% ! GUARANTEED!

!

! Click ! Here


!
Index: mboxcount.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/mboxcount.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mboxcount.py 26 Aug 2002 18:40:51 -0000 1.3 --- mboxcount.py 26 Aug 2002 18:55:26 -0000 1.4 *************** *** 63,70 **** badcount = 0 for msg in mbox: ! if msg is _marker: ! badcount += 1 ! else: ! goodcount += 1 fp.close() return goodcount, badcount --- 63,70 ---- badcount = 0 for msg in mbox: ! if msg is _marker: ! badcount += 1 ! else: ! goodcount += 1 fp.close() return goodcount, badcount From tim_one@users.sourceforge.net Mon Aug 26 21:45:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 26 Aug 2002 13:45:28 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes mboxcount.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv13516 Modified Files: mboxcount.py Log Message: Updated stats to what Barry and I both get now. Fiddled output. Index: mboxcount.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/mboxcount.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mboxcount.py 26 Aug 2002 18:55:26 -0000 1.4 --- mboxcount.py 26 Aug 2002 20:45:25 -0000 1.5 *************** *** 14,36 **** """ ! Stats for Barry's corpora, as of 22-Aug-2002: ! ! \code\edu-sig-clean.mbox 252 ! \code\python-dev-clean.mbox 8326 ! \code\mailman-developers-clean.mbox 2427 ! \code\python-list-clean.mbox 85500 ! \code\zope3-clean.mbox 2177 ! ! (zope3-clean is really zope3-dev-clean.mbox) ! ! On Linux: ! edu-sig-clean.mbox 252 (unparseable: 0) ! python-dev-clean.mbox 8325 (unparseable: 1) ! mailman-developers-clean.mbox 2427 (unparseable: 0) ! python-list-clean.mbox 159052 (unparseable: 22) ! zope3-clean.mbox 2177 (unparseable: 0) ! (unparseable messages are likely spam) """ --- 14,29 ---- """ ! Stats for Barry's corpora, as of 26-Aug-2002, using then-current 2.3a0: ! edu-sig-clean.mbox 252 (+ unparseable: 0) ! python-dev-clean.mbox 8326 (+ unparseable: 0) ! mailman-developers-clean.mbox 2427 (+ unparseable: 0) ! python-list-clean.mbox 159072 (+ unparseable: 2) ! zope3-clean.mbox 2177 (+ unparseable: 0) ! Unparseable messages are likely spam. ! zope3-clean.mbox is really from the zope3-dev mailing list. ! The Python version matters because the email package varies across releases ! in whether it uses strict or lax parsing. """ *************** *** 91,95 **** for fname in fnames: goodn, badn = count(fname) ! print "%-50s %7d (unparseable: %d)" % (fname, goodn, badn) if __name__ == '__main__': --- 84,88 ---- for fname in fnames: goodn, badn = count(fname) ! print "%-35s %7d (+ unparseable: %d)" % (fname, goodn, badn) if __name__ == '__main__': From fdrake@users.sourceforge.net Mon Aug 26 22:15:16 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 26 Aug 2002 14:15:16 -0700 Subject: [Python-checkins] python/dist/src/Python importdl.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24871 Modified Files: importdl.c Log Message: Simplify, and avoid PyModule_GetDict() while we're at it. Index: importdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/importdl.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** importdl.c 16 Oct 2001 20:07:34 -0000 2.69 --- importdl.c 26 Aug 2002 21:15:11 -0000 2.70 *************** *** 22,26 **** _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) { ! PyObject *m, *d, *s; char *lastdot, *shortname, *packagecontext, *oldcontext; dl_funcptr p; --- 22,26 ---- _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) { ! PyObject *m; char *lastdot, *shortname, *packagecontext, *oldcontext; dl_funcptr p; *************** *** 65,73 **** } /* Remember the filename as the __file__ attribute */ ! d = PyModule_GetDict(m); ! s = PyString_FromString(pathname); ! if (s == NULL || PyDict_SetItemString(d, "__file__", s) != 0) PyErr_Clear(); /* Not important enough to report */ - Py_XDECREF(s); if (Py_VerboseFlag) PySys_WriteStderr( --- 65,70 ---- } /* Remember the filename as the __file__ attribute */ ! if (PyModule_AddStringConstant(m, "__file__", pathname) < 0) PyErr_Clear(); /* Not important enough to report */ if (Py_VerboseFlag) PySys_WriteStderr( From fdrake@users.sourceforge.net Mon Aug 26 22:20:32 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 26 Aug 2002 14:20:32 -0700 Subject: [Python-checkins] python/dist/src/Python dynload_win.c,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26696 Modified Files: dynload_win.c Log Message: Fix a couple of whitespace consistency nits. Index: dynload_win.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/dynload_win.c,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** dynload_win.c 30 Jun 2002 15:26:10 -0000 2.11 --- dynload_win.c 26 Aug 2002 21:20:30 -0000 2.12 *************** *** 218,227 **** } PyErr_SetString(PyExc_ImportError, errBuf); ! return NULL; } else { char buffer[256]; PyOS_snprintf(buffer, sizeof(buffer), "python%d%d.dll", ! PY_MAJOR_VERSION,PY_MINOR_VERSION); import_python = GetPythonImport(hDLL); --- 218,227 ---- } PyErr_SetString(PyExc_ImportError, errBuf); ! return NULL; } else { char buffer[256]; PyOS_snprintf(buffer, sizeof(buffer), "python%d%d.dll", ! PY_MAJOR_VERSION,PY_MINOR_VERSION); import_python = GetPythonImport(hDLL); From fdrake@users.sourceforge.net Tue Aug 27 17:35:01 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 09:35:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools mkhowto,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv14224 Modified Files: mkhowto Log Message: Don't use tempfile.mktemp(), since it produces annoying warnings, and usually isn't what we want anyway. Index: mkhowto =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkhowto,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** mkhowto 4 Dec 2001 16:32:04 -0000 1.31 --- mkhowto 27 Aug 2002 16:34:54 -0000 1.32 *************** *** 44,48 **** import string import sys - import tempfile --- 44,47 ---- *************** *** 266,273 **** if os.path.exists(self.log_filename): os.unlink(self.log_filename) ! if os.path.exists(self.doc + ".l2h"): ! self.l2h_aux_init_file = tempfile.mktemp() ! else: ! self.l2h_aux_init_file = self.doc + ".l2h" self.write_l2h_aux_init_file() --- 265,274 ---- if os.path.exists(self.log_filename): os.unlink(self.log_filename) ! l2hconf = self.doc + ".l2h" ! if os.path.exists(l2hconf): ! if os.path.exists(l2hconf + "~"): ! os.unlink(l2hconf + "~") ! os.rename(l2hconf, l2hconf + "~") ! self.l2h_aux_init_file = self.doc + ".l2h" self.write_l2h_aux_init_file() From fdrake@users.sourceforge.net Tue Aug 27 17:42:40 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 09:42:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librexec.tex,1.14.12.2,1.14.12.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18194/Doc/lib Modified Files: Tag: release21-maint librexec.tex Log Message: Add strong security warning about the rexec module. Closes SF patch #600861. Index: librexec.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librexec.tex,v retrieving revision 1.14.12.2 retrieving revision 1.14.12.3 diff -C2 -d -r1.14.12.2 -r1.14.12.3 *** librexec.tex 31 May 2002 21:19:53 -0000 1.14.12.2 --- librexec.tex 27 Aug 2002 16:42:37 -0000 1.14.12.3 *************** *** 6,10 **** - This module contains the \class{RExec} class, which supports \method{r_eval()}, \method{r_execfile()}, \method{r_exec()}, and --- 6,9 ---- *************** *** 15,18 **** --- 14,27 ---- only have access to modules and functions that are deemed safe; you can subclass \class{RExec} to add or remove capabilities as desired. + + \strong{Warning:} + While the \module{rexec} module is designed to perform as described + below, it does have a few known vulnerabilities which could be + exploited by carefully written code. Thus it should not be relied + upon in situations requiring ``production ready'' security. In such + situations, execution via sub-processes or very careful ``cleansing'' + of both code and data to be processed may be necessary. + Alternatively, help in patching known \module{rexec} vulnerabilities + would be welcomed. \emph{Note:} The \class{RExec} class can prevent code from performing From fdrake@users.sourceforge.net Tue Aug 27 17:44:20 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 09:44:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librexec.tex,1.18.8.1,1.18.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18990/Doc/lib Modified Files: Tag: release22-maint librexec.tex Log Message: Add strong security warning about the rexec module. Closes SF patch #600861. Minor markup changes. Index: librexec.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librexec.tex,v retrieving revision 1.18.8.1 retrieving revision 1.18.8.2 diff -C2 -d -r1.18.8.1 -r1.18.8.2 *** librexec.tex 31 May 2002 21:17:53 -0000 1.18.8.1 --- librexec.tex 27 Aug 2002 16:44:18 -0000 1.18.8.2 *************** *** 6,10 **** - This module contains the \class{RExec} class, which supports \method{r_eval()}, \method{r_execfile()}, \method{r_exec()}, and --- 6,9 ---- *************** *** 16,23 **** can subclass \class{RExec} to add or remove capabilities as desired. ! \note{The \class{RExec} class can prevent code from performing ! unsafe operations like reading or writing disk files, or using TCP/IP ! sockets. However, it does not protect against code using extremely ! large amounts of memory or processor time.} \begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}} --- 15,35 ---- can subclass \class{RExec} to add or remove capabilities as desired. ! \begin{notice}[warning] ! While the \module{rexec} module is designed to perform as described ! below, it does have a few known vulnerabilities which could be ! exploited by carefully written code. Thus it should not be relied ! upon in situations requiring ``production ready'' security. In such ! situations, execution via sub-processes or very careful ! ``cleansing'' of both code and data to be processed may be ! necessary. Alternatively, help in patching known \module{rexec} ! vulnerabilities would be welcomed. ! \end{notice} ! ! \begin{notice} ! The \class{RExec} class can prevent code from performing unsafe ! operations like reading or writing disk files, or using TCP/IP ! sockets. However, it does not protect against code using extremely ! large amounts of memory or processor time. ! \end{notice} \begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}} From fdrake@users.sourceforge.net Tue Aug 27 17:46:08 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 09:46:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib librexec.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19759/Doc/lib Modified Files: librexec.tex Log Message: Add strong security warning about the rexec module. Closes SF patch #600861. Minor markup changes. Index: librexec.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librexec.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** librexec.tex 31 May 2002 21:12:53 -0000 1.19 --- librexec.tex 27 Aug 2002 16:46:06 -0000 1.20 *************** *** 6,10 **** - This module contains the \class{RExec} class, which supports \method{r_eval()}, \method{r_execfile()}, \method{r_exec()}, and --- 6,9 ---- *************** *** 16,23 **** can subclass \class{RExec} to add or remove capabilities as desired. ! \note{The \class{RExec} class can prevent code from performing ! unsafe operations like reading or writing disk files, or using TCP/IP ! sockets. However, it does not protect against code using extremely ! large amounts of memory or processor time.} \begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}} --- 15,35 ---- can subclass \class{RExec} to add or remove capabilities as desired. ! \begin{notice}[warning] ! While the \module{rexec} module is designed to perform as described ! below, it does have a few known vulnerabilities which could be ! exploited by carefully written code. Thus it should not be relied ! upon in situations requiring ``production ready'' security. In such ! situations, execution via sub-processes or very careful ! ``cleansing'' of both code and data to be processed may be ! necessary. Alternatively, help in patching known \module{rexec} ! vulnerabilities would be welcomed. ! \end{notice} ! ! \begin{notice} ! The \class{RExec} class can prevent code from performing unsafe ! operations like reading or writing disk files, or using TCP/IP ! sockets. However, it does not protect against code using extremely ! large amounts of memory or processor time. ! \end{notice} \begin{classdesc}{RExec}{\optional{hooks\optional{, verbose}}} From nowonder@users.sourceforge.net Tue Aug 27 17:58:05 2002 From: nowonder@users.sourceforge.net (nowonder@users.sourceforge.net) Date: Tue, 27 Aug 2002 09:58:05 -0700 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.264,2.265 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv23900 Modified Files: bltinmodule.c Log Message: 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.264 retrieving revision 2.265 diff -C2 -d -r2.264 -r2.265 *** bltinmodule.c 16 Aug 2002 07:04:56 -0000 2.264 --- bltinmodule.c 27 Aug 2002 16:58:00 -0000 2.265 *************** *** 554,558 **** if (!exists) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } --- 554,558 ---- if (!exists) { ! PyErr_SetFromErrnoWithFilename(PyExc_IOError, filename); return NULL; } From fdrake@users.sourceforge.net Tue Aug 27 19:41:29 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 11:41:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/api refcounts.dat,1.23.4.1,1.23.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv14755 Modified Files: Tag: release21-maint refcounts.dat Log Message: Correct some return value information. Index: refcounts.dat =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/refcounts.dat,v retrieving revision 1.23.4.1 retrieving revision 1.23.4.2 diff -C2 -d -r1.23.4.1 -r1.23.4.2 *** refcounts.dat 10 Jul 2001 16:19:26 -0000 1.23.4.1 --- refcounts.dat 27 Aug 2002 18:41:26 -0000 1.23.4.2 *************** *** 1201,1205 **** PyUnicode_Tailmatch:int:direction:: ! PyUnicode_Find:PyObject*::+1: PyUnicode_Find:PyObject*:str:0: PyUnicode_Find:PyObject*:substr:0: --- 1201,1205 ---- PyUnicode_Tailmatch:int:direction:: ! PyUnicode_Find:int::: PyUnicode_Find:PyObject*:str:0: PyUnicode_Find:PyObject*:substr:0: *************** *** 1208,1212 **** PyUnicode_Find:int:direction:: ! PyUnicode_Count:PyObject*::+1: PyUnicode_Count:PyObject*:str:0: PyUnicode_Count:PyObject*:substr:0: --- 1208,1212 ---- PyUnicode_Find:int:direction:: ! PyUnicode_Count:int::: PyUnicode_Count:PyObject*:str:0: PyUnicode_Count:PyObject*:substr:0: From fdrake@users.sourceforge.net Tue Aug 27 20:50:45 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 12:50:45 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.73.2.2,1.73.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv9144/texinputs Modified Files: Tag: release21-maint python.sty Log Message: Back-port the \ulink macro to the documentation package for Python 2.1.x since a documentation patch included \ulink. Adding this here makes back-porting further documentation patches easier than having to remove \ulink from the patches. Closes SF bug #598996. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.73.2.2 retrieving revision 1.73.2.3 diff -C2 -d -r1.73.2.2 -r1.73.2.3 *** python.sty 22 Jun 2001 15:51:28 -0000 1.73.2.2 --- python.sty 27 Aug 2002 19:50:42 -0000 1.73.2.3 *************** *** 857,860 **** --- 857,875 ---- \newcommand{\longprogramopt}[1]{\strong{-{}-#1}} + % \ulink{link text}{URL} + \@ifundefined{pdfannotlink}{ + \newcommand{\ulink}[2]{#1} + }{ + % The \noindent here is a hack -- we're forcing pdfTeX into + % horizontal mode since \pdfstartlink requires that. + \newcommand{\ulink}[2]{\noindent{% + \pdfstartlink attr{/Border [0 0 0]} user{/S /URI /URI (#2)}% + \py@LinkColor% color of the link text + #1% + \py@NormalColor% Turn it back off; these are declarative + \pdfendlink}% and don't appear bound to the current + }% formatting "box". + } + % cited titles: \citetitle{Title of Work} % online: \citetitle[url-to-resource]{Title of Work} From fdrake@users.sourceforge.net Tue Aug 27 20:50:44 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 27 Aug 2002 12:50:44 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.98.2.5,1.98.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv9144/perl Modified Files: Tag: release21-maint python.perl Log Message: Back-port the \ulink macro to the documentation package for Python 2.1.x since a documentation patch included \ulink. Adding this here makes back-porting further documentation patches easier than having to remove \ulink from the patches. Closes SF bug #598996. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.98.2.5 retrieving revision 1.98.2.6 diff -C2 -d -r1.98.2.5 -r1.98.2.6 *** python.perl 3 Apr 2002 03:36:47 -0000 1.98.2.5 --- python.perl 27 Aug 2002 19:50:42 -0000 1.98.2.6 *************** *** 324,327 **** --- 324,334 ---- } + sub do_cmd_ulink{ + local($_) = @_; + my $text = next_argument(); + my $url = next_argument(); + return "$text" . $_; + } + sub do_cmd_citetitle{ local($_) = @_; From tim_one@users.sourceforge.net Tue Aug 27 23:10:07 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 27 Aug 2002 15:10:07 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes Tester.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv3215 Added Files: Tester.py Log Message: A start at a testing class. There isn't a lot here, but it automates much of the tedium, and as the doctest shows it can already do useful things, like remembering which inputs were misclassified. --- NEW FILE: Tester.py --- class Test: # Pass a classifier instance (an instance of GrahamBayes). # Loop: # Optional: # Train it, via train(). # reset_test_results() # Loop: # invoke predict() with (probably new) examples # Optional: # suck out the results, via instance vrbls and # false_negative_rate(), false_positive_rate(), # false_negatives(), and false_positives() def __init__(self, classifier): self.classifier = classifier # The number of ham and spam instances in the training data. self.nham = self.nspam = 0 self.reset_test_results() def reset_test_results(self): # The number of ham and spam instances tested. self.nham_tested = self.nspam_tested = 0 # The number of test instances correctly and incorrectly classified. self.nham_right = 0 self.nham_wrong = 0 self.nspam_right = 0 self.nspam_wrong = 0 # Lists of bad predictions. self.ham_wrong_examples = [] # False positives: ham called spam. self.spam_wrong_examples = [] # False negatives: spam called ham. # Train the classifier on streams of ham and spam. Updates probabilities # before returning. def train(self, hamstream=None, spamstream=None): learn = self.classifier.learn if hamstream is not None: for example in hamstream: learn(example, False, False) self.nham += 1 if spamstream is not None: for example in spamstream: learn(example, True, False) self.nspam += 1 self.classifier.update_probabilities() # Run prediction on each sample in stream. You're swearing that stream # is entirely composed of spam (is_spam True), or of ham (is_spam False). # Note that mispredictions are saved, and can be retrieved later via # false_negatives (ham mistakenly called spam) and false_positives (spam # mistakenly called ham). For this reason, you may wish to wrap examples # 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: self.nspam_tested += 1 if correct: self.nspam_right += 1 else: self.nspam_wrong += 1 self.spam_wrong_examples.append(example) else: self.nham_tested += 1 if correct: self.nham_right += 1 else: self.nham_wrong += 1 self.ham_wrong_examples.append(example) assert self.nham_right + self.nham_wrong == self.nham_tested assert self.nspam_right + self.nspam_wrong == self.nspam_tested def false_positive_rate(self): return float(self.nham_wrong) / self.nham_tested def false_negative_rate(self): return float(self.nspam_wrong) / self.nspam_tested def false_positives(self): return self.ham_wrong_examples def false_negatives(self): return self.spam_wrong_examples class _Example: def __init__(self, name, words): self.name = name self.words = words def __iter__(self): return iter(self.words) _easy_test = """ >>> from classifier import GrahamBayes >>> good1 = _Example('', ['a', 'b', 'c'] * 10) >>> good2 = _Example('', ['a', 'b'] * 10) >>> bad1 = _Example('', ['d'] * 10) >>> t = Test(GrahamBayes()) >>> t.train([good1, good2], [bad1]) >>> t.reset_test_results() >>> t.predict([_Example('goodham', ['a', 'b']), ... _Example('badham', ['d']) ... ], False) >>> t.predict([_Example('goodspam', ['d', 'd']), ... _Example('badspam1', ['c']), ... _Example('badspam2', ['a'] * 15 + ['d'] * 1000), ... _Example('badspam3', ['d', 'a', 'b', 'c']) ... ], True) >>> t.nham_tested 2 >>> t.nham_right, t.nham_wrong (1, 1) >>> t.false_positive_rate() 0.5 >>> [e.name for e in t.false_positives()] ['badham'] >>> t.nspam_tested 4 >>> t.nspam_right, t.nspam_wrong (1, 3) >>> t.false_negative_rate() 0.75 >>> [e.name for e in t.false_negatives()] ['badspam1', 'badspam2', 'badspam3'] """ __test__ = {'easy': _easy_test} def _test(): import doctest, Tester doctest.testmod(Tester) if __name__ == '__main__': _test() From bwarsaw@users.sourceforge.net Tue Aug 27 23:34:46 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 27 Aug 2002 15:34:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv14044 Modified Files: Message.py Log Message: Typo Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Message.py 23 Aug 2002 18:19:30 -0000 1.19 --- Message.py 27 Aug 2002 22:34:44 -0000 1.20 *************** *** 58,62 **** ! class Message: """Basic message object for use inside the object tree. --- 58,62 ---- ! class Message: """Basic message object for use inside the object tree. From bwarsaw@users.sourceforge.net Tue Aug 27 23:38:52 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 27 Aug 2002 15:38:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv15609 Modified Files: test_email.py Log Message: Whitespace normalization. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_email.py 20 Aug 2002 14:51:10 -0000 1.5 --- test_email.py 27 Aug 2002 22:38:50 -0000 1.6 *************** *** 1764,1768 **** def test_three_lines(self): # A bug report by Andrew McNamara ! lines = ['From: Andrew Person Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9655 Modified Files: libexcs.tex Log Message: Note change in behavior from 1.5.2. The new argument to NameError is an error message and not just the missing name. Closes SF Bug 599869. Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** libexcs.tex 14 Aug 2002 16:40:54 -0000 1.47 --- libexcs.tex 27 Aug 2002 23:53:23 -0000 1.48 *************** *** 207,212 **** \begin{excdesc}{NameError} Raised when a local or global name is not found. This applies only ! to unqualified names. The associated value is the name that could ! not be found. \end{excdesc} --- 207,212 ---- \begin{excdesc}{NameError} Raised when a local or global name is not found. This applies only ! to unqualified names. The associated value is an error message that ! includes the name that could not be found. \end{excdesc} From rhettinger@users.sourceforge.net Wed Aug 28 00:54:59 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 27 Aug 2002 16:54:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.43,1.43.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11297 Modified Files: Tag: release22-maint libexcs.tex Log Message: Note change in behavior from 1.5.2. The new argument to NameError is an error message and not just the missing name. Closes SF Bug 599869. Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.43 retrieving revision 1.43.6.1 diff -C2 -d -r1.43 -r1.43.6.1 *** libexcs.tex 28 Nov 2001 07:26:15 -0000 1.43 --- libexcs.tex 27 Aug 2002 23:54:57 -0000 1.43.6.1 *************** *** 207,212 **** \begin{excdesc}{NameError} Raised when a local or global name is not found. This applies only ! to unqualified names. The associated value is the name that could ! not be found. \end{excdesc} --- 207,212 ---- \begin{excdesc}{NameError} Raised when a local or global name is not found. This applies only ! to unqualified names. The associated value is an error message that ! includes the name that could not be found. \end{excdesc} From montanaro@users.sourceforge.net Wed Aug 28 01:43:46 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 27 Aug 2002 17:43:46 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv29136 Modified Files: GBayes.py Log Message: add simple trigram tokenizer - this seems to yield the best results I've seen so far (but has not been extensively tested) Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GBayes.py 26 Aug 2002 18:55:26 -0000 1.13 --- GBayes.py 28 Aug 2002 00:43:44 -0000 1.14 *************** *** 108,111 **** --- 108,116 ---- return tokenize_ngram(string, 15) + def tokenize_trigram(string): + r"""tokenize w/ re '[\w$-]+', result squished to 3-char runs""" + lst = "".join(_token_re.findall(string)) + return tokenize_ngram(string, 3) + # add user-visible string as key and function as value - function's docstring # serves as help string when -H is used, so keep it brief! *************** *** 119,122 **** --- 124,128 ---- "split": tokenize_split, "split_fold": tokenize_split_foldcase, + "trigram": tokenize_trigram, "words": tokenize_words, "words_fold": tokenize_words_foldcase, From montanaro@users.sourceforge.net Wed Aug 28 01:45:33 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 27 Aug 2002 17:45:33 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes setup.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv29779 Added Files: setup.py Log Message: trivial little setup.py file - i don't expect most people will be interested in this, but it makes it a tad simpler to work with now that there are two files --- NEW FILE: setup.py --- from distutils.core import setup setup( name='spambayes', scripts=['GBayes.py'], py_modules=['classifier'] ) From skip@pobox.com Wed Aug 28 01:50:25 2002 From: skip@pobox.com (Skip Montanaro) Date: Tue, 27 Aug 2002 19:50:25 -0500 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.43,1.43.6.1 In-Reply-To: References: Message-ID: <15724.7761.824921.958955@12-248-11-90.client.attbi.com> Raymond> Note change in behavior from 1.5.2. The new argument to Raymond> NameError is an error message and not just the missing name. It seems to me that somewhere in the docs it would be worthwhile to state Messages to exceptions are not part of the Python API. Their contents may change from one version of Python to the next without warning and should not be relied on for code which will be run with multiple versions of the interpreter. Skip From guido@python.org Wed Aug 28 01:57:04 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 27 Aug 2002 20:57:04 -0400 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.43,1.43.6.1 In-Reply-To: Your message of "Tue, 27 Aug 2002 19:50:25 CDT." <15724.7761.824921.958955@12-248-11-90.client.attbi.com> References: <15724.7761.824921.958955@12-248-11-90.client.attbi.com> Message-ID: <200208280057.g7S0v4010931@pcp02138704pcs.reston01.va.comcast.net> > Raymond> Note change in behavior from 1.5.2. The new argument to > Raymond> NameError is an error message and not just the missing name. > > It seems to me that somewhere in the docs it would be worthwhile to state > > Messages to exceptions are not part of the Python API. Their contents > may change from one version of Python to the next without warning and > should not be relied on for code which will be run with multiple > versions of the interpreter. > > Skip Good idea! --Guido van Rossum (home page: http://www.python.org/~guido/) From neal@metaslash.com Wed Aug 28 02:06:36 2002 From: neal@metaslash.com (Neal Norwitz) Date: Tue, 27 Aug 2002 21:06:36 -0400 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.13,1.14 References: Message-ID: <3D6C221C.B7132DC3@metaslash.com> montanaro@users.sourceforge.net wrote: > > *** 108,111 **** > --- 108,116 ---- > return tokenize_ngram(string, 15) > > + def tokenize_trigram(string): > + r"""tokenize w/ re '[\w$-]+', result squished to 3-char runs""" > + lst = "".join(_token_re.findall(string)) > + return tokenize_ngram(string, 3) Hmmm, lst is not used, should lst be passed to tokenize_ngram? Also, lst isn't a list, it's a string. Neal From skip@pobox.com Wed Aug 28 02:13:55 2002 From: skip@pobox.com (Skip Montanaro) Date: Tue, 27 Aug 2002 20:13:55 -0500 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.13,1.14 In-Reply-To: <3D6C221C.B7132DC3@metaslash.com> References: <3D6C221C.B7132DC3@metaslash.com> Message-ID: <15724.9171.897832.472719@12-248-11-90.client.attbi.com> >> + lst = "".join(_token_re.findall(string)) >> + return tokenize_ngram(string, 3) Neal> Hmmm, lst is not used, should lst be passed to tokenize_ngram? Neal> Also, lst isn't a list, it's a string. Yeah, brain fart. Weird that it worked so well. ;-) I'll fix it and see how well it does. Skip From montanaro@users.sourceforge.net Wed Aug 28 02:14:59 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 27 Aug 2002 18:14:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv8319 Modified Files: ref4.tex Log Message: add warning about exception messages Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ref4.tex 26 Jun 2002 21:52:26 -0000 1.33 --- ref4.tex 28 Aug 2002 01:14:57 -0000 1.34 *************** *** 198,201 **** --- 198,208 ---- this object must be an instance of the exception class being raised. + \begin{notice}[warning] + Messages to exceptions are not part of the Python API. Their contents may + change from one version of Python to the next without warning and should not + be relied on by code which will run under multiple versions of the + interpreter. + \end{notice} + See also the description of the \keyword{try} statement in section \ref{try} and \keyword{raise} statement in section \ref{raise}. From skip@pobox.com Wed Aug 28 02:18:37 2002 From: skip@pobox.com (Skip Montanaro) Date: Tue, 27 Aug 2002 20:18:37 -0500 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.43,1.43.6.1 In-Reply-To: <200208280057.g7S0v4010931@pcp02138704pcs.reston01.va.comcast.net> References: <15724.7761.824921.958955@12-248-11-90.client.attbi.com> <200208280057.g7S0v4010931@pcp02138704pcs.reston01.va.comcast.net> Message-ID: <15724.9453.230821.221400@12-248-11-90.client.attbi.com> >> It seems to me that somewhere in the docs it would be worthwhile to >> state ... Guido> Good idea! Implemented. I love those easy patches... S From rhettinger@users.sourceforge.net Wed Aug 28 03:10:06 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 27 Aug 2002 19:10:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.28.18.1,1.28.18.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv32158 Modified Files: Tag: release22-maint ref4.tex Log Message: Backported Skip's update to revision 1.34 Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.28.18.1 retrieving revision 1.28.18.2 diff -C2 -d -r1.28.18.1 -r1.28.18.2 *** ref4.tex 17 Apr 2002 03:42:08 -0000 1.28.18.1 --- ref4.tex 28 Aug 2002 02:10:04 -0000 1.28.18.2 *************** *** 212,215 **** --- 212,222 ---- being raised. + \begin{notice}[warning] + Messages to exceptions are not part of the Python API. Their contents may + change from one version of Python to the next without warning and should not + be relied on by code which will run under multiple versions of the + interpreter. + \end{notice} + See also the description of the \keyword{try} statement in section \ref{try} and \keyword{raise} statement in section \ref{raise}. From montanaro@users.sourceforge.net Wed Aug 28 04:45:08 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 27 Aug 2002 20:45:08 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv4506 Modified Files: GBayes.py Log Message: ehh - it actually didn't work all that well. the spurious report that it did well was pilot error. besides, tim's report suggests that a simple str.split() may be the best tokenizer anyway. Index: GBayes.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/GBayes.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GBayes.py 28 Aug 2002 00:43:44 -0000 1.14 --- GBayes.py 28 Aug 2002 03:45:06 -0000 1.15 *************** *** 108,116 **** return tokenize_ngram(string, 15) - def tokenize_trigram(string): - r"""tokenize w/ re '[\w$-]+', result squished to 3-char runs""" - lst = "".join(_token_re.findall(string)) - return tokenize_ngram(string, 3) - # add user-visible string as key and function as value - function's docstring # serves as help string when -H is used, so keep it brief! --- 108,111 ---- *************** *** 124,128 **** "split": tokenize_split, "split_fold": tokenize_split_foldcase, - "trigram": tokenize_trigram, "words": tokenize_words, "words_fold": tokenize_words_foldcase, --- 119,122 ---- From tim.one@comcast.net Wed Aug 28 05:15:20 2002 From: tim.one@comcast.net (Tim Peters) Date: Wed, 28 Aug 2002 00:15:20 -0400 Subject: [Python-checkins] python/nondist/sandbox/spambayes GBayes.py,1.14,1.15 In-Reply-To: Message-ID: [Skip] > Modified Files: > GBayes.py > Log Message: > ehh - it actually didn't work all that well. the spurious report that it > did well was pilot error. That's why it's taken me so long to report anything <0.5 wink> -- it's mondo tedious work to get trustworthy results. > besides, tim's report suggests that a simple str.split() may be the > best tokenizer anyway. That's merely the first one I tried after I *finally* got the corpora into usable shape. Its chief virtue in my eyes was speed; I'm pleasantly surprised at how well it did, and despite ignoring headers, and especially despite that we appear to have trained it with plenty of spam claiming to be ham. Since the ham archive proved to be tainted, the next thing is to clean it up. Then I'll try lots of tokenization gimmicks. I'm doing a quick run on character 3-grams now for the heck of it: def tokenize_3gram(string): for i in xrange(len(string)-2): yield string[i : i+3] applied to the message body as one giant string without any transformations (so newlines are in there, and blanks, and mixed case, etc). The first thing I note is that the false negative rate has gone way down: where, e.g., the whitespace splitter sucked up entire lines of quoted-printable as single "words", character 3-grams are much better at finding something damning in that. OTOH, the false positive rate has gone up significantly, and it's not obvious why. But so many of the false positives were actually spam in the first run that there's not much point thinking more about that until it's cleaned up. Before this started, my intuition was that word 2-grams would work best for text parts, that character n-grams would work best for gibberish parts (like HTML and JavaScript and MIME decorations), and that headers and embedded URLs should get special care. All of that is quite testable, but I need a cleaner ham corpus first ... From bwarsaw@users.sourceforge.net Wed Aug 28 17:36:13 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 28 Aug 2002 09:36:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grammar.py,1.41,1.42 tokenize_tests.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31010/Lib/test Modified Files: test_grammar.py tokenize_tests.py Log Message: Quite down some FutureWarnings. Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_grammar.py 30 Jul 2002 23:26:01 -0000 1.41 --- test_grammar.py 28 Aug 2002 16:36:10 -0000 1.42 *************** *** 31,38 **** maxint = 2147483647 if maxint == 2147483647: ! if -2147483647-1 != 020000000000: raise TestFailed, 'max negative int' # XXX -2147483648 ! if 037777777777 != -1: raise TestFailed, 'oct -1' ! if 0xffffffff != -1: raise TestFailed, 'hex -1' for s in '2147483648', '040000000000', '0x100000000': try: --- 31,38 ---- maxint = 2147483647 if maxint == 2147483647: ! if -2147483647-1 != 020000000000L: raise TestFailed, 'max negative int' # XXX -2147483648 ! if 037777777777L != -1: raise TestFailed, 'oct -1' ! if 0xffffffffL != -1: raise TestFailed, 'hex -1' for s in '2147483648', '040000000000', '0x100000000': try: Index: tokenize_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/tokenize_tests.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tokenize_tests.py 13 Apr 2001 14:36:51 -0000 1.3 --- tokenize_tests.py 28 Aug 2002 16:36:11 -0000 1.4 *************** *** 40,46 **** 0377 <> 255 2147483647 != 017777777777 ! -2147483647-1 != 020000000000 ! 037777777777 != -1 ! 0xffffffff != -1 # Long integers --- 40,46 ---- 0377 <> 255 2147483647 != 017777777777 ! -2147483647-1 != 020000000000L ! 037777777777L != -1 ! 0xffffffffL != -1 # Long integers From tim_one@users.sourceforge.net Wed Aug 28 22:04:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:04:58 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes Tester.py,1.1,1.2 classifier.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv27338 Modified Files: Tester.py classifier.py Log Message: Tester.py: Repaired a comment. The false_{positive,negative})_rate() functions return a percentage now (e.g., 1.0 instead of 0.01 -- it's too hard to get motivated to reduce 0.01 <0.1 wink>). GrahamBayes.spamprob: New optional bool argument; when true, a list of the 15 strongest (word, probability) pairs is returned as well as the overall probability (this is how to find out why a message scored as it did). Index: Tester.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/Tester.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tester.py 27 Aug 2002 22:10:04 -0000 1.1 --- Tester.py 28 Aug 2002 21:04:56 -0000 1.2 *************** *** 49,54 **** # is entirely composed of spam (is_spam True), or of ham (is_spam False). # Note that mispredictions are saved, and can be retrieved later via ! # false_negatives (ham mistakenly called spam) and false_positives (spam ! # mistakenly called ham). For this reason, you may wish to wrap examples # in a little class that identifies the example in a useful way, and whose # __iter__ produces a token stream for the classifier. --- 49,54 ---- # is entirely composed of spam (is_spam True), or of ham (is_spam False). # Note that mispredictions are saved, and can be retrieved later via ! # false_negatives (spam mistakenly called ham) and false_positives (ham ! # mistakenly called spam). For this reason, you may wish to wrap examples # in a little class that identifies the example in a useful way, and whose # __iter__ produces a token stream for the classifier. *************** *** 77,84 **** def false_positive_rate(self): ! return float(self.nham_wrong) / self.nham_tested def false_negative_rate(self): ! return float(self.nspam_wrong) / self.nspam_tested def false_positives(self): --- 77,86 ---- def false_positive_rate(self): ! """Percentage of ham mistakenly identified as spam, in 0.0..100.0.""" ! return self.nham_wrong * 1e2 / self.nham_tested def false_negative_rate(self): ! """Percentage of spam mistakenly identified as ham, in 0.0..100.0.""" ! return self.nspam_wrong * 1e2 / self.nspam_tested def false_positives(self): *************** *** 120,124 **** (1, 1) >>> t.false_positive_rate() ! 0.5 >>> [e.name for e in t.false_positives()] ['badham'] --- 122,126 ---- (1, 1) >>> t.false_positive_rate() ! 50.0 >>> [e.name for e in t.false_positives()] ['badham'] *************** *** 129,133 **** (1, 3) >>> t.false_negative_rate() ! 0.75 >>> [e.name for e in t.false_negatives()] ['badspam1', 'badspam2', 'badspam3'] --- 131,135 ---- (1, 3) >>> t.false_negative_rate() ! 75.0 >>> [e.name for e in t.false_negatives()] ['badspam1', 'badspam2', 'badspam3'] Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** classifier.py 23 Aug 2002 15:42:48 -0000 1.1 --- classifier.py 28 Aug 2002 21:04:56 -0000 1.2 *************** *** 87,95 **** self.wordinfo, self.nspam, self.nham = t[1:] ! def spamprob(self, wordstream): """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]. """ --- 87,99 ---- self.wordinfo, self.nspam, self.nham = t[1:] ! def spamprob(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. """ *************** *** 139,142 **** --- 143,148 ---- # 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: *************** *** 145,148 **** --- 151,156 ---- 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) *************** *** 150,154 **** inverse_prob_product *= 1.0 - prob ! return prob_product / (prob_product + inverse_prob_product) def learn(self, wordstream, is_spam, update_probabilities=True): --- 158,166 ---- inverse_prob_product *= 1.0 - prob ! 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): From jackjansen@users.sourceforge.net Wed Aug 28 22:16:57 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:16:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon AH.py,NONE,1.1 AppleHelp.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv2390 Added Files: AH.py AppleHelp.py Log Message: Interface to Apple Help Viewer. --- NEW FILE: AH.py --- from _AH import * --- NEW FILE: AppleHelp.py --- # Generated from 'AppleHelp.h' kAHInternalErr = -10790 kAHInternetConfigPrefErr = -10791 kAHTOCTypeUser = 0 kAHTOCTypeDeveloper = 1 From jackjansen@users.sourceforge.net Wed Aug 28 22:18:39 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:18:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon AppleEvents.py,1.2,1.3 Controls.py,1.2,1.3 Dragconst.py,1.2,1.3 Icons.py,1.2,1.3 MacTextEditor.py,1.2,1.3 QuickTime.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv3029 Modified Files: AppleEvents.py Controls.py Dragconst.py Icons.py MacTextEditor.py QuickTime.py Log Message: These were regenerated some time ago (with ascii chars only and fully qualified imports) but somehow not checked in yet. Index: AppleEvents.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/AppleEvents.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AppleEvents.py 22 May 2002 15:08:58 -0000 1.2 --- AppleEvents.py 28 Aug 2002 21:18:37 -0000 1.3 *************** *** 711,715 **** kFAIndexParam = FOUR_CHAR_CODE('indx') kAEInternetSuite = FOUR_CHAR_CODE('gurl') ! kAEISWebStarSuite = FOUR_CHAR_CODE('WWW˝') kAEISGetURL = FOUR_CHAR_CODE('gurl') KAEISHandleCGI = FOUR_CHAR_CODE('sdoc') --- 711,715 ---- kFAIndexParam = FOUR_CHAR_CODE('indx') kAEInternetSuite = FOUR_CHAR_CODE('gurl') ! kAEISWebStarSuite = FOUR_CHAR_CODE('WWW\xbd') kAEISGetURL = FOUR_CHAR_CODE('gurl') KAEISHandleCGI = FOUR_CHAR_CODE('sdoc') Index: Controls.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/Controls.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Controls.py 12 Dec 2001 22:40:27 -0000 1.2 --- Controls.py 28 Aug 2002 21:18:37 -0000 1.3 *************** *** 2,13 **** def FOUR_CHAR_CODE(x): return x ! from TextEdit import * ! from QuickDraw import * ! from Dragconst import * ! from CarbonEvents import * ! from Appearance import * kDataBrowserItemAnyState = -1 kControlBevelButtonCenterPopupGlyphTag = -1 ! kDataBrowserClientPropertyFlagsMask = 0xFF << 24 # kDataBrowserClientPropertyFlagsOffset kControlDefProcType = FOUR_CHAR_CODE('CDEF') --- 2,13 ---- def FOUR_CHAR_CODE(x): return x ! from Carbon.TextEdit import * ! from Carbon.QuickDraw import * ! from Carbon.Dragconst import * ! from Carbon.CarbonEvents import * ! from Carbon.Appearance import * kDataBrowserItemAnyState = -1 kControlBevelButtonCenterPopupGlyphTag = -1 ! kDataBrowserClientPropertyFlagsMask = 0xFF000000 kControlDefProcType = FOUR_CHAR_CODE('CDEF') Index: Dragconst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/Dragconst.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Dragconst.py 22 May 2002 15:08:58 -0000 1.2 --- Dragconst.py 28 Aug 2002 21:18:37 -0000 1.3 *************** *** 2,7 **** def FOUR_CHAR_CODE(x): return x ! from TextEdit import * ! from QuickDraw import * --- 2,7 ---- def FOUR_CHAR_CODE(x): return x ! from Carbon.TextEdit import * ! from Carbon.QuickDraw import * Index: Icons.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/Icons.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Icons.py 22 May 2002 15:08:58 -0000 1.2 --- Icons.py 28 Aug 2002 21:18:37 -0000 1.3 *************** *** 280,292 **** kOwnerIcon = FOUR_CHAR_CODE('susr') kGroupIcon = FOUR_CHAR_CODE('grup') ! kAppleExtrasFolderIcon = FOUR_CHAR_CODE('aex€') kAppleMenuFolderIcon = FOUR_CHAR_CODE('amnu') kApplicationsFolderIcon = FOUR_CHAR_CODE('apps') kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup') ! kAssistantsFolderIcon = FOUR_CHAR_CODE('ast€') kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu') kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD') kControlPanelFolderIcon = FOUR_CHAR_CODE('ctrl') ! kControlStripModulesFolderIcon = FOUR_CHAR_CODE('sdv€') kDocumentsFolderIcon = FOUR_CHAR_CODE('docs') kExtensionsDisabledFolderIcon = FOUR_CHAR_CODE('extD') --- 280,292 ---- kOwnerIcon = FOUR_CHAR_CODE('susr') kGroupIcon = FOUR_CHAR_CODE('grup') ! kAppleExtrasFolderIcon = FOUR_CHAR_CODE('aex\xc4') kAppleMenuFolderIcon = FOUR_CHAR_CODE('amnu') kApplicationsFolderIcon = FOUR_CHAR_CODE('apps') kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup') ! kAssistantsFolderIcon = FOUR_CHAR_CODE('ast\xc4') kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu') kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD') kControlPanelFolderIcon = FOUR_CHAR_CODE('ctrl') ! kControlStripModulesFolderIcon = FOUR_CHAR_CODE('sdv\xc4') kDocumentsFolderIcon = FOUR_CHAR_CODE('docs') kExtensionsDisabledFolderIcon = FOUR_CHAR_CODE('extD') *************** *** 294,312 **** kFavoritesFolderIcon = FOUR_CHAR_CODE('favs') kFontsFolderIcon = FOUR_CHAR_CODE('font') ! kHelpFolderIcon = FOUR_CHAR_CODE('€hlp') ! kInternetFolderIcon = FOUR_CHAR_CODE('int€') ! kInternetPlugInFolderIcon = FOUR_CHAR_CODE('€net') ! kLocalesFolderIcon = FOUR_CHAR_CODE('€loc') ! kMacOSReadMeFolderIcon = FOUR_CHAR_CODE('mor€') ! kPreferencesFolderIcon = FOUR_CHAR_CODE('prf€') kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf') ! kPrinterDriverFolderIcon = FOUR_CHAR_CODE('€prd') kPrintMonitorFolderIcon = FOUR_CHAR_CODE('prnt') kRecentApplicationsFolderIcon = FOUR_CHAR_CODE('rapp') kRecentDocumentsFolderIcon = FOUR_CHAR_CODE('rdoc') kRecentServersFolderIcon = FOUR_CHAR_CODE('rsrv') ! kScriptingAdditionsFolderIcon = FOUR_CHAR_CODE('€scr') ! kSharedLibrariesFolderIcon = FOUR_CHAR_CODE('€lib') ! kScriptsFolderIcon = FOUR_CHAR_CODE('scr€') kShutdownItemsDisabledFolderIcon = FOUR_CHAR_CODE('shdD') kShutdownItemsFolderIcon = FOUR_CHAR_CODE('shdf') --- 294,312 ---- kFavoritesFolderIcon = FOUR_CHAR_CODE('favs') kFontsFolderIcon = FOUR_CHAR_CODE('font') ! kHelpFolderIcon = FOUR_CHAR_CODE('\xc4hlp') ! kInternetFolderIcon = FOUR_CHAR_CODE('int\xc4') ! kInternetPlugInFolderIcon = FOUR_CHAR_CODE('\xc4net') ! kLocalesFolderIcon = FOUR_CHAR_CODE('\xc4loc') ! kMacOSReadMeFolderIcon = FOUR_CHAR_CODE('mor\xc4') ! kPreferencesFolderIcon = FOUR_CHAR_CODE('prf\xc4') kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf') ! kPrinterDriverFolderIcon = FOUR_CHAR_CODE('\xc4prd') kPrintMonitorFolderIcon = FOUR_CHAR_CODE('prnt') kRecentApplicationsFolderIcon = FOUR_CHAR_CODE('rapp') kRecentDocumentsFolderIcon = FOUR_CHAR_CODE('rdoc') kRecentServersFolderIcon = FOUR_CHAR_CODE('rsrv') ! kScriptingAdditionsFolderIcon = FOUR_CHAR_CODE('\xc4scr') ! kSharedLibrariesFolderIcon = FOUR_CHAR_CODE('\xc4lib') ! kScriptsFolderIcon = FOUR_CHAR_CODE('scr\xc4') kShutdownItemsDisabledFolderIcon = FOUR_CHAR_CODE('shdD') kShutdownItemsFolderIcon = FOUR_CHAR_CODE('shdf') *************** *** 316,326 **** kSystemExtensionDisabledFolderIcon = FOUR_CHAR_CODE('macD') kSystemFolderIcon = FOUR_CHAR_CODE('macs') ! kTextEncodingsFolderIcon = FOUR_CHAR_CODE('€tex') kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') ! kUtilitiesFolderIcon = FOUR_CHAR_CODE('uti€') kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') ! kUsersFolderIcon = FOUR_CHAR_CODE('usr€') kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') --- 316,326 ---- kSystemExtensionDisabledFolderIcon = FOUR_CHAR_CODE('macD') kSystemFolderIcon = FOUR_CHAR_CODE('macs') ! kTextEncodingsFolderIcon = FOUR_CHAR_CODE('\xc4tex') kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') ! kUtilitiesFolderIcon = FOUR_CHAR_CODE('uti\xc4') kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') ! kUsersFolderIcon = FOUR_CHAR_CODE('usr\xc4') kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') Index: MacTextEditor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/MacTextEditor.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MacTextEditor.py 4 Jan 2002 16:01:23 -0000 1.2 --- MacTextEditor.py 28 Aug 2002 21:18:37 -0000 1.3 *************** *** 13,16 **** --- 13,18 ---- kTXNEndOffset = 0x7FFFFFFF MovieFileType = FOUR_CHAR_CODE('moov') + kTXNUseEncodingWordRulesMask = 0x80000000 + kTXNFontSizeAttributeSize = 4 kTXNWillDefaultToATSUIBit = 0 kTXNWillDefaultToATSUIMask = 1L << kTXNWillDefaultToATSUIBit *************** *** 84,88 **** kTXNIgnoreCaseMask = 1L << kTXNIgnoreCaseBit kTXNEntireWordMask = 1L << kTXNEntireWordBit ! kTXNUseEncodingWordRulesMask = (unsigned long)(1L << kTXNUseEncodingWordRulesBit) kTXNTextensionFile = FOUR_CHAR_CODE('txtn') kTXNTextFile = FOUR_CHAR_CODE('TEXT') --- 86,90 ---- kTXNIgnoreCaseMask = 1L << kTXNIgnoreCaseBit kTXNEntireWordMask = 1L << kTXNEntireWordBit ! # kTXNUseEncodingWordRulesMask = (unsigned long)(1L << kTXNUseEncodingWordRulesBit) kTXNTextensionFile = FOUR_CHAR_CODE('txtn') kTXNTextFile = FOUR_CHAR_CODE('TEXT') *************** *** 194,198 **** # kTXNQDFontColorAttributeSize = sizeof(RGBColor) # kTXNTextEncodingAttributeSize = sizeof(TextEncoding) ! kTXNFontSizeAttributeSize = sizeof(Fixed) kTXNSystemDefaultEncoding = 0 kTXNMacOSEncoding = 1 --- 196,200 ---- # kTXNQDFontColorAttributeSize = sizeof(RGBColor) # kTXNTextEncodingAttributeSize = sizeof(TextEncoding) ! # kTXNFontSizeAttributeSize = sizeof(Fixed) kTXNSystemDefaultEncoding = 0 kTXNMacOSEncoding = 1 Index: QuickTime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/QuickTime.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuickTime.py 22 May 2002 15:08:58 -0000 1.2 --- QuickTime.py 28 Aug 2002 21:18:37 -0000 1.3 *************** *** 41,76 **** kUserDataMovieControllerType = FOUR_CHAR_CODE('ctyp') kUserDataName = FOUR_CHAR_CODE('name') ! kUserDataTextAlbum = FOUR_CHAR_CODE('Šalb') ! kUserDataTextArtist = FOUR_CHAR_CODE('ŠART') ! kUserDataTextAuthor = FOUR_CHAR_CODE('Šaut') ! kUserDataTextChapter = FOUR_CHAR_CODE('Šchp') ! kUserDataTextComment = FOUR_CHAR_CODE('Šcmt') ! kUserDataTextComposer = FOUR_CHAR_CODE('Šcom') ! kUserDataTextCopyright = FOUR_CHAR_CODE('Šcpy') ! kUserDataTextCreationDate = FOUR_CHAR_CODE('Šday') ! kUserDataTextDescription = FOUR_CHAR_CODE('Šdes') ! kUserDataTextDirector = FOUR_CHAR_CODE('Šdir') ! kUserDataTextDisclaimer = FOUR_CHAR_CODE('Šdis') ! kUserDataTextEncodedBy = FOUR_CHAR_CODE('Šenc') ! kUserDataTextFullName = FOUR_CHAR_CODE('Šnam') ! kUserDataTextGenre = FOUR_CHAR_CODE('Šgen') ! kUserDataTextHostComputer = FOUR_CHAR_CODE('Šhst') ! kUserDataTextInformation = FOUR_CHAR_CODE('Šinf') ! kUserDataTextKeywords = FOUR_CHAR_CODE('Škey') ! kUserDataTextMake = FOUR_CHAR_CODE('Šmak') ! kUserDataTextModel = FOUR_CHAR_CODE('Šmod') ! kUserDataTextOriginalArtist = FOUR_CHAR_CODE('Šope') ! kUserDataTextOriginalFormat = FOUR_CHAR_CODE('Šfmt') ! kUserDataTextOriginalSource = FOUR_CHAR_CODE('Šsrc') ! kUserDataTextPerformers = FOUR_CHAR_CODE('Šprf') ! kUserDataTextProducer = FOUR_CHAR_CODE('Šprd') ! kUserDataTextProduct = FOUR_CHAR_CODE('ŠPRD') ! kUserDataTextSoftware = FOUR_CHAR_CODE('Šswr') ! kUserDataTextSpecialPlaybackRequirements = FOUR_CHAR_CODE('Šreq') ! kUserDataTextTrack = FOUR_CHAR_CODE('Štrk') ! kUserDataTextWarning = FOUR_CHAR_CODE('Šwrn') ! kUserDataTextWriter = FOUR_CHAR_CODE('Šwrt') ! kUserDataTextURLLink = FOUR_CHAR_CODE('Šurl') ! kUserDataTextEditDate1 = FOUR_CHAR_CODE('Šed1') kUserDataUnicodeBit = 1L << 7 DoTheRightThing = 0 --- 41,76 ---- kUserDataMovieControllerType = FOUR_CHAR_CODE('ctyp') kUserDataName = FOUR_CHAR_CODE('name') ! kUserDataTextAlbum = FOUR_CHAR_CODE('\xa9alb') ! kUserDataTextArtist = FOUR_CHAR_CODE('\xa9ART') ! kUserDataTextAuthor = FOUR_CHAR_CODE('\xa9aut') ! kUserDataTextChapter = FOUR_CHAR_CODE('\xa9chp') ! kUserDataTextComment = FOUR_CHAR_CODE('\xa9cmt') ! kUserDataTextComposer = FOUR_CHAR_CODE('\xa9com') ! kUserDataTextCopyright = FOUR_CHAR_CODE('\xa9cpy') ! kUserDataTextCreationDate = FOUR_CHAR_CODE('\xa9day') ! kUserDataTextDescription = FOUR_CHAR_CODE('\xa9des') ! kUserDataTextDirector = FOUR_CHAR_CODE('\xa9dir') ! kUserDataTextDisclaimer = FOUR_CHAR_CODE('\xa9dis') ! kUserDataTextEncodedBy = FOUR_CHAR_CODE('\xa9enc') ! kUserDataTextFullName = FOUR_CHAR_CODE('\xa9nam') ! kUserDataTextGenre = FOUR_CHAR_CODE('\xa9gen') ! kUserDataTextHostComputer = FOUR_CHAR_CODE('\xa9hst') ! kUserDataTextInformation = FOUR_CHAR_CODE('\xa9inf') ! kUserDataTextKeywords = FOUR_CHAR_CODE('\xa9key') ! kUserDataTextMake = FOUR_CHAR_CODE('\xa9mak') ! kUserDataTextModel = FOUR_CHAR_CODE('\xa9mod') ! kUserDataTextOriginalArtist = FOUR_CHAR_CODE('\xa9ope') ! kUserDataTextOriginalFormat = FOUR_CHAR_CODE('\xa9fmt') ! kUserDataTextOriginalSource = FOUR_CHAR_CODE('\xa9src') ! kUserDataTextPerformers = FOUR_CHAR_CODE('\xa9prf') ! kUserDataTextProducer = FOUR_CHAR_CODE('\xa9prd') ! kUserDataTextProduct = FOUR_CHAR_CODE('\xa9PRD') ! kUserDataTextSoftware = FOUR_CHAR_CODE('\xa9swr') ! kUserDataTextSpecialPlaybackRequirements = FOUR_CHAR_CODE('\xa9req') ! kUserDataTextTrack = FOUR_CHAR_CODE('\xa9trk') ! kUserDataTextWarning = FOUR_CHAR_CODE('\xa9wrn') ! kUserDataTextWriter = FOUR_CHAR_CODE('\xa9wrt') ! kUserDataTextURLLink = FOUR_CHAR_CODE('\xa9url') ! kUserDataTextEditDate1 = FOUR_CHAR_CODE('\xa9ed1') kUserDataUnicodeBit = 1L << 7 DoTheRightThing = 0 From jackjansen@users.sourceforge.net Wed Aug 28 22:19:28 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:19:28 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon CoreFoundation.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv3882 Added Files: CoreFoundation.py Log Message: This file never made it to the repository, somehow. --- NEW FILE: CoreFoundation.py --- # Generated from 'CFBase.h' def FOUR_CHAR_CODE(x): return x kCFCompareLessThan = -1 kCFCompareEqualTo = 0 kCFCompareGreaterThan = 1 kCFNotFound = -1 kCFPropertyListImmutable = 0 kCFPropertyListMutableContainers = 1 kCFPropertyListMutableContainersAndLeaves = 2 # kCFStringEncodingInvalidId = (long)0xFFFFFFFF kCFStringEncodingMacRoman = 0 kCFStringEncodingWindowsLatin1 = 0x0500 kCFStringEncodingISOLatin1 = 0x0201 kCFStringEncodingNextStepLatin = 0x0B01 kCFStringEncodingASCII = 0x0600 kCFStringEncodingUnicode = 0x0100 kCFStringEncodingUTF8 = 0x08000100 kCFStringEncodingNonLossyASCII = 0x0BFF kCFCompareCaseInsensitive = 1 kCFCompareBackwards = 4 kCFCompareAnchored = 8 kCFCompareNonliteral = 16 kCFCompareLocalized = 32 kCFCompareNumerically = 64 kCFURLPOSIXPathStyle = 0 kCFURLHFSPathStyle = 1 kCFURLWindowsPathStyle = 2 From jackjansen@users.sourceforge.net Wed Aug 28 22:23:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:23:55 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.198,1.199 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5585/Misc Modified Files: ACKS Log Message: Distutils-based script by Bill Fancher to download the Python documentation HTML tarball and use it to create a documentation tree readable and searchable with Apple Help Viewer. The documentation also shows up in Project Builder (if you add Python.framework to your project). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.198 retrieving revision 1.199 diff -C2 -d -r1.198 -r1.199 *** ACKS 20 Aug 2002 17:29:29 -0000 1.198 --- ACKS 28 Aug 2002 21:23:53 -0000 1.199 *************** *** 156,159 **** --- 156,160 ---- Martijn Faassen Andreas Faerber + Bill Fancher Mark Favas Niels Ferguson From jackjansen@users.sourceforge.net Wed Aug 28 22:23:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:23:55 -0700 Subject: [Python-checkins] python setupDocs.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python In directory usw-pr-cvs1:/tmp/cvs-serv5585/d/d Added Files: setupDocs.py Log Message: Distutils-based script by Bill Fancher to download the Python documentation HTML tarball and use it to create a documentation tree readable and searchable with Apple Help Viewer. The documentation also shows up in Project Builder (if you add Python.framework to your project). --- NEW FILE: setupDocs.py --- # Build and install an Apple Help Viewer compatible version of the Python # documentation into the framework. # Code by Bill Fancher, with some modifications by Jack Jansen. # # You must run this as a two-step process # 1. python setupDocs.py build # 2. Wait for Apple Help Indexing Tool to finish # 3. python setupDocs.py install # # To do: # - test whether the docs are available locally before downloading # - fix buildDocsFromSource # - Get documentation version from sys.version, fallback to 2.2.1 # - See if we can somehow detect that Apple Help Indexing Tool is finished # - data_files to setup() doesn't seem the right way to pass the arguments # import sys, os, re from distutils.cmd import Command from distutils.command.build import build from distutils.core import setup from distutils.file_util import copy_file from distutils.dir_util import copy_tree from distutils.log import log from distutils.spawn import spawn from distutils import sysconfig, dep_util def visit(arg, d,l): for f in l: arg.hackFile(d,f) class DocBuild(build): def initialize_options(self): build.initialize_options(self) self.doc_dir = None self.base_dir = None self.build_dir = None self.download = 1 self.doc_version = '2.2.1' def finalize_options(self): build.finalize_options(self) if self.build_dir is None: self.build_dir = self.build_temp if self.doc_dir is None: self.doc_dir = data_info = self.distribution.data_files[0][1][0] self.build_dest = os.path.abspath(os.path.join(self.build_dir,self.doc_dir)) #print 'DocBuild.finalize_options:\n build_dest = %s,\n doc_dir = %s' % (self.build_dest, self.doc_dir) def spawn(self, *args): spawn(args, 1, self.verbose, self.dry_run) def downloadDocs(self): workdir = os.getcwd() self.spawn('curl','-O', 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % (self.doc_version,self.doc_version)) self.mkpath(self.doc_dir) os.chdir(self.doc_dir) self.spawn('tar', '-xzf', '../html-%s.tgz' % self.doc_version) os.chdir(workdir); def buildDocsFromSouce(self): #Totally untested spawn(('make','--directory', '../Docs'), 1, self.verbose, self.dry_run) copy_tree('../Docs/html', self.doc_dir) def ensureHtml(self): if not os.path.exists(self.doc_dir): if self.download: self.downloadDocs() else: self.buildDocsFromSource() def hackIndex(self): ind_html = 'index.html' #print 'self.build_dest =', self.build_dest hackedIndex = file(os.path.join(self.build_dest, ind_html),'w') origIndex = file(os.path.join(self.doc_dir,ind_html)) r = re.compile('', re.DOTALL) hackedIndex.write(r.sub('',origIndex.read())) def hackFile(self,d,f): origPath = os.path.join(d,f) outPath = os.path.join(self.build_dir, d, f) (name, ext) = os.path.splitext(f) if os.path.isdir(origPath): self.mkpath(outPath) elif ext == '.html': if self.verbose: print 'hacking %s to %s' % (origPath,outPath) hackedFile = file(outPath, 'w') origFile = file(origPath,'r') hackedFile.write(self.r.sub('
', origFile.read())) else: copy_file(origPath, outPath) def hackHtml(self): self.r = re.compile('
') os.path.walk(self.doc_dir, visit, self) def makeHelpIndex(self): app = '/Developer/Applications/Apple Help Indexing Tool.app' self.spawn('open', '-a', app , self.build_dest) print "Please wait until Apple Help Indexing Tool finishes before installing" def run(self): self.ensure_finalized() self.ensureHtml() data_info = self.distribution.data_files[0][1] if not os.path.isdir(self.doc_dir): raise RuntimeError, \ "Can't find source folder for documentation." if dep_util.newer(os.path.join(self.doc_dir,'index.html'), os.path.join(self.build_dest,'index.html')): self.mkpath(self.build_dest) self.hackHtml() self.hackIndex() self.makeHelpIndex() class DirInstall(Command): def initialize_options(self): self.build_dest = None self.install_dir = None def finalize_options(self): build_cmd = self.get_finalized_command('build') if self.build_dest == None: self.build_dest = build_cmd.build_dest if self.install_dir == None: self.install_dir = self.distribution.data_files[0][0] print self.build_dest, self.install_dir def run(self): self.finalize_options() self.ensure_finalized() print "Running Installer" data_info = self.distribution.data_files[0][1] # spawn('pax','-r', '-w', base_dir, print self.__dict__ self.mkpath(self.install_dir) # The Python way copy_tree(self.build_dest, self.install_dir) # The fast way #workdir=os.getcwd() #os.chdir(self.build_dest) #self.spawn = ('pax', '-r', '-w', '.', self.install_dir) #selfspawn(cmd, 1, self.verbose, self.dry_run); #os.chdir(workdir) print "Installation complete" def mungeVersion(infile, outfile): i = file(infile,'r') o = file(outfile,'w') o.write(re.sub('\$\(VERSION\)',sysconfig.get_config_var('VERSION'),i.read())) i.close() o.close() def main(): # turn off warnings when deprecated modules are imported import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) setup(name = 'Python Documentation', version = '%d.%d' % sys.version_info[:2], cmdclass = {'install_data':DirInstall, 'build':DocBuild}, # Data to install data_files = [(sys.prefix+'/Resources/English.lproj/Documentation',['build-html'])] ) if __name__ == '__main__': main() From jackjansen@users.sourceforge.net Wed Aug 28 22:27:04 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:27:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv6636/OSX Modified Files: Makefile Log Message: - Install a symlink to the documentation (which lives in the framework) in Python.app, and refer to it in Info.plist. This makes Apple Help Viewer recognize the Python documentation. - Changed the externally visible name of Python.app to "Python" (was PythonW). Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile 15 Aug 2002 21:31:18 -0000 1.22 --- Makefile 28 Aug 2002 21:27:01 -0000 1.23 *************** *** 26,29 **** --- 26,30 ---- INSTALL_SCRIPT= ${INSTALL_PROGRAM} INSTALL_DATA= ${INSTALL} -m 644 + LN=ln STRIPFLAG=-s OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ *************** *** 117,120 **** --- 118,124 ---- $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) + # Finally create the documentation symlink + $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation + install_IDE: $(INSTALLED_PYTHONW) From jackjansen@users.sourceforge.net Wed Aug 28 22:27:04 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:27:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app Info.plist,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app In directory usw-pr-cvs1:/tmp/cvs-serv6636/OSXResources/app Modified Files: Info.plist Log Message: - Install a symlink to the documentation (which lives in the framework) in Python.app, and refer to it in Info.plist. This makes Apple Help Viewer recognize the Python documentation. - Changed the externally visible name of Python.app to "Python" (was PythonW). Index: Info.plist =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Info.plist,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Info.plist 1 Aug 2002 21:12:36 -0000 1.7 --- Info.plist 28 Aug 2002 21:27:02 -0000 1.8 *************** *** 30,41 **** 2.3 CFBundleIconFile PythonInterpreter.icns CFBundleIdentifier ! org.python.pythonw CFBundleInfoDictionaryVersion 6.0 CFBundleName ! PythonW CFBundlePackageType APPL --- 30,48 ---- 2.3 + CFBundleHelpBookFolder + Documentation + CFBundleHelpBookName + Python Help + CFBundleHelpTOCFile + index.html + CFBundleIconFile PythonInterpreter.icns CFBundleIdentifier ! org.python.python CFBundleInfoDictionaryVersion 6.0 CFBundleName ! Python CFBundlePackageType APPL From jackjansen@users.sourceforge.net Wed Aug 28 22:27:05 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 14:27:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj InfoPlist.strings,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj In directory usw-pr-cvs1:/tmp/cvs-serv6636/OSXResources/app/Resources/English.lproj Modified Files: InfoPlist.strings Log Message: - Install a symlink to the documentation (which lives in the framework) in Python.app, and refer to it in Info.plist. This makes Apple Help Viewer recognize the Python documentation. - Changed the externally visible name of Python.app to "Python" (was PythonW). Index: InfoPlist.strings =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/InfoPlist.strings,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InfoPlist.strings 29 Mar 2002 21:16:41 -0000 1.3 --- InfoPlist.strings 28 Aug 2002 21:27:02 -0000 1.4 *************** *** 1,5 **** /* Localized versions of Info.plist keys */ ! CFBundleName = "PythonW"; CFBundleShortVersionString = "Python Interpreter version 2.3"; CFBundleGetInfoString = "Python Interpreter version 2.3, (c) 2002 Python Software Foundation."; --- 1,5 ---- /* Localized versions of Info.plist keys */ ! CFBundleName = "Python"; CFBundleShortVersionString = "Python Interpreter version 2.3"; CFBundleGetInfoString = "Python Interpreter version 2.3, (c) 2002 Python Software Foundation."; From jackjansen@users.sourceforge.net Wed Aug 28 23:21:22 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 15:21:22 -0700 Subject: [Python-checkins] python setupDocs.py,1.1,NONE Message-ID: Update of /cvsroot/python/python In directory usw-pr-cvs1:/tmp/cvs-serv28605/python Removed Files: setupDocs.py Log Message: This file doesn't belong here. --- setupDocs.py DELETED --- From jackjansen@users.sourceforge.net Wed Aug 28 23:22:12 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 Aug 2002 15:22:12 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX setupDocs.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv28884 Added Files: setupDocs.py Log Message: Distutils-based script by Bill Fancher to download the Python documentation HTML tarball and use it to create a documentation tree readable and searchable with Apple Help Viewer. The documentation also shows up in Project Builder (if you add Python.framework to your project). --- NEW FILE: setupDocs.py --- # Build and install an Apple Help Viewer compatible version of the Python # documentation into the framework. # Code by Bill Fancher, with some modifications by Jack Jansen. # # You must run this as a two-step process # 1. python setupDocs.py build # 2. Wait for Apple Help Indexing Tool to finish # 3. python setupDocs.py install # # To do: # - test whether the docs are available locally before downloading # - fix buildDocsFromSource # - Get documentation version from sys.version, fallback to 2.2.1 # - See if we can somehow detect that Apple Help Indexing Tool is finished # - data_files to setup() doesn't seem the right way to pass the arguments # import sys, os, re from distutils.cmd import Command from distutils.command.build import build from distutils.core import setup from distutils.file_util import copy_file from distutils.dir_util import copy_tree from distutils.log import log from distutils.spawn import spawn from distutils import sysconfig, dep_util def visit(arg, d,l): for f in l: arg.hackFile(d,f) class DocBuild(build): def initialize_options(self): build.initialize_options(self) self.doc_dir = None self.base_dir = None self.build_dir = None self.download = 1 self.doc_version = '2.2.1' def finalize_options(self): build.finalize_options(self) if self.build_dir is None: self.build_dir = self.build_temp if self.doc_dir is None: self.doc_dir = data_info = self.distribution.data_files[0][1][0] self.build_dest = os.path.abspath(os.path.join(self.build_dir,self.doc_dir)) #print 'DocBuild.finalize_options:\n build_dest = %s,\n doc_dir = %s' % (self.build_dest, self.doc_dir) def spawn(self, *args): spawn(args, 1, self.verbose, self.dry_run) def downloadDocs(self): workdir = os.getcwd() self.spawn('curl','-O', 'http://www.python.org/ftp/python/doc/%s/html-%s.tgz' % (self.doc_version,self.doc_version)) self.mkpath(self.doc_dir) os.chdir(self.doc_dir) self.spawn('tar', '-xzf', '../html-%s.tgz' % self.doc_version) os.chdir(workdir); def buildDocsFromSouce(self): #Totally untested spawn(('make','--directory', '../Docs'), 1, self.verbose, self.dry_run) copy_tree('../Docs/html', self.doc_dir) def ensureHtml(self): if not os.path.exists(self.doc_dir): if self.download: self.downloadDocs() else: self.buildDocsFromSource() def hackIndex(self): ind_html = 'index.html' #print 'self.build_dest =', self.build_dest hackedIndex = file(os.path.join(self.build_dest, ind_html),'w') origIndex = file(os.path.join(self.doc_dir,ind_html)) r = re.compile('', re.DOTALL) hackedIndex.write(r.sub('',origIndex.read())) def hackFile(self,d,f): origPath = os.path.join(d,f) outPath = os.path.join(self.build_dir, d, f) (name, ext) = os.path.splitext(f) if os.path.isdir(origPath): self.mkpath(outPath) elif ext == '.html': if self.verbose: print 'hacking %s to %s' % (origPath,outPath) hackedFile = file(outPath, 'w') origFile = file(origPath,'r') hackedFile.write(self.r.sub('
', origFile.read())) else: copy_file(origPath, outPath) def hackHtml(self): self.r = re.compile('
') os.path.walk(self.doc_dir, visit, self) def makeHelpIndex(self): app = '/Developer/Applications/Apple Help Indexing Tool.app' self.spawn('open', '-a', app , self.build_dest) print "Please wait until Apple Help Indexing Tool finishes before installing" def run(self): self.ensure_finalized() self.ensureHtml() data_info = self.distribution.data_files[0][1] if not os.path.isdir(self.doc_dir): raise RuntimeError, \ "Can't find source folder for documentation." if dep_util.newer(os.path.join(self.doc_dir,'index.html'), os.path.join(self.build_dest,'index.html')): self.mkpath(self.build_dest) self.hackHtml() self.hackIndex() self.makeHelpIndex() class DirInstall(Command): def initialize_options(self): self.build_dest = None self.install_dir = None def finalize_options(self): build_cmd = self.get_finalized_command('build') if self.build_dest == None: self.build_dest = build_cmd.build_dest if self.install_dir == None: self.install_dir = self.distribution.data_files[0][0] print self.build_dest, self.install_dir def run(self): self.finalize_options() self.ensure_finalized() print "Running Installer" data_info = self.distribution.data_files[0][1] # spawn('pax','-r', '-w', base_dir, print self.__dict__ self.mkpath(self.install_dir) # The Python way copy_tree(self.build_dest, self.install_dir) # The fast way #workdir=os.getcwd() #os.chdir(self.build_dest) #self.spawn = ('pax', '-r', '-w', '.', self.install_dir) #selfspawn(cmd, 1, self.verbose, self.dry_run); #os.chdir(workdir) print "Installation complete" def mungeVersion(infile, outfile): i = file(infile,'r') o = file(outfile,'w') o.write(re.sub('\$\(VERSION\)',sysconfig.get_config_var('VERSION'),i.read())) i.close() o.close() def main(): # turn off warnings when deprecated modules are imported import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) setup(name = 'Python Documentation', version = '%d.%d' % sys.version_info[:2], cmdclass = {'install_data':DirInstall, 'build':DocBuild}, # Data to install data_files = [(sys.prefix+'/Resources/English.lproj/Documentation',['build-html'])] ) if __name__ == '__main__': main() From bwarsaw@users.sourceforge.net Thu Aug 29 13:57:02 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 Aug 2002 05:57:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_tokenize,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv23370 Modified Files: test_tokenize Log Message: The test_tokenize output has changed slightly, by the addition of some trailing `L's. Index: test_tokenize =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_tokenize,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_tokenize 13 Apr 2001 14:55:18 -0000 1.6 --- test_tokenize 29 Aug 2002 12:56:59 -0000 1.7 *************** *** 125,140 **** 42,12-42,13: NUMBER '1' 42,14-42,16: OP '!=' ! 42,17-42,29: NUMBER '020000000000' ! 42,29-42,30: NEWLINE '\n' ! 43,0-43,12: NUMBER '037777777777' ! 43,13-43,15: OP '!=' ! 43,16-43,17: OP '-' ! 43,17-43,18: NUMBER '1' ! 43,18-43,19: NEWLINE '\n' ! 44,0-44,10: NUMBER '0xffffffff' ! 44,11-44,13: OP '!=' ! 44,14-44,15: OP '-' ! 44,15-44,16: NUMBER '1' ! 44,16-44,17: NEWLINE '\n' 45,0-45,1: NL '\n' 46,0-46,16: COMMENT '# Long integers\n' --- 125,140 ---- 42,12-42,13: NUMBER '1' 42,14-42,16: OP '!=' ! 42,17-42,30: NUMBER '020000000000L' ! 42,30-42,31: NEWLINE '\n' ! 43,0-43,13: NUMBER '037777777777L' ! 43,14-43,16: OP '!=' ! 43,17-43,18: OP '-' ! 43,18-43,19: NUMBER '1' ! 43,19-43,20: NEWLINE '\n' ! 44,0-44,11: NUMBER '0xffffffffL' ! 44,12-44,14: OP '!=' ! 44,15-44,16: OP '-' ! 44,16-44,17: NUMBER '1' ! 44,17-44,18: NEWLINE '\n' 45,0-45,1: NL '\n' 46,0-46,16: COMMENT '# Long integers\n' From bwarsaw@users.sourceforge.net Thu Aug 29 14:09:50 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 Aug 2002 06:09:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grammar.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28950 Modified Files: test_grammar.py Log Message: Fixed three exceptions in the Plain integers test, although I'm not sure these are the best fixes. - Test maxint-1 against the negative octal constant -020000000000 - Comment out the tests for oct -1 and hex -1, since 037777777777 and 0xffffffff raise FutureWarnings now and in Python 2.4 those constants will produce positive values, not negative values. So the existing test seems to test something that won't be true in 2.4. Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_grammar.py 28 Aug 2002 16:36:10 -0000 1.42 --- test_grammar.py 29 Aug 2002 13:09:47 -0000 1.43 *************** *** 31,38 **** maxint = 2147483647 if maxint == 2147483647: ! if -2147483647-1 != 020000000000L: raise TestFailed, 'max negative int' # XXX -2147483648 ! if 037777777777L != -1: raise TestFailed, 'oct -1' ! if 0xffffffffL != -1: raise TestFailed, 'hex -1' for s in '2147483648', '040000000000', '0x100000000': try: --- 31,38 ---- maxint = 2147483647 if maxint == 2147483647: ! if -2147483647-1 != -020000000000: raise TestFailed, 'max negative int' # XXX -2147483648 ! #if 037777777777 != -1: raise TestFailed, 'oct -1' ! #if 0xffffffff != -1: raise TestFailed, 'hex -1' for s in '2147483648', '040000000000', '0x100000000': try: From rhettinger@users.sourceforge.net Thu Aug 29 15:22:53 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 29 Aug 2002 07:22:53 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26220/Objects Modified Files: complexobject.c Log Message: complex() was the only numeric constructor that created a new instance when given its own type as an argument. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** complexobject.c 19 Aug 2002 19:26:42 -0000 2.63 --- complexobject.c 29 Aug 2002 14:22:50 -0000 2.64 *************** *** 824,827 **** --- 824,836 ---- &r, &i)) return NULL; + + /* Special-case for single argumet that is already complex */ + if (PyComplex_CheckExact(r) && i == NULL) { + /* Note that we can't know whether it's safe to return + a complex *subclass* instance as-is, hence the restriction + to exact complexes here. */ + Py_INCREF(r); + return r; + } if (PyString_Check(r) || PyUnicode_Check(r)) { if (i != NULL) { From rhettinger@users.sourceforge.net Thu Aug 29 15:22:53 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 29 Aug 2002 07:22:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26220/Lib/test Modified Files: test_b1.py Log Message: complex() was the only numeric constructor that created a new instance when given its own type as an argument. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** test_b1.py 14 Aug 2002 18:38:27 -0000 1.52 --- test_b1.py 29 Aug 2002 14:22:51 -0000 1.53 *************** *** 141,144 **** --- 141,148 ---- if complex("1j") != 1j: raise TestFailed, 'complex("1j")' + c = 3.14 + 1j + if complex(c) is not c: raise TestFailed, 'complex(3.14+1j) changed identity' + del c + try: complex("1", "1") except TypeError: pass From gvanrossum@users.sourceforge.net Thu Aug 29 15:57:28 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 Aug 2002 07:57:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grammar.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6271 Modified Files: test_grammar.py Log Message: Restore the hex/oct constant tests that Barry commented out for fear of FutureWarnings. Added a comment explaining the situation. Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** test_grammar.py 29 Aug 2002 13:09:47 -0000 1.43 --- test_grammar.py 29 Aug 2002 14:57:26 -0000 1.44 *************** *** 2,5 **** --- 2,12 ---- # This just tests whether the parser accepts them all. + # NOTE: When you run this test as a script from the command line, you + # get warnings about certain hex/oct constants. Since those are + # issued by the parser, you can't suppress them by adding a + # filterwarnings() call to this module. Therefore, to shut up the + # regression test, the filterwarnings() call has been added to + # regrtest.py. + from test.test_support import TestFailed, verify, check_syntax import sys *************** *** 33,38 **** if -2147483647-1 != -020000000000: raise TestFailed, 'max negative int' # XXX -2147483648 ! #if 037777777777 != -1: raise TestFailed, 'oct -1' ! #if 0xffffffff != -1: raise TestFailed, 'hex -1' for s in '2147483648', '040000000000', '0x100000000': try: --- 40,45 ---- if -2147483647-1 != -020000000000: raise TestFailed, 'max negative int' # XXX -2147483648 ! if 037777777777 != -1: raise TestFailed, 'oct -1' ! if 0xffffffff != -1: raise TestFailed, 'hex -1' for s in '2147483648', '040000000000', '0x100000000': try: From gvanrossum@users.sourceforge.net Thu Aug 29 16:04:39 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 Aug 2002 08:04:39 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.98,1.99 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv8483 Modified Files: Makefile.pre.in Log Message: Suppress warnings when byte-compiling the installed library modules. This seems the sanest thing to do. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** Makefile.pre.in 9 Aug 2002 19:18:25 -0000 1.98 --- Makefile.pre.in 29 Aug 2002 15:04:37 -0000 1.99 *************** *** 670,677 **** $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \ ! $(LIBDEST) PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST) # Create the PLATDIR source directory, if one wasn't distributed.. --- 670,678 ---- $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -tt $(LIBDEST)/compileall.py \ ! -x badsyntax $(LIBDEST) PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -tt -O $(LIBDEST)/compileall.py \ ! -x badsyntax $(LIBDEST) # Create the PLATDIR source directory, if one wasn't distributed.. From gvanrossum@users.sourceforge.net Thu Aug 29 16:09:36 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 Aug 2002 08:09:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test tokenize_tests.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10039 Modified Files: tokenize_tests.py Log Message: Undo Barry's change. This file is not imported, it's fed as input to the tokenize module by test_tokenize.py. The FutureWarnings only appeared during installation, and I've figured out a way to suppress those in a different way. Index: tokenize_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/tokenize_tests.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tokenize_tests.py 28 Aug 2002 16:36:11 -0000 1.4 --- tokenize_tests.py 29 Aug 2002 15:09:34 -0000 1.5 *************** *** 40,46 **** 0377 <> 255 2147483647 != 017777777777 ! -2147483647-1 != 020000000000L ! 037777777777L != -1 ! 0xffffffffL != -1 # Long integers --- 40,46 ---- 0377 <> 255 2147483647 != 017777777777 ! -2147483647-1 != 020000000000 ! 037777777777 != -1 ! 0xffffffff != -1 # Long integers From gvanrossum@users.sourceforge.net Thu Aug 29 16:10:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 Aug 2002 08:10:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_tokenize,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv10353 Modified Files: test_tokenize Log Message: Undo Barry's change. This file is not imported, it's fed as input to the tokenize module by test_tokenize.py. The FutureWarnings only appeared during installation, and I've figured out a way to suppress those in a different way. Index: test_tokenize =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_tokenize,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_tokenize 29 Aug 2002 12:56:59 -0000 1.7 --- test_tokenize 29 Aug 2002 15:10:30 -0000 1.8 *************** *** 125,140 **** 42,12-42,13: NUMBER '1' 42,14-42,16: OP '!=' ! 42,17-42,30: NUMBER '020000000000L' ! 42,30-42,31: NEWLINE '\n' ! 43,0-43,13: NUMBER '037777777777L' ! 43,14-43,16: OP '!=' ! 43,17-43,18: OP '-' ! 43,18-43,19: NUMBER '1' ! 43,19-43,20: NEWLINE '\n' ! 44,0-44,11: NUMBER '0xffffffffL' ! 44,12-44,14: OP '!=' ! 44,15-44,16: OP '-' ! 44,16-44,17: NUMBER '1' ! 44,17-44,18: NEWLINE '\n' 45,0-45,1: NL '\n' 46,0-46,16: COMMENT '# Long integers\n' --- 125,140 ---- 42,12-42,13: NUMBER '1' 42,14-42,16: OP '!=' ! 42,17-42,29: NUMBER '020000000000' ! 42,29-42,30: NEWLINE '\n' ! 43,0-43,12: NUMBER '037777777777' ! 43,13-43,15: OP '!=' ! 43,16-43,17: OP '-' ! 43,17-43,18: NUMBER '1' ! 43,18-43,19: NEWLINE '\n' ! 44,0-44,10: NUMBER '0xffffffff' ! 44,11-44,13: OP '!=' ! 44,14-44,15: OP '-' ! 44,15-44,16: NUMBER '1' ! 44,16-44,17: NEWLINE '\n' 45,0-45,1: NL '\n' 46,0-46,16: COMMENT '# Long integers\n' From rhettinger@users.sourceforge.net Thu Aug 29 16:13:52 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 29 Aug 2002 08:13:52 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10634 Modified Files: sets.py Log Message: Sped _update(). Uses the fast update() method when a dictionary is available. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** sets.py 26 Aug 2002 00:44:07 -0000 1.29 --- sets.py 29 Aug 2002 15:13:50 -0000 1.30 *************** *** 311,314 **** --- 311,323 ---- # The main loop for update() and the subclass __init__() methods. data = self._data + + # Use the fast update() method when a dictionary is available. + if isinstance(iterable, BaseSet): + data.update(iterable._data) + return + if isinstance(iterable, dict): + data.update(iterable) + return + value = True it = iter(iterable) From bwarsaw@users.sourceforge.net Thu Aug 29 16:25:06 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 Aug 2002 08:25:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15234 Modified Files: test_strptime.py Log Message: The test I saw failing this morning just happened to be run at 8am localtime, which in -0400 is 12 noon GMT. The bug boiled down to broken conversion of 12 PM to hour 12 for the '%I %p' format string. Added a test for this specific condition: Strptime12AMPMTests. Fix to _strptime.py coming momentarily. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_strptime.py 22 Aug 2002 19:57:50 -0000 1.3 --- test_strptime.py 29 Aug 2002 15:25:04 -0000 1.4 *************** *** 265,268 **** --- 265,279 ---- + class Strptime12AMPMTests(unittest.TestCase): + """Test a _strptime regression in '%I %p' at 12 noon (12 PM)""" + + def test_twelve_noon_midnight(self): + eq = self.assertEqual + eq(time.strptime('12 PM', '%I %p')[3], 12) + eq(time.strptime('12 AM', '%I %p')[3], 0) + eq(_strptime.strptime('12 PM', '%I %p')[3], 12) + eq(_strptime.strptime('12 AM', '%I %p')[3], 0) + + def test_main(): suite = unittest.TestSuite() *************** *** 271,274 **** --- 282,286 ---- suite.addTest(unittest.makeSuite(StrptimeTests)) suite.addTest(unittest.makeSuite(FxnTests)) + suite.addTest(unittest.makeSuite(Strptime12AMPMTests)) test_support.run_suite(suite) From bwarsaw@users.sourceforge.net Thu Aug 29 16:29:52 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 Aug 2002 08:29:52 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17266 Modified Files: _strptime.py Log Message: strptime(): The code that was adding 12 to PM hours was incorrect because it added it to 12 PM too. 12 PM should be hour 12 not hour 24. Also cleaned up a minor style nit. There are more style problems in this file that I'll clean up next (but I didn't want them to overwhelm the substance of this fix). Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _strptime.py 8 Aug 2002 20:19:18 -0000 1.2 --- _strptime.py 29 Aug 2002 15:29:49 -0000 1.3 *************** *** 416,425 **** else: hour = int(found_dict['I']) ! if found_dict.has_key('p'): ! if found_dict['p'] == locale_time.am_pm[1]: hour += 12 - else: - if hour is 12: - hour = 0 elif group_key is 'M': minute = int(found_dict['M']) --- 416,432 ---- else: 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. ! # 12 midnight == 12 AM == hour 0 ! 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. ! # 12 noon == 12 PM == hour 12 ! if hour != 12: hour += 12 elif group_key is 'M': minute = int(found_dict['M']) From bwarsaw@users.sourceforge.net Thu Aug 29 17:24:52 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 Aug 2002 09:24:52 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5581 Modified Files: _strptime.py Log Message: Many hopefully benign style clean ups. Still passes the test suite of course. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _strptime.py 29 Aug 2002 15:29:49 -0000 1.3 --- _strptime.py 29 Aug 2002 16:24:50 -0000 1.4 *************** *** 19,23 **** Can be used in Python 2.2 if the following line is added: >>> True = 1; False = 0 - """ import time --- 19,22 ---- *************** *** 28,32 **** from string import whitespace as whitespace_string ! __version__ = (2,1,5) __author__ = "Brett Cannon" __email__ = "drifty@bigfoot.com" --- 27,31 ---- from string import whitespace as whitespace_string ! __version__ = (2,1,6) __author__ = "Brett Cannon" __email__ = "drifty@bigfoot.com" *************** *** 34,37 **** --- 33,39 ---- __all__ = ['strptime'] + RegexpType = type(re_compile('')) + + class LocaleTime(object): """Stores and handles locale-specific information related to time. *************** *** 53,83 **** possible lack of timezone such as UTC) lang -- Language used by instance (string) - """ def __init__(self, f_weekday=None, a_weekday=None, f_month=None, ! a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None, ! timezone=None, lang=None): """Optionally set attributes with passed-in values.""" ! if f_weekday is None: self.__f_weekday = None ! elif len(f_weekday) == 7: self.__f_weekday = list(f_weekday) else: raise TypeError("full weekday names must be a 7-item sequence") ! if a_weekday is None: self.__a_weekday = None ! elif len(a_weekday) == 7: self.__a_weekday = list(a_weekday) else: raise TypeError( ! "abbreviated weekday names must be a 7-item sequence") ! if f_month is None: self.__f_month = None elif len(f_month) == 12: self.__f_month = self.__pad(f_month, True) else: raise TypeError("full month names must be a 12-item sequence") ! if a_month is None: self.__a_month = None elif len(a_month) == 12: self.__a_month = self.__pad(a_month, True) else: raise TypeError( ! "abbreviated month names must be a 12-item sequence") if am_pm is None: self.__am_pm = None --- 55,90 ---- possible lack of timezone such as UTC) lang -- Language used by instance (string) """ def __init__(self, f_weekday=None, a_weekday=None, f_month=None, ! a_month=None, am_pm=None, LC_date_time=None, LC_time=None, ! LC_date=None, timezone=None, lang=None): """Optionally set attributes with passed-in values.""" ! if f_weekday is None: ! self.__f_weekday = None ! elif len(f_weekday) == 7: ! self.__f_weekday = list(f_weekday) else: raise TypeError("full weekday names must be a 7-item sequence") ! if a_weekday is None: ! self.__a_weekday = None ! elif len(a_weekday) == 7: ! self.__a_weekday = list(a_weekday) else: raise TypeError( ! "abbreviated weekday names must be a 7-item sequence") ! if f_month is None: ! self.__f_month = None elif len(f_month) == 12: self.__f_month = self.__pad(f_month, True) else: raise TypeError("full month names must be a 12-item sequence") ! if a_month is None: ! self.__a_month = None elif len(a_month) == 12: self.__a_month = self.__pad(a_month, True) else: raise TypeError( ! "abbreviated month names must be a 12-item sequence") if am_pm is None: self.__am_pm = None *************** *** 98,144 **** def __pad(self, seq, front): ! """Add '' to seq to either front (is True), else the back.""" seq = list(seq) ! if front: seq.insert(0, '') ! else: seq.append('') return seq def __set_nothing(self, stuff): ! """Raise TypeError when trying to set an attribute.""" raise TypeError("attribute does not support assignment") def __get_f_weekday(self): ! """Fetch self.f_weekday.""" ! if not self.__f_weekday: self.__calc_weekday() return self.__f_weekday def __get_a_weekday(self): ! """Fetch self.a_weekday.""" ! if not self.__a_weekday: self.__calc_weekday() return self.__a_weekday f_weekday = property(__get_f_weekday, __set_nothing, ! doc="Full weekday names") a_weekday = property(__get_a_weekday, __set_nothing, ! doc="Abbreviated weekday names") def __get_f_month(self): ! """Fetch self.f_month.""" ! if not self.__f_month: self.__calc_month() return self.__f_month def __get_a_month(self): ! """Fetch self.a_month.""" ! if not self.__a_month: self.__calc_month() return self.__a_month f_month = property(__get_f_month, __set_nothing, ! doc="Full month names (dummy value at index 0)") a_month = property(__get_a_month, __set_nothing, ! doc="Abbreviated month names (dummy value at index 0)") def __get_am_pm(self): ! """Fetch self.am_pm.""" ! if not self.__am_pm: self.__calc_am_pm() return self.__am_pm --- 105,158 ---- def __pad(self, seq, front): ! # Add '' to seq to either front (is True), else the back. seq = list(seq) ! if front: ! seq.insert(0, '') ! else: ! seq.append('') return seq def __set_nothing(self, stuff): ! # Raise TypeError when trying to set an attribute. raise TypeError("attribute does not support assignment") def __get_f_weekday(self): ! # Fetch self.f_weekday. ! if not self.__f_weekday: ! self.__calc_weekday() return self.__f_weekday def __get_a_weekday(self): ! # Fetch self.a_weekday. ! if not self.__a_weekday: ! self.__calc_weekday() return self.__a_weekday f_weekday = property(__get_f_weekday, __set_nothing, ! doc="Full weekday names") a_weekday = property(__get_a_weekday, __set_nothing, ! doc="Abbreviated weekday names") def __get_f_month(self): ! # Fetch self.f_month. ! if not self.__f_month: ! self.__calc_month() return self.__f_month def __get_a_month(self): ! # Fetch self.a_month. ! if not self.__a_month: ! self.__calc_month() return self.__a_month f_month = property(__get_f_month, __set_nothing, ! doc="Full month names (dummy value at index 0)") a_month = property(__get_a_month, __set_nothing, ! doc="Abbreviated month names (dummy value at index 0)") def __get_am_pm(self): ! # Fetch self.am_pm. ! if not self.__am_pm: ! self.__calc_am_pm() return self.__am_pm *************** *** 146,151 **** def __get_timezone(self): ! """Fetch self.timezone.""" ! if not self.__timezone: self.__calc_timezone() return self.__timezone --- 160,166 ---- def __get_timezone(self): ! # Fetch self.timezone. ! if not self.__timezone: ! self.__calc_timezone() return self.__timezone *************** *** 154,173 **** def __get_LC_date_time(self): ! """Fetch self.LC_date_time.""" ! if not self.__LC_date_time: self.__calc_date_time() return self.__LC_date_time def __get_LC_date(self): ! """Fetch self.LC_date.""" ! if not self.__LC_date: self.__calc_date_time() return self.__LC_date def __get_LC_time(self): ! """Fetch self.LC_time.""" ! if not self.__LC_time: self.__calc_date_time() return self.__LC_time ! LC_date_time = property(__get_LC_date_time, __set_nothing, ! doc="Format string for locale's date/time representation ('%c' format)") LC_date = property(__get_LC_date, __set_nothing, doc="Format string for locale's date representation ('%x' format)") --- 169,193 ---- def __get_LC_date_time(self): ! # Fetch self.LC_date_time. ! if not self.__LC_date_time: ! self.__calc_date_time() return self.__LC_date_time def __get_LC_date(self): ! # Fetch self.LC_date. ! if not self.__LC_date: ! self.__calc_date_time() return self.__LC_date def __get_LC_time(self): ! # Fetch self.LC_time. ! if not self.__LC_time: ! self.__calc_date_time() return self.__LC_time ! LC_date_time = property( ! __get_LC_date_time, __set_nothing, ! doc= ! "Format string for locale's date/time representation ('%c' format)") LC_date = property(__get_LC_date, __set_nothing, doc="Format string for locale's date representation ('%x' format)") *************** *** 176,207 **** def __get_lang(self): ! """Fetch self.lang.""" ! if not self.__lang: self.__calc_lang() return self.__lang ! lang = property(__get_lang, __set_nothing, doc="Language used for instance") def __calc_weekday(self): ! """Set self.__a_weekday and self.__f_weekday using the calendar module.""" a_weekday = [calendar.day_abbr[i] for i in range(7)] f_weekday = [calendar.day_name[i] for i in range(7)] ! if not self.__a_weekday: self.__a_weekday = a_weekday ! if not self.__f_weekday: self.__f_weekday = f_weekday def __calc_month(self): ! """Set self.__f_month and self.__a_month using the calendar module.""" a_month = [calendar.month_abbr[i] for i in range(13)] f_month = [calendar.month_name[i] for i in range(13)] ! if not self.__a_month: self.__a_month = a_month ! if not self.__f_month: self.__f_month = f_month def __calc_am_pm(self): ! """Set self.__am_pm by using time.strftime(). ! ! The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really ! that magical; just happened to have used it everywhere else where a ! static date was needed. ! """ am_pm = [] for hour in (01,22): --- 196,232 ---- def __get_lang(self): ! # Fetch self.lang. ! if not self.__lang: ! self.__calc_lang() return self.__lang ! lang = property(__get_lang, __set_nothing, ! doc="Language used for instance") def __calc_weekday(self): ! # Set self.__a_weekday and self.__f_weekday using the calendar ! # module. a_weekday = [calendar.day_abbr[i] for i in range(7)] f_weekday = [calendar.day_name[i] for i in range(7)] ! if not self.__a_weekday: ! self.__a_weekday = a_weekday ! if not self.__f_weekday: ! self.__f_weekday = f_weekday def __calc_month(self): ! # Set self.__f_month and self.__a_month using the calendar module. a_month = [calendar.month_abbr[i] for i in range(13)] f_month = [calendar.month_name[i] for i in range(13)] ! if not self.__a_month: ! self.__a_month = a_month ! if not self.__f_month: ! self.__f_month = f_month def __calc_am_pm(self): ! # Set self.__am_pm by using time.strftime(). ! # The magic date (1999,3,17,hour,44,55,2,76,0) is not really that ! # magical; just happened to have used it everywhere else where a ! # static date was needed. am_pm = [] for hour in (01,22): *************** *** 211,222 **** def __calc_date_time(self): ! """Set self.__date_time, self.__date, & self.__time by using time.strftime(). ! ! Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of ! overloaded numbers is minimized. The order in which searches for ! values within the format string is very important; it eliminates ! possible ambiguity for what something represents. ! """ time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0)) date_time = [None, None, None] --- 236,246 ---- def __calc_date_time(self): ! # Set self.__date_time, self.__date, & self.__time by using ! # time.strftime(). ! # Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of ! # overloaded numbers is minimized. The order in which searches for ! # values within the format string is very important; it eliminates ! # possible ambiguity for what something represents. time_tuple = time.struct_time((1999,3,17,22,44,55,2,76,0)) date_time = [None, None, None] *************** *** 250,274 **** U_W = '%W' date_time[offset] = current_format.replace('11', U_W) ! if not self.__LC_date_time: self.__LC_date_time = date_time[0] ! if not self.__LC_date: self.__LC_date = date_time[1] ! if not self.__LC_time: self.__LC_time = date_time[2] def __calc_timezone(self): ! """Set self.__timezone by using time.tzname. ! ! Empty string used for matching when timezone is not used/needed such ! as with UTC. ! ! """ self.__timezone = self.__pad(time.tzname, 0) def __calc_lang(self): ! """Set self.lang by using locale.getlocale() or ! locale.getdefaultlocale(). ! ! """ current_lang = locale.getlocale(locale.LC_TIME)[0] ! if current_lang: self.__lang = current_lang ! else: self.__lang = locale.getdefaultlocale()[0] class TimeRE(dict): --- 274,300 ---- U_W = '%W' date_time[offset] = current_format.replace('11', U_W) ! if not self.__LC_date_time: ! self.__LC_date_time = date_time[0] ! if not self.__LC_date: ! self.__LC_date = date_time[1] ! if not self.__LC_time: ! self.__LC_time = date_time[2] def __calc_timezone(self): ! # Set self.__timezone by using time.tzname. ! # ! # Empty string used for matching when timezone is not used/needed such ! # as with UTC. self.__timezone = self.__pad(time.tzname, 0) def __calc_lang(self): ! # Set self.lang by using locale.getlocale() or ! # locale.getdefaultlocale(). current_lang = locale.getlocale(locale.LC_TIME)[0] ! if current_lang: ! self.__lang = current_lang ! else: ! self.__lang = locale.getdefaultlocale()[0] ! class TimeRE(dict): *************** *** 276,284 **** def __init__(self, locale_time=LocaleTime()): ! """Initialize instance with non-locale regexes and store LocaleTime object.""" super(TimeRE,self).__init__({ ! 'd': r"(?P3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is ! #to make %c from ANSI ! #C work 'H': r"(?P2[0-3]|[0-1]\d|\d)", 'I': r"(?P0\d|1[0-2]|\d)", --- 302,309 ---- def __init__(self, locale_time=LocaleTime()): ! """Init inst with non-locale regexes and store LocaleTime object.""" super(TimeRE,self).__init__({ ! # The " \d" option is to make %c from ANSI C work ! 'd': r"(?P3[0-1]|[0-2]\d|\d| \d)", 'H': r"(?P2[0-3]|[0-1]\d|\d)", 'I': r"(?P0\d|1[0-2]|\d)", *************** *** 289,293 **** 'U': r"(?P5[0-3]|[0-4]\d|\d)", 'w': r"(?P[0-6])", ! 'W': r"(?P5[0-3]|[0-4]\d|\d)", #Same as U 'y': r"(?P\d\d)", 'Y': r"(?P\d\d\d\d)"}) --- 314,318 ---- 'U': r"(?P5[0-3]|[0-4]\d|\d)", 'w': r"(?P[0-6])", ! 'W': r"(?P5[0-3]|[0-4]\d|\d)", # Same as U 'y': r"(?P\d\d)", 'Y': r"(?P\d\d\d\d)"}) *************** *** 301,314 **** 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) --- 326,339 ---- 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) *************** *** 321,325 **** elif fetch == 'Z': self[fetch] = self.__seqToRE(self.locale_time.timezone, ! fetch) elif fetch == '%': return '%' --- 346,350 ---- elif fetch == 'Z': self[fetch] = self.__seqToRE(self.locale_time.timezone, ! fetch) elif fetch == '%': return '%' *************** *** 334,346 **** differ by a suffix and thus want the name with the suffix to match first. - """ ! try: a_length = len(a) ! except TypeError: a_length = 0 ! try: b_length = len(b) ! except TypeError: b_length = 0 return cmp(b_length, a_length) ! to_convert = to_convert[:] #Don't want to change value in-place. to_convert.sort(sorter) regex = '(?P<%s>' % directive --- 359,374 ---- differ by a suffix and thus want the name with the suffix to match first. """ ! try: ! a_length = len(a) ! except TypeError: ! a_length = 0 ! try: ! b_length = len(b) ! except TypeError: ! b_length = 0 return cmp(b_length, a_length) ! to_convert = to_convert[:] # Don't want to change value in-place. to_convert.sort(sorter) regex = '(?P<%s>' % directive *************** *** 359,364 **** directive_index = format.index('%')+1 processed_format = "%s%s%s" % (processed_format, ! format[:directive_index-1], ! self[format[directive_index]]) format = format[directive_index+1:] return "%s%s" % (processed_format, format) --- 387,392 ---- directive_index = format.index('%')+1 processed_format = "%s%s%s" % (processed_format, ! format[:directive_index-1], ! self[format[directive_index]]) format = format[directive_index+1:] return "%s%s" % (processed_format, format) *************** *** 371,387 **** def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): ! """Convert data_string to a time struct based on the format string or re object; will return an re object for format if data_string is False. ! ! The object passed in for format may either be a re object compiled by ! strptime() or a format string. If False is passed in for data_string ! then an re object for format will be returned. The re object ! must be used with the same language as used to compile the re object. """ locale_time = LocaleTime() ! if isinstance(format, type(re_compile(''))): if format.pattern.find(locale_time.lang) == -1: ! raise TypeError("re object not created with same language as \ ! LocaleTime instance") else: compiled_re = format --- 399,414 ---- def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): ! """Return a time struct based on the input data and the format string. + The format argument may either be a regular expression object compiled by + strptime(), or a format string. If False is passed in for data_string + then the re object calculated for format will be returned. The re object + must be used with the same locale as was used to compile the re object. """ locale_time = LocaleTime() ! if isinstance(format, RegexpType): if format.pattern.find(locale_time.lang) == -1: ! raise TypeError("re object not created with same language as " ! "LocaleTime instance") else: compiled_re = format *************** *** 394,450 **** if not found: raise ValueError("time data did not match format") ! year = month = day = hour = minute = second = weekday = julian = tz = -1 found_dict = found.groupdict() for group_key in found_dict.iterkeys(): ! if group_key in 'yY': ! if group_key is 'y': ! year = int("%s%s" % (time.strftime("%Y")[:-2], found_dict['y'])) ! else: ! year = int(found_dict['Y']) ! elif group_key in 'Bbm': ! if group_key is 'm': ! month = int(found_dict['m']) ! elif group_key is 'B': ! month = locale_time.f_month.index(found_dict['B']) ! else: ! month = locale_time.a_month.index(found_dict['b']) ! elif group_key is 'd': day = int(found_dict['d']) ! elif group_key in 'HI': ! if group_key is 'H': ! hour = int(found_dict['H']) ! else: ! 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. ! # 12 midnight == 12 AM == hour 0 ! 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. ! # 12 noon == 12 PM == hour 12 ! if hour != 12: ! hour += 12 ! elif group_key is 'M': minute = int(found_dict['M']) ! elif group_key is 'S': second = int(found_dict['S']) ! elif group_key in 'Aaw': ! if group_key is 'A': ! weekday = locale_time.f_weekday.index(found_dict['A']) ! elif group_key is 'a': ! weekday = locale_time.a_weekday.index(found_dict['a']) else: ! weekday = int(found_dict['w']) ! if weekday == 0: ! weekday = 6 ! else: ! weekday -= 1 ! elif group_key is 'j': julian = int(found_dict['j']) ! elif group_key is 'Z': if locale_time.timezone[0] == found_dict['Z']: tz = 0 --- 421,474 ---- if not found: raise ValueError("time data did not match format") ! year = month = day = hour = minute = second = weekday = julian = tz =-1 found_dict = found.groupdict() for group_key in found_dict.iterkeys(): ! if group_key == 'y': ! year = int("%s%s" % ! (time.strftime("%Y")[:-2], found_dict['y'])) ! elif group_key == 'Y': ! year = int(found_dict['Y']) ! elif group_key == 'm': ! 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']) ! elif group_key is 'H': ! hour = int(found_dict['H']) ! 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. ! # 12 midnight == 12 AM == hour 0 ! 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. ! # 12 noon == 12 PM == hour 12 ! if hour != 12: ! hour += 12 ! elif group_key == 'M': minute = int(found_dict['M']) ! elif group_key == 'S': 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']) ! if weekday == 0: ! weekday = 6 else: ! weekday -= 1 ! elif group_key == 'j': julian = int(found_dict['j']) ! elif group_key == 'Z': if locale_time.timezone[0] == found_dict['Z']: tz = 0 *************** *** 456,493 **** julian = julianday(year, month, day) if (month == -1 or day == -1) and julian != -1 and year != -1: ! year,month,day = gregorian(julian, year) if weekday == -1 and year != -1 and month != -1 and day != -1: weekday = dayofweek(year, month, day) ! return time.struct_time((year,month,day,hour,minute,second,weekday, ! julian,tz)) def firstjulian(year): """Calculate the Julian date up until the first of the year.""" ! return ((146097*(year+4799))//400)-31738 def julianday(year, month, day): ! """Calculate the Julian day since the beginning of the year from the Gregorian date.""" ! a = (14-month)//12 ! return (day-32045+(((153*(month+(12*a)-3))+2)//5)+\ ! ((146097*(year+4800-a))//400))-firstjulian(year)+1 def gregorian(julian, year): ! """Return a 3-item list containing the Gregorian date based on the Julian day.""" ! a = 32043+julian+firstjulian(year) ! b = ((4*a)+3)//146097 ! c = a-((146097*b)//4) ! d = ((4*c)+3)//1461 ! e = c-((1461*d)//4) ! m = ((5*e)+2)//153 ! day = 1+e-(((153*m)+2)//5) ! month = m+3-(12*(m//10)) ! year = (100*b)+d-4800+(m//10) return [year, month, day] def dayofweek(year, month, day): """Calculate the day of the week (Monday is 0).""" ! a = (14-month)//12 ! y = year-a ! weekday = (day+y+((97*y)//400)+((31*(month+(12*a)-2))//12))%7 if weekday == 0: return 6 --- 480,521 ---- julian = julianday(year, month, day) if (month == -1 or day == -1) and julian != -1 and year != -1: ! year, month, day = gregorian(julian, year) if weekday == -1 and year != -1 and month != -1 and day != -1: weekday = dayofweek(year, month, day) ! return time.struct_time( ! (year,month,day,hour,minute,second,weekday, julian,tz)) def firstjulian(year): """Calculate the Julian date up until the first of the year.""" ! return ((146097 * (year + 4799)) // 400) - 31738 def julianday(year, month, day): ! """Calculate the Julian day since the beginning of the year. ! Calculated from the Gregorian date. ! """ ! a = (14 - month) // 12 ! return (day - 32045 ! + (((153 * (month + (12 * a) - 3)) + 2) // 5) ! + ((146097 * (year + 4800 - a)) // 400)) - firstjulian(year) + 1 def gregorian(julian, year): ! """Return 3-item list containing Gregorian date based on the Julian day.""" ! a = 32043 + julian + firstjulian(year) ! b = ((4 * a) + 3) // 146097 ! c = a - ((146097 * b) // 4) ! d = ((4 * c) + 3) // 1461 ! e = c - ((1461 * d) // 4) ! m = ((5 * e) + 2) // 153 ! day = 1 + e - (((153 * m) + 2) // 5) ! month = m + 3 - (12 * (m // 10)) ! year = (100 * b) + d - 4800 + (m // 10) return [year, month, day] def dayofweek(year, month, day): """Calculate the day of the week (Monday is 0).""" ! a = (14 - month) // 12 ! y = year - a ! weekday = (day + y + ((97 * y) // 400) ! + ((31 * (month + (12 * a) -2 )) // 12)) % 7 if weekday == 0: return 6 From python@rcn.com Thu Aug 29 19:44:02 2002 From: python@rcn.com (Raymond Hettinger) Date: Thu, 29 Aug 2002 14:44:02 -0400 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64 References: Message-ID: <001001c24f8c$0bf952e0$83ec7ad1@othello> I think this should be backported but am not certain. ----- Original Message ----- From: To: Sent: Thursday, August 29, 2002 10:22 AM Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64 > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv26220/Objects > > Modified Files: > complexobject.c > Log Message: > complex() was the only numeric constructor that created a new instance > when given its own type as an argument. > > > Index: complexobject.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v > retrieving revision 2.63 > retrieving revision 2.64 > diff -C2 -d -r2.63 -r2.64 > *** complexobject.c 19 Aug 2002 19:26:42 -0000 2.63 > --- complexobject.c 29 Aug 2002 14:22:50 -0000 2.64 > *************** > *** 824,827 **** > --- 824,836 ---- > &r, &i)) > return NULL; > + > + /* Special-case for single argumet that is already complex */ > + if (PyComplex_CheckExact(r) && i == NULL) { > + /* Note that we can't know whether it's safe to return > + a complex *subclass* instance as-is, hence the restriction > + to exact complexes here. */ > + Py_INCREF(r); > + return r; > + } > if (PyString_Check(r) || PyUnicode_Check(r)) { > if (i != NULL) { > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins > From guido@python.org Thu Aug 29 19:56:09 2002 From: guido@python.org (Guido van Rossum) Date: Thu, 29 Aug 2002 14:56:09 -0400 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64 In-Reply-To: Your message of "Thu, 29 Aug 2002 14:44:02 EDT." <001001c24f8c$0bf952e0$83ec7ad1@othello> References: <001001c24f8c$0bf952e0$83ec7ad1@othello> Message-ID: <200208291856.g7TIu9p01311@odiug.zope.com> > I think this should be backported but am not certain. > > > complex() was the only numeric constructor that created a new instance > > when given its own type as an argument. Hm, it seems a very minor efficiency hack at best. For immutable objects, object identity is generally an optimization only and programs should never depend on it. --Guido van Rossum (home page: http://www.python.org/~guido/) From python@rcn.com Thu Aug 29 20:05:54 2002 From: python@rcn.com (Raymond Hettinger) Date: Thu, 29 Aug 2002 15:05:54 -0400 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64 References: <001001c24f8c$0bf952e0$83ec7ad1@othello> <200208291856.g7TIu9p01311@odiug.zope.com> Message-ID: <002c01c24f8f$19f501c0$83ec7ad1@othello> From: "Guido van Rossum" > > I think this should be backported but am not certain. > > > > > complex() was the only numeric constructor that created a new instance > > > when given its own type as an argument. > > Hm, it seems a very minor efficiency hack at best. For immutable > objects, object identity is generally an optimization only and > programs should never depend on it. Agreed. I was more concerned that what works for one numeric type, works for them all. Since it's not a bug and you're not awestruck, backporting is out. From jhylton@users.sourceforge.net Thu Aug 29 21:12:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 29 Aug 2002 13:12:29 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.34.2.5,1.34.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15977 Modified Files: Tag: release21-maint httplib.py Log Message: Fix SF bug [ 599838 ] httplib.connect broken in 2.1 branch Some IPv6-specific changes crept into the 2.1 branch when I backported other bug fixes. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.34.2.5 retrieving revision 1.34.2.6 diff -C2 -d -r1.34.2.5 -r1.34.2.6 *** httplib.py 12 Jul 2002 15:22:07 -0000 1.34.2.5 --- httplib.py 29 Aug 2002 20:12:26 -0000 1.34.2.6 *************** *** 506,528 **** def connect(self): """Connect to the host and port specified in __init__.""" ! msg = "getaddrinfo returns an empty list" ! for res in socket.getaddrinfo(self.host, self.port, 0, ! socket.SOCK_STREAM): ! af, socktype, proto, canonname, sa = res ! try: ! self.sock = socket.socket(af, socktype, proto) ! if self.debuglevel > 0: ! print "connect: (%s, %s)" % (self.host, self.port) ! self.sock.connect(sa) ! except socket.error, msg: ! if self.debuglevel > 0: ! print 'connect fail:', (self.host, self.port) ! if self.sock: ! self.sock.close() ! self.sock = None ! continue ! break ! if not self.sock: ! raise socket.error, msg def close(self): --- 506,513 ---- def connect(self): """Connect to the host and port specified in __init__.""" ! self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ! if self.debuglevel > 0: ! print "connect: (%s, %s)" % (self.host, self.port) ! self.sock.connect((self.host, self.port)) def close(self): From jackjansen@users.sourceforge.net Thu Aug 29 21:20:27 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 Aug 2002 13:20:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib buildtools.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18669 Modified Files: buildtools.py Log Message: Don't copy the documentation when using Python.app as an applet template. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** buildtools.py 18 Aug 2002 21:57:09 -0000 1.17 --- buildtools.py 29 Aug 2002 20:20:24 -0000 1.18 *************** *** 296,299 **** --- 296,300 ---- exceptlist = ["Contents/Info.plist", "Contents/Resources/English.lproj/InfoPlist.strings", + "Contents/Resources/English.lproj/Documentation", "Contents/Resources/python.rsrc", ] From nnorwitz@users.sourceforge.net Thu Aug 29 21:25:48 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 29 Aug 2002 13:25:48 -0700 Subject: [Python-checkins] python/dist/src/Objects frameobject.c,2.65,2.66 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20797/Objects Modified Files: frameobject.c Log Message: SF #561244: micro optimizations, builtins cannot be NULL, so use Py_INCREF Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -d -r2.65 -r2.66 *** frameobject.c 19 Aug 2002 16:54:08 -0000 2.65 --- frameobject.c 29 Aug 2002 20:25:46 -0000 2.66 *************** *** 288,292 **** } else ! Py_XINCREF(builtins); f->f_builtins = builtins; Py_XINCREF(back); --- 288,292 ---- } else ! Py_INCREF(builtins); f->f_builtins = builtins; Py_XINCREF(back); From jackjansen@users.sourceforge.net Thu Aug 29 22:09:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 Aug 2002 14:09:02 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.108,1.109 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv4709 Modified Files: setup.py Log Message: Revived the Carbon.Help module, but implementing the MacHelp API in stead of the defunct Balloons API. Help tags are TBD, but at least this gives us access to the help menu. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** setup.py 15 Aug 2002 01:34:38 -0000 1.108 --- setup.py 29 Aug 2002 21:08:59 -0000 1.109 *************** *** 779,782 **** --- 779,784 ---- exts.append( Extension('_AE', ['ae/_AEmodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_AH', ['ah/_AHmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_App', ['app/_Appmodule.c'], extra_link_args=['-framework', 'Carbon']) ) *************** *** 797,800 **** --- 799,804 ---- extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Help', ['help/_Helpmodule.c'], extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], From jackjansen@users.sourceforge.net Thu Aug 29 22:09:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 Aug 2002 14:09:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon MacHelp.py,NONE,1.1 Balloons.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv4709/Mac/Lib/Carbon Added Files: MacHelp.py Removed Files: Balloons.py Log Message: Revived the Carbon.Help module, but implementing the MacHelp API in stead of the defunct Balloons API. Help tags are TBD, but at least this gives us access to the help menu. --- NEW FILE: MacHelp.py --- # Generated from 'MacHelp.h' def FOUR_CHAR_CODE(x): return x kMacHelpVersion = 0x0003 kHMSupplyContent = 0 kHMDisposeContent = 1 kHMNoContent = FOUR_CHAR_CODE('none') kHMCFStringContent = FOUR_CHAR_CODE('cfst') kHMPascalStrContent = FOUR_CHAR_CODE('pstr') kHMStringResContent = FOUR_CHAR_CODE('str#') kHMTEHandleContent = FOUR_CHAR_CODE('txth') kHMTextResContent = FOUR_CHAR_CODE('text') kHMStrResContent = FOUR_CHAR_CODE('str ') kHMDefaultSide = 0 kHMOutsideTopScriptAligned = 1 kHMOutsideLeftCenterAligned = 2 kHMOutsideBottomScriptAligned = 3 kHMOutsideRightCenterAligned = 4 kHMOutsideTopLeftAligned = 5 kHMOutsideTopRightAligned = 6 kHMOutsideLeftTopAligned = 7 kHMOutsideLeftBottomAligned = 8 kHMOutsideBottomLeftAligned = 9 kHMOutsideBottomRightAligned = 10 kHMOutsideRightTopAligned = 11 kHMOutsideRightBottomAligned = 12 kHMOutsideTopCenterAligned = 13 kHMOutsideBottomCenterAligned = 14 kHMInsideRightCenterAligned = 15 kHMInsideLeftCenterAligned = 16 kHMInsideBottomCenterAligned = 17 kHMInsideTopCenterAligned = 18 kHMInsideTopLeftCorner = 19 kHMInsideTopRightCorner = 20 kHMInsideBottomLeftCorner = 21 kHMInsideBottomRightCorner = 22 kHMAbsoluteCenterAligned = 23 kHMTopSide = kHMOutsideTopScriptAligned kHMLeftSide = kHMOutsideLeftCenterAligned kHMBottomSide = kHMOutsideBottomScriptAligned kHMRightSide = kHMOutsideRightCenterAligned kHMTopLeftCorner = kHMOutsideTopLeftAligned kHMTopRightCorner = kHMOutsideTopRightAligned kHMLeftTopCorner = kHMOutsideLeftTopAligned kHMLeftBottomCorner = kHMOutsideLeftBottomAligned kHMBottomLeftCorner = kHMOutsideBottomLeftAligned kHMBottomRightCorner = kHMOutsideBottomRightAligned kHMRightTopCorner = kHMOutsideRightTopAligned kHMRightBottomCorner = kHMOutsideRightBottomAligned kHMContentProvided = 0 kHMContentNotProvided = 1 kHMContentNotProvidedDontPropagate = 2 kHMMinimumContentIndex = 0 kHMMaximumContentIndex = 1 errHMIllegalContentForMinimumState = -10980 errHMIllegalContentForMaximumState = -10981 kHMIllegalContentForMinimumState = errHMIllegalContentForMinimumState kHelpTagEventHandlerTag = FOUR_CHAR_CODE('hevt') --- Balloons.py DELETED --- From jackjansen@users.sourceforge.net Thu Aug 29 22:09:02 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 Aug 2002 14:09:02 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c,1.6,1.7 helpscan.py,1.6,1.7 helpsupport.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory usw-pr-cvs1:/tmp/cvs-serv4709/Mac/Modules/help Modified Files: _Helpmodule.c helpscan.py helpsupport.py Log Message: Revived the Carbon.Help module, but implementing the MacHelp API in stead of the defunct Balloons API. Help tags are TBD, but at least this gives us access to the help menu. Index: _Helpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/_Helpmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _Helpmodule.c 16 Aug 2002 09:09:26 -0000 1.6 --- _Helpmodule.c 29 Aug 2002 21:09:00 -0000 1.7 *************** *** 21,68 **** ! #include static PyObject *Help_Error; ! static PyObject *Help_HMGetHelpMenuHandle(PyObject *_self, PyObject *_args) ! { ! PyObject *_res = NULL; ! OSErr _err; ! MenuRef mh; ! if (!PyArg_ParseTuple(_args, "")) ! return NULL; ! _err = HMGetHelpMenuHandle(&mh); ! if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&", ! MenuObj_New, mh); ! return _res; ! } ! ! static PyObject *Help_HMRemoveBalloon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSErr _err; if (!PyArg_ParseTuple(_args, "")) return NULL; ! _err = HMRemoveBalloon(); if (_err != noErr) return PyMac_Error(_err); ! Py_INCREF(Py_None); ! _res = Py_None; ! return _res; ! } ! ! static PyObject *Help_HMIsBalloon(PyObject *_self, PyObject *_args) ! { ! PyObject *_res = NULL; ! Boolean _rv; ! if (!PyArg_ParseTuple(_args, "")) ! return NULL; ! _rv = HMIsBalloon(); ! _res = Py_BuildValue("b", ! _rv); return _res; } ! static PyObject *Help_HMGetBalloons(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 21,50 ---- ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif static PyObject *Help_Error; ! static PyObject *Help_HMGetHelpMenu(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSStatus _err; ! MenuRef outHelpMenu; ! MenuItemIndex outFirstCustomItemIndex; if (!PyArg_ParseTuple(_args, "")) return NULL; ! _err = HMGetHelpMenu(&outHelpMenu, ! &outFirstCustomItemIndex); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("O&H", ! MenuObj_New, outHelpMenu, ! outFirstCustomItemIndex); return _res; } ! static PyObject *Help_HMAreHelpTagsDisplayed(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 70,74 **** if (!PyArg_ParseTuple(_args, "")) return NULL; ! _rv = HMGetBalloons(); _res = Py_BuildValue("b", _rv); --- 52,56 ---- if (!PyArg_ParseTuple(_args, "")) return NULL; ! _rv = HMAreHelpTagsDisplayed(); _res = Py_BuildValue("b", _rv); *************** *** 76,103 **** } ! static PyObject *Help_HMSetBalloons(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSErr _err; ! Boolean flag; if (!PyArg_ParseTuple(_args, "b", ! &flag)) ! return NULL; ! _err = HMSetBalloons(flag); ! if (_err != noErr) return PyMac_Error(_err); ! Py_INCREF(Py_None); ! _res = Py_None; ! return _res; ! } ! ! static PyObject *Help_HMSetFont(PyObject *_self, PyObject *_args) ! { ! PyObject *_res = NULL; ! OSErr _err; ! SInt16 font; ! if (!PyArg_ParseTuple(_args, "h", ! &font)) return NULL; ! _err = HMSetFont(font); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 58,70 ---- } ! static PyObject *Help_HMSetHelpTagsDisplayed(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSStatus _err; ! Boolean inDisplayTags; if (!PyArg_ParseTuple(_args, "b", ! &inDisplayTags)) return NULL; ! _err = HMSetHelpTagsDisplayed(inDisplayTags); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 106,118 **** } ! static PyObject *Help_HMSetFontSize(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSErr _err; ! UInt16 fontSize; ! if (!PyArg_ParseTuple(_args, "H", ! &fontSize)) return NULL; ! _err = HMSetFontSize(fontSize); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 73,85 ---- } ! static PyObject *Help_HMSetTagDelay(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSStatus _err; ! Duration inDelay; ! if (!PyArg_ParseTuple(_args, "l", ! &inDelay)) return NULL; ! _err = HMSetTagDelay(inDelay); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 121,179 **** } ! static PyObject *Help_HMGetFont(PyObject *_self, PyObject *_args) ! { ! PyObject *_res = NULL; ! OSErr _err; ! SInt16 font; ! if (!PyArg_ParseTuple(_args, "")) ! return NULL; ! _err = HMGetFont(&font); ! if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("h", ! font); ! return _res; ! } ! ! static PyObject *Help_HMGetFontSize(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSErr _err; ! UInt16 fontSize; if (!PyArg_ParseTuple(_args, "")) return NULL; ! _err = HMGetFontSize(&fontSize); ! if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("H", ! fontSize); ! return _res; ! } ! ! static PyObject *Help_HMSetDialogResID(PyObject *_self, PyObject *_args) ! { ! PyObject *_res = NULL; ! OSErr _err; ! SInt16 resID; ! if (!PyArg_ParseTuple(_args, "h", ! &resID)) ! return NULL; ! _err = HMSetDialogResID(resID); if (_err != noErr) return PyMac_Error(_err); ! Py_INCREF(Py_None); ! _res = Py_None; return _res; } ! static PyObject *Help_HMSetMenuResID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSErr _err; ! SInt16 menuID; ! SInt16 resID; ! if (!PyArg_ParseTuple(_args, "hh", ! &menuID, ! &resID)) return NULL; ! _err = HMSetMenuResID(menuID, ! resID); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 88,117 ---- } ! static PyObject *Help_HMGetTagDelay(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSStatus _err; ! Duration outDelay; if (!PyArg_ParseTuple(_args, "")) return NULL; ! _err = HMGetTagDelay(&outDelay); if (_err != noErr) return PyMac_Error(_err); ! _res = Py_BuildValue("l", ! outDelay); return _res; } ! static PyObject *Help_HMSetMenuHelpFromBalloonRsrc(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSStatus _err; ! MenuRef inMenu; ! SInt16 inHmnuRsrcID; ! if (!PyArg_ParseTuple(_args, "O&h", ! MenuObj_Convert, &inMenu, ! &inHmnuRsrcID)) return NULL; ! _err = HMSetMenuHelpFromBalloonRsrc(inMenu, ! inHmnuRsrcID); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 182,200 **** } ! static PyObject *Help_HMScanTemplateItems(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSErr _err; ! SInt16 whichID; ! SInt16 whichResFile; ! ResType whichType; ! if (!PyArg_ParseTuple(_args, "hhO&", ! &whichID, ! &whichResFile, ! PyMac_GetOSType, &whichType)) return NULL; ! _err = HMScanTemplateItems(whichID, ! whichResFile, ! whichType); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 120,138 ---- } ! static PyObject *Help_HMSetDialogHelpFromBalloonRsrc(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; ! OSStatus _err; ! DialogPtr inDialog; ! SInt16 inHdlgRsrcID; ! SInt16 inItemStart; ! if (!PyArg_ParseTuple(_args, "O&hh", ! DlgObj_Convert, &inDialog, ! &inHdlgRsrcID, ! &inItemStart)) return NULL; ! _err = HMSetDialogHelpFromBalloonRsrc(inDialog, ! inHdlgRsrcID, ! inItemStart); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 203,282 **** } - static PyObject *Help_HMGetDialogResID(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OSErr _err; - SInt16 resID; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HMGetDialogResID(&resID); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("h", - resID); - return _res; - } - - static PyObject *Help_HMGetMenuResID(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OSErr _err; - SInt16 menuID; - SInt16 resID; - if (!PyArg_ParseTuple(_args, "h", - &menuID)) - return NULL; - _err = HMGetMenuResID(menuID, - &resID); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("h", - resID); - return _res; - } - - static PyObject *Help_HMGetBalloonWindow(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OSErr _err; - WindowPtr window; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HMGetBalloonWindow(&window); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - WinObj_New, window); - return _res; - } - static PyMethodDef Help_methods[] = { ! {"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1, ! PyDoc_STR("() -> (MenuRef mh)")}, ! {"HMRemoveBalloon", (PyCFunction)Help_HMRemoveBalloon, 1, ! PyDoc_STR("() -> None")}, ! {"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1, ! PyDoc_STR("() -> (Boolean _rv)")}, ! {"HMGetBalloons", (PyCFunction)Help_HMGetBalloons, 1, PyDoc_STR("() -> (Boolean _rv)")}, ! {"HMSetBalloons", (PyCFunction)Help_HMSetBalloons, 1, ! PyDoc_STR("(Boolean flag) -> None")}, ! {"HMSetFont", (PyCFunction)Help_HMSetFont, 1, ! PyDoc_STR("(SInt16 font) -> None")}, ! {"HMSetFontSize", (PyCFunction)Help_HMSetFontSize, 1, ! PyDoc_STR("(UInt16 fontSize) -> None")}, ! {"HMGetFont", (PyCFunction)Help_HMGetFont, 1, ! PyDoc_STR("() -> (SInt16 font)")}, ! {"HMGetFontSize", (PyCFunction)Help_HMGetFontSize, 1, ! PyDoc_STR("() -> (UInt16 fontSize)")}, ! {"HMSetDialogResID", (PyCFunction)Help_HMSetDialogResID, 1, ! PyDoc_STR("(SInt16 resID) -> None")}, ! {"HMSetMenuResID", (PyCFunction)Help_HMSetMenuResID, 1, ! PyDoc_STR("(SInt16 menuID, SInt16 resID) -> None")}, ! {"HMScanTemplateItems", (PyCFunction)Help_HMScanTemplateItems, 1, ! PyDoc_STR("(SInt16 whichID, SInt16 whichResFile, ResType whichType) -> None")}, ! {"HMGetDialogResID", (PyCFunction)Help_HMGetDialogResID, 1, ! PyDoc_STR("() -> (SInt16 resID)")}, ! {"HMGetMenuResID", (PyCFunction)Help_HMGetMenuResID, 1, ! PyDoc_STR("(SInt16 menuID) -> (SInt16 resID)")}, ! {"HMGetBalloonWindow", (PyCFunction)Help_HMGetBalloonWindow, 1, ! PyDoc_STR("() -> (WindowPtr window)")}, {NULL, NULL, 0} }; --- 141,159 ---- } static PyMethodDef Help_methods[] = { ! {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1, ! PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")}, ! {"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1, PyDoc_STR("() -> (Boolean _rv)")}, ! {"HMSetHelpTagsDisplayed", (PyCFunction)Help_HMSetHelpTagsDisplayed, 1, ! PyDoc_STR("(Boolean inDisplayTags) -> None")}, ! {"HMSetTagDelay", (PyCFunction)Help_HMSetTagDelay, 1, ! PyDoc_STR("(Duration inDelay) -> None")}, ! {"HMGetTagDelay", (PyCFunction)Help_HMGetTagDelay, 1, ! PyDoc_STR("() -> (Duration outDelay)")}, ! {"HMSetMenuHelpFromBalloonRsrc", (PyCFunction)Help_HMSetMenuHelpFromBalloonRsrc, 1, ! PyDoc_STR("(MenuRef inMenu, SInt16 inHmnuRsrcID) -> None")}, ! {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction)Help_HMSetDialogHelpFromBalloonRsrc, 1, ! PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")}, {NULL, NULL, 0} }; Index: helpscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/helpscan.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** helpscan.py 15 Aug 2002 21:48:14 -0000 1.6 --- helpscan.py 29 Aug 2002 21:09:00 -0000 1.7 *************** *** 7,11 **** from scantools import Scanner ! LONG = "Balloons" SHORT = "help" OBJECT = "NOTUSED" --- 7,11 ---- from scantools import Scanner ! LONG = "MacHelp" SHORT = "help" OBJECT = "NOTUSED" *************** *** 46,58 **** def makeblacklisttypes(self): return [ ! "TipFunctionUPP", ! "HMMessageRecord", ! "HMMessageRecord_ptr", ] def makerepairinstructions(self): return [ ! ([("WindowPtr", "*", "OutMode")], ! [("ExistingWindowPtr", "*", "*")]), ] --- 46,65 ---- def makeblacklisttypes(self): return [ ! ## "TipFunctionUPP", ! ## "HMMessageRecord", ! ## "HMMessageRecord_ptr", ! "HMWindowContentUPP", ! "HMMenuTitleContentUPP", ! "HMControlContentUPP", ! "HMMenuItemContentUPP", ! # For the moment ! "HMHelpContentRec", ! "HMHelpContentRec_ptr", ] def makerepairinstructions(self): return [ ! ## ([("WindowPtr", "*", "OutMode")], ! ## [("ExistingWindowPtr", "*", "*")]), ] Index: helpsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/helpsupport.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** helpsupport.py 23 Aug 2001 13:49:19 -0000 1.5 --- helpsupport.py 29 Aug 2002 21:09:00 -0000 1.6 *************** *** 7,11 **** # Declarations that change for each manager - MACHEADERFILE = 'Balloons.h' # The Apple header file MODNAME = '_Help' # The name of the module OBJECTNAME = 'UNUSED' # The basic name of the objects used here --- 7,10 ---- *************** *** 23,42 **** # Create the type objects MenuRef = OpaqueByValueType("MenuRef", "MenuObj") ! #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) ! RgnHandle = FakeType("(RgnHandle)0") # XXXX Should be next, but this will break a lot of code... # RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj") ! KeyMap = ArrayOutputBufferType("KeyMap") ##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style ##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style ! EventMask = Type("EventMask", "H") ! EventKind = Type("EventKind", "H") includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ """ --- 22,45 ---- # Create the type objects MenuRef = OpaqueByValueType("MenuRef", "MenuObj") ! MenuItemIndex = Type("MenuItemIndex", "H") #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) ! #RgnHandle = FakeType("(RgnHandle)0") # XXXX Should be next, but this will break a lot of code... # RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj") ! #KeyMap = ArrayOutputBufferType("KeyMap") ##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style ##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style ! #EventMask = Type("EventMask", "H") ! #EventKind = Type("EventKind", "H") includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif """ From jackjansen@users.sourceforge.net Thu Aug 29 23:04:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 Aug 2002 15:04:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib FrameWork.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22648 Modified Files: FrameWork.py Log Message: Added support for the help menu. Application.gethelpmenu() will return it. Also fixed menu IDs to be signed in do_menudispatch. this is an incompatible change, but I don't think it'll hurt anyone. Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** FrameWork.py 4 Feb 2002 12:52:44 -0000 1.49 --- FrameWork.py 29 Aug 2002 22:04:15 -0000 1.50 *************** *** 14,17 **** --- 14,18 ---- from Carbon.Evt import * from Carbon.Events import * + from Carbon.Help import * from Carbon.Menu import * from Carbon.Menus import * *************** *** 112,115 **** --- 113,117 ---- else: self.makemenubar() + self._helpmenu = None def __del__(self): *************** *** 126,129 **** --- 128,136 ---- self.filemenu = m = Menu(self.menubar, "File") self._quititem = MenuItem(m, "Quit", "Q", self._quit) + + def gethelpmenu(self): + if self._helpmenu == None: + self._helpmenu = HelpMenu(self.menubar) + return self._helpmenu def _quit(self, *args): *************** *** 298,301 **** --- 305,310 ---- result = MenuSelect(where) id = (result>>16) & 0xffff # Hi word + if id >= 0x8000: + id = -65536 + id item = result & 0xffff # Lo word self.do_rawmenu(id, item, window, event) *************** *** 716,719 **** --- 725,740 ---- name = self.menu.GetMenuItemText(item) OpenDeskAcc(name) + + class HelpMenu(Menu): + def __init__(self, bar): + # Note we don't call Menu.__init__, we do the necessary things by hand + self.bar = bar + self.menu, index = HMGetHelpMenu() + self.id = self.menu.GetMenuID() + bar.menus[self.id] = self + # The next line caters for the entries the system already handles for us + self.items = [None]*(index-1) + self._parent = None + class Window: *************** *** 1067,1070 **** --- 1088,1094 ---- self.opt3 = CheckItem(mm, "Complaints", (kMenuOptionModifier|kMenuNoCommandModifier, "A")) Separator(m) + self.itemeh = MenuItem(m, "Enable Help", None, self.enablehelp) + self.itemdbg = MenuItem(m, "Debug", None, self.debug) + Separator(m) self.quititem = MenuItem(m, "Quit", "Q", self.quit) *************** *** 1074,1077 **** --- 1098,1112 ---- def quit(self, *args): raise self + + def enablehelp(self, *args): + hm = self.gethelpmenu() + self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp) + + def nohelp(self, *args): + print "I told you there isn't any!" + + def debug(self, *args): + import pdb + pdb.set_trace() From goodger@users.sourceforge.net Fri Aug 30 04:10:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:10:54 -0700 Subject: [Python-checkins] python/nondist/peps pep-0256.txt,1.3,1.4 pep-0257.txt,1.5,1.6 pep-0258.txt,1.3,1.4 pep-0287.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30789 Modified Files: pep-0256.txt pep-0257.txt pep-0258.txt pep-0287.txt Log Message: Converted to reStructuredText & updated. Index: pep-0256.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0256.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0256.txt 1 Aug 2002 22:32:33 -0000 1.3 --- pep-0256.txt 30 Aug 2002 03:10:51 -0000 1.4 *************** *** 3,10 **** Version: $Revision$ Last-Modified: $Date$ ! Author: goodger@users.sourceforge.net (David Goodger) ! Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track Created: 01-Jun-2001 Post-History: 13-Jun-2001 --- 3,11 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: David Goodger ! Discussions-To: Status: Draft Type: Standards Track + Content-Type: text/x-rst Created: 01-Jun-2001 Post-History: 13-Jun-2001 *************** *** 12,291 **** Abstract ! Python lends itself to inline documentation. With its built-in ! docstring syntax, a limited form of Literate Programming [1]_ is ! easy to do in Python. However, there are no satisfactory standard ! tools for extracting and processing Python docstrings. The lack ! of a standard toolset is a significant gap in Python's ! infrastructure; this PEP aims to fill the gap. ! The issues surrounding docstring processing have been contentious ! and difficult to resolve. This PEP proposes a generic Docstring ! Processing System (DPS) framework, which separates out the ! components (program and conceptual), enabling the resolution of ! individual issues either through consensus (one solution) or ! through divergence (many). It promotes standard interfaces which ! will allow a variety of plug-in components (input context readers, ! markup parsers, and output format writers) to be used. ! The concepts of a DPS framework are presented independently of ! implementation details. Roadmap to the Doctring PEPs ! There are many aspects to docstring processing. The "Docstring ! PEPs" have broken up the issues in order to deal with each of them ! in isolation, or as close as possible. The individual aspects and ! associated PEPs are as follows: ! * Docstring syntax. PEP 287, reStructuredText Docstring Format, ! proposes a syntax for Python docstrings, PEPs, and other uses. ! * Docstring semantics consist of at least two aspects: ! - Conventions: the high-level structure of docstrings. Dealt ! with in PEP 257, Docstring Conventions. ! - Methodology: rules for the informational content of ! docstrings. Not addressed. ! * Processing mechanisms. This PEP outlines the high-level issues ! and specification of an abstract docstring processing system ! (DPS). PEP 258, Docutils Design Specification, is an overview ! of the design and implementation of one DPS under development. ! * Output styles: developers want the documentation generated from ! their source code to look good, and there are many different ! ideas about what that means. PEP 258 touches on "Stylist ! Transforms". This aspect of docstring processing has yet to be ! fully explored. ! By separating out the issues, we can form consensus more easily ! (smaller fights ;-), and accept divergence more readily. Rationale ! There are standard inline documentation systems for some other ! languages. For example, Perl has POD [2]_ and Java has Javadoc ! [3]_, but neither of these mesh with the Pythonic way. POD syntax ! is very explicit, but takes after Perl in terms of readability. ! Javadoc is HTML-centric; except for '@field' tags, raw HTML is ! used for markup. There are also general tools such as Autoduck ! [4]_ and Web (Tangle & Weave) [5]_, useful for multiple languages. ! There have been many attempts to write auto-documentation systems ! for Python (not an exhaustive list): ! - Marc-Andre Lemburg's doc.py [6]_ ! - Daniel Larsson's pythondoc & gendoc [7]_ ! - Doug Hellmann's HappyDoc [8]_ ! - Laurence Tratt's Crystal [9]_ ! - Ka-Ping Yee's htmldoc & pydoc [10]_ (pydoc.py is now part of the ! Python standard library; see below) ! - Tony Ibbs' docutils [11]_ ! - Edward Loper's STminus formalization and related efforts [12]_ ! These systems, each with different goals, have had varying degrees ! of success. A problem with many of the above systems was ! over-ambition combined with inflexibility. They provided a ! self-contained set of components: a docstring extraction system, a ! markup parser, an internal processing system and one or more ! output format writers with a fixed style. Inevitably, one or more ! aspects of each system had serious shortcomings, and they were not ! easily extended or modified, preventing them from being adopted as ! standard tools. ! It has become clear (to this author, at least) that the "all or ! nothing" approach cannot succeed, since no monolithic ! self-contained system could possibly be agreed upon by all ! interested parties. A modular component approach designed for ! extension, where components may be multiply implemented, may be ! the only chance for success. Standard inter-component APIs will ! make the DPS components comprehensible without requiring detailed ! knowledge of the whole, lowering the barrier for contributions, ! and ultimately resulting in a rich and varied system. ! Each of the components of a docstring processing system should be ! developed independently. A 'best of breed' system should be ! chosen, either merged from existing systems, and/or developed ! anew. This system should be included in Python's standard ! library. PyDoc & Other Existing Systems ! PyDoc became part of the Python standard library as of release ! 2.1. It extracts and displays docstrings from within the Python ! interactive interpreter, from the shell command line, and from a ! GUI window into a web browser (HTML). Although a very useful ! tool, PyDoc has several deficiencies, including: ! - In the case of the GUI/HTML, except for some heuristic ! hyperlinking of identifier names, no formatting of the ! docstrings is done. They are presented within

! tags to avoid unwanted line wrapping. Unfortunately, the result ! is not attractive. ! - PyDoc extracts docstrings and structural information (class ! identifiers, method signatures, etc.) from imported module ! objects. There are security issues involved with importing ! untrusted code. Also, information from the source is lost when ! importing, such as comments, "additional docstrings" (string ! literals in non-docstring contexts; see PEP 258 [13]_), and the ! order of definitions. ! The functionality proposed in this PEP could be added to or used ! by PyDoc when serving HTML pages. The proposed docstring ! processing system's functionality is much more than PyDoc needs in ! its current form. Either an independent tool will be developed ! (which PyDoc may or may not use), or PyDoc could be expanded to ! encompass this functionality and *become* the docstring processing ! system (or one such system). That decision is beyond the scope of ! this PEP. ! Similarly for other existing docstring processing systems, their ! authors may or may not choose compatibility with this framework. ! However, if this framework is accepted and adopted as the Python ! standard, compatibility will become an important consideration in ! these systems' future. Specification ! The docstring processing system framework consists of components, ! as follows:: ! 1. Docstring conventions. Documents issues such as: ! - What should be documented where. ! - First line is a one-line synopsis. ! PEP 257, Docstring Conventions [14]_, documents some of these ! issues. ! 2. Docstring processing system design specification. Documents ! issues such as: ! - High-level spec: what a DPS does. ! - Command-line interface for executable script. ! - System Python API. ! - Docstring extraction rules. ! - Readers, which encapsulate the input context . ! - Parsers. ! - Document tree: the intermediate internal data structure. The ! output of the Parser and Reader, and the input to the Writer ! all share the same data structure. ! - Transforms, which modify the document tree. ! - Writers for output formats. ! - Distributors, which handle output management (one file, many ! files, or objects in memory). ! These issues are applicable to any docstring processing system ! implementation. PEP 258, Docutils Design Specification [13 ]_, ! documents these issues. ! 3. Docstring processing system implementation. ! 4. Input markup specifications: docstring syntax. PEP 287, ! reStructuredText Docstring Format [15]_, proposes a standard ! syntax. ! 5. Input parser implementations. ! 6. Input context readers ("modes": Python source code, PEP, ! standalone text file, email, etc.) and implementations. ! 7. Stylists: certain input context readers may have associated ! stylists which allow for a variety of output document styles. ! 8. Output formats (HTML, XML, TeX, DocBook, info, etc.) and writer ! implementations. ! Components 1, 2/3, and 4/5 are the subject of individual companion ! PEPs. If there is another implementation of the framework or ! syntax/parser, additional PEPs may be required. Multiple ! implementations of each of components 6 and 7 will be required; ! the PEP mechanism may be overkill for these components. Project Web Site ! A SourceForge project has been set up for this work at ! http://docutils.sourceforge.net/. References and Footnotes ! [1] http://www.literateprogramming.com/ ! [2] Perl "Plain Old Documentation" ! http://www.perldoc.com/perl5.6/pod/perlpod.html ! [3] http://java.sun.com/j2se/javadoc/ ! [4] http://www.helpmaster.com/hlp-developmentaids-autoduck.htm ! [5] http://www-cs-faculty.stanford.edu/~knuth/cweb.html ! [6] http://www.lemburg.com/files/python/SoftwareDescriptions.html#doc.py ! [7] http://starship.python.net/crew/danilo/pythondoc/ ! [8] http://happydoc.sourceforge.net/ ! [9] http://www.btinternet.com/~tratt/comp/python/crystal/ ! [10] http://www.python.org/doc/current/lib/module-pydoc.html ! [11] http://homepage.ntlworld.com/tibsnjoan/docutils/ ! [12] http://www.cis.upenn.edu/~edloper/pydoc/ ! [13] PEP 258, Docutils Design Specification, Goodger ! http://www.python.org/peps/pep-0258.html ! [14] PEP 257, Docstring Conventions, Goodger, Van Rossum ! http://www.python.org/peps/pep-0257.html ! [15] PEP 287, reStructuredText Docstring Format, Goodger ! http://www.python.org/peps/pep-0287.html ! [16] http://www.python.org/sigs/doc-sig/ Copyright ! This document has been placed in the public domain. Acknowledgements ! This document borrows ideas from the archives of the Python ! Doc-SIG [16]_. Thanks to all members past & present. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! fill-column: 70 ! sentence-end-double-space: t ! End: --- 13,299 ---- Abstract + ======== ! Python lends itself to inline documentation. With its built-in ! docstring syntax, a limited form of `Literate Programming`_ is easy to ! do in Python. However, there are no satisfactory standard tools for ! extracting and processing Python docstrings. The lack of a standard ! toolset is a significant gap in Python's infrastructure; this PEP aims ! to fill the gap. ! The issues surrounding docstring processing have been contentious and ! difficult to resolve. This PEP proposes a generic Docstring ! Processing System (DPS) framework, which separates out the components ! (program and conceptual), enabling the resolution of individual issues ! either through consensus (one solution) or through divergence (many). ! It promotes standard interfaces which will allow a variety of plug-in ! components (input context readers, markup parsers, and output format ! writers) to be used. ! The concepts of a DPS framework are presented independently of ! implementation details. Roadmap to the Doctring PEPs + ============================ ! There are many aspects to docstring processing. The "Docstring PEPs" ! have broken up the issues in order to deal with each of them in ! isolation, or as close as possible. The individual aspects and ! associated PEPs are as follows: ! * Docstring syntax. PEP 287, "reStructuredText Docstring Format" ! [#PEP-287]_, proposes a syntax for Python docstrings, PEPs, and ! other uses. ! * Docstring semantics consist of at least two aspects: ! - Conventions: the high-level structure of docstrings. Dealt with ! in PEP 257, "Docstring Conventions" [#PEP-257]_. ! - Methodology: rules for the informational content of docstrings. ! Not addressed. ! * Processing mechanisms. This PEP (PEP 256) outlines the high-level ! issues and specification of an abstract docstring processing system ! (DPS). PEP 258, "Docutils Design Specification" [#PEP-258]_, is an ! overview of the design and implementation of one DPS under ! development. ! * Output styles: developers want the documentation generated from ! their source code to look good, and there are many different ideas ! about what that means. PEP 258 touches on "Stylist Transforms". ! This aspect of docstring processing has yet to be fully explored. ! By separating out the issues, we can form consensus more easily ! (smaller fights ;-), and accept divergence more readily. Rationale + ========= ! There are standard inline documentation systems for some other ! languages. For example, Perl has POD_ ("Plain Old Documentation") and ! Java has Javadoc_, but neither of these mesh with the Pythonic way. ! POD syntax is very explicit, but takes after Perl in terms of ! readability. Javadoc is HTML-centric; except for "``@field``" tags, ! raw HTML is used for markup. There are also general tools such as ! Autoduck_ and Web_ (Tangle & Weave), useful for multiple languages. ! There have been many attempts to write auto-documentation systems ! for Python (not an exhaustive list): ! - Marc-Andre Lemburg's doc.py_ ! - Daniel Larsson's pythondoc_ & gendoc_ ! - Doug Hellmann's HappyDoc_ ! - Laurence Tratt's Crystal_ ! - Ka-Ping Yee's pydoc_ (pydoc.py is now part of the Python standard ! library; see below) ! - Tony Ibbs' docutils_ (Tony has donated this name to the `Docutils ! project`_) ! - Edward Loper's STminus_ formalization and related efforts ! These systems, each with different goals, have had varying degrees of ! success. A problem with many of the above systems was over-ambition ! combined with inflexibility. They provided a self-contained set of ! components: a docstring extraction system, a markup parser, an ! internal processing system and one or more output format writers with ! a fixed style. Inevitably, one or more aspects of each system had ! serious shortcomings, and they were not easily extended or modified, ! preventing them from being adopted as standard tools. ! It has become clear (to this author, at least) that the "all or ! nothing" approach cannot succeed, since no monolithic self-contained ! system could possibly be agreed upon by all interested parties. A ! modular component approach designed for extension, where components ! may be multiply implemented, may be the only chance for success. ! Standard inter-component APIs will make the DPS components ! comprehensible without requiring detailed knowledge of the whole, ! lowering the barrier for contributions, and ultimately resulting in a ! rich and varied system. ! Each of the components of a docstring processing system should be ! developed independently. A "best of breed" system should be chosen, ! either merged from existing systems, and/or developed anew. This ! system should be included in Python's standard library. PyDoc & Other Existing Systems + ------------------------------ ! PyDoc became part of the Python standard library as of release 2.1. ! It extracts and displays docstrings from within the Python interactive ! interpreter, from the shell command line, and from a GUI window into a ! web browser (HTML). Although a very useful tool, PyDoc has several ! deficiencies, including: ! - In the case of the GUI/HTML, except for some heuristic hyperlinking ! of identifier names, no formatting of the docstrings is done. They ! are presented within ``

`` tags to avoid unwanted line ! wrapping. Unfortunately, the result is not attractive. ! - PyDoc extracts docstrings and structural information (class ! identifiers, method signatures, etc.) from imported module objects. ! There are security issues involved with importing untrusted code. ! Also, information from the source is lost when importing, such as ! comments, "additional docstrings" (string literals in non-docstring ! contexts; see PEP 258 [#PEP-258]_), and the order of definitions. ! The functionality proposed in this PEP could be added to or used by ! PyDoc when serving HTML pages. The proposed docstring processing ! system's functionality is much more than PyDoc needs in its current ! form. Either an independent tool will be developed (which PyDoc may ! or may not use), or PyDoc could be expanded to encompass this ! functionality and *become* the docstring processing system (or one ! such system). That decision is beyond the scope of this PEP. ! Similarly for other existing docstring processing systems, their ! authors may or may not choose compatibility with this framework. ! However, if this framework is accepted and adopted as the Python ! standard, compatibility will become an important consideration in ! these systems' future. Specification + ============= ! The docstring processing system framework is broken up as follows: ! 1. Docstring conventions. Documents issues such as: ! - What should be documented where. ! - First line is a one-line synopsis. ! PEP 257 [#PEP-257]_ documents some of these issues. ! 2. Docstring processing system design specification. Documents ! issues such as: ! - High-level spec: what a DPS does. ! - Command-line interface for executable script. ! - System Python API. ! - Docstring extraction rules. ! - Readers, which encapsulate the input context . ! - Parsers. ! - Document tree: the intermediate internal data structure. The ! output of the Parser and Reader, and the input to the Writer all ! share the same data structure. ! - Transforms, which modify the document tree. ! - Writers for output formats. ! - Distributors, which handle output management (one file, many ! files, or objects in memory). ! These issues are applicable to any docstring processing system ! implementation. PEP 258 [#PEP-258]_ documents these issues. ! 3. Docstring processing system implementation. ! 4. Input markup specifications: docstring syntax. PEP 287 [#PEP-287]_ ! proposes a standard syntax. ! 5. Input parser implementations. ! 6. Input context readers ("modes": Python source code, PEP, standalone ! text file, email, etc.) and implementations. ! 7. Stylists: certain input context readers may have associated ! stylists which allow for a variety of output document styles. ! 8. Output formats (HTML, XML, TeX, DocBook, info, etc.) and writer ! implementations. ! Components 1, 2/3/5, and 4 are the subject of individual companion ! PEPs. If there is another implementation of the framework or ! syntax/parser, additional PEPs may be required. Multiple ! implementations of each of components 6 and 7 will be required; the ! PEP mechanism may be overkill for these components. Project Web Site + ================ ! A SourceForge project has been set up for this work at ! http://docutils.sourceforge.net/. References and Footnotes + ======================== ! .. [#PEP-287] PEP 287, reStructuredText Docstring Format, Goodger ! (http://www.python.org/peps/pep-0287.html) ! .. [#PEP-257] PEP 257, Docstring Conventions, Goodger, Van Rossum ! (http://www.python.org/peps/pep-0257.html) ! .. [#PEP-258] PEP 258, Docutils Design Specification, Goodger ! (http://www.python.org/peps/pep-0258.html) ! .. _Literate Programming: http://www.literateprogramming.com/ ! .. _POD: http://www.perldoc.com/perl5.6/pod/perlpod.html ! .. _Javadoc: http://java.sun.com/j2se/javadoc/ ! .. _Autoduck: ! http://www.helpmaster.com/hlp-developmentaids-autoduck.htm ! .. _Web: http://www-cs-faculty.stanford.edu/~knuth/cweb.html ! .. _doc.py: ! http://www.lemburg.com/files/python/SoftwareDescriptions.html#doc.py ! .. _pythondoc: ! .. _gendoc: http://starship.python.net/crew/danilo/pythondoc/ ! .. _HappyDoc: http://happydoc.sourceforge.net/ ! .. _Crystal: http://www.btinternet.com/~tratt/comp/python/crystal/ ! .. _pydoc: http://www.python.org/doc/current/lib/module-pydoc.html ! .. _docutils: http://homepage.ntlworld.com/tibsnjoan/docutils/ ! .. _Docutils project: http://docutils.sourceforge.net/ ! .. _STMinus: http://www.cis.upenn.edu/~edloper/pydoc/ ! ! .. _Python Doc-SIG: http://www.python.org/sigs/doc-sig/ Copyright + ========= ! This document has been placed in the public domain. Acknowledgements + ================ ! This document borrows ideas from the archives of the `Python ! Doc-SIG`_. Thanks to all members past & present. ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: Index: pep-0257.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0257.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0257.txt 1 Aug 2002 22:32:33 -0000 1.5 --- pep-0257.txt 30 Aug 2002 03:10:51 -0000 1.6 *************** *** 3,11 **** Version: $Revision$ Last-Modified: $Date$ ! Author: goodger@users.sourceforge.net (David Goodger), ! guido@python.org (Guido van Rossum) Discussions-To: doc-sig@python.org Status: Active Type: Informational Created: 29-May-2001 Post-History: 13-Jun-2001 --- 3,12 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: David Goodger , ! Guido van Rossum Discussions-To: doc-sig@python.org Status: Active Type: Informational + Content-Type: text/x-rst Created: 29-May-2001 Post-History: 13-Jun-2001 *************** *** 13,256 **** Abstract ! This PEP documents the semantics and conventions associated with ! Python docstrings. Rationale ! The aim of this PEP is to standardize the high-level structure of ! docstrings: what they should contain, and how to say it (without ! touching on any markup syntax within docstrings). The PEP ! contains conventions, not laws or syntax. ! "A universal convention supplies all of maintainability, ! clarity, consistency, and a foundation for good programming ! habits too. What it doesn't do is insist that you follow it ! against your will. That's Python!" ! --Tim Peters on comp.lang.python, 2001-06-16 ! If you violate the conventions, the worst you'll get is some dirty ! looks. But some software (such as the Docutils docstring ! processing system [1] [2]) will be aware of the conventions, so ! following them will get you the best results. Specification ! What is a Docstring? ! -------------------- ! A docstring is a string literal that occurs as the first statement ! in a module, function, class, or method definition. Such a ! docstring becomes the __doc__ special attribute of that object. ! All modules should normally have docstrings, and all functions and ! classes exported by a module should also have docstrings. Public ! methods (including the __init__ constructor) should also have ! docstrings. A package may be documented in the module docstring ! of the __init__.py file in the package directory. ! String literals occurring elsewhere in Python code may also act as ! documentation. They are not recognized by the Python bytecode ! compiler and are not accessible as runtime object attributes ! (i.e. not assigned to __doc__), but two types of extra docstrings ! may be extracted by software tools: ! 1. String literals occurring immediately after a simple assignment ! at the top level of a module, class, or __init__ method ! are called "attribute docstrings". ! 2. String literals occurring immediately after another docstring ! are called "additional docstrings". ! Please see PEP 258 "Docutils Design Specification" [2] for a ! detailed description of attribute and additional docstrings. ! XXX Mention docstrings of 2.2 properties. ! For consistency, always use """triple double quotes""" around ! docstrings. Use r"""raw triple double quotes""" if you use any ! backslashes in your docstrings. For Unicode docstrings, use ! u"""Unicode triple-quoted strings""". ! There are two forms of docstrings: one-liners and multi-line ! docstrings. - One-line Docstrings - -------------------- ! One-liners are for really obvious cases. They should really fit ! on one line. For example:: ! def kos_root(): ! """Return the pathname of the KOS root directory.""" ! global _kos_root ! if _kos_root: return _kos_root ! ... ! Notes: ! - Triple quotes are used even though the string fits on one line. ! This makes it easy to later expand it. ! - The closing quotes are on the same line as the opening quotes. ! This looks better for one-liners. ! - There's no blank line either before or after the docstring. ! - The docstring is a phrase ending in a period. It prescribes the ! function or method's effect as a command ("Do this", "Return ! that"), not as a description: e.g. don't write "Returns the ! pathname ..." ! - The one-line docstring should NOT be a "signature" reiterating ! the function/method parameters (which can be obtained by ! introspection). Don't do:: ! def function(a, b): ! """function(a, b) -> list""" ! This type of docstring is only appropriate for C functions (such ! as built-ins), where introspection is not possible. However, ! the nature of the *return value* cannot be determined by ! introspection, so it should be mentioned. The preferred form ! for such a docstring would be something like:: ! def function(a, b): ! """Do X and return a list.""" ! (Of course "Do X" should be replaced by a useful description!) ! Multi-line Docstrings ! ---------------------- - Multi-line docstrings consist of a summary line just like a - one-line docstring, followed by a blank line, followed by a more - elaborate description. The summary line may be used by automatic - indexing tools; it is important that it fits on one line and is - separated from the rest of the docstring by a blank line. The - summary line may be on the same line as the opening quotes or on - the next line. ! The entire docstring is indented the same as the quotes at its ! first line (see example below). Docstring processing tools will ! strip an amount of indentation from the second and further lines ! of the docstring equal to the indentation of the first non-blank ! line after the first line of the docstring. Relative indentation ! of later lines in the docstring is retained. ! Insert a blank line before and after all docstrings (one-line or ! multi-line) that document a class -- generally speaking, the ! class's methods are separated from each other by a single blank ! line, and the docstring needs to be offset from the first method ! by a blank line; for symmetry, put a blank line between the class ! header and the docstring. Docstrings documenting functions or ! methods generally don't have this requirement, unless the function ! or method's body is written as a number of blank-line separated ! sections -- in this case, treat the docstring as another section, ! and precede it with a blank line. ! The docstring of a script (a stand-alone program) should be usable ! as its "usage" message, printed when the script is invoked with ! incorrect or missing arguments (or perhaps with a "-h" option, for ! "help"). Such a docstring should document the script's function ! and command line syntax, environment variables, and files. Usage ! messages can be fairly elaborate (several screens full) and should ! be sufficient for a new user to use the command properly, as well ! as a complete quick reference to all options and arguments for the ! sophisticated user. ! The docstring for a module should generally list the classes, ! exceptions and functions (and any other objects) that are exported ! by the module, with a one-line summary of each. (These summaries ! generally give less detail than the summary line in the object's ! docstring.) The docstring for a package (i.e., the docstring of ! the package's __init__.py module) should also list the modules and ! subpackages exported by the package. ! The docstring for a function or method should summarize its ! behavior and document its arguments, return value(s), side ! effects, exceptions raised, and restrictions on when it can be ! called (all if applicable). Optional arguments should be ! indicated. It should be documented whether keyword arguments are ! part of the interface. ! The docstring for a class should summarize its behavior and list ! the public methods and instance variables. If the class is ! intended to be subclassed, and has an additional interface for ! subclasses, this interface should be listed separately (in the ! docstring). The class constructor should be documented in the ! docstring for its __init__ method. Individual methods should be ! documented by their own docstring. ! If a class subclasses another class and its behavior is mostly ! inherited from that class, its docstring should mention this and ! summarize the differences. Use the verb "override" to indicate ! that a subclass method replaces a superclass method and does not ! call the superclass method; use the verb "extend" to indicate that ! a subclass method calls the superclass method (in addition to its ! own behavior). ! *Do not* use the Emacs convention of mentioning the arguments of ! functions or methods in upper case in running text. Python is ! case sensitive and the argument names can be used for keyword ! arguments, so the docstring should document the correct argument ! names. It is best to list each argument on a separate line. For ! example:: ! def complex(real=0.0, imag=0.0): ! """Form a complex number. ! Keyword arguments: ! real -- the real part (default 0.0) ! imag -- the imaginary part (default 0.0) ! """ ! if imag == 0.0 and real == 0.0: return complex_zero ! ... ! The BDFL [3] recommends inserting a blank line between the last ! paragraph in a multi-line docstring and its closing quotes, ! placing the closing quotes on a line by themselves. This way, ! Emacs' fill-paragraph command can be used on it. References and Footnotes ! [1] PEP 256, Docstring Processing System Framework, Goodger ! http://www.python.org/peps/pep-0256.html ! [2] PEP 258, Docutils Design Specification, Goodger ! http://www.python.org/peps/pep-0258.html ! [3] Guido van Rossum, Python's creator and Benevolent Dictator For ! Life. ! [4] http://www.python.org/doc/essays/styleguide.html ! [5] http://www.python.org/sigs/doc-sig/ Copyright ! This document has been placed in the public domain. Acknowledgements ! The "Specification" text comes mostly verbatim from the Python ! Style Guide essay by Guido van Rossum [4]. ! This document borrows ideas from the archives of the Python ! Doc-SIG [5]. Thanks to all members past and present. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! fill-column: 70 ! sentence-end-double-space: t ! End: --- 14,263 ---- Abstract + ======== ! This PEP documents the semantics and conventions associated with ! Python docstrings. Rationale + ========= ! The aim of this PEP is to standardize the high-level structure of ! docstrings: what they should contain, and how to say it (without ! touching on any markup syntax within docstrings). The PEP contains ! conventions, not laws or syntax. ! "A universal convention supplies all of maintainability, clarity, ! consistency, and a foundation for good programming habits too. ! What it doesn't do is insist that you follow it against your will. ! That's Python!" ! -- Tim Peters on comp.lang.python, 2001-06-16 ! If you violate these conventions, the worst you'll get is some dirty ! looks. But some software (such as the Docutils_ docstring processing ! system [1]_ [2]_) will be aware of the conventions, so following them ! will get you the best results. Specification + ============= ! What is a Docstring? ! -------------------- ! A docstring is a string literal that occurs as the first statement in ! a module, function, class, or method definition. Such a docstring ! becomes the ``__doc__`` special attribute of that object. ! All modules should normally have docstrings, and all functions and ! classes exported by a module should also have docstrings. Public ! methods (including the ``__init__`` constructor) should also have ! docstrings. A package may be documented in the module docstring of ! the ``__init__.py`` file in the package directory. ! String literals occurring elsewhere in Python code may also act as ! documentation. They are not recognized by the Python bytecode ! compiler and are not accessible as runtime object attributes (i.e. not ! assigned to ``__doc__``), but two types of extra docstrings may be ! extracted by software tools: ! 1. String literals occurring immediately after a simple assignment at ! the top level of a module, class, or ``__init__`` method are called ! "attribute docstrings". ! 2. String literals occurring immediately after another docstring are ! called "additional docstrings". ! Please see PEP 258, "Docutils Design Specification" [2]_, for a ! detailed description of attribute and additional docstrings. ! XXX Mention docstrings of 2.2 properties. ! For consistency, always use ``"""triple double quotes"""`` around ! docstrings. Use ``r"""raw triple double quotes"""`` if you use any ! backslashes in your docstrings. For Unicode docstrings, use ! ``u"""Unicode triple-quoted strings"""``. ! There are two forms of docstrings: one-liners and multi-line ! docstrings. ! One-line Docstrings ! -------------------- ! One-liners are for really obvious cases. They should really fit on ! one line. For example:: ! def kos_root(): ! """Return the pathname of the KOS root directory.""" ! global _kos_root ! if _kos_root: return _kos_root ! ... ! Notes: ! - Triple quotes are used even though the string fits on one line. ! This makes it easy to later expand it. ! - The closing quotes are on the same line as the opening quotes. This ! looks better for one-liners. ! - There's no blank line either before or after the docstring. ! - The docstring is a phrase ending in a period. It prescribes the ! function or method's effect as a command ("Do this", "Return that"), ! not as a description; e.g. don't write "Returns the pathname ...". ! - The one-line docstring should NOT be a "signature" reiterating the ! function/method parameters (which can be obtained by introspection). ! Don't do:: ! def function(a, b): ! """function(a, b) -> list""" ! This type of docstring is only appropriate for C functions (such as ! built-ins), where introspection is not possible. However, the ! nature of the *return value* cannot be determined by introspection, ! so it should be mentioned. The preferred form for such a docstring ! would be something like:: ! def function(a, b): ! """Do X and return a list.""" ! (Of course "Do X" should be replaced by a useful description!) ! Multi-line Docstrings ! ---------------------- ! Multi-line docstrings consist of a summary line just like a one-line ! docstring, followed by a blank line, followed by a more elaborate ! description. The summary line may be used by automatic indexing ! tools; it is important that it fits on one line and is separated from ! the rest of the docstring by a blank line. The summary line may be on ! the same line as the opening quotes or on the next line. ! The entire docstring is indented the same as the quotes at its first ! line (see example below). Docstring processing tools will strip an ! amount of indentation from the second and further lines of the ! docstring equal to the indentation of the first non-blank line after ! the first line of the docstring. Relative indentation of later lines ! in the docstring is retained. ! Insert a blank line before and after all docstrings (one-line or ! multi-line) that document a class -- generally speaking, the class's ! methods are separated from each other by a single blank line, and the ! docstring needs to be offset from the first method by a blank line; ! for symmetry, put a blank line between the class header and the ! docstring. Docstrings documenting functions or methods generally ! don't have this requirement, unless the function or method's body is ! written as a number of blank-line separated sections -- in this case, ! treat the docstring as another section, and precede it with a blank ! line. ! The docstring of a script (a stand-alone program) should be usable as ! its "usage" message, printed when the script is invoked with incorrect ! or missing arguments (or perhaps with a "-h" option, for "help"). ! Such a docstring should document the script's function and command ! line syntax, environment variables, and files. Usage messages can be ! fairly elaborate (several screens full) and should be sufficient for a ! new user to use the command properly, as well as a complete quick ! reference to all options and arguments for the sophisticated user. ! The docstring for a module should generally list the classes, ! exceptions and functions (and any other objects) that are exported by ! the module, with a one-line summary of each. (These summaries ! generally give less detail than the summary line in the object's ! docstring.) The docstring for a package (i.e., the docstring of the ! package's ``__init__.py`` module) should also list the modules and ! subpackages exported by the package. ! The docstring for a function or method should summarize its behavior ! and document its arguments, return value(s), side effects, exceptions ! raised, and restrictions on when it can be called (all if applicable). ! Optional arguments should be indicated. It should be documented ! whether keyword arguments are part of the interface. ! The docstring for a class should summarize its behavior and list the ! public methods and instance variables. If the class is intended to be ! subclassed, and has an additional interface for subclasses, this ! interface should be listed separately (in the docstring). The class ! constructor should be documented in the docstring for its ``__init__`` ! method. Individual methods should be documented by their own ! docstring. ! If a class subclasses another class and its behavior is mostly ! inherited from that class, its docstring should mention this and ! summarize the differences. Use the verb "override" to indicate that a ! subclass method replaces a superclass method and does not call the ! superclass method; use the verb "extend" to indicate that a subclass ! method calls the superclass method (in addition to its own behavior). ! *Do not* use the Emacs convention of mentioning the arguments of ! functions or methods in upper case in running text. Python is case ! sensitive and the argument names can be used for keyword arguments, so ! the docstring should document the correct argument names. It is best ! to list each argument on a separate line. For example:: ! def complex(real=0.0, imag=0.0): ! """Form a complex number. ! Keyword arguments: ! real -- the real part (default 0.0) ! imag -- the imaginary part (default 0.0) ! ! """ ! if imag == 0.0 and real == 0.0: return complex_zero ! ... ! ! The BDFL [3]_ recommends inserting a blank line between the last ! paragraph in a multi-line docstring and its closing quotes, placing ! the closing quotes on a line by themselves. This way, Emacs' ! ``fill-paragraph`` command can be used on it. References and Footnotes + ======================== ! .. [1] PEP 256, Docstring Processing System Framework, Goodger ! (http://www.python.org/peps/pep-0256.html) ! .. [2] PEP 258, Docutils Design Specification, Goodger ! (http://www.python.org/peps/pep-0258.html) ! .. [3] Guido van Rossum, Python's creator and Benevolent Dictator For ! Life. ! .. _Docutils: http://docutils.sourceforge.net/ ! .. _Python Style Guide: ! http://www.python.org/doc/essays/styleguide.html ! ! .. _Doc-SIG: http://www.python.org/sigs/doc-sig/ Copyright + ========= ! This document has been placed in the public domain. Acknowledgements + ================ ! The "Specification" text comes mostly verbatim from the `Python Style ! Guide`_ essay by Guido van Rossum. ! This document borrows ideas from the archives of the Python Doc-SIG_. ! Thanks to all members past and present. ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! fill-column: 70 ! sentence-end-double-space: t ! End: Index: pep-0258.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0258.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0258.txt 1 Aug 2002 22:32:33 -0000 1.3 --- pep-0258.txt 30 Aug 2002 03:10:51 -0000 1.4 *************** *** 3,10 **** Version: $Revision$ Last-Modified: $Date$ ! Author: goodger@users.sourceforge.net (David Goodger) ! Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track Requires: 256, 257 Created: 31-May-2001 --- 3,11 ---- Version: $Revision$ [...1821 lines suppressed...] ! This document has been placed in the public domain. ! ================== ! Acknowledgements ! ================== ! This document borrows ideas from the archives of the `Python ! Doc-SIG`_. Thanks to all members past & present. ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: Index: pep-0287.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0287.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0287.txt 1 Aug 2002 22:32:33 -0000 1.3 --- pep-0287.txt 30 Aug 2002 03:10:51 -0000 1.4 *************** *** 3,10 **** Version: $Revision$ Last-Modified: $Date$ ! Author: goodger@users.sourceforge.net (David Goodger) ! Discussions-To: doc-sig@python.org Status: Draft Type: Informational Created: 25-Mar-2002 Post-History: 02-Apr-2002 --- 3,11 ---- Version: $Revision$ [...1594 lines suppressed...] ! This document has been placed in the public domain. Acknowledgements + ================ ! Some text is borrowed from PEP 216, Docstring Format [#PEP-216]_, by ! Moshe Zadka. ! Special thanks to all members past & present of the Python Doc-SIG_. ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: From goodger@users.sourceforge.net Fri Aug 30 04:11:42 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:11:42 -0700 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31016 Modified Files: pep-0290.txt Log Message: Converted to reStructuredText & edited for readability. Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0290.txt 12 Aug 2002 14:22:33 -0000 1.3 --- pep-0290.txt 30 Aug 2002 03:11:40 -0000 1.4 *************** *** 3,9 **** Version: $Revision$ Last-Modified: $Date$ ! Author: python@rcn.com (Raymond D. Hettinger) Status: Active Type: Informational Created: 6-Jun-2002 Post-History: --- 3,10 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Raymond D. Hettinger Status: Active Type: Informational + Content-Type: text/x-rst Created: 6-Jun-2002 Post-History: *************** *** 11,187 **** Abstract ! This PEP is a collection of procedures and ideas for updating ! Python applications when newer versions of Python are installed. ! The migration tips highlight possible areas of incompatibility and ! make suggestions on how to find and resolve those differences. The ! modernization procedures show how older code can be updated to ! take advantage of new language features. Rationale ! This repository of procedures serves as a catalog or checklist of ! known migration issues and procedures for addressing those issues. ! ! Migration issues can arise for several reasons. Some obsolete ! features are slowly deprecated according to the guidelines in PEP 4. ! Also, some code relies on undocumented behaviors which are subject to ! change between versions. Some code may rely on behavior which was ! subsequently shown to be a bug and that behavior changes when the bug ! is fixed. ! Modernization options arise when new versions of Python add features ! that allow improved clarity or higher performance than previously ! available. Guidelines for New Entries ! Developers with commit access may update the PEP directly. Others ! can send their ideas to a developer for possible inclusion. ! While a consistent format makes the repository easier to use, feel ! free to add or subtract sections to improve clarity. ! Grep patterns may be supplied as tool to help maintainers locate ! code for possible updates. However, fully automated search/replace ! style regular expressions are not recommended. Instead, each code ! fragment should be evaluated individually. ! The contra-indications section is the most important part of a new ! entry. It lists known situations where the update SHOULD NOT be ! applied. Modernization Procedures ! Pattern: if d.has_key(k): --> if k in d: ! Idea: For testing dictionary membership, use the 'in' keyword ! instead of the 'has_key()' method. ! Version: 2.2 or greater ! Benefits: The result is shorter and more readable. The style becomes ! consistent with tests for membership in lists. The result is ! slightly faster because has_key requires an attribute search ! and uses a relatively expensive CALL FUNCTION op code. ! Locating: grep has_key ! Contra-indications: ! 1. if dictlike.has_key(k) ## objects like shelve do not define ! __contains__() ! Pattern: for k in d.keys() --> for k in d ! for k in d.items() --> for k in d.iteritems() ! for k in d.values() --> for k in d.itervalues() ! Idea: Use the new iter methods for looping over dictionaries ! Version: 2.2 or greater ! Benefits: The iter methods are faster because the do not have to create ! a new list object with a complete copy of all of the keys, ! values, or items. Selecting only keys, items, or values as ! needed saves the time for creating throwaway object references ! and, in the case of items, saves a second hash look-up of ! the key. ! Contra-indications: ! 1. def getids(): return d.keys() ## do not change the return type ! 2. for k in dictlike.keys() ## objects like shelve do not define ! itermethods ! 3. k = d.keys(); j = k[:] ## iterators do not support slicing, ! sorting or other operations ! 4. for k in d.keys(): del[k] ## dict iterators prohibit modifying the ! dictionary ! Pattern: if v == None --> if v is None: ! if v != None --> if v is not None: ! Idea: Since there is only one None object, equality can be tested ! with identity. ! Version: All ! Benefits: Identity tests are slightly faster than equality tests. Also, ! some object types may overload comparison to be much slower. ! Locating: grep '== None' or grep '!= None' ! Pattern: os.stat("foo")[stat.ST_MTIME] --> os.stat("foo").st_mtime ! os.stat("foo")[stat.ST_MTIME] --> os.path.getmtime("foo") ! Idea: Replace stat contants or indices with new stat methods ! Version: 2.2 or greater ! Benefits: The methods are not order dependent and do not require an ! import of the stat module ! Locating: grep os.stat ! Pattern: import whrandom --> import random ! Idea: Replace deprecated module ! Version: 2.1 or greater ! Benefits: All random methods collected in one place ! Locating: grep whrandom ! Pattern: import types ; type(v, types.IntType) --> isinstance(v, int) ! type(s, types.StringTypes --> isinstance(s, basestring) ! Idea: The types module will likely to be deprecated in the future. ! Version: 2.3 or greater (basestring introduced in Py2.3) ! Benefits: May be slightly faster, avoid a deprecated feature. ! Locating: grep types *.py | grep import ! Pattern: import string ; string.method(s, ...) --> s.method(...) ! c in string.whitespace --> c.isspace() ! Idea: The string module will likely to be deprecated in the future. ! Version: 2.0 or greater ! Benefits: Slightly faster, avoid a deprecated feature. ! Locating: grep string *.py | grep import ! Pattern: NewError = 'NewError' --> class NewError(Exception): pass ! Idea: String exceptions are deprecated, derive from the Exception ! base class. ! Version: Any ! Benefits: Unlike the obsolete string exceptions, class exceptions all ! derive from another exception or the Exception base class. ! This allows meaningful groupings of exceptions. It also ! allows an "except Exception" clause to catch all exceptions. ! Locating: Use PyChecker ! Pattern: "foobar"[:3] == "foo" -> "foobar".startswith("foo") ! "foobar"[-3:] == "bar" -> "foobar".endswith("bar") ! Version: 2.0 or greater ! Benefits: Faster because no slice has to be created. Less risk of ! miscounting. ! Pattern: "s1".find("s2") >= 0 or "s1".find("s2") != -1 -> "s2" in "s1" ! Idea: In Python 2.3, for "s2" in "s1", the length ! restriction on s2 are lifted; they can now be strings ! of any length. ! Version: 2.3 or later ! Benefits: When searching for a substring, where you don't care ! about the position of the substring in the original ! string, using the `in' operator makes things more ! clear. ! References ! [1] PEP 4, Deprecation of Standard Modules ! http://www.python.org/peps/pep-0004.html ! Copyright ! This document has been placed in the public domain. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: --- 12,288 ---- Abstract + ======== ! This PEP is a collection of procedures and ideas for updating Python ! applications when newer versions of Python are installed. ! The migration tips highlight possible areas of incompatibility and ! make suggestions on how to find and resolve those differences. The ! modernization procedures show how older code can be updated to take ! advantage of new language features. Rationale + ========= ! This repository of procedures serves as a catalog or checklist of ! known migration issues and procedures for addressing those issues. ! Migration issues can arise for several reasons. Some obsolete ! features are slowly deprecated according to the guidelines in PEP 4 ! [1]_. Also, some code relies on undocumented behaviors which are ! subject to change between versions. Some code may rely on behavior ! which was subsequently shown to be a bug and that behavior changes ! when the bug is fixed. + Modernization options arise when new versions of Python add features + that allow improved clarity or higher performance than previously + available. Guidelines for New Entries + ========================== ! Developers with commit access may update this PEP directly. Others ! can send their ideas to a developer for possible inclusion. ! While a consistent format makes the repository easier to use, feel ! free to add or subtract sections to improve clarity. ! Grep patterns may be supplied as tool to help maintainers locate code ! for possible updates. However, fully automated search/replace style ! regular expressions are not recommended. Instead, each code fragment ! should be evaluated individually. ! The contra-indications section is the most important part of a new ! entry. It lists known situations where the update SHOULD NOT be ! applied. Modernization Procedures + ======================== ! Procedures are grouped by the Python version required to be able to ! take advantage of the modernization. ! Python 2.3 or Later ! ------------------- + Testing String Membership + ''''''''''''''''''''''''' ! In Python 2.3, for ``string2 in string1``, the length restriction on ! ``string2`` is lifted; it can now be a string of any length. When ! searching for a substring, where you don't care about the position of ! the substring in the original string, using the ``in`` operator makes ! the meaning clear. + Pattern:: ! string1.find(string2) >= 0 --> string2 in string1 ! string1.find(string2) != -1 --> string2 in string1 ! Python 2.2 or Later ! ------------------- + Testing Dictionary Membership + ''''''''''''''''''''''''''''' ! For testing dictionary membership, use the 'in' keyword instead of the ! 'has_key()' method. The result is shorter and more readable. The ! style becomes consistent with tests for membership in lists. The ! result is slightly faster because ``has_key`` requires an attribute ! search and uses a relatively expensive function call. + Pattern:: ! if d.has_key(k): --> if k in d: + Contra-indications: ! 1. Some dictionary-like objects like ``shelve`` do not define a ! ``__contains__()`` method:: + if dictlike.has_key(k) ! Locating: ``grep has_key`` ! Looping Over Dictionaries ! ''''''''''''''''''''''''' + Use the new ``iter`` methods for looping over dictionaries. The + ``iter`` methods are faster because they do not have to create a new + list object with a complete copy of all of the keys, values, or items. + Selecting only keys, values, or items (key/value pairs) as needed + saves the time for creating throwaway object references and, in the + case of items, saves a second hash look-up of the key. ! Pattern:: ! for key in d.keys(): --> for key in d: ! for value in d.values(): --> for value in d.itervalues(): ! for key, value in d.items(): ! --> for key, value in d.iteritems(): + Contra-indications: + 1. If you need a list, do not change the return type:: ! def getids(): return d.keys() ! 2. Some dictionary-like objects like ``shelve`` do not define ! ``iter`` methods:: + for k in dictlike.keys(): + 3. Iterators do not support slicing, sorting or other operations:: ! k = d.keys(); j = k[:] + 4. Dictionary iterators prohibit modifying the dictionary:: + + for k in d.keys(): del[k] + + + ``stat`` Methods + '''''''''''''''' + + Replace ``stat`` constants or indices with new ``os.stat`` attributes + and methods. The ``os.stat`` attributes and methods are not + order-dependent and do not require an import of the ``stat`` module. + Pattern:: + + os.stat("foo")[stat.ST_MTIME] --> os.stat("foo").st_mtime + os.stat("foo")[stat.ST_MTIME] --> os.path.getmtime("foo") + + Locating: ``grep os.stat`` or ``grep stat.S`` + + + Reduce Dependency on ``types`` Module + ''''''''''''''''''''''''''''''''''''' + + The ``types`` module is likely to be deprecated in the future. Use + built-in constructor functions instead. They may be slightly faster. + + Pattern:: + + isinstance(v, types.IntType) --> isinstance(v, int) + isinstance(s, types.StringTypes) --> isinstance(s, basestring) + + Full use of this technique requires Python 2.3 or later + (``basestring`` was introduced in Python 2.3), but Python 2.2 is + sufficient for most uses. + + Locating: ``grep types *.py | grep import`` + + + Python 2.1 or Later + ------------------- + + ``whrandom`` Module Deprecated + '''''''''''''''''''''''''''''' + + All random-related methods have been collected in one place, the + ``random`` module. + + Pattern:: + + import whrandom --> import random + + Locating: ``grep whrandom`` + + + Python 2.0 or Later + ------------------- + + String Methods + '''''''''''''' + + The string module is likely to be deprecated in the future. Use + string methods instead. They're faster too. + + Pattern:: + + import string ; string.method(s, ...) --> s.method(...) + c in string.whitespace --> c.isspace() + + Locating: ``grep string *.py | grep import`` + + + ``startswith`` and ``endswith`` String Methods + '''''''''''''''''''''''''''''''''''''''''''''' + + Use these string methods instead of slicing. They're faster because + no slice has to be created, and there's no risk of miscounting. + + Pattern:: + + "foobar"[:3] == "foo" --> "foobar".startswith("foo") + "foobar"[-3:] == "bar" --> "foobar".endswith("bar") + + + Python 1.5 or Later + ------------------- + + Class-Based Exceptions + '''''''''''''''''''''' + + String exceptions are deprecated, so derive from the ``Exception`` + base class. Unlike the obsolete string exceptions, class exceptions + all derive from another exception or the ``Exception`` base class. + This allows meaningful groupings of exceptions. It also allows an + "``except Exception``" clause to catch all exceptions. + + Pattern:: + + NewError = 'NewError' --> class NewError(Exception): pass + + Locating: Use PyChecker_. + + + All Python Versions + ------------------- + + Testing for ``None`` + '''''''''''''''''''' + + Since there is only one ``None`` object, equality can be tested with + identity. Identity tests are slightly faster than equality tests. + Also, some object types may overload comparison, so equality testing + may be much slower. + + Pattern:: + + if v == None --> if v is None: + if v != None --> if v is not None: + + Locating: ``grep '== None'`` or ``grep '!= None'`` + + + References + ========== + + .. [1] PEP 4, Deprecation of Standard Modules, von Loewis + (http://www.python.org/peps/pep-0004.html) + + .. _PyChecker: http://pychecker.sourceforge.net/ + + + Copyright + ========= + + This document has been placed in the public domain. + + + + .. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + End: From goodger@users.sourceforge.net Fri Aug 30 04:12:38 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:12:38 -0700 Subject: [Python-checkins] python/nondist/peps docutils.conf,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31298 Modified Files: docutils.conf Log Message: Better link. Index: docutils.conf =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** docutils.conf 26 Aug 2002 15:43:47 -0000 1.1 --- docutils.conf 30 Aug 2002 03:12:36 -0000 1.2 *************** *** 1,3 **** ! # Configuration file for Docutils: http://docutils.sf.net/ [options] --- 1,4 ---- ! # Configuration file for Docutils. ! # See http://docutils.sf.net/docs/tools.html [options] From goodger@users.sourceforge.net Fri Aug 30 04:13:42 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:13:42 -0700 Subject: [Python-checkins] python/nondist/peps README.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv31537 Modified Files: README.txt Log Message: Fixed some typos and simplified. Index: README.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/README.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.txt 26 Aug 2002 15:36:55 -0000 1.1 --- README.txt 30 Aug 2002 03:13:40 -0000 1.2 *************** *** 3,10 **** Original PEP source may be written using two standard formats, a ! mildly idiomatic plain text format and a the reStructuredText format ! (also, technically plain text). These two formats are described in PEP 9 and PEP 12 respectively. The pep2html.py processing and ! installation scripts knows how to produce the html for either PEP format, however in order to process reStructuredText PEPs, you must install the Docutils package. If this package is not installed, --- 3,10 ---- Original PEP source may be written using two standard formats, a ! mildly idiomatic plaintext format and the reStructuredText format ! (also, technically plaintext). These two formats are described in PEP 9 and PEP 12 respectively. The pep2html.py processing and ! installation script knows how to produce the HTML for either PEP format, however in order to process reStructuredText PEPs, you must install the Docutils package. If this package is not installed, *************** *** 13,20 **** Installing Docutils for reStructuredText PEPs ! ============================================= ! ! :Author: David Goodger ! :Contact: goodger@users.sourceforge.net 1. Get the latest Docutils software (CVS snapshot): --- 13,17 ---- Installing Docutils for reStructuredText PEPs ! --------------------------------------------- 1. Get the latest Docutils software (CVS snapshot): *************** *** 36,38 **** Please report any problems or questions to ! docutils-develop@lists.sourceforge.net or to the author. --- 33,36 ---- Please report any problems or questions to ! docutils-develop@lists.sourceforge.net or to David Goodger ! (goodger@python.org). From goodger@users.sourceforge.net Fri Aug 30 04:15:53 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:15:53 -0700 Subject: [Python-checkins] python/nondist/peps pep-0012.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32150 Modified Files: pep-0012.txt Log Message: Tracked Barry's changes to PEP 9. Index: pep-0012.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0012.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0012.txt 26 Aug 2002 16:31:58 -0000 1.1 --- pep-0012.txt 30 Aug 2002 03:15:51 -0000 1.2 *************** *** 21,29 **** Note: if you are reading this PEP via the web, you should first grab ! the text (reStructuredText) version in order to complete the steps ! below. **DO NOT USE THE HTML FILE AS YOUR TEMPLATE!** ! To get the text version of this file, look at the top of the page and ! click on the link titled "PEP Source". If you would prefer not to use markup in your PEP, please see PEP 9, --- 21,29 ---- Note: if you are reading this PEP via the web, you should first grab ! the text (reStructuredText) source of this PEP in order to complete ! the steps below. **DO NOT USE THE HTML FILE AS YOUR TEMPLATE!** ! To get the source of this (or any) PEP, look at the top of the HTML ! page and click on the link titled "PEP Source". If you would prefer not to use markup in your PEP, please see PEP 9, *************** *** 52,58 **** To use this template you must first decide whether your PEP is going ! to be Informational or Standards Track. Most PEPs are Standards Track ! because they propose a new feature for the Python language or standard ! library. When in doubt, read PEP 1 for details. Once you've decided which type of PEP yours is going to be, follow the --- 52,59 ---- To use this template you must first decide whether your PEP is going ! to be an Informational or Standards Track PEP. Most PEPs are ! Standards Track because they propose a new feature for the Python ! language or standard library. When in doubt, read PEP 1 for details ! or contact the PEP editors . Once you've decided which type of PEP yours is going to be, follow the *************** *** 73,78 **** email address. Be sure to follow the format carefully: your name must appear first, and it must not be contained in parentheses. ! Your email address may appear second (it can also be omitted) and if ! it appears, it must appear in angle brackets. - If there is a mailing list for discussion of your new feature, add a --- 74,80 ---- email address. Be sure to follow the format carefully: your name must appear first, and it must not be contained in parentheses. ! Your email address may appear second (or it can be omitted) and if ! it appears, it must appear in angle brackets. It is okay to ! obfuscate your email address. - If there is a mailing list for discussion of your new feature, add a *************** *** 120,124 **** You must manually add new dates and check them in. If you don't ! have check-in privileges, send your changes to the PEP editor. - Add a Replaces header if your PEP obsoletes an earlier PEP. The --- 122,126 ---- You must manually add new dates and check them in. If you don't ! have check-in privileges, send your changes to the PEP editors. - Add a Replaces header if your PEP obsoletes an earlier PEP. The *************** *** 144,149 **** formfeed character ("^L", or ``\f``). ! - Send your PEP submission to the PEP editor, Barry Warsaw, at ! peps@python.org. --- 146,150 ---- formfeed character ("^L", or ``\f``). ! - Send your PEP submission to the PEP editors at peps@python.org. From goodger@users.sourceforge.net Fri Aug 30 04:18:24 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:18:24 -0700 Subject: [Python-checkins] python/nondist/peps pep.css,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv32594 Modified Files: pep.css Log Message: Removed unused a.footnote-references style, added styles for line blocks and tt inside titles. Index: pep.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep.css 26 Aug 2002 16:50:00 -0000 1.1 --- pep.css 30 Aug 2002 03:18:22 -0000 1.2 *************** *** 44,51 **** margin-bottom: 0em } - a.footnote-reference { - font-size: smaller ; - vertical-align: super } - a.target { color: blue } --- 44,47 ---- *************** *** 189,192 **** --- 185,193 ---- font-weight: bold } + pre.line-block { + margin-left: 2em ; + font-family: serif ; + font-size: 100% } + pre.literal-block, pre.doctest-block { margin-left: 2em ; *************** *** 235,238 **** --- 236,245 ---- font-weight: bold ; text-align: right } + + h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { + font-size: 100% } + + tt { + background-color: #eeeeee } ul.auto-toc { From goodger@users.sourceforge.net Fri Aug 30 04:23:00 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 20:23:00 -0700 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1153 Modified Files: pep2html.py Log Message: Added an exception handler for a bad PEP number. Updated docstrings. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** pep2html.py 26 Aug 2002 17:02:09 -0000 1.41 --- pep2html.py 30 Aug 2002 03:22:58 -0000 1.42 *************** *** 7,11 **** -u/--user ! SF username -b/--browse --- 7,11 ---- -u/--user ! python.org username -b/--browse *************** *** 17,24 **** -i/--install ! After generating the HTML, install it and the source file (.txt) ! SourceForge. In that case the user's name is used in the scp and ssh ! commands, unless -u sf_username is given (in which case, that is used ! instead). Without -i, -u is ignored. -q/--quiet --- 17,24 ---- -i/--install ! After generating the HTML, install it and the plaintext source file ! (.txt) on python.org. In that case the user's name is used in the scp ! and ssh commands, unless "-u username" is given (in which case, it is ! used instead). Without -i, -u is ignored. -q/--quiet *************** *** 132,136 **** basename = os.path.basename(inpath) infile = iter(input_lines) ! # convert plain text pep to minimal XHTML markup print >> outfile, DTD print >> outfile, '' --- 132,136 ---- basename = os.path.basename(inpath) infile = iter(input_lines) ! # convert plaintext pep to minimal XHTML markup print >> outfile, DTD print >> outfile, '' *************** *** 178,183 **** print >> outfile, '[PEP Index]' if pep: ! print >> outfile, '[PEP Source]' \ ! % int(pep) print >> outfile, '' print >> outfile, '

\n' --- 178,187 ---- print >> outfile, '[PEP Index]' if pep: ! try: ! print >> outfile, ('[PEP Source' ! ']' % int(pep)) ! except ValueError, error: ! print >> sys.stderr, ('ValueError (invalid PEP number): %s' ! % error) print >> outfile, '
' print >> outfile, '
\n' *************** *** 207,214 **** v = otherpeps elif k.lower() in ('last-modified',): - url = PEPCVSURL % int(pep) date = v or time.strftime('%d-%b-%Y', time.localtime(os.stat(inpath)[8])) ! v = '%s ' % (url, cgi.escape(date)) elif k.lower() in ('content-type',): url = PEPURL % 9 --- 211,221 ---- v = otherpeps elif k.lower() in ('last-modified',): date = v or time.strftime('%d-%b-%Y', time.localtime(os.stat(inpath)[8])) ! try: ! url = PEPCVSURL % int(pep) ! v = '%s ' % (url, cgi.escape(date)) ! except ValueError, error: ! v = date elif k.lower() in ('content-type',): url = PEPURL % 9 From goodger@users.sourceforge.net Fri Aug 30 05:11:23 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 21:11:23 -0700 Subject: [Python-checkins] python/nondist/peps pep-0012.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12208 Modified Files: pep-0012.txt Log Message: Posting it now. Index: pep-0012.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0012.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0012.txt 30 Aug 2002 03:15:51 -0000 1.2 --- pep-0012.txt 30 Aug 2002 04:11:20 -0000 1.3 *************** *** 9,13 **** Content-Type: text/x-rst Created: 05-Aug-2002 ! Post-History: --- 9,13 ---- Content-Type: text/x-rst Created: 05-Aug-2002 ! Post-History: 30-Aug-2002 From goodger@users.sourceforge.net Fri Aug 30 05:30:42 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 29 Aug 2002 21:30:42 -0700 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv16648 Modified Files: pep2html.py Log Message: removed tab Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** pep2html.py 30 Aug 2002 03:22:58 -0000 1.42 --- pep2html.py 30 Aug 2002 04:30:40 -0000 1.43 *************** *** 183,187 **** except ValueError, error: print >> sys.stderr, ('ValueError (invalid PEP number): %s' ! % error) print >> outfile, '
' print >> outfile, '
\n' --- 183,187 ---- except ValueError, error: print >> sys.stderr, ('ValueError (invalid PEP number): %s' ! % error) print >> outfile, '
' print >> outfile, '
\n' From jackjansen@users.sourceforge.net Fri Aug 30 13:56:11 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 05:56:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory usw-pr-cvs1:/tmp/cvs-serv20288/Mac/OSX/PythonLauncher/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: On Jaguar the default mode for files in the installed product is 444 (or 555) in stead of 644 (755). This makes a subsequent install fail. Changed the INSTALL_MODE_FLAG to fix this. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** project.pbxproj 2 Aug 2002 22:32:41 -0000 1.4 --- project.pbxproj 30 Aug 2002 12:56:08 -0000 1.5 *************** *** 289,292 **** --- 289,293 ---- FRAMEWORK_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = ""; + INSTALL_MODE_FLAG = "a+rX"; INSTALL_PATH = /Applications/Python; LIBRARY_SEARCH_PATHS = ""; From mwh@users.sourceforge.net Fri Aug 30 14:09:52 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Aug 2002 06:09:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24418/Lib/test Added Files: test_trace.py Log Message: Further SET_LINENO reomval fixes. See comments in patch #587933. Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch... --- NEW FILE: test_trace.py --- # Testing the line trace facility. from test import test_support import unittest import sys import difflib # A very basic example. If this fails, we're in deep trouble. def basic(): return 1 basic.events = [(0, 'call'), (1, 'line'), (1, 'return')] # Armin Rigo's failing example: def arigo_example(): x = 1 del x while 0: pass x = 1 arigo_example.events = [(0, 'call'), (1, 'line'), (2, 'line'), (3, 'line'), (5, 'line'), (5, 'return')] # check that lines consisting of just one instruction get traced: def one_instr_line(): x = 1 del x x = 1 one_instr_line.events = [(0, 'call'), (1, 'line'), (2, 'line'), (3, 'line'), (3, 'return')] def no_pop_tops(): # 0 x = 1 # 1 for a in range(2): # 2 if a: # 3 x = 1 # 4 else: # 5 x = 1 # 6 no_pop_tops.events = [(0, 'call'), (1, 'line'), (2, 'line'), (3, 'line'), (6, 'line'), (2, 'line'), (3, 'line'), (4, 'line'), (2, 'line'), (6, 'return')] def no_pop_blocks(): while 0: bla x = 1 no_pop_blocks.events = [(0, 'call'), (1, 'line'), (3, 'line'), (3, 'return')] class Tracer: def __init__(self): self.events = [] def trace(self, frame, event, arg): self.events.append((frame.f_lineno, event)) return self.trace class TraceTestCase(unittest.TestCase): def run_test(self, func): tracer = Tracer() sys.settrace(tracer.trace) 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): self.run_test(basic) def test_2_arigo(self): self.run_test(arigo_example) def test_3_one_instr(self): self.run_test(one_instr_line) def test_4_no_pop_blocks(self): self.run_test(no_pop_blocks) def test_5_no_pop_tops(self): self.run_test(no_pop_tops) def test_main(): test_support.run_unittest(TraceTestCase) if __name__ == "__main__": test_main() From mwh@users.sourceforge.net Fri Aug 30 14:09:54 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Aug 2002 06:09:54 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.332,2.333 compile.c,2.262,2.263 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24418/Python Modified Files: ceval.c compile.c Log Message: Further SET_LINENO reomval fixes. See comments in patch #587933. Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch... Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.332 retrieving revision 2.333 diff -C2 -d -r2.332 -r2.333 *** ceval.c 23 Aug 2002 14:11:35 -0000 2.332 --- ceval.c 30 Aug 2002 13:09:50 -0000 2.333 *************** *** 1516,1525 **** break; - case RETURN_NONE: - retval = Py_None; - Py_INCREF(retval); - why = WHY_RETURN; - break; - case YIELD_VALUE: retval = POP(); --- 1516,1519 ---- *************** *** 2881,2887 **** co_lnotab takes some work, but is conceptually clear. ! Somewhat harder to explain is why we don't call the line ! trace function when executing a POP_TOP or RETURN_NONE ! opcodes. An example probably serves best. Consider this code: --- 2875,2880 ---- co_lnotab takes some work, but is conceptually clear. ! Somewhat harder to explain is why we don't *always* call the ! line trace function when the above test fails. Consider this code: *************** *** 2908,2912 **** 19 PRINT_ITEM 20 PRINT_NEWLINE ! >> 21 RETURN_NONE If a is false, execution will jump to instruction at offset --- 2901,2906 ---- 19 PRINT_ITEM 20 PRINT_NEWLINE ! >> 21 LOAD_CONST 0 (None) ! 24 RETURN_VALUE If a is false, execution will jump to instruction at offset *************** *** 2916,2948 **** sense in all cases (I think). ! On the other hand, if 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. ! ! This is why it is important that RETURN_NONE is *only* used ! for the "falling off the end of the function" form of ! returning None -- using it for code like ! ! 1: def f(): ! 2: return ! ! would, once again, lead to misleading tracing behaviour. ! It is also worth mentioning that getting tracing behaviour ! right is the *entire* motivation for adding the RETURN_NONE ! opcode. */ ! if (opcode != POP_TOP && opcode != RETURN_NONE && ! (frame->f_lasti < *instr_lb || frame->f_lasti > *instr_ub)) { PyCodeObject* co = frame->f_code; int size, addr; unsigned char* p; ! call_trace(func, obj, frame, PyTrace_LINE, Py_None); ! size = PyString_Size(co->co_lnotab) / 2; ! p = (unsigned char*)PyString_AsString(co->co_lnotab); /* possible optimization: if f->f_lasti == instr_ub --- 2910,2933 ---- sense in all cases (I think). ! What we do is only call the line trace function if the co_lnotab ! indicates we have jumped to the *start* of a line, i.e. if the ! current instruction offset matches the offset given for the ! 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; ! size = PyString_GET_SIZE(co->co_lnotab) / 2; ! p = (unsigned char*)PyString_AS_STRING(co->co_lnotab); ! addr = 0; /* possible optimization: if f->f_lasti == instr_ub *************** *** 2951,2956 **** somwhere we could skip the first while loop. */ - addr = 0; - /* see comments in compile.c for the description of co_lnotab. A point to remember: increments to p --- 2936,2939 ---- *************** *** 2959,2963 **** increments gets confusing, to say the least. */ ! while (size >= 0) { if (addr + *p > frame->f_lasti) break; --- 2942,2946 ---- increments gets confusing, to say the least. */ ! while (size > 0) { if (addr + *p > frame->f_lasti) break; *************** *** 2966,2969 **** --- 2949,2955 ---- --size; } + if (addr == frame->f_lasti) + call_trace(func, obj, frame, + PyTrace_LINE, Py_None); *instr_lb = addr; if (size > 0) { Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.262 retrieving revision 2.263 diff -C2 -d -r2.262 -r2.263 *** compile.c 16 Aug 2002 02:48:11 -0000 2.262 --- compile.c 30 Aug 2002 13:09:51 -0000 2.263 *************** *** 4015,4019 **** com_node(c, CHILD(n, 4)); c->c_infunction = 0; ! com_addbyte(c, RETURN_NONE); } --- 4015,4022 ---- com_node(c, CHILD(n, 4)); c->c_infunction = 0; ! com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); ! com_push(c, 1); ! com_addbyte(c, RETURN_VALUE); ! com_pop(c, 1); } *************** *** 4082,4086 **** if (TYPE(n) != NEWLINE) com_node(c, n); ! com_addbyte(c, RETURN_NONE); c->c_interactive--; break; --- 4085,4092 ---- if (TYPE(n) != NEWLINE) com_node(c, n); ! com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); ! com_push(c, 1); ! com_addbyte(c, RETURN_VALUE); ! com_pop(c, 1); c->c_interactive--; break; *************** *** 4088,4092 **** case file_input: /* A whole file, or built-in function exec() */ com_file_input(c, n); ! com_addbyte(c, RETURN_NONE); break; --- 4094,4101 ---- case file_input: /* A whole file, or built-in function exec() */ com_file_input(c, n); ! com_addoparg(c, LOAD_CONST, com_addconst(c, Py_None)); ! com_push(c, 1); ! com_addbyte(c, RETURN_VALUE); ! com_pop(c, 1); break; From mwh@users.sourceforge.net Fri Aug 30 14:10:21 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Aug 2002 06:10:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv24418/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Further SET_LINENO reomval fixes. See comments in patch #587933. Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch... Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** whatsnew23.tex 22 Aug 2002 16:51:08 -0000 1.48 --- whatsnew23.tex 30 Aug 2002 13:09:48 -0000 1.49 *************** *** 1226,1234 **** under ``python -O'' in earlier versions of Python. - To make tracing work as expected, it was found necessary to add a new - opcode, \cdata{RETURN_NONE}, to the VM. If you want to know why, read - the comments in the function \cfunction{maybe_call_line_trace} in - \file{Python/ceval.c}. - \end{itemize} --- 1226,1229 ---- From mwh@users.sourceforge.net Fri Aug 30 14:10:20 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Aug 2002 06:10:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24418/Doc/lib Modified Files: libdis.tex Log Message: Further SET_LINENO reomval fixes. See comments in patch #587933. Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch... Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** libdis.tex 15 Aug 2002 14:58:59 -0000 1.39 --- libdis.tex 30 Aug 2002 13:09:48 -0000 1.40 *************** *** 28,32 **** 6 CALL_FUNCTION 1 9 RETURN_VALUE ! 10 RETURN_NONE \end{verbatim} --- 28,33 ---- 6 CALL_FUNCTION 1 9 RETURN_VALUE ! 10 LOAD_CONST 0 (None) ! 13 RETURN_VALUE \end{verbatim} *************** *** 400,411 **** \begin{opcodedesc}{RETURN_VALUE}{} Returns with TOS to the caller of the function. - \end{opcodedesc} - - \begin{opcodedesc}{RETURN_NONE}{} - Returns \constant{None} to the caller of the function. This opcode is - generated as the last opcode of every function and only then, for - reasons to do with tracing support. See the comments in the function - \cfunction{maybe_call_line_trace} in \file{Python/ceval.c} for the - gory details. \versionadded{2.3}. \end{opcodedesc} --- 401,404 ---- From mwh@users.sourceforge.net Fri Aug 30 14:10:21 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Aug 2002 06:10:21 -0700 Subject: [Python-checkins] python/dist/src/Include opcode.h,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv24418/Include Modified Files: opcode.h Log Message: Further SET_LINENO reomval fixes. See comments in patch #587933. Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch... Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** opcode.h 15 Aug 2002 14:59:00 -0000 2.40 --- opcode.h 30 Aug 2002 13:09:49 -0000 2.41 *************** *** 72,78 **** #define BREAK_LOOP 80 - #define RETURN_NONE 81 /* *only* for function epilogues - -- see comments in - ceval.c:maybe_call_line_trace for why */ #define LOAD_LOCALS 82 #define RETURN_VALUE 83 --- 72,75 ---- From mwh@users.sourceforge.net Fri Aug 30 14:10:22 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 30 Aug 2002 06:10:22 -0700 Subject: [Python-checkins] python/dist/src/Lib dis.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24418/Lib Modified Files: dis.py Log Message: Further SET_LINENO reomval fixes. See comments in patch #587933. Use a slightly different strategy to determine when not to call the line trace function. This removes the need for the RETURN_NONE opcode, so that's gone again. Update docs and comments to match. Thanks to Neal and Armin! Also add a test suite. This should have come with the original patch... Index: dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** dis.py 23 Aug 2002 18:19:29 -0000 1.43 --- dis.py 30 Aug 2002 13:09:49 -0000 1.44 *************** *** 255,259 **** def_op('BREAK_LOOP', 80) - def_op('RETURN_NONE', 81) def_op('LOAD_LOCALS', 82) def_op('RETURN_VALUE', 83) --- 255,258 ---- From jackjansen@users.sourceforge.net Fri Aug 30 16:14:04 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 08:14:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv7742 Modified Files: Makefile Log Message: Fix for Jaguar: use ln for installing symlinks, install no longer works. Fix for sh: use : in stead of an empty then clause in an if. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Makefile 28 Aug 2002 21:27:01 -0000 1.23 --- Makefile 30 Aug 2002 15:14:02 -0000 1.24 *************** *** 22,26 **** DIRMODE=755 INSTALL=/usr/bin/install -c ! INSTALL_SYMLINK=/usr/bin/install -l as INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} --- 22,26 ---- DIRMODE=755 INSTALL=/usr/bin/install -c ! INSTALL_SYMLINK=ln -fs INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} *************** *** 123,127 **** install_IDE: $(INSTALLED_PYTHONW) ! @if $(INSTALLED_PYTHONW) -c "import waste"; then ; else \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ --- 123,127 ---- install_IDE: $(INSTALLED_PYTHONW) ! @if $(INSTALLED_PYTHONW) -c "import waste"; then : ; else \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ From jhylton@users.sourceforge.net Fri Aug 30 20:11:41 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 12:11:41 -0700 Subject: [Python-checkins] python/dist/src/Parser asdl_c.py,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv22394/Parser Modified Files: Tag: ast-branch asdl_c.py Log Message: Generate marshalling code. XXX The marshalling code works except that the BoolOp has a sequence of cmpop_ty. The asdl_seq elements have type void * then needs to be explicitly cast back to cmpop_ty. Maybe we shouldn't store ints that are cast to void *. Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/asdl_c.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** asdl_c.py 7 Jul 2002 17:34:44 -0000 1.1.2.1 --- asdl_c.py 30 Aug 2002 19:11:39 -0000 1.1.2.2 *************** *** 329,370 **** pass ! class PicklePrototypeVisitor(PickleVisitor): ! def visitSum(self, sum, name): ctype = get_c_type(name) ! self.emit("int pkl_write_%s(PyObject *write, %s o);" % (name, ctype), ! 0) ! class PickleFunctionVisitor(PickleVisitor): ! ! def visitSum(self, sum, name): ctype = get_c_type(name) self.emit("int", 0) ! self.emit("pkl_write_%s(PyObject *write, %s o)" % (name, ctype), 0) self.emit("{", 0) ! self.emit("switch (o->kind) {", 1) simple = self.is_simple(sum) for i in range(len(sum.types)): t = sum.types[i] ! self.visit(t, i + 1, name, simple) self.emit("}", 1) ! self.emit("return 0;", 1) ! self.emit("}", 0) ! self.emit("", 0) def visitConstructor(self, cons, enum, name, simple): if simple: ! pass else: self.emit("case %s_kind:" % cons.name, 1) ! self.emit("pkl_write_int(write, %d);" % enum, 2) for f in cons.fields: ! self.visit(f, cons.name) self.emit("break;", 2) ! def visitField(self, field, name): ! # handle seq and opt ! self.emit("pkl_write_%s(write, o->v.%s.%s);" % ( ! field.type, name, field.name), 2) class ChainOfVisitors: --- 329,422 ---- pass ! class MarshalPrototypeVisitor(PickleVisitor): ! def prototype(self, sum, name): ctype = get_c_type(name) ! self.emit("int marshal_write_%s(PyObject **, int *, %s);" ! % (name, ctype), 0) ! visitProduct = visitSum = prototype ! ! def find_sequence(fields): ! """Return True if any field uses a sequence.""" ! for f in fields: ! if f.seq: ! return 1 ! return 0 ! ! class MarshalFunctionVisitor(PickleVisitor): ! ! def func_begin(self, name, has_seq): ctype = get_c_type(name) self.emit("int", 0) ! self.emit("marshal_write_%s(PyObject **buf, int *off, %s o)" % ! (name, ctype), 0) self.emit("{", 0) ! if has_seq: ! self.emit("int i;", 1) # XXX only need it for sequences ! ! def func_end(self): ! self.emit("return 1;", 1) ! self.emit("}", 0) ! self.emit("", 0) ! ! def visitSum(self, sum, name): ! has_seq = 0 ! for t in sum.types: ! if find_sequence(t.fields): ! has_seq = 1 ! break ! self.func_begin(name, has_seq) simple = self.is_simple(sum) + if simple: + self.emit("switch (o) {", 1) + else: + self.emit("switch (o->kind) {", 1) for i in range(len(sum.types)): t = sum.types[i] ! self.visitConstructor(t, i + 1, name, simple) self.emit("}", 1) ! self.func_end() ! ! def visitProduct(self, prod, name): ! self.func_begin(name, find_sequence(prod.fields)) ! for field in prod.fields: ! self.visitField(field, name, 1, 1) ! self.func_end() def visitConstructor(self, cons, enum, name, simple): if simple: ! self.emit("case %s:" % cons.name, 1) ! self.emit("marshal_write_int(buf, off, %d);" % enum, 2); ! self.emit("break;", 2) else: self.emit("case %s_kind:" % cons.name, 1) ! self.emit("marshal_write_int(buf, off, %d);" % enum, 2) for f in cons.fields: ! self.visitField(f, cons.name, 2, 0) self.emit("break;", 2) ! def visitField(self, field, name, depth, product): ! def emit(s, d): ! self.emit(s, depth + d) ! if product: ! value = "o->%s" % field.name ! else: ! value = "o->v.%s.%s" % (name, field.name) ! if field.seq: ! emit("marshal_write_int(buf, off, asdl_seq_LEN(%s));" % value, 0) ! emit("for (i = 0; i < asdl_seq_LEN(%s); i++) {" % value, 0) ! emit("void *elt = asdl_seq_GET(%s, i);" % value, 1); ! emit("marshal_write_%s(buf, off, elt);" % field.type, 1) ! emit("}", 0) ! elif field.opt: ! emit("if (%s) {" % value, 0) ! emit("marshal_write_int(buf, off, 1);", 1) ! emit("marshal_write_%s(buf, off, %s);" % (field.type, value), 1) ! emit("}", 0) ! emit("else", 0) ! emit("marshal_write_int(buf, off, 0);", 1) ! else: ! emit("marshal_write_%s(buf, off, %s);" % (field.type, value), 0) class ChainOfVisitors: *************** *** 391,395 **** StructVisitor(f), PrototypeVisitor(f), ! ## PicklePrototypeVisitor(f), ) c.visit(mod) --- 443,447 ---- StructVisitor(f), PrototypeVisitor(f), ! MarshalPrototypeVisitor(f), ) c.visit(mod) *************** *** 406,410 **** print >> f v = ChainOfVisitors(FunctionVisitor(f), ! ## PickleFunctionVisitor(f), ) v.visit(mod) --- 458,462 ---- print >> f v = ChainOfVisitors(FunctionVisitor(f), ! MarshalFunctionVisitor(f), ) v.visit(mod) From jhylton@users.sourceforge.net Fri Aug 30 20:20:42 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 12:20:42 -0700 Subject: [Python-checkins] python/dist/src/Include Python-ast.h,1.1.2.2,1.1.2.3 asdl.h,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv25556/Include Modified Files: Tag: ast-branch Python-ast.h asdl.h Log Message: Checkin the generated ast code with marshal support (write only). Also, change the asdl_seq code to implement fixed-size arrays rather than dynamically sized arrays. Every place that uses an asdl_seq can determine its exact size easily. Index: Python-ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/Python-ast.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** Python-ast.h 9 Jul 2002 13:20:11 -0000 1.1.2.2 --- Python-ast.h 30 Aug 2002 19:20:40 -0000 1.1.2.3 *************** *** 380,381 **** --- 380,395 ---- keyword_ty keyword(identifier arg, expr_ty value); alias_ty alias(identifier name, identifier asname); + int marshal_write_mod(PyObject **, int *, mod_ty); + int marshal_write_stmt(PyObject **, int *, stmt_ty); + int marshal_write_expr(PyObject **, int *, expr_ty); + int marshal_write_expr_context(PyObject **, int *, expr_context_ty); + int marshal_write_slice(PyObject **, int *, slice_ty); + int marshal_write_boolop(PyObject **, int *, boolop_ty); + int marshal_write_operator(PyObject **, int *, operator_ty); + int marshal_write_unaryop(PyObject **, int *, unaryop_ty); + int marshal_write_cmpop(PyObject **, int *, cmpop_ty); + int marshal_write_listcomp(PyObject **, int *, listcomp_ty); + int marshal_write_excepthandler(PyObject **, int *, excepthandler_ty); + int marshal_write_arguments(PyObject **, int *, arguments_ty); + int marshal_write_keyword(PyObject **, int *, keyword_ty); + int marshal_write_alias(PyObject **, int *, alias_ty); Index: asdl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/asdl.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** asdl.h 7 Jul 2002 17:34:44 -0000 1.1.2.1 --- asdl.h 30 Aug 2002 19:20:40 -0000 1.1.2.2 *************** *** 14,31 **** */ ! /* A sequence should be typed so that its use can be typechecked. */ typedef struct { int size; ! int used; ! void **elements; } asdl_seq; asdl_seq *asdl_seq_new(int size); - void *asdl_seq_get(asdl_seq *seq, int offset); - int asdl_seq_append(asdl_seq *seq, void *elt); void asdl_seq_free(asdl_seq *); ! #define asdl_seq_LEN(S) ((S)->used) #endif /* !Py_ASDL_H */ --- 14,41 ---- */ ! /* XXX A sequence should be typed so that its use can be typechecked. */ ! ! /* XXX We shouldn't pay for offset when we don't need APPEND. */ typedef struct { int size; ! int offset; ! void *elements[1]; } asdl_seq; asdl_seq *asdl_seq_new(int size); void asdl_seq_free(asdl_seq *); ! #define asdl_seq_GET(S, I) (S)->elements[(I)] ! #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) ! #define asdl_seq_APPEND(S, V) (S)->elements[(S)->offset++] = (V) ! #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) ! ! /* Routines to marshal the basic types. */ ! int marshal_write_int(PyObject **, int *, int); ! int marshal_write_bool(PyObject **, int *, bool); ! int marshal_write_identifier(PyObject **, int *, identifier); ! int marshal_write_string(PyObject **, int *, string); ! int marshal_write_object(PyObject **, int *, object); #endif /* !Py_ASDL_H */ From jhylton@users.sourceforge.net Fri Aug 30 20:20:42 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 12:20:42 -0700 Subject: [Python-checkins] python/dist/src/Python Python-ast.c,1.1.2.2,1.1.2.3 asdl.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv25556/Python Modified Files: Tag: ast-branch Python-ast.c asdl.c Log Message: Checkin the generated ast code with marshal support (write only). Also, change the asdl_seq code to implement fixed-size arrays rather than dynamically sized arrays. Every place that uses an asdl_seq can determine its exact size easily. Index: Python-ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/Python-ast.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 *** Python-ast.c 9 Jul 2002 13:20:11 -0000 1.1.2.2 --- Python-ast.c 30 Aug 2002 19:20:40 -0000 1.1.2.3 *************** *** 1046,1047 **** --- 1046,1763 ---- } + int + marshal_write_mod(PyObject **buf, int *off, mod_ty o) + { + int i; + switch (o->kind) { + case Module_kind: + marshal_write_int(buf, off, 1); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Module.body)); + for (i = 0; i < asdl_seq_LEN(o->v.Module.body); i++) { + void *elt = asdl_seq_GET(o->v.Module.body, i); + marshal_write_stmt(buf, off, elt); + } + break; + case Interactive_kind: + marshal_write_int(buf, off, 2); + marshal_write_stmt(buf, off, o->v.Interactive.body); + break; + case Expression_kind: + marshal_write_int(buf, off, 3); + marshal_write_expr(buf, off, o->v.Expression.body); + break; + case Suite_kind: + marshal_write_int(buf, off, 4); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Suite.body)); + for (i = 0; i < asdl_seq_LEN(o->v.Suite.body); i++) { + void *elt = asdl_seq_GET(o->v.Suite.body, i); + marshal_write_stmt(buf, off, elt); + } + break; + } + return 1; + } + + int + marshal_write_stmt(PyObject **buf, int *off, stmt_ty o) + { + int i; + switch (o->kind) { + case FunctionDef_kind: + marshal_write_int(buf, off, 1); + marshal_write_identifier(buf, off, o->v.FunctionDef.name); + marshal_write_arguments(buf, off, o->v.FunctionDef.args); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.FunctionDef.body)); + for (i = 0; i < asdl_seq_LEN(o->v.FunctionDef.body); i++) { + void *elt = asdl_seq_GET(o->v.FunctionDef.body, i); + marshal_write_stmt(buf, off, elt); + } + break; + case ClassDef_kind: + marshal_write_int(buf, off, 2); + marshal_write_identifier(buf, off, o->v.ClassDef.name); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.ClassDef.bases)); + for (i = 0; i < asdl_seq_LEN(o->v.ClassDef.bases); i++) { + void *elt = asdl_seq_GET(o->v.ClassDef.bases, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.ClassDef.body)); + for (i = 0; i < asdl_seq_LEN(o->v.ClassDef.body); i++) { + void *elt = asdl_seq_GET(o->v.ClassDef.body, i); + marshal_write_stmt(buf, off, elt); + } + break; + case Return_kind: + marshal_write_int(buf, off, 3); + if (o->v.Return.value) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Return.value); + } + else + marshal_write_int(buf, off, 0); + break; + case Yield_kind: + marshal_write_int(buf, off, 4); + marshal_write_expr(buf, off, o->v.Yield.value); + break; + case Delete_kind: + marshal_write_int(buf, off, 5); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Delete.targets)); + for (i = 0; i < asdl_seq_LEN(o->v.Delete.targets); i++) { + void *elt = asdl_seq_GET(o->v.Delete.targets, i); + marshal_write_expr(buf, off, elt); + } + break; + case Assign_kind: + marshal_write_int(buf, off, 6); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Assign.targets)); + for (i = 0; i < asdl_seq_LEN(o->v.Assign.targets); i++) { + void *elt = asdl_seq_GET(o->v.Assign.targets, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_expr(buf, off, o->v.Assign.value); + break; + case AugAssign_kind: + marshal_write_int(buf, off, 7); + marshal_write_expr(buf, off, o->v.AugAssign.target); + marshal_write_operator(buf, off, o->v.AugAssign.op); + marshal_write_expr(buf, off, o->v.AugAssign.value); + break; + case Print_kind: + marshal_write_int(buf, off, 8); + if (o->v.Print.dest) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Print.dest); + } + else + marshal_write_int(buf, off, 0); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Print.values)); + for (i = 0; i < asdl_seq_LEN(o->v.Print.values); i++) { + void *elt = asdl_seq_GET(o->v.Print.values, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_bool(buf, off, o->v.Print.nl); + break; + case For_kind: + marshal_write_int(buf, off, 9); + marshal_write_expr(buf, off, o->v.For.target); + marshal_write_expr(buf, off, o->v.For.iter); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.For.body)); + for (i = 0; i < asdl_seq_LEN(o->v.For.body); i++) { + void *elt = asdl_seq_GET(o->v.For.body, i); + marshal_write_stmt(buf, off, elt); + } + marshal_write_int(buf, off, asdl_seq_LEN(o->v.For.orelse)); + for (i = 0; i < asdl_seq_LEN(o->v.For.orelse); i++) { + void *elt = asdl_seq_GET(o->v.For.orelse, i); + marshal_write_stmt(buf, off, elt); + } + break; + case While_kind: + marshal_write_int(buf, off, 10); + marshal_write_expr(buf, off, o->v.While.test); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.While.body)); + for (i = 0; i < asdl_seq_LEN(o->v.While.body); i++) { + void *elt = asdl_seq_GET(o->v.While.body, i); + marshal_write_stmt(buf, off, elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.While.orelse)); + for (i = 0; i < asdl_seq_LEN(o->v.While.orelse); i++) { + void *elt = asdl_seq_GET(o->v.While.orelse, i); + marshal_write_stmt(buf, off, elt); + } + break; + case If_kind: + marshal_write_int(buf, off, 11); + marshal_write_expr(buf, off, o->v.If.test); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.If.body)); + for (i = 0; i < asdl_seq_LEN(o->v.If.body); i++) { + void *elt = asdl_seq_GET(o->v.If.body, i); + marshal_write_stmt(buf, off, elt); + } + marshal_write_int(buf, off, asdl_seq_LEN(o->v.If.orelse)); + for (i = 0; i < asdl_seq_LEN(o->v.If.orelse); i++) { + void *elt = asdl_seq_GET(o->v.If.orelse, i); + marshal_write_stmt(buf, off, elt); + } + break; + case Raise_kind: + marshal_write_int(buf, off, 12); + if (o->v.Raise.type) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Raise.type); + } + else + marshal_write_int(buf, off, 0); + if (o->v.Raise.inst) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Raise.inst); + } + else + marshal_write_int(buf, off, 0); + if (o->v.Raise.tback) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Raise.tback); + } + else + marshal_write_int(buf, off, 0); + break; + case TryExcept_kind: + marshal_write_int(buf, off, 13); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.TryExcept.body)); + for (i = 0; i < asdl_seq_LEN(o->v.TryExcept.body); i++) { + void *elt = asdl_seq_GET(o->v.TryExcept.body, i); + marshal_write_stmt(buf, off, elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.TryExcept.handlers)); + for (i = 0; i < asdl_seq_LEN(o->v.TryExcept.handlers); i++) + { + void *elt = asdl_seq_GET(o->v.TryExcept.handlers, + i); + marshal_write_excepthandler(buf, off, elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.TryExcept.orelse)); + for (i = 0; i < asdl_seq_LEN(o->v.TryExcept.orelse); i++) { + void *elt = asdl_seq_GET(o->v.TryExcept.orelse, i); + marshal_write_stmt(buf, off, elt); + } + break; + case TryFinally_kind: + marshal_write_int(buf, off, 14); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.TryFinally.body)); + for (i = 0; i < asdl_seq_LEN(o->v.TryFinally.body); i++) { + void *elt = asdl_seq_GET(o->v.TryFinally.body, i); + marshal_write_stmt(buf, off, elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.TryFinally.finalbody)); + for (i = 0; i < asdl_seq_LEN(o->v.TryFinally.finalbody); + i++) { + void *elt = asdl_seq_GET(o->v.TryFinally.finalbody, + i); + marshal_write_stmt(buf, off, elt); + } + break; + case Assert_kind: + marshal_write_int(buf, off, 15); + marshal_write_expr(buf, off, o->v.Assert.test); + if (o->v.Assert.msg) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Assert.msg); + } + else + marshal_write_int(buf, off, 0); + break; + case Import_kind: + marshal_write_int(buf, off, 16); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Import.names)); + for (i = 0; i < asdl_seq_LEN(o->v.Import.names); i++) { + void *elt = asdl_seq_GET(o->v.Import.names, i); + marshal_write_alias(buf, off, elt); + } + break; + case ImportFrom_kind: + marshal_write_int(buf, off, 17); + marshal_write_identifier(buf, off, o->v.ImportFrom.module); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.ImportFrom.names)); + for (i = 0; i < asdl_seq_LEN(o->v.ImportFrom.names); i++) { + void *elt = asdl_seq_GET(o->v.ImportFrom.names, i); + marshal_write_alias(buf, off, elt); + } + break; + case Exec_kind: + marshal_write_int(buf, off, 18); + marshal_write_expr(buf, off, o->v.Exec.body); + if (o->v.Exec.globals) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Exec.globals); + } + else + marshal_write_int(buf, off, 0); + if (o->v.Exec.locals) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Exec.locals); + } + else + marshal_write_int(buf, off, 0); + break; + case Global_kind: + marshal_write_int(buf, off, 19); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Global.names)); + for (i = 0; i < asdl_seq_LEN(o->v.Global.names); i++) { + void *elt = asdl_seq_GET(o->v.Global.names, i); + marshal_write_identifier(buf, off, elt); + } + break; + case Expr_kind: + marshal_write_int(buf, off, 20); + marshal_write_expr(buf, off, o->v.Expr.value); + break; + case Pass_kind: + marshal_write_int(buf, off, 21); + break; + case Break_kind: + marshal_write_int(buf, off, 22); + break; + case Continue_kind: + marshal_write_int(buf, off, 23); + break; + } + return 1; + } + + int + marshal_write_expr(PyObject **buf, int *off, expr_ty o) + { + int i; + switch (o->kind) { + case BoolOp_kind: + marshal_write_int(buf, off, 1); + marshal_write_boolop(buf, off, o->v.BoolOp.op); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.BoolOp.values)); + for (i = 0; i < asdl_seq_LEN(o->v.BoolOp.values); i++) { + void *elt = asdl_seq_GET(o->v.BoolOp.values, i); + marshal_write_expr(buf, off, elt); + } + break; + case BinOp_kind: + marshal_write_int(buf, off, 2); + marshal_write_expr(buf, off, o->v.BinOp.left); + marshal_write_operator(buf, off, o->v.BinOp.op); + marshal_write_expr(buf, off, o->v.BinOp.right); + break; + case UnaryOp_kind: + marshal_write_int(buf, off, 3); + marshal_write_unaryop(buf, off, o->v.UnaryOp.op); + marshal_write_expr(buf, off, o->v.UnaryOp.operand); + break; + case Lambda_kind: + marshal_write_int(buf, off, 4); + marshal_write_arguments(buf, off, o->v.Lambda.args); + marshal_write_expr(buf, off, o->v.Lambda.body); + break; + case Dict_kind: + marshal_write_int(buf, off, 5); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Dict.keys)); + for (i = 0; i < asdl_seq_LEN(o->v.Dict.keys); i++) { + void *elt = asdl_seq_GET(o->v.Dict.keys, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Dict.values)); + for (i = 0; i < asdl_seq_LEN(o->v.Dict.values); i++) { + void *elt = asdl_seq_GET(o->v.Dict.values, i); + marshal_write_expr(buf, off, elt); + } + break; + case ListComp_kind: + marshal_write_int(buf, off, 6); + marshal_write_expr(buf, off, o->v.ListComp.target); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.ListComp.generators)); + for (i = 0; i < asdl_seq_LEN(o->v.ListComp.generators); + i++) { + void *elt = asdl_seq_GET(o->v.ListComp.generators, + i); + marshal_write_listcomp(buf, off, elt); + } + break; + case Compare_kind: + marshal_write_int(buf, off, 7); + marshal_write_expr(buf, off, o->v.Compare.left); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Compare.ops)); + for (i = 0; i < asdl_seq_LEN(o->v.Compare.ops); i++) { + void *elt = asdl_seq_GET(o->v.Compare.ops, i); + marshal_write_cmpop(buf, off, (cmpop_ty)elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Compare.comparators)); + for (i = 0; i < asdl_seq_LEN(o->v.Compare.comparators); + i++) { + void *elt = asdl_seq_GET(o->v.Compare.comparators, + i); + marshal_write_expr(buf, off, elt); + } + break; + case Call_kind: + marshal_write_int(buf, off, 8); + marshal_write_expr(buf, off, o->v.Call.func); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Call.args)); + for (i = 0; i < asdl_seq_LEN(o->v.Call.args); i++) { + void *elt = asdl_seq_GET(o->v.Call.args, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.Call.keywords)); + for (i = 0; i < asdl_seq_LEN(o->v.Call.keywords); i++) { + void *elt = asdl_seq_GET(o->v.Call.keywords, i); + marshal_write_keyword(buf, off, elt); + } + if (o->v.Call.starargs) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Call.starargs); + } + else + marshal_write_int(buf, off, 0); + if (o->v.Call.kwargs) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Call.kwargs); + } + else + marshal_write_int(buf, off, 0); + break; + case Repr_kind: + marshal_write_int(buf, off, 9); + marshal_write_expr(buf, off, o->v.Repr.value); + break; + case Num_kind: + marshal_write_int(buf, off, 10); + marshal_write_object(buf, off, o->v.Num.n); + break; + case Str_kind: + marshal_write_int(buf, off, 11); + marshal_write_string(buf, off, o->v.Str.s); + break; + case Attribute_kind: + marshal_write_int(buf, off, 12); + marshal_write_expr(buf, off, o->v.Attribute.value); + marshal_write_identifier(buf, off, o->v.Attribute.attr); + marshal_write_expr_context(buf, off, o->v.Attribute.ctx); + break; + case Subscript_kind: + marshal_write_int(buf, off, 13); + marshal_write_expr(buf, off, o->v.Subscript.value); + marshal_write_slice(buf, off, o->v.Subscript.slice); + marshal_write_expr_context(buf, off, o->v.Subscript.ctx); + break; + case Name_kind: + marshal_write_int(buf, off, 14); + marshal_write_identifier(buf, off, o->v.Name.id); + marshal_write_expr_context(buf, off, o->v.Name.ctx); + break; + case List_kind: + marshal_write_int(buf, off, 15); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.List.elts)); + for (i = 0; i < asdl_seq_LEN(o->v.List.elts); i++) { + void *elt = asdl_seq_GET(o->v.List.elts, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_expr_context(buf, off, o->v.List.ctx); + break; + case Tuple_kind: + marshal_write_int(buf, off, 16); + marshal_write_int(buf, off, asdl_seq_LEN(o->v.Tuple.elts)); + for (i = 0; i < asdl_seq_LEN(o->v.Tuple.elts); i++) { + void *elt = asdl_seq_GET(o->v.Tuple.elts, i); + marshal_write_expr(buf, off, elt); + } + marshal_write_expr_context(buf, off, o->v.Tuple.ctx); + break; + } + return 1; + } + + int + marshal_write_expr_context(PyObject **buf, int *off, expr_context_ty o) + { + switch (o) { + case Load: + marshal_write_int(buf, off, 1); + break; + case Store: + marshal_write_int(buf, off, 2); + break; + case Del: + marshal_write_int(buf, off, 3); + break; + case AugStore: + marshal_write_int(buf, off, 4); + break; + } + return 1; + } + + int + marshal_write_slice(PyObject **buf, int *off, slice_ty o) + { + int i; + switch (o->kind) { + case Ellipsis_kind: + marshal_write_int(buf, off, 1); + break; + case Slice_kind: + marshal_write_int(buf, off, 2); + if (o->v.Slice.lower) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Slice.lower); + } + else + marshal_write_int(buf, off, 0); + if (o->v.Slice.upper) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Slice.upper); + } + else + marshal_write_int(buf, off, 0); + if (o->v.Slice.step) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->v.Slice.step); + } + else + marshal_write_int(buf, off, 0); + break; + case ExtSlice_kind: + marshal_write_int(buf, off, 3); + marshal_write_int(buf, off, + asdl_seq_LEN(o->v.ExtSlice.dims)); + for (i = 0; i < asdl_seq_LEN(o->v.ExtSlice.dims); i++) { + void *elt = asdl_seq_GET(o->v.ExtSlice.dims, i); + marshal_write_slice(buf, off, elt); + } + break; + case Index_kind: + marshal_write_int(buf, off, 4); + marshal_write_expr(buf, off, o->v.Index.value); + break; + } + return 1; + } + + int + marshal_write_boolop(PyObject **buf, int *off, boolop_ty o) + { + switch (o) { + case And: + marshal_write_int(buf, off, 1); + break; + case Or: + marshal_write_int(buf, off, 2); + break; + } + return 1; + } + + int + marshal_write_operator(PyObject **buf, int *off, operator_ty o) + { + switch (o) { + case Add: + marshal_write_int(buf, off, 1); + break; + case Sub: + marshal_write_int(buf, off, 2); + break; + case Mult: + marshal_write_int(buf, off, 3); + break; + case Div: + marshal_write_int(buf, off, 4); + break; + case Mod: + marshal_write_int(buf, off, 5); + break; + case Pow: + marshal_write_int(buf, off, 6); + break; + case LShift: + marshal_write_int(buf, off, 7); + break; + case RShift: + marshal_write_int(buf, off, 8); + break; + case BitOr: + marshal_write_int(buf, off, 9); + break; + case BitXor: + marshal_write_int(buf, off, 10); + break; + case BitAnd: + marshal_write_int(buf, off, 11); + break; + case FloorDiv: + marshal_write_int(buf, off, 12); + break; + } + return 1; + } + + int + marshal_write_unaryop(PyObject **buf, int *off, unaryop_ty o) + { + switch (o) { + case Invert: + marshal_write_int(buf, off, 1); + break; + case Not: + marshal_write_int(buf, off, 2); + break; + case UAdd: + marshal_write_int(buf, off, 3); + break; + case USub: + marshal_write_int(buf, off, 4); + break; + } + return 1; + } + + int + marshal_write_cmpop(PyObject **buf, int *off, cmpop_ty o) + { + switch (o) { + case Eq: + marshal_write_int(buf, off, 1); + break; + case NotEq: + marshal_write_int(buf, off, 2); + break; + case Lt: + marshal_write_int(buf, off, 3); + break; + case LtE: + marshal_write_int(buf, off, 4); + break; + case Gt: + marshal_write_int(buf, off, 5); + break; + case GtE: + marshal_write_int(buf, off, 6); + break; + case Is: + marshal_write_int(buf, off, 7); + break; + case IsNot: + marshal_write_int(buf, off, 8); + break; + case In: + marshal_write_int(buf, off, 9); + break; + case NotIn: + marshal_write_int(buf, off, 10); + break; + } + return 1; + } + + int + marshal_write_listcomp(PyObject **buf, int *off, listcomp_ty o) + { + int i; + marshal_write_expr(buf, off, o->target); + marshal_write_expr(buf, off, o->iter); + marshal_write_int(buf, off, asdl_seq_LEN(o->ifs)); + for (i = 0; i < asdl_seq_LEN(o->ifs); i++) { + void *elt = asdl_seq_GET(o->ifs, i); + marshal_write_expr(buf, off, elt); + } + return 1; + } + + int + marshal_write_excepthandler(PyObject **buf, int *off, excepthandler_ty o) + { + int i; + if (o->type) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->type); + } + else + marshal_write_int(buf, off, 0); + if (o->name) { + marshal_write_int(buf, off, 1); + marshal_write_expr(buf, off, o->name); + } + else + marshal_write_int(buf, off, 0); + marshal_write_int(buf, off, asdl_seq_LEN(o->body)); + for (i = 0; i < asdl_seq_LEN(o->body); i++) { + void *elt = asdl_seq_GET(o->body, i); + marshal_write_stmt(buf, off, elt); + } + return 1; + } + + int + marshal_write_arguments(PyObject **buf, int *off, arguments_ty o) + { + int i; + marshal_write_int(buf, off, asdl_seq_LEN(o->args)); + for (i = 0; i < asdl_seq_LEN(o->args); i++) { + void *elt = asdl_seq_GET(o->args, i); + marshal_write_expr(buf, off, elt); + } + if (o->vararg) { + marshal_write_int(buf, off, 1); + marshal_write_identifier(buf, off, o->vararg); + } + else + marshal_write_int(buf, off, 0); + if (o->kwarg) { + marshal_write_int(buf, off, 1); + marshal_write_identifier(buf, off, o->kwarg); + } + else + marshal_write_int(buf, off, 0); + marshal_write_int(buf, off, asdl_seq_LEN(o->defaults)); + for (i = 0; i < asdl_seq_LEN(o->defaults); i++) { + void *elt = asdl_seq_GET(o->defaults, i); + marshal_write_expr(buf, off, elt); + } + return 1; + } + + int + marshal_write_keyword(PyObject **buf, int *off, keyword_ty o) + { + marshal_write_identifier(buf, off, o->arg); + marshal_write_expr(buf, off, o->value); + return 1; + } + + int + marshal_write_alias(PyObject **buf, int *off, alias_ty o) + { + marshal_write_identifier(buf, off, o->name); + if (o->asname) { + marshal_write_int(buf, off, 1); + marshal_write_identifier(buf, off, o->asname); + } + else + marshal_write_int(buf, off, 0); + return 1; + } + Index: asdl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/asdl.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** asdl.c 7 Jul 2002 17:34:44 -0000 1.1.2.1 --- asdl.c 30 Aug 2002 19:20:40 -0000 1.1.2.2 *************** *** 5,49 **** asdl_seq_new(int size) { ! asdl_seq *seq = (asdl_seq *)malloc(sizeof(asdl_seq)); if (!seq) return NULL; - seq->elements = malloc(sizeof(void *) * size); - if (!seq->elements) { - free(seq); - return NULL; - } seq->size = size; ! seq->used = 0; return seq; } ! void * ! asdl_seq_get(asdl_seq *seq, int offset) { ! if (offset > seq->used) ! return NULL; ! return seq->elements[offset]; } ! int ! asdl_seq_append(asdl_seq *seq, void *elt) { ! if (seq->size == seq->used) { ! void *newptr; ! int nsize = seq->size * 2; ! newptr = realloc(seq->elements, sizeof(void *) * nsize); ! if (!newptr) ! return 0; ! seq->elements = newptr; ! } ! seq->elements[seq->used++] = elt; ! return 1; } ! void ! asdl_seq_free(asdl_seq *seq) { ! if (seq->elements) ! free(seq->elements); ! free(seq); } --- 5,82 ---- asdl_seq_new(int size) { ! asdl_seq *seq = (asdl_seq *)PyObject_Malloc(sizeof(asdl_seq) ! + sizeof(void *) * (size - 1)); if (!seq) return NULL; seq->size = size; ! seq->offset = 0; return seq; } ! void ! asdl_seq_free(asdl_seq *seq) { ! PyObject_Free(seq); } ! #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 ! marshal_write_int(PyObject **buf, int *offset, int x) { ! char *s; ! ! CHECKSIZE(buf, offset, 4) ! s = PyString_AS_STRING(*buf) + (*offset); ! s[0] = (x & 0xff); ! s[1] = (x >> 8) & 0xff; ! s[2] = (x >> 16) & 0xff; ! s[3] = (x >> 24) & 0xff; ! *offset += 4; ! return 1; } ! int ! marshal_write_bool(PyObject **buf, int *offset, bool b) { ! if (b) ! marshal_write_int(buf, offset, 1); ! else ! marshal_write_int(buf, offset, 0); ! return 1; ! } ! ! int ! marshal_write_identifier(PyObject **buf, int *offset, identifier id) ! { ! int l = PyString_GET_SIZE(id); ! marshal_write_int(buf, offset, l); ! CHECKSIZE(buf, offset, l); ! memcpy(PyString_AS_STRING(*buf) + *offset, ! PyString_AS_STRING(id), l); ! *offset += l; ! return 1; ! } ! ! int ! marshal_write_string(PyObject **buf, int *offset, string s) ! { ! int l = PyString_GET_SIZE(s); ! marshal_write_int(buf, offset, l); ! CHECKSIZE(buf, offset, l); ! memcpy(PyString_AS_STRING(*buf) + *offset, ! PyString_AS_STRING(s), l); ! *offset += l; ! return 1; ! } ! ! int ! marshal_write_object(PyObject **buf, int *offset, object s) ! { ! /* XXX */ ! return 0; } From jhylton@users.sourceforge.net Fri Aug 30 20:59:57 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 12:59:57 -0700 Subject: [Python-checkins] python/dist/src/Include ast.h,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv5178/Include Modified Files: Tag: ast-branch ast.h Log Message: PyAST_FromNode() does not modify its argument. Index: ast.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/ast.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** ast.h 7 Jul 2002 17:34:44 -0000 1.1.2.1 --- ast.h 30 Aug 2002 19:59:55 -0000 1.1.2.2 *************** *** 5,9 **** #endif ! extern DL_IMPORT(mod_ty) PyAST_FromNode(node *); #ifdef __cplusplus --- 5,9 ---- #endif ! extern DL_IMPORT(mod_ty) PyAST_FromNode(const node *); #ifdef __cplusplus From jhylton@users.sourceforge.net Fri Aug 30 21:04:51 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:04:51 -0700 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.9.18.4,2.9.18.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv6715/Include Modified Files: Tag: ast-branch symtable.h Log Message: Cleanup symbol table. Add public PySymtable_Lookup() function that returns an entry for a block given the address of its AST node. Remove lookup code from PySTEntry_New() since we only call this when the symbol table is created. Track change in asdl_seq_ API, e.g. get -> GET. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9.18.4 retrieving revision 2.9.18.5 diff -C2 -d -r2.9.18.4 -r2.9.18.5 *** symtable.h 23 Aug 2002 18:09:41 -0000 2.9.18.4 --- symtable.h 30 Aug 2002 20:04:48 -0000 2.9.18.5 *************** *** 48,54 **** DL_IMPORT(int) PyST_GetScope(PySTEntryObject *, PyObject *); - DL_IMPORT(struct symtable *) PyNode_CompileSymtable(struct _node *, char *); DL_IMPORT(struct symtable *) PySymtable_Build(mod_ty, const char *, PyFutureFeatures *); DL_IMPORT(void) PySymtable_Free(struct symtable *); --- 48,54 ---- DL_IMPORT(int) PyST_GetScope(PySTEntryObject *, PyObject *); DL_IMPORT(struct symtable *) PySymtable_Build(mod_ty, const char *, PyFutureFeatures *); + DL_IMPORT(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); DL_IMPORT(void) PySymtable_Free(struct symtable *); From jhylton@users.sourceforge.net Fri Aug 30 21:04:52 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:04:52 -0700 Subject: [Python-checkins] python/dist/src/Python symtable.c,2.10.8.5,2.10.8.6 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv6715/Python Modified Files: Tag: ast-branch symtable.c Log Message: Cleanup symbol table. Add public PySymtable_Lookup() function that returns an entry for a block given the address of its AST node. Remove lookup code from PySTEntry_New() since we only call this when the symbol table is created. Track change in asdl_seq_ API, e.g. get -> GET. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.5 retrieving revision 2.10.8.6 diff -C2 -d -r2.10.8.5 -r2.10.8.6 *** symtable.c 23 Aug 2002 22:51:51 -0000 2.10.8.5 --- symtable.c 30 Aug 2002 20:04:49 -0000 2.10.8.6 *************** *** 16,28 **** if (k == NULL) goto fail; - /* XXX do we need the lookup code anymore? */ - v = PyDict_GetItem(st->st_symbols, k); - if (v) { - assert(PySTEntry_Check(v)); - Py_DECREF(k); - Py_INCREF(v); - return (PySTEntryObject *)v; - } - ste = (PySTEntryObject *)PyObject_New(PySTEntryObject, &PySTEntry_Type); --- 16,19 ---- *************** *** 196,208 **** } - void - PySymtable_Free(struct symtable *st) - { - Py_XDECREF(st->st_symbols); - Py_XDECREF(st->st_stack); - Py_XDECREF(st->st_cur); - PyMem_Free((void *)st); - } - struct symtable * PySymtable_Build(mod_ty mod, const char *filename, PyFutureFeatures *future) --- 187,190 ---- *************** *** 218,240 **** /* Any other top-level initialization? */ switch (mod->kind) { ! case Module_kind: ! { int i; asdl_seq *seq = mod->v.Module.body; for (i = 0; i < asdl_seq_LEN(seq); i++) ! if (!symtable_visit_stmt(st, asdl_seq_get(seq, i))) { ! PySymtable_Free(st); ! return NULL; ! } } - break; case Expression_kind: ! symtable_visit_expr(st, mod->v.Expression.body); break; ! default: return NULL; } symtable_exit_block(st, (void *)mod); return st; } --- 200,260 ---- /* Any other top-level initialization? */ switch (mod->kind) { ! case Module_kind: { int i; asdl_seq *seq = mod->v.Module.body; for (i = 0; i < asdl_seq_LEN(seq); i++) ! if (!symtable_visit_stmt(st, asdl_seq_GET(seq, i))) ! goto error; ! 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, ! "this compiler does not handle Suites"); return NULL; } symtable_exit_block(st, (void *)mod); return st; + error: + PySymtable_Free(st); + return NULL; + } + + void + PySymtable_Free(struct symtable *st) + { + Py_XDECREF(st->st_symbols); + Py_XDECREF(st->st_stack); + Py_XDECREF(st->st_cur); + PyMem_Free((void *)st); + } + + PySTEntryObject * + PySymtable_Lookup(struct symtable *st, void *key) + { + PyObject *k, *v; + + k = PyLong_FromVoidPtr(key); + if (k == NULL) + return NULL; + v = PyDict_GetItem(st->st_symbols, k); + if (v) { + assert(PySTEntry_Check(v)); + Py_DECREF(k); + Py_INCREF(v); + return (PySTEntryObject *)v; + } + else { + PyErr_SetString(PyExc_KeyError, + "unknown symbol table entry"); + return NULL; + } } *************** *** 579,583 **** asdl_seq *seq = (SEQ); /* avoid variable capture */ \ for (i = 0; i < asdl_seq_LEN(seq); i++) { \ ! TYPE ## _ty elt = asdl_seq_get(seq, i); \ if (!symtable_visit_ ## TYPE((ST), elt)) \ return 0; \ --- 599,603 ---- asdl_seq *seq = (SEQ); /* avoid variable capture */ \ for (i = 0; i < asdl_seq_LEN(seq); i++) { \ ! TYPE ## _ty elt = asdl_seq_GET(seq, i); \ if (!symtable_visit_ ## TYPE((ST), elt)) \ return 0; \ *************** *** 692,696 **** asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) ! symtable_add_def(st, asdl_seq_get(seq, i), DEF_GLOBAL); break; --- 712,717 ---- asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) ! symtable_add_def(st, asdl_seq_GET(seq, i), ! DEF_GLOBAL); break; *************** *** 800,804 **** for (i = 0; i < asdl_seq_LEN(args); i++) { ! expr_ty arg = asdl_seq_get(args, i); if (arg->kind == Name_kind) { assert(arg->v.Name.ctx == Load); --- 821,825 ---- for (i = 0; i < asdl_seq_LEN(args); i++) { ! expr_ty arg = asdl_seq_GET(args, i); if (arg->kind == Name_kind) { assert(arg->v.Name.ctx == Load); *************** *** 830,835 **** XXX should ast be different? */ ! if (!symtable_visit_params(st, a->args, 1)) ! return 0; if (a->vararg) --- 851,857 ---- XXX should ast be different? */ ! if (a->args) ! if (!symtable_visit_params(st, a->args, 1)) ! return 0; if (a->vararg) *************** *** 911,914 **** return 1; } - --- 933,935 ---- From jhylton@users.sourceforge.net Fri Aug 30 21:12:10 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:12:10 -0700 Subject: [Python-checkins] python/dist/src/Python ast.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-serv8511/Python Modified Files: Tag: ast-branch ast.c Log Message: A large collection of improvements. Handle a simple_stmt that contains multiple small_stmt elements. Getting this right ends up having far-reaching changes, since callers of ast_for_stmt() must guarantee that the node they pass contains only a single stmt. Add num_stmts() helper function that counts the number of contained statements. Extend PyAST_FromNode() to handle single_input. Mark more internal functions as taking a const node *. Add parsenumber() function from old compile.c and call it when creating a Num() type. XXX Not sure what this means for marshalling. Track changes to asdl_seq_ API, removing most uses of append. Simplify BoolOp handling by collapsing test and and_test code. Fix handling of the power production when multiple trailers. It still doesn't do function calls, but it does handle repeated attribute access and subscripting. Fix subtle bug in If() handling that ended up creating a circular reference instead of a properly nested if/else. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.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 *** ast.c 23 Aug 2002 18:21:22 -0000 1.1.2.2 --- ast.c 30 Aug 2002 20:12:05 -0000 1.1.2.3 *************** *** 16,60 **** */ ! static asdl_seq *seq_for_testlist(node *); ! static expr_ty ast_for_expr(node *); ! static stmt_ty ast_for_stmt(node *); ! static asdl_seq *ast_for_suite(node *); ! static asdl_seq *ast_for_exprlist(node *, int); ! static expr_ty ast_for_testlist(node *); extern grammar _PyParser_Grammar; /* From graminit.c */ [...1215 lines suppressed...] + return PyInt_FromLong(x); + } + /* XXX Huge floats may silently fail */ + #ifndef WITHOUT_COMPLEX + if (imflag) { + c.real = 0.; + PyFPE_START_PROTECT("atof", return 0) + c.imag = atof(s); + PyFPE_END_PROTECT(c) + return PyComplex_FromCComplex(c); + } + else + #endif + { + PyFPE_START_PROTECT("atof", return 0) + dx = atof(s); + PyFPE_END_PROTECT(dx) + return PyFloat_FromDouble(dx); + } + } From jhylton@users.sourceforge.net Fri Aug 30 21:15:59 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:15:59 -0700 Subject: [Python-checkins] python/dist/src/Python future.c,2.12.2.3,2.12.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9819/Python Modified Files: Tag: ast-branch future.c Log Message: Track changes to asdl_seq_ API. Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.12.2.3 retrieving revision 2.12.2.4 diff -C2 -d -r2.12.2.3 -r2.12.2.4 *** future.c 16 Aug 2002 20:19:53 -0000 2.12.2.3 --- future.c 30 Aug 2002 20:15:55 -0000 2.12.2.4 *************** *** 22,26 **** names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { ! feature = PyString_AsString(asdl_seq_get(names, i)); if (!feature) return 0; --- 22,26 ---- names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { ! feature = PyString_AsString(asdl_seq_GET(names, i)); if (!feature) return 0; *************** *** 61,65 **** return 1; for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { ! stmt_ty s = asdl_seq_get(mod->v.Module.body, i); /* The tests below will return from this function unless it is --- 61,65 ---- return 1; for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { ! stmt_ty s = asdl_seq_GET(mod->v.Module.body, i); /* The tests below will return from this function unless it is From jhylton@users.sourceforge.net Fri Aug 30 21:20:44 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:20:44 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.161.2.4,2.161.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11309/Python Modified Files: Tag: ast-branch pythonrun.c Log Message: Interim repair to parser error handling. I haven't fully debugged the problem, but it appears that the perrdetail structure isn't always setup properly. Perhaps an error is raised inside PyAST_FromNode() and err_input() gets called anyway. At any rate, recode this routine so it is a bit more defensive. Delay calling Py_BuildValue() until err->error has been inspected. If err->error is garbage, exit right away. The previous code passed err->garbage to Py_BuildValue() causing a segfault. XXX Need to figure out what is actually going wrong. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.4 retrieving revision 2.161.2.5 diff -C2 -d -r2.161.2.4 -r2.161.2.5 *** pythonrun.c 23 Aug 2002 18:13:27 -0000 2.161.2.4 --- pythonrun.c 30 Aug 2002 20:20:33 -0000 2.161.2.5 *************** *** 832,835 **** --- 832,837 ---- } PyErr_Fetch(&exception, &v, &tb); + if (exception == NULL) + return; PyErr_NormalizeException(&exception, &v, &tb); if (exception == NULL) *************** *** 1096,1099 **** --- 1098,1102 ---- node *n; perrdetail err; + fprintf(stderr, "filename=%s\n", filename); n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, start, ps1, ps2, &err, flags); *************** *** 1155,1164 **** char *msg = NULL; errtype = PyExc_SyntaxError; - v = Py_BuildValue("(ziiz)", err->filename, - err->lineno, err->offset, err->text); - if (err->text != NULL) { - PyMem_DEL(err->text); - err->text = NULL; - } switch (err->error) { case E_SYNTAX: --- 1158,1161 ---- *************** *** 1204,1211 **** msg = "too many levels of indentation"; break; ! default: ! fprintf(stderr, "error=%d\n", err->error); ! msg = "unknown parsing error"; break; } w = Py_BuildValue("(sO)", msg, v); --- 1201,1219 ---- msg = "too many levels of indentation"; break; ! default: { ! char buf[256]; ! sprintf(buf, "unknown parsing error=%d\n", err->error); ! Py_FatalError(buf); ! /* If the error code is bogus, who knows what the state ! of the rest of err is. ! */ break; + } + } + v = Py_BuildValue("(ziiz)", err->filename, + err->lineno, err->offset, err->text); + if (err->text != NULL) { + PyMem_DEL(err->text); + err->text = NULL; } w = Py_BuildValue("(sO)", msg, v); From jhylton@users.sourceforge.net Fri Aug 30 21:25:51 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:25:51 -0700 Subject: [Python-checkins] python/dist/src/Python newcompile.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-serv14029/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Add arg_is_pyobject(opcode) -- returns true of the opcode has an argument that is represented internally as a PyObject *. Add init() function to initialize the compiler structure. Stick some code in PyAST_Compile() that calls marshal_write_mod() just to test this code. Use PyObject_Malloc() / PyObject_Free() for compiler memory. Fix compiler_new_block() to return -1 on error, since 0 is a perfectly valid block index. Fix all calls to test for failure using result < 0 instead of result == 0. Fix addop() functions to use opcode argument. Add placeholder assemble() function that prints out the contents of the basic blocks. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.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 *** newcompile.c 23 Aug 2002 18:35:41 -0000 1.1.2.3 --- newcompile.c 30 Aug 2002 20:25:49 -0000 1.1.2.4 *************** *** 46,50 **** static int compiler_enter_scope(struct compiler *, identifier, void *); - static int compiler_exit_scope(struct compiler *, identifier, void *); static void compiler_free(struct compiler *); static PyCodeObject *compiler_get_code(struct compiler *); --- 46,49 ---- *************** *** 67,70 **** --- 66,72 ---- static void compiler_pop_fblock(struct compiler *, enum fblocktype, int); + static PyCodeObject *assemble(struct compiler *); + static int arg_is_pyobject(int); + int _Py_Mangle(char *p, char *name, char *buffer, size_t maxlen) *************** *** 95,98 **** --- 97,108 ---- } + static void + init(struct compiler *c) + { + c->c_blocks = NULL; + c->c_nblocks = 0; + c->c_interactive = 0; + } + PyCodeObject * PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags) *************** *** 100,103 **** --- 110,114 ---- struct compiler c; + init(&c); c.c_filename = filename; c.c_future = PyFuture_FromAST(mod, filename); *************** *** 109,122 **** flags->cf_flags = merged; } ! c.c_st = PySymtable_Build(mod, filename, c.c_future); if (c.c_st == NULL) goto error; - return NULL; ! compiler_mod(&c, mod); error: compiler_free(&c); return NULL; } --- 120,147 ---- flags->cf_flags = merged; } ! ! /* Trivial test of marshal code for now. */ ! { ! PyObject *buf = PyString_FromStringAndSize(NULL, 1024); ! int offset = 0; ! assert(marshal_write_mod(&buf, &offset, mod)); ! if (!_PyString_Resize(&buf, offset) < 0) { ! fprintf(stderr, "resize failed!\n"); ! goto error; ! } ! } ! c.c_st = PySymtable_Build(mod, filename, c.c_future); if (c.c_st == NULL) goto error; ! if (!compiler_mod(&c, mod)) ! goto error; + return assemble(&c); error: compiler_free(&c); + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_SystemError, "PyAST_Compile() failed"); return NULL; } *************** *** 130,138 **** PySymtable_Free(c->c_st); if (c->c_future) ! PyMem_Free((void *)c->c_future); for (i = 0; i < c->c_nblocks; i++) ! free((void *)c->c_blocks[i]); if (c->c_blocks) ! free((void *)c->c_blocks); } --- 155,163 ---- PySymtable_Free(c->c_st); if (c->c_future) ! PyObject_Free((void *)c->c_future); for (i = 0; i < c->c_nblocks; i++) ! PyObject_Free((void *)c->c_blocks[i]); if (c->c_blocks) ! PyObject_Free((void *)c->c_blocks); } *************** *** 141,171 **** compiler_enter_scope(struct compiler *c, identifier name, void *key) { ! /* XXX need stack of info */ ! PyObject *k, *v; ! ! k = PyLong_FromVoidPtr(key); ! if (k == NULL) ! return 0; ! v = PyDict_GetItem(c->c_st->st_symbols, k); ! if (!v) { ! /* XXX */ ! PyErr_SetObject(PyExc_KeyError, name); return 0; ! } ! assert(PySTEntry_Check(v)); ! c->c_ste = (PySTEntryObject *)v; ! c->c_nblocks = 0; ! c->c_blocks = (struct basicblock **)malloc(sizeof(struct basicblock *) ! * DEFAULT_BLOCKS); if (!c->c_blocks) return 0; ! return 1; ! } ! ! static int ! compiler_exit_scope(struct compiler *c, identifier name, void *key) ! { ! /* pop current scope off stack & reinit */ return 1; } --- 166,181 ---- compiler_enter_scope(struct compiler *c, identifier name, void *key) { ! c->c_ste = PySymtable_Lookup(c->c_st, key); ! if (!c->c_ste) { return 0; ! } c->c_nblocks = 0; ! c->c_blocks = (struct basicblock **)PyObject_Malloc( ! sizeof(struct basicblock *) * DEFAULT_BLOCKS); if (!c->c_blocks) return 0; ! memset(c->c_blocks, 0, sizeof(struct basicblock *) * DEFAULT_BLOCKS); ! if (compiler_use_new_block(c) < 0) ! return 0; return 1; } *************** *** 177,185 **** XXX may want to return a thunk instead to allow later passes */ return NULL; } /* Allocate a new block and return its index in c_blocks. ! Returns 0 on error. */ --- 187,196 ---- XXX may want to return a thunk instead to allow later passes */ + PyErr_SetString(PyExc_SystemError, "compiler doesn't work"); return NULL; } /* Allocate a new block and return its index in c_blocks. ! Returns -1 on error. */ *************** *** 193,203 **** /* XXX should double */ int newsize = c->c_nblocks + DEFAULT_BLOCKS; ! c->c_blocks = (struct basicblock **)realloc(c->c_blocks, ! newsize); if (c->c_blocks == NULL) return 0; } i = c->c_nblocks++; ! b = (struct basicblock *)malloc(sizeof(struct basicblock)); if (b == NULL) return 0; --- 204,214 ---- /* XXX should double */ int newsize = c->c_nblocks + DEFAULT_BLOCKS; ! c->c_blocks = (struct basicblock **)PyObject_Realloc(c->c_blocks, ! newsize); if (c->c_blocks == NULL) return 0; } i = c->c_nblocks++; ! b = (struct basicblock *)PyObject_Malloc(sizeof(struct basicblock)); if (b == NULL) return 0; *************** *** 219,223 **** { int block = compiler_new_block(c); ! if (!block) return 0; c->c_curblock = block; --- 230,234 ---- { int block = compiler_new_block(c); ! if (block < 0) return 0; c->c_curblock = block; *************** *** 240,245 **** int newsize; b->b_ialloc *= 2; ! /* XXX newsize is wrong */ ! ptr = realloc((void *)b, newsize); if (ptr == NULL) return -1; --- 251,258 ---- int newsize; b->b_ialloc *= 2; ! newsize = sizeof(struct basicblock) ! + ((b->b_ialloc - DEFAULT_BLOCK_SIZE) ! * sizeof(struct instr)); ! ptr = PyObject_Realloc((void *)b, newsize); if (ptr == NULL) return -1; *************** *** 274,282 **** struct instr *i; int off; off = compiler_next_instr(c, c->c_curblock); if (off < 0) return 0; i = &c->c_blocks[c->c_curblock]->b_instr[off]; ! i->i_opcode = i->i_opcode; i->i_arg = o; return 1; --- 287,296 ---- struct instr *i; int off; + assert(arg_is_pyobject(opcode)); off = compiler_next_instr(c, c->c_curblock); if (off < 0) return 0; i = &c->c_blocks[c->c_curblock]->b_instr[off]; ! i->i_opcode = opcode; i->i_arg = o; return 1; *************** *** 296,300 **** return 0; i = &c->c_blocks[c->c_curblock]->b_instr[off]; ! i->i_opcode = i->i_opcode; i->i_oparg = oparg; return 1; --- 310,314 ---- return 0; i = &c->c_blocks[c->c_curblock]->b_instr[off]; ! i->i_opcode = opcode; i->i_oparg = oparg; return 1; *************** *** 302,306 **** #define NEW_BLOCK(C) { \ ! if (!compiler_use_new_block((C))) \ return 0; \ } --- 316,320 ---- #define NEW_BLOCK(C) { \ ! if (compiler_use_new_block((C)) < 0) \ return 0; \ } *************** *** 334,338 **** asdl_seq *seq = (SEQ); /* avoid variable capture */ \ for (i = 0; i < asdl_seq_LEN(seq); i++) { \ ! TYPE ## _ty elt = asdl_seq_get(seq, i); \ if (!compiler_visit_ ## TYPE((C), elt)) \ return 0; \ --- 348,352 ---- asdl_seq *seq = (SEQ); /* avoid variable capture */ \ for (i = 0; i < asdl_seq_LEN(seq); i++) { \ ! TYPE ## _ty elt = asdl_seq_GET(seq, i); \ if (!compiler_visit_ ## TYPE((C), elt)) \ return 0; \ *************** *** 343,346 **** --- 357,362 ---- compiler_mod(struct compiler *c, mod_ty mod) { + if (!compiler_enter_scope(c, NULL, mod)) + return 0; switch (mod->kind) { case Module_kind: *************** *** 348,351 **** --- 364,368 ---- break; case Interactive_kind: + c->c_interactive = 1; VISIT(c, stmt, mod->v.Interactive.body); break; *************** *** 397,401 **** ADDOP(c, DUP_TOP); VISIT(c, expr, ! (expr_ty)asdl_seq_get(s->v.Print.values, i)); ADDOP(c, ROT_TWO); ADDOP(c, PRINT_ITEM_TO); --- 414,418 ---- ADDOP(c, DUP_TOP); VISIT(c, expr, ! (expr_ty)asdl_seq_GET(s->v.Print.values, i)); ADDOP(c, ROT_TWO); ADDOP(c, PRINT_ITEM_TO); *************** *** 403,407 **** else { VISIT(c, expr, ! (expr_ty)asdl_seq_get(s->v.Print.values, i)); ADDOP(c, PRINT_ITEM); } --- 420,424 ---- else { VISIT(c, expr, ! (expr_ty)asdl_seq_GET(s->v.Print.values, i)); ADDOP(c, PRINT_ITEM); } *************** *** 425,433 **** assert(s->kind == If_kind); end = compiler_new_block(c); ! if (!end) return 0; while (elif) { next = compiler_new_block(c); ! if (!next) return 0; VISIT(c, expr, s->v.If.test); --- 442,450 ---- assert(s->kind == If_kind); end = compiler_new_block(c); ! if (end < 0) return 0; while (elif) { next = compiler_new_block(c); ! if (next < 0) return 0; VISIT(c, expr, s->v.If.test); *************** *** 440,444 **** ADDOP(c, POP_TOP); if (s->v.If.orelse) { ! stmt_ty t = asdl_seq_get(s->v.If.orelse, 0); if (t->kind == If_kind) { elif = 1; --- 457,461 ---- ADDOP(c, POP_TOP); if (s->v.If.orelse) { ! stmt_ty t = asdl_seq_GET(s->v.If.orelse, 0); if (t->kind == If_kind) { elif = 1; *************** *** 462,466 **** cleanup = compiler_new_block(c); end = compiler_new_block(c); ! if (!(start && end && cleanup)) return 0; ADDOP_I(c, SETUP_LOOP, end); --- 479,483 ---- cleanup = compiler_new_block(c); end = compiler_new_block(c); ! if (start < 0 || end < 0 || cleanup < 0) return 0; ADDOP_I(c, SETUP_LOOP, end); *************** *** 488,496 **** loop = compiler_new_block(c); end = compiler_new_block(c); ! if (!(loop && end)) return 0; if (s->v.While.orelse) { orelse = compiler_new_block(c); ! if (!orelse) return 0; } --- 505,513 ---- loop = compiler_new_block(c); end = compiler_new_block(c); ! if (loop < 0 || end < 0) return 0; if (s->v.While.orelse) { orelse = compiler_new_block(c); ! if (orelse < 0) return 0; } *************** *** 562,565 **** --- 579,583 ---- int i, n; + fprintf(stderr, "compile stmt %d at %d\n", s->kind, s->lineno); c->c_lineno = s->lineno; /* XXX this isn't right */ switch (s->kind) { *************** *** 590,594 **** ADDOP(c, DUP_TOP); VISIT(c, expr, ! (expr_ty)asdl_seq_get(s->v.Assign.targets, i)); } break; --- 608,612 ---- ADDOP(c, DUP_TOP); VISIT(c, expr, ! (expr_ty)asdl_seq_GET(s->v.Assign.targets, i)); } break; *************** *** 803,817 **** jumpi = JUMP_IF_TRUE; end = compiler_new_block(c); ! if (!end) return 0; s = e->v.BoolOp.values; n = asdl_seq_LEN(s) - 1; for (i = 0; i < n; ++i) { ! VISIT(c, expr, asdl_seq_get(s, i)); ADDOP_I(c, jumpi, end); NEW_BLOCK(c); ADDOP(c, POP_TOP) } ! VISIT(c, expr, asdl_seq_get(s, n)); compiler_use_block(c, end); return 1; --- 821,835 ---- jumpi = JUMP_IF_TRUE; end = compiler_new_block(c); ! if (end < 0) return 0; s = e->v.BoolOp.values; n = asdl_seq_LEN(s) - 1; for (i = 0; i < n; ++i) { ! VISIT(c, expr, asdl_seq_GET(s, i)); ADDOP_I(c, jumpi, end); NEW_BLOCK(c); ADDOP(c, POP_TOP) } ! VISIT(c, expr, asdl_seq_GET(s, n)); compiler_use_block(c, end); return 1; *************** *** 846,852 **** for (i = 0; i < n; i++) { ADDOP(c, DUP_TOP); ! VISIT(c, expr, asdl_seq_get(e->v.Dict.values, i)); ADDOP(c, ROT_TWO); ! VISIT(c, expr, asdl_seq_get(e->v.Dict.keys, i)); ADDOP(c, STORE_SUBSCR); } --- 864,870 ---- for (i = 0; i < n; i++) { ADDOP(c, DUP_TOP); ! VISIT(c, expr, asdl_seq_GET(e->v.Dict.values, i)); ADDOP(c, ROT_TWO); ! VISIT(c, expr, asdl_seq_GET(e->v.Dict.keys, i)); ADDOP(c, STORE_SUBSCR); } *************** *** 862,866 **** ADDOP(c, UNARY_CONVERT); break; ! case Num_kind: break; case Str_kind: --- 880,885 ---- ADDOP(c, UNARY_CONVERT); break; ! case Num_kind: ! ADDOP_O(c, LOAD_CONST, e->v.Num.n); break; case Str_kind: *************** *** 962,964 **** --- 981,1020 ---- { return 1; + } + + static PyCodeObject * + assemble(struct compiler *c) + { + int i, j; + + fprintf(stderr, "nblocks=%d curblock=%d\n", + c->c_nblocks, c->c_curblock); + for (i = 0; i < c->c_nblocks; i++) { + struct basicblock *b = c->c_blocks[i]; + fprintf(stderr, "block %d: used=%d alloc=%d\n", + i, b->b_iused, b->b_ialloc); + for (j = 0; j < b->b_iused; j++) { + fprintf(stderr, "instr %d: %d\n", + j, b->b_instr[j].i_opcode); + } + } + + PyErr_SetString(PyExc_SystemError, "no assembler exists\n"); + return NULL; + } + + static int + arg_is_pyobject(int opcode) + { + switch (opcode) { + case LOAD_CONST: + case LOAD_NAME: case LOAD_GLOBAL: case LOAD_FAST: case LOAD_DEREF: + case STORE_NAME: case STORE_GLOBAL: case STORE_FAST: case STORE_DEREF: + case DELETE_NAME: case DELETE_GLOBAL: case DELETE_FAST: + return 1; + default: + return 0; + } + assert(0); /* Can't get here */ + return 0; } From jhylton@users.sourceforge.net Fri Aug 30 21:37:57 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:37:57 -0700 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.161.2.5,2.161.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19150 Modified Files: Tag: ast-branch pythonrun.c Log Message: Resolve mysterious crashes in err_input(). PyRun_InteractiveOneFlags() was causing the problem. It had a local perrdetail leftover from the old parser API. If PyParser_ASTFromFile() returns NULL, it will call err_input() to set an exception. PyRun_IOF() was calling err_input() a second time with its own uninitialized local variable. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.5 retrieving revision 2.161.2.6 diff -C2 -d -r2.161.2.5 -r2.161.2.6 *** pythonrun.c 30 Aug 2002 20:20:33 -0000 2.161.2.5 --- pythonrun.c 30 Aug 2002 20:37:54 -0000 2.161.2.6 *************** *** 535,539 **** PyObject *m, *d, *v, *w; mod_ty mod; - perrdetail err; char *ps1 = "", *ps2 = ""; --- 535,538 ---- *************** *** 560,571 **** Py_XDECREF(w); if (mod == NULL) { - if (err.error == E_EOF) { - if (err.text) - PyMem_DEL(err.text); - return E_EOF; - } - err_input(&err); PyErr_Print(); ! return err.error; } m = PyImport_AddModule("__main__"); --- 559,564 ---- Py_XDECREF(w); if (mod == NULL) { PyErr_Print(); ! return -1; } m = PyImport_AddModule("__main__"); From jhylton@users.sourceforge.net Fri Aug 30 21:55:02 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:55:02 -0700 Subject: [Python-checkins] python/dist/src/Python import.c,2.208.2.2,2.208.2.3 pythonrun.c,2.161.2.6,2.161.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24065/Python Modified Files: Tag: ast-branch import.c pythonrun.c Log Message: Extend PyParser_ASTFromFile() with int *errcode argument. If errocode is non-NULL and an error occurred in the parser, errcode will be set to the parser errorcode, e.g. E_EOF. We need this change so that PyRun_InteractiveOneFlags() can detect E_EOF and exit instead of reporting "unexpected EOF during parsing." Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.208.2.2 retrieving revision 2.208.2.3 diff -C2 -d -r2.208.2.2 -r2.208.2.3 *** import.c 16 Aug 2002 20:27:17 -0000 2.208.2.2 --- import.c 30 Aug 2002 20:54:59 -0000 2.208.2.3 *************** *** 658,662 **** mod_ty mod; ! mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0); if (mod) co = PyAST_Compile(mod, pathname, NULL); --- 658,663 ---- mod_ty mod; ! mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0, ! NULL); if (mod) co = PyAST_Compile(mod, pathname, NULL); Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.6 retrieving revision 2.161.2.7 diff -C2 -d -r2.161.2.6 -r2.161.2.7 *** pythonrun.c 30 Aug 2002 20:37:54 -0000 2.161.2.6 --- pythonrun.c 30 Aug 2002 20:55:00 -0000 2.161.2.7 *************** *** 536,539 **** --- 536,540 ---- mod_ty mod; char *ps1 = "", *ps2 = ""; + int errcode = 0; v = PySys_GetObject("ps1"); *************** *** 555,562 **** mod = PyParser_ASTFromFile(fp, filename, Py_single_input, ps1, ps2, ! PARSER_FLAGS(flags)); Py_XDECREF(v); Py_XDECREF(w); if (mod == NULL) { PyErr_Print(); return -1; --- 556,567 ---- mod = PyParser_ASTFromFile(fp, filename, Py_single_input, ps1, ps2, ! PARSER_FLAGS(flags), &errcode); Py_XDECREF(v); Py_XDECREF(w); if (mod == NULL) { + if (errcode == E_EOF) { + PyErr_Clear(); + return E_EOF; + } PyErr_Print(); return -1; *************** *** 979,983 **** { mod_ty mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, ! PARSER_FLAGS(flags)); if (closeit) fclose(fp); --- 984,988 ---- { mod_ty mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, ! PARSER_FLAGS(flags), NULL); if (closeit) fclose(fp); *************** *** 1087,1091 **** mod_ty PyParser_ASTFromFile(FILE *fp, const char *filename, int start, char *ps1, ! char *ps2, int flags) { node *n; --- 1092,1096 ---- mod_ty PyParser_ASTFromFile(FILE *fp, const char *filename, int start, char *ps1, ! char *ps2, int flags, int *errcode) { node *n; *************** *** 1098,1101 **** --- 1103,1108 ---- else { err_input(&err); + if (errcode) + *errcode = err.error; return NULL; } From jhylton@users.sourceforge.net Fri Aug 30 21:55:01 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 13:55:01 -0700 Subject: [Python-checkins] python/dist/src/Include pythonrun.h,2.49.2.2,2.49.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv24065/Include Modified Files: Tag: ast-branch pythonrun.h Log Message: Extend PyParser_ASTFromFile() with int *errcode argument. If errocode is non-NULL and an error occurred in the parser, errcode will be set to the parser errorcode, e.g. E_EOF. We need this change so that PyRun_InteractiveOneFlags() can detect E_EOF and exit instead of reporting "unexpected EOF during parsing." Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.49.2.2 retrieving revision 2.49.2.3 diff -C2 -d -r2.49.2.2 -r2.49.2.3 *** pythonrun.h 23 Aug 2002 18:13:27 -0000 2.49.2.2 --- pythonrun.h 30 Aug 2002 20:54:59 -0000 2.49.2.3 *************** *** 37,41 **** int, int); DL_IMPORT(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, ! char *, char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); --- 37,41 ---- int, int); DL_IMPORT(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, ! char *, char *, int, int *); DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); From jhylton@users.sourceforge.net Fri Aug 30 23:09:41 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 30 Aug 2002 15:09:41 -0700 Subject: [Python-checkins] python/dist/src/Parser Python.asdl,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv17139 Modified Files: Tag: ast-branch Python.asdl Log Message: Interactive() must contain a stmt* The following is a valid interactive input: x = 1; y = 2 Index: Python.asdl =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/Python.asdl,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.asdl 4 Aug 2002 20:54:05 -0000 1.1.2.3 --- Python.asdl 30 Aug 2002 22:09:38 -0000 1.1.2.4 *************** *** 4,8 **** { mod = Module(stmt* body) ! | Interactive(stmt body) | Expression(expr body) --- 4,8 ---- { mod = Module(stmt* body) ! | Interactive(stmt* body) | Expression(expr body) From jackjansen@users.sourceforge.net Sat Aug 31 00:01:31 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 16:01:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Lib FrameWork.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1293 Modified Files: FrameWork.py Log Message: Initialize self._helpmenu earlier, so we can use gethelpmenu() while building the user menus. Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** FrameWork.py 29 Aug 2002 22:04:15 -0000 1.50 --- FrameWork.py 30 Aug 2002 23:01:28 -0000 1.51 *************** *** 109,117 **** self.needmenubarredraw = 0 self._windows = {} if nomenubar: self.menubar = None else: self.makemenubar() - self._helpmenu = None def __del__(self): --- 109,117 ---- self.needmenubarredraw = 0 self._windows = {} + self._helpmenu = None if nomenubar: self.menubar = None else: self.makemenubar() def __del__(self): From jackjansen@users.sourceforge.net Sat Aug 31 00:02:11 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 16:02:11 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/ah _AHmodule.c,1.1,1.2 ahsupport.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ah In directory usw-pr-cvs1:/tmp/cvs-serv1537 Modified Files: _AHmodule.c ahsupport.py Log Message: Typecode for AHTOCType was wrong. Fixed. Index: _AHmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ah/_AHmodule.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _AHmodule.c 22 Aug 2002 23:31:37 -0000 1.1 --- _AHmodule.c 30 Aug 2002 23:02:09 -0000 1.2 *************** *** 53,57 **** OSStatus _err; AHTOCType toctype; ! if (!PyArg_ParseTuple(_args, "s", &toctype)) return NULL; --- 53,57 ---- OSStatus _err; AHTOCType toctype; ! if (!PyArg_ParseTuple(_args, "h", &toctype)) return NULL; Index: ahsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ah/ahsupport.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ahsupport.py 22 Aug 2002 23:31:37 -0000 1.1 --- ahsupport.py 30 Aug 2002 23:02:09 -0000 1.2 *************** *** 18,22 **** # Create the type objects ! AHTOCType = Type("AHTOCType", "s") includestuff = includestuff + """ --- 18,22 ---- # Create the type objects ! AHTOCType = Type("AHTOCType", "h") includestuff = includestuff + """ From jackjansen@users.sourceforge.net Sat Aug 31 02:20:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 18:20:55 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE Wapplication.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv28935 Modified Files: Wapplication.py Log Message: MenuID's are signed. Index: Wapplication.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Wapplication.py 3 Apr 2002 21:52:10 -0000 1.18 --- Wapplication.py 31 Aug 2002 01:20:53 -0000 1.19 *************** *** 191,194 **** --- 191,196 ---- result = MenuToolbox.MenuSelect(where) id = (result>>16) & 0xffff # Hi word + if id >= 0x8000: + id = -0x10000 + id item = result & 0xffff # Lo word self.do_rawmenu(id, item, window, event) From jackjansen@users.sourceforge.net Sat Aug 31 02:22:39 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 18:22:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDE.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv29093 Modified Files: PythonIDE.py Log Message: If there's an environment variable PYTHONIDEPATH it points to the IDE folder. This allows running the IDE from the source tree on OSX. Index: PythonIDE.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDE.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PythonIDE.py 21 Jan 2002 23:00:52 -0000 1.9 --- PythonIDE.py 31 Aug 2002 01:22:37 -0000 1.10 *************** *** 22,26 **** widgetresfile = os.path.join(*widgetrespathsegs) refno = macresource.need('CURS', 468, widgetresfile) ! if refno: # We're not a fullblown application idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"] --- 22,29 ---- widgetresfile = os.path.join(*widgetrespathsegs) refno = macresource.need('CURS', 468, widgetresfile) ! if os.environ.has_key('PYTHONIDEPATH'): ! # For development set this environment variable ! ide_path = os.environ['PYTHONIDEPATH'] ! elif refno: # We're not a fullblown application idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"] From jackjansen@users.sourceforge.net Sat Aug 31 02:25:19 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 30 Aug 2002 18:25:19 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv29215 Modified Files: PythonIDEMain.py Log Message: Implemented the Help menu. The Python manual can be viewed (if installed) and the selection can be looked up, and so can the Carbon manual. From the help menu you can also get to the online documentation, the Python website and the MacPython page. Untested in MacPython-OS9. Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PythonIDEMain.py 12 Jul 2002 16:50:32 -0000 1.19 --- PythonIDEMain.py 31 Aug 2002 01:25:17 -0000 1.20 *************** *** 146,149 **** --- 146,150 ---- self.scriptsmenu = None self.makescriptsmenu() + self.makehelpmenu() def quitevent(self, theAppleEvent, theReply): *************** *** 279,282 **** --- 280,384 ---- return self.quitting = 1 + + def makehelpmenu(self): + docs = self.installdocumentation() + self.helpmenu = m = self.gethelpmenu() + 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) + web2item = FrameWork.MenuItem(m, "Python on the Web", None, self.domenu_webpython) + web3item = FrameWork.MenuItem(m, "MacPython on the Web", None, self.domenu_webmacpython) + + def domenu_localdocs(self, *args): + from Carbon import AH + AH.AHGotoPage("Python Help", "index.html", "") + + def domenu_appledocs(self, *args): + from Carbon import AH, AppleHelp + try: + AH.AHGotoMainTOC(AppleHelp.kAHTOCTypeDeveloper) + except AH.Error, arg: + if arg[0] == -50: + W.Message("Developer documentation not installed") + else: + W.Message("AppleHelp Error: %s" % `arg`) + + def domenu_lookuppython(self, *args): + from Carbon import AH + searchstring = self._getsearchstring() + if not searchstring: + return + try: + AH.AHSearch("Python Help", searchstring) + except AH.Error, arg: + W.Message("AppleHelp Error: %s" % `arg`) + + def domenu_lookupcarbon(self, *args): + from Carbon import AH + searchstring = self._getsearchstring() + if not searchstring: + return + try: + AH.AHSearch("Carbon", searchstring) + except AH.Error, arg: + W.Message("AppleHelp Error: %s" % `arg`) + + def _getsearchstring(self): + import PyEdit + editor = PyEdit.findeditor(None, fromtop=1) + if editor: + text = editor.getselectedtext() + if text: + return text + # This is a cop-out. We should have disabled the menus + # if there is no selection, but the can_ methods only seem + # to work for Windows. Or not for the Help menu, maybe? + import EasyDialogs + text = EasyDialogs.AskString("Search documentation for", ok="Search") + return text + + def domenu_webdocs(self, *args): + import webbrowser + major, minor, micro, state, nano = sys.version_info + if state in ('alpha', 'beta'): + docversion = 'dev/doc/devel' + elif micro == 0: + docversion = 'doc/%d.%d' % (major, minor) + else: + docversion = 'doc/%d.%d.%d' % (major, minor, micro) + webbrowser.open("http://www.python.org/%s" % docversion) + + def domenu_webpython(self, *args): + import webbrowser + webbrowser.open("http://www.python.org/") + + def domenu_webmacpython(self, *args): + import webbrowser + webbrowser.open("http://www.cwi.nl/~jack/macpython.html") + + def installdocumentation(self): + # This is rather much of a hack. Someone has to tell the Help Viewer + # about the Python documentation, so why not us. The documentation + # is located in the framework, but there's a symlink in Python.app. + # And as AHRegisterHelpBook wants a bundle (with the right bits in + # the plist file) we refer it to Python.app + python_app = os.path.join(sys.prefix, 'Resources/Python.app') + doc_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation') + if not os.path.isdir(doc_source): + return 0 + try: + from Carbon import AH + AH.AHRegisterHelpBook(python_app) + except (ImportError, MacOS.Error), arg: + W.Message("Cannot register Python documentation: %s" % `arg`) + return 0 + return 1 + PythonIDE() From tim_one@users.sourceforge.net Sat Aug 31 07:49:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 Aug 2002 23:49:09 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv15617 Modified Files: classifier.py Log Message: The explanation for these changes was on Python-Dev. You'll find out why if the moderator approves the msg . Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** classifier.py 28 Aug 2002 21:04:56 -0000 1.2 --- classifier.py 31 Aug 2002 06:49:07 -0000 1.3 *************** *** 15,22 **** # that occur in one corpus but not the other. Again by trial and error I # chose .01 and .99.". However, the code snippet clamps *all* probabilities ! # into this range. MIN_SPAMPROB = 0.01 MAX_SPAMPROB = 0.99 UNKNOWN_SPAMPROB = 0.20 --- 15,26 ---- # that occur in one corpus but not the other. Again by trial and error I # chose .01 and .99.". However, the code snippet clamps *all* probabilities ! # into this range. That's good in principle (IMO), because no finite amount ! # of training data is good enough to justify probabilities of 0 or 1. It ! # may justify probabilities outside this range, though. MIN_SPAMPROB = 0.01 MAX_SPAMPROB = 0.99 + # The spam probability assigned to words never seen before. Neil Schemenauer + # reported anecdotal evidence that 0.5 works better. XXX Test this. UNKNOWN_SPAMPROB = 0.20 *************** *** 28,32 **** MINCOUNT = 5.0 ! MAX_DISCRIMINATORS = 15 PICKLE_VERSION = 1 --- 32,41 ---- MINCOUNT = 5.0 ! # The maximum number of words spamprob() pays attention to. Graham had 15 ! # here. If there are 8 indicators with spam probabilities near 1, and 7 ! # near 0, the math is such that the combined result is near 1. Making this ! # even gets away from that oddity (8 of each allows for graceful ties, ! # which favor ham). ! MAX_DISCRIMINATORS = 16 PICKLE_VERSION = 1 *************** *** 104,110 **** raise ValueError("non-empty wordstream required") - wordinfoget = self.wordinfo.get - now = time.time() - # A priority queue to remember the MAX_DISCRIMINATORS best # probabilities, where "best" means largest distance from 0.5. --- 113,116 ---- *************** *** 113,117 **** --- 119,138 ---- 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 + now = time.time() + for word in wordstream: + count = word2countget(word, 0) + 1 + if count > 2: + continue + word2count[word] = count + record = wordinfoget(word) if record is None: From tim_one@users.sourceforge.net Sat Aug 31 07:50:27 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 Aug 2002 23:50:27 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv15716 Added Files: timtest.py Log Message: This is a driver I've been using for test runs. It's specific to my corpus directories, but has useful stuff in it all the same. --- NEW FILE: timtest.py --- #! /usr/bin/env python NSETS = 5 SPAMDIRS = ["Data/Spam/Set%d" % i for i in range(1, NSETS+1)] HAMDIRS = ["Data/Ham/Set%d" % i for i in range(1, NSETS+1)] SPAMHAMDIRS = zip(SPAMDIRS, HAMDIRS) import os import re from sets import Set import email from email import message_from_string import Tester import classifier def textparts(msg): text = Set() redundant_html = Set() for part in msg.walk(): if part.get_content_type() == 'multipart/alternative': textpart = htmlpart = None for subpart in part.get_payload(): ctype = subpart.get_content_type() if ctype == 'text/plain': textpart = subpart elif ctype == 'text/html': htmlpart = subpart if textpart is not None: text.add(textpart) if htmlpart is not None: redundant_html.add(htmlpart) elif htmlpart is not None: text.add(htmlpart) elif part.get_content_maintype() == 'text': text.add(part) return text - redundant_html url_re = re.compile(r"http://([^\s>'\"\x7f-\xff]+)", re.IGNORECASE) 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 url in url_re.findall(nohead): for i, piece in enumerate(url.lower().split('/')): prefix = "url%d:" % 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.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.split(): if 3 <= len(w) <= 12: yield w class Msg(object): def __init__(self, dir, name): path = dir + "/" + name self.path = path f = open(path, 'rb') guts = f.read() f.close() # # Skip the headers. # i = guts.find('\n\n') # if i >= 0: # guts = guts[i+2:] self.guts = guts def __iter__(self): return tokenize(self.guts) def __hash__(self): return hash(self.path) def __eq__(self, other): return self.path == other.path class MsgStream(object): def __init__(self, directory): self.directory = directory def produce(self): directory = self.directory for fname in os.listdir(directory): yield Msg(directory, fname) def __iter__(self): return self.produce() def drive(): falsepos = Set() falseneg = Set() for spamdir, hamdir in SPAMHAMDIRS: c = classifier.GrahamBayes() t = Tester.Test(c) print "Training on", hamdir, "&", spamdir, "...", t.train(MsgStream(hamdir), MsgStream(spamdir)) print t.nham, "hams &", t.nspam, "spams" 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" print " false positive:", t.false_positive_rate() print " false negative:", t.false_negative_rate() newfpos = Set(t.false_positives()) - falsepos falsepos |= newfpos print " new false positives:", [e.path for e in newfpos] for e in newfpos: print '*' * 78 print e.path prob, clues = c.spamprob(e, True) print "prob =", prob for clue in clues: print "prob(%r) = %g" % clue print e.guts newfneg = Set(t.false_negatives()) - falseneg falseneg |= newfneg print " new false negatives:", [e.path for e in newfneg] for e in newfneg: print '*' * 78 print e.path prob, clues = c.spamprob(e, True) print "prob =", prob for clue in clues: print "prob(%r) = %g" % clue print e.guts[:1000] print print " best discriminators:" stats = [(r.killcount, w) for w, r in c.wordinfo.iteritems()] stats.sort() del stats[:-30] for count, w in stats: r = c.wordinfo[w] print " %r %d %g" % (w, r.killcount, r.spamprob) print drive() From gvanrossum@users.sourceforge.net Sat Aug 31 16:16:17 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 31 Aug 2002 08:16:17 -0700 Subject: [Python-checkins] python/dist/src/Python import.c,2.209,2.210 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14935 Modified Files: import.c Log Message: Because MWH changed the bytecode again, moved the magic number *back* to 62011. This should get the snake-farm to throw away its old .pyc files, amongst others. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.209 retrieving revision 2.210 diff -C2 -d -r2.209 -r2.210 *** import.c 15 Aug 2002 14:59:02 -0000 2.209 --- import.c 31 Aug 2002 15:16:14 -0000 2.210 *************** *** 53,56 **** --- 53,60 ---- out the MAGIC schemes, so just incremented it by 10. + GvR, 2002-08-31: Because MWH changed the bytecode again, moved the + magic number *back* to 62011. This should get the snake-farm to + throw away its old .pyc files, amongst others. + Known values: Python 1.5: 20121 *************** *** 65,70 **** Python 2.3a0: 62011 Python 2.3a0: 62021 */ ! #define MAGIC (62021 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the --- 69,75 ---- Python 2.3a0: 62011 Python 2.3a0: 62021 + Python 2.3a0: 62011 (!) */ ! #define MAGIC (62011 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the From rhettinger@users.sourceforge.net Sat Aug 31 16:51:07 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 31 Aug 2002 08:51:07 -0700 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.30,2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22233 Modified Files: descrobject.c Log Message: Added comparison functions to dict proxies. Now all non-mutating dict methods are in the proxy also. Inspired by SF bug #602232, Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** descrobject.c 19 Aug 2002 18:45:37 -0000 2.30 --- descrobject.c 31 Aug 2002 15:51:04 -0000 2.31 *************** *** 719,722 **** --- 719,734 ---- } + static int + proxy_compare(proxyobject *v, PyObject *w) + { + return PyObject_Compare(v->dict, w); + } + + static PyObject * + proxy_richcompare(proxyobject *v, PyObject *w, int op) + { + return PyObject_RichCompare(v->dict, w, op); + } + static PyTypeObject proxytype = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 730,734 **** 0, /* tp_getattr */ 0, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ --- 742,746 ---- 0, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)proxy_compare, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ *************** *** 745,749 **** proxy_traverse, /* tp_traverse */ 0, /* tp_clear */ ! 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)proxy_getiter, /* tp_iter */ --- 757,761 ---- proxy_traverse, /* tp_traverse */ 0, /* tp_clear */ ! (richcmpfunc)proxy_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)proxy_getiter, /* tp_iter */ From tim_one@users.sourceforge.net Sat Aug 31 18:25:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 10:25:12 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.3,1.4 timtest.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv10667 Modified Files: classifier.py timtest.py Log Message: Boost UNKNOWN_SPAMPROB. # The spam probability assigned to words never seen before. Graham used # 0.2 here. Neil Schemenauer reported that 0.5 seemed to work better. In # Tim's content-only tests (no headers), boosting to 0.5 cut the false # negative rate by over 1/3. The f-p rate increased, but there were so few # f-ps that the increase wasn't statistically significant. It also caught # 13 more spams erroneously classified as ham. By eyeball (and common # sense ), this has most effect on very short messages, where there # simply aren't many high-value words. A word with prob 0.5 is (in effect) # completely ignored by spamprob(), in favor of *any* word with *any* prob # differing from 0.5. At 0.2, an unknown word favors ham at the expense # of kicking out a word with a prob in (0.2, 0.8), and that seems dubious # on the face of it. Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** classifier.py 31 Aug 2002 06:49:07 -0000 1.3 --- classifier.py 31 Aug 2002 17:25:10 -0000 1.4 *************** *** 21,27 **** MAX_SPAMPROB = 0.99 ! # The spam probability assigned to words never seen before. Neil Schemenauer ! # reported anecdotal evidence that 0.5 works better. XXX Test this. ! UNKNOWN_SPAMPROB = 0.20 # "I only consider words that occur more than five times in total". --- 21,37 ---- MAX_SPAMPROB = 0.99 ! # The spam probability assigned to words never seen before. Graham used ! # 0.2 here. Neil Schemenauer reported that 0.5 seemed to work better. In ! # Tim's content-only tests (no headers), boosting to 0.5 cut the false ! # negative rate by over 1/3. The f-p rate increased, but there were so few ! # f-ps that the increase wasn't statistically significant. It also caught ! # 13 more spams erroneously classified as ham. By eyeball (and common ! # sense ), this has most effect on very short messages, where there ! # simply aren't many high-value words. A word with prob 0.5 is (in effect) ! # completely ignored by spamprob(), in favor of *any* word with *any* prob ! # differing from 0.5. At 0.2, an unknown word favors ham at the expense ! # of kicking out a word with a prob in (0.2, 0.8), and that seems dubious ! # on the face of it. ! UNKNOWN_SPAMPROB = 0.5 # "I only consider words that occur more than five times in total". Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timtest.py 31 Aug 2002 06:50:25 -0000 1.1 --- timtest.py 31 Aug 2002 17:25:10 -0000 1.2 *************** *** 150,154 **** falseneg |= newfneg print " new false negatives:", [e.path for e in newfneg] ! for e in newfneg: print '*' * 78 print e.path --- 150,154 ---- falseneg |= newfneg print " new false negatives:", [e.path for e in newfneg] ! for e in []:#newfneg: print '*' * 78 print e.path From tim_one@users.sourceforge.net Sat Aug 31 19:52:40 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 11:52:40 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes rebal.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv30297 Added Files: rebal.py Log Message: A little script I use to rebalance the ham corpora after deleting what turns out to be spam. I have another Ham/reservoir directory with a few thousand randomly selected msgs from the presumably-good archive. These aren't used in scoring or training. This script marches over all the ham corpora directories that are used, and if any have gotten too big (this never happens anymore) deletes msgs at random from them, and if any have gotten too small plugs the holes by moving in random msgs from the reservoir. --- NEW FILE: rebal.py --- import os import sys import random ''' dead = """ Data/Ham/Set1/62902.txt Data/Ham/Set3/17667.txt Data/Ham/Set5/129688.txt""" for f in dead.split(): os.unlink(f) sys.exit(0) ''' NPERDIR = 4000 RESDIR = 'Data/Ham/reservoir' res = os.listdir(RESDIR) stuff = [] for i in range(1, 6): dir = 'Data/Ham/Set%d' % i fs = os.listdir(dir) stuff.append((dir, fs)) while stuff: dir, fs = stuff.pop() if len(fs) > NPERDIR: f = random.choice(fs) fs.remove(f) print "deleting", f, "from", dir os.unlink(dir + "/" + f) stuff.append((dir, fs)) elif len(fs) < NPERDIR: print "need a new one for", dir f = random.choice(res) print "How about", f res.remove(f) fp = file(RESDIR + "/" + f, 'rb') guts = fp.read() fp.close() print guts ok = raw_input('good enough? ') if ok.startswith('y'): fp = file(dir + "/" + f, 'wb') fp.write(guts) fp.close() os.unlink(RESDIR + "/" + f) fs.append(f) stuff.append((dir, fs)) From tim_one@users.sourceforge.net Sat Aug 31 19:56:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 11:56:30 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv31583 Modified Files: timtest.py Log Message: textparts(): This was failing to weed out redundant HTML in cases like this: multipart/alternative text/plain multipart/related text/html The tokenizer here also transforms everything to lowercase, but that's an accident due simply to that I'm testing that now. Can't say for sure until the test runs end, but so far it looks like a bad idea for the false positive rate. Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timtest.py 31 Aug 2002 17:25:10 -0000 1.2 --- timtest.py 31 Aug 2002 18:56:28 -0000 1.3 *************** *** 15,18 **** --- 15,23 ---- import classifier + # Find all the text components of the msg. There's no point decoding + # binary blobs (like images). If a multipart/alternative has both plain + # text and HTML versions of a msg, ignore the HTML part: HTML decorations + # have monster-high spam probabilities, and innocent newbies often post + # using HTML. def textparts(msg): text = Set() *************** *** 20,25 **** for part in msg.walk(): if part.get_content_type() == 'multipart/alternative': ! textpart = htmlpart = None ! for subpart in part.get_payload(): ctype = subpart.get_content_type() if ctype == 'text/plain': --- 25,34 ---- for part in msg.walk(): if part.get_content_type() == 'multipart/alternative': ! # Descend this part of the tree, adding any redundant HTML text ! # part to redundant_html. ! htmlpart = textpart = None ! stack = part.get_payload() ! while stack: ! subpart = stack.pop() ctype = subpart.get_content_type() if ctype == 'text/plain': *************** *** 27,37 **** elif ctype == 'text/html': htmlpart = subpart ! if textpart is not None: ! text.add(textpart) ! if htmlpart is not None: ! redundant_html.add(htmlpart) ! elif htmlpart is not None: ! text.add(htmlpart) elif part.get_content_maintype() == 'text': --- 36,46 ---- elif ctype == 'text/html': htmlpart = subpart + elif ctype == 'multipart/related': + stack.extend(subpart.get_payload()) ! if textpart is not None and htmlpart is not None: ! redundant_html.add(htmlpart) ! # If only textpart was found, the main walk() will eventually ! # add it to text. elif part.get_content_maintype() == 'text': *************** *** 60,64 **** yield 'control: MessageParseError' if nohead is not None: ! for w in nohead.split(): if 3 <= len(w) <= 12: yield w --- 69,73 ---- yield 'control: MessageParseError' if nohead is not None: ! for w in nohead.lower().split(): if 3 <= len(w) <= 12: yield w *************** *** 74,78 **** yield 'control: payload is None' else: ! for w in text.split(): if 3 <= len(w) <= 12: yield w --- 83,87 ---- yield 'control: payload is None' else: ! for w in text.lower().split(): if 3 <= len(w) <= 12: yield w From tim_one@users.sourceforge.net Sat Aug 31 20:09:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 12:09:10 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes rebal.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv3319 Modified Files: rebal.py Log Message: Aha! Staring at the checkin msg revealed a logic bug that explains why my ham directories sometimes remained unbalanced after running this -- if the randomly selected reservoir msg turned out to be spam, it wasn't pushing the too-small directory on the stack again. Index: rebal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/rebal.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rebal.py 31 Aug 2002 18:52:38 -0000 1.1 --- rebal.py 31 Aug 2002 19:09:08 -0000 1.2 *************** *** 27,30 **** --- 27,33 ---- while stuff: dir, fs = stuff.pop() + if len(fs) == NPERDIR: + continue + if len(fs) > NPERDIR: f = random.choice(fs) *************** *** 32,36 **** print "deleting", f, "from", dir os.unlink(dir + "/" + f) ! stuff.append((dir, fs)) elif len(fs) < NPERDIR: print "need a new one for", dir --- 35,39 ---- print "deleting", f, "from", dir os.unlink(dir + "/" + f) ! elif len(fs) < NPERDIR: print "need a new one for", dir *************** *** 42,45 **** --- 45,49 ---- guts = fp.read() fp.close() + os.unlink(RESDIR + "/" + f) print guts *************** *** 49,53 **** fp.write(guts) fp.close() - os.unlink(RESDIR + "/" + f) fs.append(f) ! stuff.append((dir, fs)) --- 53,57 ---- fp.write(guts) fp.close() fs.append(f) ! ! stuff.append((dir, fs)) From tim_one@users.sourceforge.net Sat Aug 31 20:37:47 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 12:37:47 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes timtest.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv10937 Modified Files: timtest.py Log Message: textparts(): Worm around what feels like a bug in msg.walk() (Barry has details). Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** timtest.py 31 Aug 2002 18:56:28 -0000 1.3 --- timtest.py 31 Aug 2002 19:37:44 -0000 1.4 *************** *** 39,46 **** stack.extend(subpart.get_payload()) ! if textpart is not None and htmlpart is not None: ! redundant_html.add(htmlpart) ! # If only textpart was found, the main walk() will eventually ! # add it to text. elif part.get_content_maintype() == 'text': --- 39,54 ---- 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) ! if htmlpart is not None: ! redundant_html.add(htmlpart) ! elif htmlpart is not None: ! text.add(htmlpart) elif part.get_content_maintype() == 'text': From tim_one@users.sourceforge.net Sat Aug 31 21:47:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 13:47:30 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes classifier.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv25564 Modified Files: classifier.py Log Message: spamprob(): Removed useless check that wordstream isn't empty. For one thing, it didn't work, since wordstream is often an iterator. Even if it did work, it isn't needed -- the probability of an empty wordstream gets computed as 0.5 based on the total absence of evidence. Index: classifier.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/classifier.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** classifier.py 31 Aug 2002 17:25:10 -0000 1.4 --- classifier.py 31 Aug 2002 20:47:28 -0000 1.5 *************** *** 120,126 **** print "spamprob(%r)" % wordstream - if not wordstream: - raise ValueError("non-empty wordstream required") - # A priority queue to remember the MAX_DISCRIMINATORS best # probabilities, where "best" means largest distance from 0.5. --- 120,123 ---- From tim_one@users.sourceforge.net Sat Aug 31 22:33:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 31 Aug 2002 14:33:12 -0700 Subject: [Python-checkins] python/nondist/sandbox/spambayes rebal.py,1.2,1.3 timtest.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/spambayes In directory usw-pr-cvs1:/tmp/cvs-serv4362 Modified Files: rebal.py timtest.py Log Message: Folding case is here to stay. Read the new comments for why. This may be a bad idea for other languages, though. Refined the embedded-URL tagging scheme. Curious: as a protocol, http is spam-neutral, but https is a strong spam indicator. That surprised me. Index: rebal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/rebal.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rebal.py 31 Aug 2002 19:09:08 -0000 1.2 --- rebal.py 31 Aug 2002 21:33:10 -0000 1.3 *************** *** 5,11 **** ''' dead = """ ! Data/Ham/Set1/62902.txt ! Data/Ham/Set3/17667.txt ! Data/Ham/Set5/129688.txt""" for f in dead.split(): --- 5,12 ---- ''' dead = """ ! Data/Ham/Set2/22467.txt ! Data/Ham/Set5/31389.txt ! Data/Ham/Set1/19642.txt ! """ for f in dead.split(): Index: timtest.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/timtest.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** timtest.py 31 Aug 2002 19:37:44 -0000 1.4 --- timtest.py 31 Aug 2002 21:33:10 -0000 1.5 *************** *** 57,63 **** return text - redundant_html ! url_re = re.compile(r"http://([^\s>'\"\x7f-\xff]+)", re.IGNORECASE) urlsep_re = re.compile(r"[;?:@&=+,$.]") def tokenize(string): # Skip headers. --- 57,97 ---- 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 + # to other languages; and, indeed, 'FREE' (all caps) turned out to be one + # of the strongest spam indicators in my content-only tests (== one with + # prob 0.99 *and* made it into spamprob's nbest list very often). + # + # Against preservering case, it makes the database size larger, and requires + # more training data to get enough "representative" mixed-case examples. + # + # Running my c.l.py tests didn't support my intuition that case was + # valuable, so it's getting folded away now. Folding or not made no + # significant difference to the false positive rate, and folding made a + # small (but statistically significant all the same) reduction in the + # false negative rate. There is one obvious difference: after folding + # case, conference announcements no longer got high spam scores. Their + # content was usually fine, but they were highly penalized for VISIT OUR + # WEBSITE FOR MORE INFORMATION! kinds of repeated SCREAMING. That is + # indeed the language of advertising, and I halfway regret that folding + # away case no longer picks on them. + # + # Since the f-p rate didn't change, but conference announcements escaped + # that category, something else took their place. It seems to be highly + # off-topic messages, like debates about Microsoft's place in the world. + # Talk about "money" and "lucrative" is indistinguishable now from talk + # about "MONEY" and "LUCRATIVE", and spam mentions MONEY a lot. + def tokenize(string): # Skip headers. *************** *** 66,72 **** if i >= 0: nohead = string[i+2:] ! for url in url_re.findall(nohead): ! for i, piece in enumerate(url.lower().split('/')): ! prefix = "url%d:" % i for chunk in urlsep_re.split(piece): yield prefix + chunk --- 100,108 ---- 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