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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337
|
+++++++++++
Python News
+++++++++++
(editors: check NEWS.help for information about editing NEWS using ReST.)
What's New in Python 2.4.6?
===========================
*Release date: 19-Dec-2008*
What's New in Python 2.4.6c1?
=============================
*Release date: 13-Dec-2008*
Core and builtins
-----------------
- Issue #4469: Prevent expandtabs() on string and unicode
objects from causing a segfault when a large width is passed
on 32-bit platforms. CVE-2008-5031.
- Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function.
- Issue #4230: Fix a crash when a class has a custom __getattr__ and an
__getattribute__ method that deletes the __getattr__ attribute.
- Apply security patches from Apple. CVE-2008-2315.
- Issue #2620: Overflow checking when allocating or reallocating memory
was not always being done properly in some python types and extension
modules. PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have
all been updated to perform better checks and places in the code that
would previously leak memory on the error path when such an allocation
failed have been fixed.
- Issue #1179: Fix CVE-2007-4965 and CVE-2008-1679, multiple integer
overflows in the imageop and rgbimgmodule modules.
- Issue #2586: Fix CVE-2008-1721, zlib crash from
zlib.decompressobj().flush(val) when val is not positive.
- Issues #2588, #2589: Fix potential integer underflow and overflow
conditions in the PyOS_vsnprintf C API function. CVE-2008-3144.
- Issue #2587: In the C API, PyString_FromStringAndSize() takes a signed size
parameter but was not verifying that it was greater than zero. Values
less than zero will now raise a SystemError and return NULL to indicate a
bug in the calling C code. CVE-2008-1887.
- Security Issue #2: imageop did not validate arguments correctly and could
segfault as a result. CVE-2008-4864.
Extension Modules
-----------------
Library
-------
Tests
-----
Build
-----
Tools/Demos
-----------
- Tools/faqwiz/move-faqwiz.sh: Fix unsecure use of temporary files.
What's New in Python 2.4.5?
=============================
*Release date: 11-Mar-2008*
What's New in Python 2.4.5c1?
=============================
*Release date: 02-Mar-2008*
Core and builtins
-----------------
- Added checks for integer overflows, contributed by Google. Some are
only available if asserts are left in the code, in cases where they
can't be triggered from Python code.
- patch #1630975: Fix crash when replacing sys.stdout in sitecustomize.py
Extension Modules
-----------------
Library
-------
- HTML-escape the plain traceback in cgitb's HTML output, to prevent
the traceback inadvertently or maliciously closing the comment and
injecting HTML into the error page.
Tests
-----
Build
-----
What's New in Python 2.4.4?
===========================
*Release date: 18-OCT-2006*
Build
-----
- Bug #1578513: Cross compilation was broken by a change to configure.
Repair so that it's back to how it was in 2.4.3.
What's New in Python 2.4.4c1?
=============================
*Release date: 11-OCT-2006*
Core and builtins
-----------------
- Bug #1456209: In some obscure cases it was possible for a class with a
custom ``__eq__()`` method to confuse dict internals when class instances
were used as a dict's keys and the ``__eq__()`` method mutated the dict.
No, you don't have any code that did this ;-)
- A number of places, including integer negation and absolute value,
were fixed to not rely on undefined behaviour of the C compiler
anymore.
- Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
- staticmethod() and classmethod() also now complain about keyword args
instead of silently ignoring them.
- Bug #1331062: Fix error in UTF-7 codec.
- Bug #1365916: Fix an int/long mismatch in the sorted() built-in.
- Fix memory leak of coding spec in Parser/tokenizer.c.
- Fix memory leak in file_init.
- Fix segfault when doing string formatting on subclasses of long.
- Overflow checking code in integer division ran afoul of new gcc
optimizations. Changed to be more standard-conforming.
- Fix some potential crashes found with failmalloc.
- Fix warnings reported by the Coverity and Klocwork static analysis tools.
- Patch #1541585: fix buffer overrun when performing repr() on
a unicode string in a build with wide unicode (UCS-4) support.
- Bug #1536786: buffer comparison could emit a RuntimeWarning.
- Bug #1535165: fixed a segfault in input() and raw_input() when
sys.stdin is closed.
- Bug #1524310: Properly report errors from FindNextFile in os.listdir.
- Bug #1232517: An overflow error was not detected properly when
attempting to convert a large float to an int in os.utime().
- Bug #927248: Recursive method-wrapper objects can now safely
be released.
- Bug #992017: A classic class that defined a __coerce__() method that returned
its arguments swapped would infinitely recurse and segfault the interpreter.
- Bug #532646: The object set to the __call__ attribute has its own __call__
attribute checked; this continues until the attribute can no longer be found
or segfaulting. Recursion limit is now followed.
- Bug #1454485: Don't crash on Unicode characters <0.
- Patch #1488312, Fix memory alignment problem on SPARC in unicode
- fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments
were transposed.
Extension Modules
-----------------
- #1494314: Fix a regression with high-numbered sockets in 2.4.3. This
means that select() on sockets > FD_SETSIZE (typically 1024) work again.
The patch makes sockets use poll() internally where available.
- Fix buffer handling in posix.confstr.
- Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault
when encoding non-BMP unicode characters.
- Fixed a few bugs in cjkcodecs:
- gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly.
- iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312
codepoints to conform the standard.
- iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 2013:2
codepoints now.
- Bug #1556784: allow format strings longer than 127 characters in
datetime's strftime function.
- gcmodule: add a missing incref.
- threadmodule: add a missing incref.
- Bug #1551427: fix a wrong NULL pointer check in the win32 version
of os.urandom().
- Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
- Make regex engine raise MemoryError if allocating memory fails.
- Bug #1471938: Fix curses module build problem on Solaris 8; patch by
Paul Eggert.
- Bug #1548092: fix curses.tparm() segfault on invalid input.
- cursesmodule: fix a number of reference leaks with 'python -v'; handle
failure from PyModule_GetDict (Klocwork 208).
- Bug #1512695: cPickle.loads could crash if it was interrupted with
a KeyboardInterrupt.
- Change binascii.hexlify() to accept any read-only buffer and not just a char
buffer.
- Fixed a potentially invalid memory access of CJKCodecs' shift-jis decoder.
- Calling Tk_Init twice is refused if the first call failed as that
may deadlock.
- Patch #1191065: Fix preprocessor problems on systems where recvfrom
is a macro.
- Bug #1467952: os.listdir() now correctly raises an error if readdir()
fails with an error condition.
- Fix bsddb.db.DBError derived exceptions so they can be unpickled.
- Bug #1117761: bsddb.*open() no longer raises an exception when using
the cachesize parameter.
- Bug #1493322: bsddb: the __len__ method of a DB object has been fixed to
return correct results. It could previously incorrectly return 0 in some
cases. Fixes SF bug 1493322 (pybsddb bug 1184012).
- pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
methods now allow their database parameter to be None as the
sleepycat API allows.
Library
-------
- Bug #1545341: The 'classifier' keyword argument to the Distutils setup()
function now accepts tuples as well as lists.
- Bug #1560617: in pyclbr, return full module name not only for classes,
but also for functions.
- Bug #1566602: correct failure of posixpath unittest when $HOME ends
with a slash.
- Reverted patch #1504333 because it introduced an infinite loop.
- Fix missing import of the types module in logging.config.
- Bug #1112549, DoS attack on cgi.FieldStorage.
- Bug #1257728: Complain about missing VS 2003 in the error message
of msvccompiler, and mention Cygwin as an alternative.
- Bug #1002398: The documentation for os.path.sameopenfile now correctly
refers to file descriptors, not file objects.
- Bug #1529297: The rewrite of doctest for Python 2.4 unintentionally
lost that tests are sorted by name before being run. This rarely
matters for well-written tests, but can create baffling symptoms if
side effects from one test to the next affect outcomes. ``DocTestFinder``
has been changed to sort the list of tests it returns.
- The email package has improved RFC 2231 support, specifically for
recognizing the difference between encoded (name*0*=<blah>) and non-encoded
(name*0=<blah>) parameter continuations. This may change the types of
values returned from email.message.Message.get_param() and friends.
Specifically in some cases where non-encoded continuations were used,
get_param() used to return a 3-tuple of (None, None, string) whereas now it
will just return the string (since non-encoded continuations don't have
charset and language parts).
Also, whereas % values were decoded in all parameter continuations, they are
now only decoded in encoded parameter parts.
- Bug #822974: Honor timeout in telnetlib.{expect,read_until}
even if some data are received.
- Bug #1267547: Put proper recursive setup.py call into the
spec file generated by bdist_rpm.
- Bug #1504333: Make sgmllib support angle brackets in quoted attribute
values.
- Bug #853506: Fix IPv6 address parsing in unquoted attributes in sgmllib
('[' and ']' were not accepted).
- Bug #1117556: SimpleHTTPServer now tries to find and use the system's
mime.types file for determining MIME types.
- Bug #1339007: Shelf objects now don't raise an exception in their
__del__ method when initialization failed.
- Bug #1501223: Possible overflow in _PySys_Init() when reading the code page
under Windows.
- Patch #1478292. ``doctest.register_optionflag(name)`` shouldn't create a
new flag when ``name`` is already the name of an option flag.
- Bug #1473760: ``tempfile.TemporaryFile()`` could hang on Windows, when
called from a thread spawned as a side effect of importing a module.
- The ``__del__`` method of class ``local`` in module ``_threading_local``
returned before accomplishing any of its intended cleanup.
- Patch #1191700: Adjust column alignment in bdb breakpoint lists.
- The email module's parsedate_tz function now sets the daylight savings
flag to -1 (unknown) since it can't tell from the date whether it should
be set.
- Bug #1460340: ``random.sample(dict)`` failed in various ways. Dicts
aren't officially supported here, and trying to use them will probably
raise an exception some day. But dicts have been allowed, and "mostly
worked", so support for them won't go away without warning.
- Bug #1472827: correctly escape newlines and tabs in attribute values in
the saxutils.XMLGenerator class.
- Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
Tools/Demos
-----------
Build
-----
- The Windows binaries for the _ssl module are now linked with
OpenSSL 0.9.7l.
- On Windows, there are no longer linker warnings when building the
``_bsddb`` project.
- Bug #1568842: Fix test for uintptr_t.
- Bug #1439538: Drop usage of test -e in configure as it is not portable.
- Bug #1502728: Correctly link against librt library on HP-UX.
- OpenBSD 3.9 and 4.0 are now supported.
- Test for sys/statvfs.h before including it, as statvfs is present
on some OSX installation, but its header file is not.
- Fix test_long failure on Tru64 with gcc by using -mieee gcc option.
Documentation
-------------
- Bug #1541682: Fix example in the "Refcount details" API docs.
Additionally, remove a faulty example showing PySequence_SetItem applied
to a newly created list object and add notes that this isn't a good idea.
- Clarified documentation for tp_as_buffer->bf_getcharbuffer.
- Bug #1337990: clarified that ``doctest`` does not support examples
requiring both expected output and an exception.
Tests
-----
- Bug #1535182: really test the xreadlines() method of bz2 objects.
- Patch #1529686: test_iterlen and test_email_codecs are now actually
run by regrtest.py.
- Fix the socket tests so they can be run concurrently.
What's New in Python 2.4.3?
===========================
*Release date: 29-MAR-2006*
Core and builtins
-----------------
- A few reference leaks were squished.
- A threading issue that caused random segfaults on some platforms from
the testsuite was fixed in test_capi.
- Reverted fix for Bug #1379994: Builtin unicode_escape and
raw_unicode_escape codec now encodes backslash correctly.
This caused another issue for unicode repr strings being double-escaped
(SF Bug #1459029). Correct fix will be in 2.5, but is too risky for 2.4.3.
Extension Modules
-----------------
- Patch #1380952: fix SSL objects timing out on consecutive read()s
- Ubuntu bug #29289: Fixed a bug that the gb18030 codec raises
RuntimeError on encoding surrogate pair area on UCS4 build.
What's New in Python 2.4.3c1?
=============================
*Release date: 23-MAR-2006*
Core and builtins
-----------------
- Bug #1115379: Compiling a Unicode string with an encoding declaration
now gives a SyntaxError.
- Fix missing check on whether the PendingDeprecationWarning for string
exceptions was re-raised as an actual PendingDeprecationWarning when
'warnings' is set to a filter action of "error"
- Bug #1378022, UTF-8 files with a leading BOM crashed the interpreter.
- Patch #1400181, fix unicode string formatting to not use the locale.
This is how string objects work. u'%f' could use , instead of .
for the decimal point. Now both strings and unicode always use periods.
- Bug #1244610, #1392915, fix build problem on OpenBSD 3.7 and 3.8.
configure would break checking curses.h.
- Bug #959576: The pwd module is now builtin. This allows Python to be
built on UNIX platforms without $HOME set.
- Bug #1379994: Builtin unicode_escape and raw_unicode_escape codec
now encodes backslash correctly.
- Bug #1281408: Py_BuildValue now works correct even with unsigned longs
and long longs.
- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
It was possible dlerror() returns a NULL pointer, use a default error
message in this case.
- SF bug #1167751: fix incorrect code being for generator expressions.
The following code now raises a SyntaxError: foo(a = i for i in range(10))
- SF Bug #976608: fix SystemError when mtime of an imported file is -1.
- SF Bug #887946: fix segfault when redirecting stdin from a directory.
Provide a warning when a directory is passed on the command line.
- Fix segfault with invalid coding.
- Patch #1413181: changed ``PyThreadState_Delete()`` to forget about the
current thread state when the auto-GIL-state machinery knows about
it (since the thread state is being deleted, continuing to remember it
can't help, but can hurt if another thread happens to get created with
the same thread id).
Extension Modules
-----------------
- Bug #1448490: Fixed a bug that ISO-2022 codecs could not handle
SS2 (single-shift 2) escape sequences correctly.
- Bug #854823: socketmodule now builds on Sun platforms even when
INET_ADDRSTRLEN is not defined.
- Bug #876637, prevent stack corruption when socket descriptor
is larger than FD_SETSIZE.
- Patch #1407135, bug #1424041: mmap.mmap(-1, size, ...) can return
anonymous memory again on Unix.
- Bug #1215432: in bsddb DB.associate() would crash when a DBError
was supposed to be raised.
- Fix 64-bit problems in bsddb.
- Bug #1290333: Added a workaround for cjkcodecs' _codecs_cn build
problem on AIX.
- Bug #869197: os.setgroups rejects long integer arguments
- Bug #1344508, Fix UNIX mmap leaking file descriptors
- Patch #1338314, Bug #1336623: fix tarfile so it can extract
REGTYPE directories from tarfiles written by old programs.
- Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1,
but Python incorrectly assumes it is in UTF-8 format
- Fix parse errors in the readline module when compiling without threads.
Library
-------
- Patch #1462313, bug #1443328: the pickle modules now can handle classes
that have __private names in their __slots__.
- A regrtest option -w was added to re-run failed tests in verbose mode.
- Patch #1337756: fileinput now handles Unicode filenames correctly.
- Patch #1373643: The chunk module can now read chunks larger than
two gigabytes.
- Bug #1430298: It is now possible to send a mail with an empty
return address using smtplib.
- Bug #1432260: The names of lambda functions are now properly displayed
in pydoc.
- Bug #1371247: Update Windows locale identifiers in locale.py.
- Bug #1394565: SimpleHTTPServer now doesn't choke on query parameters
any more.
- Bug #1403410: The warnings module now doesn't get confused
when it can't find out the module name it generates a warning for.
- Patch #1117398: cookielib.LWPCookieJar and .MozillaCookieJar now raise
LoadError as documented, instead of IOError. For compatibility,
LoadError subclasses IOError.
- Bug #1365984: urllib now opens "data:" URLs again.
- Patch #1314396: Prevent threading.Thread.join() from blocking if a previous
call caused an exception to be raised (e.g., calling join() with an illegal
argument).
- urllib.unquote() now handles Unicode strings correctly. Formerly, it would
either ignore the substitution or raise UnicodeDecodeError.
- SF #1313496: the bisect module now accepts named arguments.
- Bug #729103: pydoc.py: Fix docother() method to accept additional
"parent" argument.
- Patch #1300515: xdrlib.py: Fix pack_fstring() to really use null bytes
for padding.
- Bug #1296004: httplib.py: Limit maximal amount of data read from the
socket to avoid a MemoryError on Windows.
Tools/Demos
-----------
- Fixed a display glitch in Pynche, which could cause the right arrow to
wiggle over by a pixel.
Build
-----
- Patch #1432345: Make python compile on DragonFly.
- Patch #1428494: Prefer linking against ncursesw over ncurses library.
What's New in Python 2.4.2 final?
=================================
*Release date: 28-SEP-2005*
Extension Modules
-----------------
- Patches #1298449 and #1298499: Add some missing checks for error
returns in cStringIO.c.
- Patch #1297028: fix segfault if call type on MultibyteCodec,
MultibyteStreamReader, or MultibyteStreamWriter.
Tests
-----
- Fixed failure in test_macfs on Mac OS X 10.4 (Tiger), which
apparently doesn't allow the creation time to be set later than the
modification time. Fixed by changing the test data.
Build
-----
- Patch #881820: look for openpty and forkpty also in libbsd.
- Use -xcode=pic32 for CCSHARED on Solaris with SunPro.
- The Windows .msi files are now compressed using lzx:21. This produces a
significantly smaller installer.
What's New in Python 2.4.2c1?
=============================
*Release date: 21-SEP-2005*
Core and builtins
-----------------
- SF bug #1163563: the original fix for bug #1010677 ("thread Module
Breaks PyGILState_Ensure()") broke badly in the case of multiple
interpreter states; back out that fix and do a better job (see
http://mail.python.org/pipermail/python-dev/2005-June/054258.html
for a longer write-up of the problem).
- On 64-bit platforms, when __len__() returns a value that cannot be
represented as a C int, raise OverflowError.
- SF bug #893549: parsing keyword arguments was broken with a few format
codes.
- Changes donated by Elemental Security to make it work on AIX 5.3
with IBM's 64-bit compiler (SF patch #1284289). This also closes SF
bug #105470: test_pwd fails on 64bit system (Opteron).
- Changes donated by Elemental Security to make it work on HP-UX 11 on
Itanium2 with HP's 64-bit compiler (SF patch #1225212).
- Disallow keyword arguments for type constructors that don't use them
(fixes bug #1119418).
- Forward UnicodeDecodeError into SyntaxError for source encoding errors.
- SF bug #900092: When tracing (e.g. for hotshot), restore 'return' events for
exceptions that cause a function to exit.
- SF bug #1257731: set.discard() and set.remove() did not correctly
handle keys that both inherited from set and defined their own
__hash__() function. Also, changed set.__contains__() to have
identical logic.
- The set() builtin can now properly compute s-=s as an empty set.
- SF bug #1238681: freed pointer is used in longobject.c:long_pow().
- SF bug #1185883: Python's small-object memory allocator took over
a block managed by the platform C library whenever a realloc specified
a small new size. However, there's no portable way to know then how
much of the address space following the pointer is valid, so no
portable way to copy data from the C-managed block into Python's
small-object space without risking a memory fault. Python's small-object
realloc now leaves such blocks under the control of the platform C
realloc.
- Fix garbage collection for set and frozenset objects. SF patch #1200018.
- It is now safe to call PyGILState_Release() before
PyEval_InitThreads() (note that if there is reason to believe there
are multiple threads around you still must call PyEval_InitThreads()
before using the Python API; this fix is for extension modules that
have no way of knowing if Python is multi-threaded yet).
- Typing Ctrl-C whilst raw_input() was waiting in a build with threads
disabled caused a crash.
- Bug #1165306: instancemethod_new allowed the creation of a method
with im_class == im_self == NULL, which caused a crash when called.
Extension Modules
-----------------
- Bug #1413192, fix seg fault in bsddb if a transaction was deleted
before the env.
- Bug #1402308, (possible) segfault when using mmap.mmap(-1, ...)
- Bug #1400822, _curses over{lay,write} doesn't work when passing 6 ints.
Also fix ungetmouse() which did not accept arguments properly.
The code now conforms to the documented signature.
- Bug #1400115, Fix segfault when calling curses.panel.userptr()
without prior setting of the userptr.
- Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint
- Fix memory leak in posix.access().
- Patch #1213831: Fix typo in unicodedata._getcode.
- Bug #1007046: os.startfile() did not accept unicode strings encoded in
the file system encoding.
- Patch #756021: Special-case socket.inet_aton('255.255.255.255') for
platforms that don't have inet_aton().
- Bug #1215928: Fix bz2.BZ2File.seek() for 64-bit file offsets.
- Bug #1191043: Fix bz2.BZ2File.(x)readlines() for files containing one line
without newlines.
- Bug #728515: mmap.resize() now resizes the file on Unix as it did
on Windows.
- Bug #1234979: For the argument of thread.Lock.acquire, the Windows
implemented treated all integer values except 1 as false.
- Bug #1194181: bz2.BZ2File didn't handle mode 'U' correctly.
- Bug #1166660: The readline module could segfault if hook functions
were set in a different thread than that which called readline.
- weakref proxy has incorrect __nonzero__ behavior. SF bug #1770766.
Library
-------
- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE
to get the correct encoding.
- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of
languages.
- Patch #1268314: Cache lines in StreamReader.readlines for performance.
- Bug #1290505: time.strptime() was not invalidating its regex cache when the
locale changed.
- Fix a misuse of str.find() in detection of use of %U or %W in datetime
format.
- Bug #1167128: Fix size of a symlink in a tarfile to be 0.
- Patch #810023: Fix off-by-one bug in urllib.urlretrieve reporthook
functionality.
- Bug #1163178: Make IDNA return an empty string when the input is empty.
- Bug #1121494: distutils.dir_utils.mkpath now accepts Unicode strings.
- Bug #1178484: Return complete lines from codec stream readers
even if there is an exception in later lines, resulting in
correct line numbers for decoding errors in source code.
- Bug #1266283: "lexists" is now in os.path.__all__.
- The sets module can now properly compute s-=s and s^=s as an empty set.
- Bug #1192315: Disallow negative arguments to clear() in pdb.
- Patch #827386: Support absolute source paths in msvccompiler.py.
- Fix a problem in Tkinter introduced by SF patch #869468: delete bogus
__hasattr__ and __delattr__ methods on class Tk that were breaking
Tkdnd.
- Bug #1015140: disambiguated the term "article id" in nntplib docs and
docstrings to either "article number" or "message id".
- Bug #1177468: Don't cache the /dev/urandom file descriptor for os.urandom,
as this can cause problems with apps closing all file descriptors.
- Bug #839151: Fix an attempt to access sys.argv in the warnings module
though this can be missing in embedded interpreters
- Bug #1155638: Fix a bug which affected HTTP 0.9 responses in httplib.
- Bug #1100201: Cross-site scripting was possible on BaseHTTPServer via
error messages.
- Bug #1224621: tokenize module does not detect inconsistent dedents
- Bug #1196315: fix weakref.WeakValueDictionary constructor.
- Bug #1213894: os.path.realpath didn't resolve symlinks that were the first
component of the path.
- distutils.commands.register now encodes the data as UTF-8 before posting
them to PyPI.
- Partial fixes for SF bugs #1163244 and #1175396: If a chunk read by
``codecs.StreamReader.readline()`` has a trailing "\r", read one more
character even if the user has passed a size parameter to get a proper
line ending. Remove the special handling of a "\r\n" that has been split
between two lines.
- Bug #1251300: On UCS-4 builds the "unicode-internal" codec will now complain
about illegal code points. The codec now supports PEP 293 style error
handlers.
- Bug #1235646: ``codecs.StreamRecoder.next()`` now reencodes the data it reads
from the input stream, so that the output is a byte string in the correct
encoding instead of a unicode string.
- Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than
considering it exactly like a '*'.
Build
-----
- Patch #1160164: Build zlib.pyd for Itanium.
- Bug #1189330: configure did not correctly determine the necessary
value of LINKCC if python was built with GCC 4.0.
- Upgrade Windows build to zlib 1.2.3 which eliminates a potential security
vulnerability in zlib 1.2.1 and 1.2.2.
Documentation
-------------
- Bug #1402224: Add warning to dl docs about crashes.
- Bug #1396471: Document that Windows' ftell() can return invalid
values for text files with UNIX-style line endings.
- Bug #1274828: Document os.path.splitunc().
- Bug #1190204: Clarify which directories are searched by site.py.
- Bug #1193849: Clarify os.path.expanduser() documentation.
- Bug #1243192: re.UNICODE and re.LOCALE affect \d, \D, \s and \S.
- Bug #755617: Document the effects of os.chown() on Windows.
- Patch #1180012: The documentation for modulefinder is now in the library reference.
- Patch #1213031: Document that os.chown() accepts argument values of -1.
- Bug #1190563: Document os.waitpid() return value with WNOHANG flag.
- Bug #1175022: Correct the example code for property().
Tools/Demos
-----------
- Bug #1072853: pindent.py used an uninitialized variable.
What's New in Python 2.4.1 final?
=================================
*Release date: 30-MAR-2005*
Core and builtins
-----------------
- Move exception finalisation later in the shutdown process - this
fixes the crash seen in bug #1165761
Tests
-----
- SF patch 1167316: doctest.py fails self-test if run directly.
Build
-----
- SF patch 1171767: Darwin 8's headers are anal about POSIX compliance,
and linking has changed (prebinding is now deprecated, and libcc_dynamic
no longer exists). This configure patch makes things right.
What's New in Python 2.4.1c2?
=============================
*Release date: 17-MAR-2005*
Library
-------
- Fixed decimal operator and comparison methods to return NotImplemented
instead of raising a TypeError when interacting with other types.
Allows other classes to successfully implement __radd__ style methods.
- Bug #1163325: Decimal infinities failed to hash. Attempting to
hash a NaN raised an InvalidOperation instead of a TypeError.
- Bug #1160802: can't build Zope on Windows with 2.4.1c1. The
``MSVCCompiler`` class in distutils forgot to record that it was
initialized, and continued adding redundant entries to the system
``PATH`` environment variable until ``putenv()`` complained about the
size. This only affected building projects with many C extensions,
and only on Windows using Microsoft's compiler. This wasn't visible
before because a bugfix first included in 2.4.1c1 provoked it (bug
#1110478: revert os.environ.update to do putenv again).
- Bug #1156259: Seeking in codecs.reader was broken, now fixed.
Tests
-----
- Fix the test for socket.getfqdn() in test_socket to also consider the host
name returned by socket.gethostname() a valid return value for getfqdn().
Also clarified the wording of docs and docstring that this is the case.
Extensions Modules
------------------
- os.access now supports Unicode path names on non-Win32 systems.
What's New in Python 2.4.1c1?
=============================
*Release date: 10-MAR-2005*
Core and builtins
-----------------
- Bug #1155938: new style classes did not verify that __init__()
returns None.
- Bug #723201: Raise a TypeError for passing bad objects to 'L' format.
- Bug #1124295: the __name__ attribute of file objects was
inadvertently made inaccessible in restricted mode.
- Bug #1074011: closing sys.std{out,err} now causes a flush() and
an ferror() call.
- Bug #1085744: Add missing overflow check to PySequence_Tuple().
Make resize schedule linear (amortized).
- marshal.dumps() no longer crashes when the optional argument ``version``
is provided.
Extension Modules
-----------------
- Patches #925152, #1118602: Avoid reading after the end of the buffer
in pyexpat.GetInputContext.
- Patch #1093585: raise a ValueError for negative history items in readline.
{remove_history,replace_history}
Library
-------
- Patch #1075887: Don't require MSVC in distutils if there is nothing
to build.
- Patch #1103407: Properly deal with tarfile iterators when untarring
symbolic links on Windows.
- Patch #1117454: Remove code to special-case cookies without values
in LWPCookieJar.
- Patch #1117339: Add cookielib special name tests.
- Patch #1112812: Make bsddb/__init__.py more friendly for modulefinder.
- Patch #1121234: Properly cleanup _exit and tkerror commands.
- Applied a security fix to SimpleXMLRPCserver (PSF-2005-001). This
disables recursive traversal through instance attributes, which can
be exploited in various ways.
- Bug #1110478: Revert os.environ.update to do putenv again.
- Bug #1103844: fix distutils.install.dump_dirs() with negated options.
- Bug #1067732: wininst --install-script doesn't leave residual files anymore.
- StringIO.truncate() now correctly adjusts the size attribute.
(Bug #951915).
- The decimal module wouldn't run on builds without threads (Bug #1083645).
- Bug #1086555: Fix leak in syslog module.
- atexit.register no longer references the sys module before importing it.
(Bug #1083202).
- unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully
extended or overridden by subclasses. Formerly, the subclassed method would
be ignored by the rest of the module. (Bug #1078905).
- Bug #1076985: ``codecs.StreamReader.readline()`` now calls ``read()`` only
once when a size argument is given. This prevents a buffer overflow in the
tokenizer with very long source lines.
- Bug #1083110: ``zlib.decompress.flush()`` would segfault if called immediately
after creating the object, without any intervening ``.decompress()`` calls.
- Bug #1149508: ``textwrap`` now handles hyphenated numbers (eg. "2004-03-05")
correctly.
Build
-----
- Bug #1158607: Build with --disable-unicode again.
- term.h is now properly detected again.
- Check for tzset no longer dependent on tm->tm_zone to exist in the struct
(not required by either ISO C nor the UNIX 2 spec).
Tests for sanity in tzname when HAVE_TZNAME defined were also defined.
Closes bug #1096244. Thanks Gregory Bond.
Windows
-------
- Bug #1076861: The IDLE shortcut is now correct even if the target
directory contains a space.
- Bug #1085208 and similar: The installer does not fail anymore if
VBScript is not available on the target machine, not installed
properly, or outdated; the MSI package now does not rely on VB
anymore.
Macintosh
---------
- Bug #1091468: make frameworkinstall now works with DESTROOT builds
- On 10.3 and later extensions are built with -undefined dynamic_lookup.
This ensures that extensions can be built in older versions of Python after
a newer framework has been installed. In addition, an extension will not
accidentally pull in another copy of the Python interpreter.
On 10.2 and earlier (or if MACOSX_DEPLOYMENT_TARGET is set to a value <= 10.2)
extensions are linked directly to the dylib in the framework, in stead
of against the framework itself. This ensures that extensions can be built
in older versions of Python after a newer framework has been installed.
- PackageManager and the underlying pimp.py module have been updated to
version 0.5, which greatly simplifies maintainance of the package
databases.
Documentation
-------------
- Remove all latent references for "Macintosh" that referred to semantics for
Mac OS 9 and change to reflect the state for OS X.
Closes patch #1095802. Thanks Jack Jansen.
What's New in Python 2.4 final?
===============================
*Release date: 30-NOV-2004*
Core and builtins
-----------------
- Bug 875692: Improve signal handling, especially when using threads, by
forcing an early re-execution of PyEval_EvalFrame() "periodic" code when
things_to_do is not cleared by Py_MakePendingCalls().
What's New in Python 2.4 (release candidate 1)
==============================================
*Release date: 18-NOV-2004*
Core and builtins
-----------------
- Bug 1061968: Fixes in 2.4a3 to address thread bug 1010677 reintroduced
the years-old thread shutdown race bug 225673. Numeric history lesson
aside, all bugs in all three reports are fixed now.
Library
-------
- Bug 1052242: If exceptions are raised by an atexit handler function an
attempt is made to execute the remaining handlers. The last exception
raised is re-raised.
- ``doctest``'s new support for adding ``pdb.set_trace()`` calls to
doctests was broken in a dramatic but shallow way. Fixed.
- Bug 1065388: ``calendar``'s ``day_name``, ``day_abbr``, ``month_name``,
and ``month_abbr`` attributes emulate sequences of locale-correct
spellings of month and day names. Because the locale can change at
any time, the correct spelling is recomputed whenever one of these is
indexed. In the worst case, the index may be a slice object, so these
recomputed every day or month name each time they were indexed. This is
much slower than necessary in the usual case, when the index is just an
integer. In that case, only the single spelling needed is recomputed
now; and, when the index is a slice object, only the spellings needed
by the slice are recomputed now.
- Patch 1061679: Added ``__all__`` to pickletools.py.
Build
-----
- Bug 1034277 / Patch 1035255: Remove compilation of core against CoreServices
and CoreFoundation on OS X. Involved removing PyMac_GetAppletScriptFile()
which has no known users. Thanks Bob Ippolito.
C API
-----
- The PyRange_New() function is deprecated.
What's New in Python 2.4 beta 2?
================================
*Release date: 03-NOV-2004*
License
-------
The Python Software Foundation changed the license under which Python
is released, to remove Python version numbers. There were no other
changes to the license. So, for example, wherever the license for
Python 2.3 said "Python 2.3", the new license says "Python". The
intent is to make it possible to refer to the PSF license in a more
durable way. For example, some people say they're confused by that
the Open Source Initiative's entry for the Python Software Foundation
License::
http://www.opensource.org/licenses/PythonSoftFoundation.php
says "Python 2.1.1" all over it, wondering whether it applies only
to Python 2.1.1.
The official name of the new license is the Python Software Foundation
License Version 2.
Core and builtins
-----------------
- Bug #1055820 Cyclic garbage collection was not protecting against that
calling a live weakref to a piece of cyclic trash could resurrect an
insane mutation of the trash if any Python code ran during gc (via
running a dead object's __del__ method, running another callback on a
weakref to a dead object, or via any Python code run in any other thread
that managed to obtain the GIL while a __del__ or callback was running
in the thread doing gc). The most likely symptom was "impossible"
``AttributeEror`` exceptions, appearing seemingly at random, on weakly
referenced objects. The cure was to clear all weakrefs to unreachable
objects before allowing any callbacks to run.
- Bug #1054139 _PyString_Resize() now invalidates its cached hash value.
Extension Modules
-----------------
- Bug #1048870: the compiler now generates distinct code objects for
functions with identical bodies. This was producing confusing
traceback messages which pointed to the function where the code
object was first defined rather than the function being executed.
Library
-------
- Patch #1056967 changes the semantics of Template.safe_substitute() so that
no ValueError is raised on an 'invalid' match group. Now the delimiter is
returned.
- Bug #1052503 pdb.runcall() was not passing along keyword arguments.
- Bug #902037: XML.sax.saxutils.prepare_input_source() now combines relative
paths with a base path before checking os.path.isfile().
- The whichdb module can now be run from the command line.
- Bug #1045381: time.strptime() can now infer the date using %U or %W (week of
the year) when the day of the week and year are also specified.
- Bug #1048816: fix bug in Ctrl-K at start of line in curses.textpad.Textbox
- Bug #1017553: fix bug in tarfile.filemode()
- Patch #737473: fix bug that old source code is shown in tracebacks even if
the source code is updated and reloaded.
Build
-----
- Patch #1044395: --enable-shared is allowed in FreeBSD also.
What's New in Python 2.4 beta 1?
================================
*Release date: 15-OCT-2004*
Core and builtins
-----------------
- Patch #975056: Restartable signals were not correctly disabled on
BSD systems. Consistently use PyOS_setsig() instead of signal().
- The internal portable implementation of thread-local storage (TLS), used
by the ``PyGILState_Ensure()``/``PyGILState_Release()`` API, was not
thread-correct. This could lead to a variety of problems, up to and
including segfaults. See bug 1041645 for an example.
- Added a command line option, -m module, which searches sys.path for the
module and then runs it. (Contributed by Nick Coghlan.)
- The bytecode optimizer now folds tuples of constants into a single
constant.
- SF bug #513866: Float/long comparison anomaly. Prior to 2.4b1, when
an integer was compared to a float, the integer was coerced to a float.
That could yield spurious overflow errors (if the integer was very
large), and to anomalies such as
``long(1e200)+1 == 1e200 == long(1e200)-1``. Coercion to float is no
longer performed, and cases like ``long(1e200)-1 < 1e200``,
``long(1e200)+1 > 1e200`` and ``(1 << 20000) > 1e200`` are computed
correctly now.
Extension modules
-----------------
- ``collections.deque`` objects didn't play quite right with garbage
collection, which could lead to a segfault in a release build, or
an assert failure in a debug build. Also, added overflow checks,
better detection of mutation during iteration, and shielded deque
comparisons from unusual subclass overrides of the __iter__() method.
Library
-------
- Patch 1046644: distutils build_ext grew two new options - --swig for
specifying the swig executable to use, and --swig-opts to specify
options to pass to swig. --swig-opts="-c++" is the new way to spell
--swig-cpp.
- Patch 983206: distutils now obeys environment variable LDSHARED, if
it is set.
- Added Peter Astrand's subprocess.py module. See PEP 324 for details.
- time.strptime() now properly escapes timezones and all other locale-specific
strings for regex-specific symbols. Was breaking under Japanese Windows when
the timezone was specified as "Tokyo (standard time)".
Closes bug #1039270.
- Updates for the email package:
+ email.Utils.formatdate() grew a 'usegmt' argument for HTTP support.
+ All deprecated APIs that in email 2.x issued warnings have been removed:
_encoder argument to the MIMEText constructor, Message.add_payload(),
Utils.dump_address_pair(), Utils.decode(), Utils.encode()
+ New deprecations: Generator.__call__(), Message.get_type(),
Message.get_main_type(), Message.get_subtype(), the 'strict' argument to
the Parser constructor. These will be removed in email 3.1.
+ Support for Python earlier than 2.3 has been removed (see PEP 291).
+ All defect classes have been renamed to end in 'Defect'.
+ Some FeedParser fixes; also a MultipartInvariantViolationDefect will be
added to messages that claim to be multipart but really aren't.
+ Updates to documentation.
- re's findall() and finditer() functions now take an optional flags argument
just like the compile(), search(), and match() functions. Also, documented
the previously existing start and stop parameters for the findall() and
finditer() methods of regular expression objects.
- rfc822 Messages now support iterating over the headers.
- The (undocumented) tarfile.Tarfile.membernames has been removed;
applications should use the getmember function.
- httplib now offers symbolic constants for the HTTP status codes.
- SF bug #1028306: Trying to compare a ``datetime.date`` to a
``datetime.datetime`` mistakenly compared only the year, month and day.
Now it acts like a mixed-type comparison: ``False`` for ``==``,
``True`` for ``!=``, and raises ``TypeError`` for other comparison
operators. Because datetime is a subclass of date, comparing only the
base class (date) members can still be done, if that's desired, by
forcing using of the approprate date method; e.g.,
``a_date.__eq__(a_datetime)`` is true if and only if the year, month
and day members of ``a_date`` and ``a_datetime`` are equal.
- bdist_rpm now supports command line options --force-arch,
{pre,post}-install, {pre,post}-uninstall, and
{prep,build,install,clean,verify}-script.
- SF patch #998993: The UTF-8 and the UTF-16 stateful decoders now support
decoding incomplete input (when the input stream is temporarily exhausted).
``codecs.StreamReader`` now implements buffering, which enables proper
readline support for the UTF-16 decoders. ``codecs.StreamReader.read()``
has a new argument ``chars`` which specifies the number of characters to
return. ``codecs.StreamReader.readline()`` and
``codecs.StreamReader.readlines()`` have a new argument ``keepends``.
Trailing "\n"s will be stripped from the lines if ``keepends`` is false.
- The documentation for doctest is greatly expanded, and now covers all
the new public features (of which there are many).
- ``doctest.master`` was put back in, and ``doctest.testmod()`` once again
updates it. This isn't good, because every ``testmod()`` call
contributes to bloating the "hidden" state of ``doctest.master``, but
some old code apparently relies on it. For now, all we can do is
encourage people to stitch doctests together via doctest's unittest
integration features instead.
- httplib now handles ipv6 address/port pairs.
- SF bug #1017864: ConfigParser now correctly handles default keys,
processing them with ``ConfigParser.optionxform`` when supplied,
consistent with the handling of config file entries and runtime-set
options.
- SF bug #997050: Document, test, & check for non-string values in
ConfigParser. Moved the new string-only restriction added in
rev. 1.65 to the SafeConfigParser class, leaving existing
ConfigParser & RawConfigParser behavior alone, and documented the
conditions under which non-string values work.
Build
-----
- Building on darwin now includes /opt/local/include and /opt/local/lib for
building extension modules. This is so as to include software installed as
a DarwinPorts port <http://darwinports.opendarwin.org/>
- pyport.h now defines a Py_IS_NAN macro. It works as-is when the
platform C computes true for ``x != x`` if and only if X is a NaN.
Other platforms can override the default definition with a platform-
specific spelling in that platform's pyconfig.h. You can also override
pyport.h's default Py_IS_INFINITY definition now.
C API
-----
- SF patch 1044089: New function ``PyEval_ThreadsInitialized()`` returns
non-zero if PyEval_InitThreads() has been called.
- The undocumented and unused extern int ``_PyThread_Started`` was removed.
- The C API calls ``PyInterpreterState_New()`` and ``PyThreadState_New()``
are two of the very few advertised as being safe to call without holding
the GIL. However, this wasn't true in a debug build, as bug 1041645
demonstrated. In a debug build, Python redirects the ``PyMem`` family
of calls to Python's small-object allocator, to get the benefit of
its extra debugging capabilities. But Python's small-object allocator
isn't threadsafe, relying on the GIL to avoid the expense of doing its
own locking. ``PyInterpreterState_New()`` and ``PyThreadState_New()``
call the platform ``malloc()`` directly now, regardless of build type.
- PyLong_AsUnsignedLong[Mask] now support int objects as well.
- SF patch #998993: ``PyUnicode_DecodeUTF8Stateful`` and
``PyUnicode_DecodeUTF16Stateful`` have been added, which implement stateful
decoding.
Tests
-----
- test__locale ported to unittest
Mac
---
- ``plistlib`` now supports non-dict root objects. There is also a new
interface for reading and writing plist files: ``readPlist(pathOrFile)``
and ``writePlist(rootObject, pathOrFile)``
Tools/Demos
-----------
- The text file comparison scripts ``ndiff.py`` and ``diff.py`` now
read the input files in universal-newline mode. This spares them
from consuming a great deal of time to deduce the useless result that,
e.g., a file with Windows line ends and a file with Linux line ends
have no lines in common.
What's New in Python 2.4 alpha 3?
=================================
*Release date: 02-SEP-2004*
Core and builtins
-----------------
- SF patch #1007189: ``from ... import ...`` statements now allow the name
list to be surrounded by parentheses.
- Some speedups for long arithmetic, thanks to Trevor Perrin. Gradeschool
multiplication was sped a little by optimizing the C code. Gradeschool
squaring was sped by about a factor of 2, by exploiting that about half
the digit products are duplicates in a square. Because exponentiation
uses squaring often, this also speeds long power. For example, the time
to compute 17**1000000 dropped from about 14 seconds to 9 on my box due
to this much. The cutoff for Karatsuba multiplication was raised,
since gradeschool multiplication got quicker, and the cutoff was
aggressively small regardless. The exponentiation algorithm was switched
from right-to-left to left-to-right, which is more efficient for small
bases. In addition, if the exponent is large, the algorithm now does
5 bits (instead of 1 bit) at a time. That cut the time to compute
17**1000000 on my box in half again, down to about 4.5 seconds.
- OverflowWarning is no longer generated. PEP 237 scheduled this to
occur in Python 2.3, but since OverflowWarning was disabled by default,
nobody realized it was still being generated. On the chance that user
code is still using them, the Python builtin OverflowWarning, and
corresponding C API PyExc_OverflowWarning, will exist until Python 2.5.
- Py_InitializeEx has been added.
- Fix the order of application of decorators. The proper order is bottom-up;
the first decorator listed is the last one called.
- SF patch #1005778. Fix a seg fault if the list size changed while
calling list.index(). This could happen if a rich comparison function
modified the list.
- The ``func_name`` (a.k.a. ``__name__``) attribute of user-defined
functions is now writable.
- code_new (a.k.a new.code()) now checks its arguments sufficiently
carefully that passing them on to PyCode_New() won't trigger calls
to Py_FatalError() or PyErr_BadInternalCall(). It is still the case
that the returned code object might be entirely insane.
- Subclasses of string can no longer be interned. The semantics of
interning were not clear here -- a subclass could be mutable, for
example -- and had bugs. Explicitly interning a subclass of string
via intern() will raise a TypeError. Internal operations that attempt
to intern a string subclass will have no effect.
- Bug 1003935: xrange() could report bogus OverflowErrors. Documented
what xrange() intends, and repaired tests accordingly.
Extension modules
-----------------
- difflib now supports HTML side-by-side diff.
- os.urandom has been added for systems that support sources of random
data.
- Patch 1012740: truncate() on a writeable cStringIO now resets the
position to the end of the stream. This is consistent with the original
StringIO module and avoids inadvertently resurrecting data that was
supposed to have been truncated away.
- Added socket.socketpair().
- Added CurrentByteIndex, CurrentColumnNumber, CurrentLineNumber
members to xml.parsers.expat.XMLParser object.
- The mpz, rotor, and xreadlines modules, all deprecated in earlier
versions of Python, have now been removed.
Library
-------
- Patch #934356: if a module defines __all__, believe that rather than using
heuristics for filtering out imported names.
- Patch #941486: added os.path.lexists(), which returns True for broken
symlinks, unlike os.path.exists().
- the random module now uses os.urandom() for seeding if it is available.
Added a new generator based on os.urandom().
- difflib and diff.py can now generate HTML.
- bdist_rpm now includes version and release in the BuildRoot, and
replaces - by ``_`` in version and release.
- distutils build/build_scripts now has an -e option to specify the
path to the Python interpreter for installed scripts.
- PEP 292 classes Template and SafeTemplate are added to the string module.
- tarfile now generates GNU tar files by default.
- HTTPResponse has now a getheaders method.
- Patch #1006219: let inspect.getsource handle '@' decorators. Thanks Simon
Percivall.
- logging.handlers.SMTPHandler.date_time has been removed;
the class now uses email.Utils.formatdate to generate the time stamp.
- A new function tkFont.nametofont was added to return an existing
font. The Font class constructor now has an additional exists argument
which, if True, requests to return/configure an existing font, rather
than creating a new one.
- Updated the decimal package's min() and max() methods to match the
latest revision of the General Decimal Arithmetic Specification.
Quiet NaNs are ignored and equal values are sorted based on sign
and exponent.
- The decimal package's Context.copy() method now returns deep copies.
- Deprecated sys.exitfunc in favor of the atexit module. The sys.exitfunc
attribute will be kept around for backwards compatibility and atexit
will just become the one preferred way to do it.
- patch #675551: Add get_history_item and replace_history_item functions
to the readline module.
- bug #989672: pdb.doc and the help messages for the help_d and help_u methods
of the pdb.Pdb class gives have been corrected. d(own) goes to a newer
frame, u(p) to an older frame, not the other way around.
- bug #990669: os.path.realpath() will resolve symlinks before normalizing the
path, as normalizing the path may alter the meaning of the path if it
contains symlinks.
- bug #851123: shutil.copyfile will raise an exception when trying to copy a
file onto a link to itself. Thanks Gregory Ball.
- bug #570300: Fix inspect to resolve file locations using os.path.realpath()
so as to properly list all functions in a module when the module itself is
reached through a symlink. Thanks Johannes Gijsbers.
- doctest refactoring continued. See the docs for details. As part of
this effort, some old and little- (never?) used features are now
deprecated: the Tester class, the module is_private() function, and the
isprivate argument to testmod(). The Tester class supplied a feeble
"by hand" way to combine multiple doctests, if you knew exactly what
you were doing. The newer doctest features for unittest integration
already did a better job of that, are stronger now than ever, and the
new DocTestRunner class is a saner foundation if you want to do it by
hand. The "private name" filtering gimmick was a mistake from the
start, and testmod() changed long ago to ignore it by default. If
you want to filter out tests, the new DocTestFinder class can be used
to return a list of all doctests, and you can filter that list by
any computable criteria before passing it to a DocTestRunner instance.
- Bug #891637, patch #1005466: fix inspect.getargs() crash on def foo((bar)).
Tools/Demos
-----------
- IDLE's shortcut keys for windows are now case insensitive so that
Control-V works the same as Control-v.
- pygettext.py: Generate POT-Creation-Date header in ISO format.
Build
-----
- Backward incompatibility: longintrepr.h now triggers a compile-time
error if SHIFT (the number of bits in a Python long "digit") isn't
divisible by 5. This new requirement allows simple code for the new
5-bits-at-a-time long_pow() implementation. If necessary, the
restriction could be removed (by complicating long_pow(), or by
falling back to the 1-bit-at-a-time algorithm), but there are no
plans to do so.
- bug #991962: When building with --disable-toolbox-glue on Darwin no
attempt to build Mac-specific modules occurs.
- The --with-tsc flag to configure to enable VM profiling with the
processor's timestamp counter now works on PPC platforms.
- patch #1006629: Define _XOPEN_SOURCE to 500 on Solaris 8/9 to match
GCC's definition and avoid redefinition warnings.
- Detect pthreads support (provided by gnu pth pthread emulation) on
GNU/k*BSD systems.
- bug #1005737, #1007249: Fixed several build problems and warnings
found on old/legacy C compilers of HP-UX, IRIX and Tru64.
C API
-----
..
Documentation
-------------
- patch #1005936, bug #1009373: fix index entries which contain
an underscore when viewed with Acrobat.
- bug #990669: os.path.normpath may alter the meaning of a path if
it contains symbolic links. This has been documented in a comment
since 1992, but is now in the library reference as well.
New platforms
-------------
- FreeBSD 6 is now supported.
Tests
-----
..
Windows
-------
- Boosted the stack reservation for python.exe and pythonw.exe from
the default 1MB to 2MB. Stack frames under VC 7.1 for 2.4 are enough
bigger than under VC 6.0 for 2.3.4 that deeply recursive progams
within the default sys.getrecursionlimit() default value of 1000 were
able to suffer undetected C stack overflows. The standard test program
test_compiler was one such program. If a Python process on Windows
"just vanishes" without a trace, and without an error message of any
kind, but with an exit code of 128, undetected stack overflow may be
the problem.
Mac
---
..
What's New in Python 2.4 alpha 2?
=================================
*Release date: 05-AUG-2004*
Core and builtins
-----------------
- Patch #980695: Implements efficient string concatenation for statements
of the form s=s+t and s+=t. This will vary across implementations.
Accordingly, the str.join() method is strongly preferred for performance
sensitive code.
- PEP-0318, Function Decorators have been added to the language. These are
implemented using the Java-style @decorator syntax, like so::
@staticmethod
def foo(bar):
(The PEP needs to be updated to reflect the current state)
- When importing a module M raises an exception, Python no longer leaves M
in sys.modules. Before 2.4a2 it did, and a subsequent import of M would
succeed, picking up a module object from sys.modules reflecting as much
of the initialization of M as completed before the exception was raised.
Subsequent imports got no indication that M was in a partially-
initialized state, and the importers could get into arbitrarily bad
trouble as a result (the M they got was in an unintended state,
arbitrarily far removed from M's author's intent). Now subsequent
imports of M will continue raising exceptions (but if, for example, the
source code for M is edited between import attempts, then perhaps later
attempts will succeed, or raise a different exception).
This can break existing code, but in such cases the code was probably
working before by accident. In the Python source, the only case of
breakage discovered was in a test accidentally relying on a damaged
module remaining in sys.modules. Cases are also known where tests
deliberately provoking import errors remove damaged modules from
sys.modules themselves, and such tests will break now if they do an
unconditional del sys.modules[M].
- u'%s' % obj will now try obj.__unicode__() first and fallback to
obj.__str__() if no __unicode__ method can be found.
- Patch #550732: Add PyArg_VaParseTupleAndKeywords(). Analogous to
PyArg_VaParse(). Both are now documented. Thanks Greg Chapman.
- Allow string and unicode return types from .encode()/.decode()
methods on string and unicode objects. Added unicode.decode()
which was missing for no apparent reason.
- An attempt to fix the mess that is Python's behaviour with
signal handlers and threads, complicated by readline's behaviour.
It's quite possible that there are still bugs here.
- Added C macros Py_CLEAR and Py_VISIT to ease the implementation of
types that support garbage collection.
- Compiler now treats None as a constant.
- The type of values returned by __int__, __float__, __long__,
__oct__, and __hex__ are now checked. Returning an invalid type
will cause a TypeError to be raised. This matches the behavior of
Jython.
- Implemented bind_textdomain_codeset() in locale module.
- Added a workaround for proper string operations in BSDs. str.split
and str.is* methods can now work correctly with UTF-8 locales.
- Bug #989185: unicode.iswide() and unicode.width() is dropped and
the East Asian Width support is moved to unicodedata extension
module.
- Patch #941229: The source code encoding in interactive mode
now refers sys.stdin.encoding not just ISO-8859-1 anymore. This
allows for non-latin-1 users to write unicode strings directly.
Extension modules
-----------------
- cpickle now supports the same keyword arguments as pickle.
Library
-------
- Added new codecs and aliases for ISO_8859-11, ISO_8859-16 and
TIS-620
- Thanks to Edward Loper, doctest has been massively refactored, and
many new features were added. Full docs will appear later. For now
the doctest module comments and new test cases give good coverage.
The refactoring provides many hook points for customizing behavior
(such as how to report errors, and how to compare expected to actual
output). New features include a <BLANKLINE> marker for expected
output containing blank lines, options to produce unified or context
diffs when actual output doesn't match expectations, an option to
normalize whitespace before comparing, and an option to use an
ellipsis to signify "don't care" regions of output.
- Tkinter now supports the wish -sync and -use options.
- The following methods in time support passing of None: ctime(), gmtime(),
and localtime(). If None is provided, the current time is used (the
same as when the argument is omitted).
[SF bug 658254, patch 663482]
- nntplib does now allow to ignore a .netrc file.
- urllib2 now recognizes Basic authentication even if other authentication
schemes are offered.
- Bug #1001053. wave.open() now accepts unicode filenames.
- gzip.GzipFile has a new fileno() method, to retrieve the handle of the
underlying file object (provided it has a fileno() method). This is
needed if you want to use os.fsync() on a GzipFile.
- imaplib has two new methods: deleteacl and myrights.
- nntplib has two new methods: description and descriptions. They
use a more RFC-compliant way of getting a newsgroup description.
- Bug #993394. Fix a possible red herring of KeyError in 'threading' being
raised during interpreter shutdown from a registered function with atexit
when dummy_threading is being used.
- Bug #857297/Patch #916874. Fix an error when extracting a hard link
from a tarfile.
- Patch #846659. Fix an error in tarfile.py when using
GNU longname/longlink creation.
- The obsolete FCNTL.py has been deleted. The builtin fcntl module
has been available (on platforms that support fcntl) since Python
1.5a3, and all FCNTL.py did is export fcntl's names, after generating
a deprecation warning telling you to use fcntl directly.
- Several new unicode codecs are added: big5hkscs, euc_jis_2004,
iso2022_jp_2004, shift_jis_2004.
- Bug #788520. Queue.{get, get_nowait, put, put_nowait} have new
implementations, exploiting Conditions (which didn't exist at the time
Queue was introduced). A minor semantic change is that the Full and
Empty exceptions raised by non-blocking calls now occur only if the
queue truly was full or empty at the instant the queue was checked (of
course the Queue may no longer be full or empty by the time a calling
thread sees those exceptions, though). Before, the exceptions could
also be raised if it was "merely inconvenient" for the implementation
to determine the true state of the Queue (because the Queue was locked
by some other method in progress).
- Bugs #979794 and #980117: difflib.get_grouped_opcodes() now handles the
case of comparing two empty lists. This affected both context_diff() and
unified_diff(),
- Bug #980938: smtplib now prints debug output to sys.stderr.
- Bug #930024: posixpath.realpath() now handles infinite loops in symlinks by
returning the last point in the path that was not part of any loop. Thanks
AM Kuchling.
- Bug #980327: ntpath not handles compressing erroneous slashes between the
drive letter and the rest of the path. Also clearly handles UNC addresses now
as well. Thanks Paul Moore.
- bug #679953: zipfile.py should now work for files over 2 GB. The packed data
for file sizes (compressed and uncompressed) was being stored as signed
instead of unsigned.
- decimal.py now only uses signals in the IBM spec. The other conditions are
no longer part of the public API.
- codecs module now has two new generic APIs: encode() and decode()
which don't restrict the return types (unlike the unicode and
string methods of the same name).
- Non-blocking SSL sockets work again; they were broken in Python 2.3.
SF patch 945642.
- doctest unittest integration improvements:
o Improved the unitest test output for doctest-based unit tests
o Can now pass setUp and tearDown functions when creating
DocTestSuites.
- The threading module has a new class, local, for creating objects
that provide thread-local data.
- Bug #990307: when keep_empty_values is True, cgi.parse_qsl()
no longer returns spurious empty fields.
- Implemented bind_textdomain_codeset() in gettext module.
- Introduced in gettext module the l*gettext() family of functions,
which return translation strings encoded in the preferred encoding,
as informed by locale module's getpreferredencoding().
- optparse module (and tests) upgraded to Optik 1.5a1. Changes:
- Add expansion of default values in help text: the string
"%default" in an option's help string is expanded to str() of
that option's default value, or "none" if no default value.
- Bug #955889: option default values that happen to be strings are
now processed in the same way as values from the command line; this
allows generation of nicer help when using custom types. Can
be disabled with parser.set_process_default_values(False).
- Bug #960515: don't crash when generating help for callback
options that specify 'type', but not 'dest' or 'metavar'.
- Feature #815264: change the default help format for short options
that take an argument from e.g. "-oARG" to "-o ARG"; add
set_short_opt_delimiter() and set_long_opt_delimiter() methods to
HelpFormatter to allow (slight) customization of the formatting.
- Patch #736940: internationalize Optik: all built-in user-
targeted literal strings are passed through gettext.gettext(). (If
you want translations (.po files), they're not included with Python
-- you'll find them in the Optik source distribution from
http://optik.sourceforge.net/ .)
- Bug #878453: respect $COLUMNS environment variable for
wrapping help output.
- Feature #988122: expand "%prog" in the 'description' passed
to OptionParser, just like in the 'usage' and 'version' strings.
(This is *not* done in the 'description' passed to OptionGroup.)
C API
-----
- PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx(): if an
error occurs while loading the module, these now delete the module's
entry from sys.modules. All ways of loading modules eventually call
one of these, so this is an error-case change in semantics for all
ways of loading modules. In rare cases, a module loader may wish
to keep a module object in sys.modules despite that the module's
code cannot be executed. In such cases, the module loader must
arrange to reinsert the name and module object in sys.modules.
PyImport_ReloadModule() has been changed to reinsert the original
module object into sys.modules if the module reload fails, so that
its visible semantics have not changed.
- A large pile of datetime field-extraction macros is now documented,
thanks to Anthony Tuininga (patch #986010).
Documentation
-------------
- Improved the tutorial on creating types in C.
- point out the importance of reassigning data members before
assigning their values
- correct my misconception about return values from visitprocs. Sigh.
- mention the labor saving Py_VISIT and Py_CLEAR macros.
- Major rewrite of the math module docs, to address common confusions.
Tests
-----
- The test data files for the decimal test suite are now installed on
platforms that use the Makefile.
- SF patch 995225: The test file testtar.tar accidentally contained
CVS keywords (like $Id: NEWS 67852 2008-12-19 15:02:52Z martin.v.loewis $), which could cause spurious failures in
test_tarfile.py depending on how the test file was checked out.
What's New in Python 2.4 alpha 1?
=================================
*Release date: 08-JUL-2004*
Core and builtins
-----------------
- weakref.ref is now the type object also known as
weakref.ReferenceType; it can be subclassed like any other new-style
class. There's less per-entry overhead in WeakValueDictionary
objects now (one object instead of three).
- Bug #951851: Python crashed when reading import table of certain
Windows DLLs.
- Bug #215126. The locals argument to eval(), execfile(), and exec now
accept any mapping type.
- marshal now shares interned strings. This change introduces
a new .pyc magic.
- Bug #966623. classes created with type() in an exec(, {}) don't
have a __module__, but code in typeobject assumed it would always
be there.
- Python no longer relies on the LC_NUMERIC locale setting to be
the "C" locale; as a result, it no longer tries to prevent changing
the LC_NUMERIC category.
- Bug #952807: Unpickling pickled instances of subclasses of
datetime.date, datetime.datetime and datetime.time could yield insane
objects. Thanks to Jiwon Seo for a fix.
- Bug #845802: Python crashes when __init__.py is a directory.
- Unicode objects received two new methods: iswide() and width().
These query East Asian width information, as specified in Unicode
TR11.
- Improved the tuple hashing algorithm to give fewer collisions in
common cases. Fixes bug #942952.
- Implemented generator expressions (PEP 289). Coded by Jiwon Seo.
- Enabled the profiling of C extension functions (and builtins) - check
new documentation and modified profile and bdb modules for more details
- Set file.name to the object passed to open (instead of a new string)
- Moved tracebackobject into traceback.h and renamed to PyTracebackObject
- Optimized the byte coding for multiple assignments like "a,b=b,a" and
"a,b,c=1,2,3". Improves their speed by 25% to 30%.
- Limit the nested depth of a tuple for the second argument to isinstance()
and issubclass() to the recursion limit of the interpreter.
Fixes bug #858016 .
- Optimized dict iterators, creating separate types for each
and having them reveal their length. Also optimized the
methods: keys(), values(), and items().
- Implemented a newcode opcode, LIST_APPEND, that simplifies
the generated bytecode for list comprehensions and further
improves their performance (about 35%).
- Implemented rich comparisons for floats, which seems to make
comparisons involving NaNs somewhat less surprising when the
underlying C compiler actually implements C99 semantics.
- Optimized list.extend() to save memory and no longer create
intermediate sequences. Also, extend() now pre-allocates the
needed memory whenever the length of the iterable is known in
advance -- this halves the time to extend the list.
- Optimized list resize operations to make fewer calls to the system
realloc(). Significantly speeds up list appends, list pops,
list comprehensions, and the list constructor (when the input iterable
length is not known).
- Changed the internal list over-allocation scheme. For larger lists,
overallocation ranged between 3% and 25%. Now, it is a constant 12%.
For smaller lists (n<8), overallocation was upto eight elements. Now,
the overallocation is no more than three elements -- this improves space
utilization for applications that have large numbers of small lists.
- Most list bodies now get re-used rather than freed. Speeds up list
instantiation and deletion by saving calls to malloc() and free().
- The dict.update() method now accepts all the same argument forms
as the dict() constructor. This now includes item lists and/or
keyword arguments.
- Support for arbitrary objects supporting the read-only buffer
interface as the co_code field of code objects (something that was
only possible to create from C code) has been removed.
- Made omitted callback and None equivalent for weakref.ref() and
weakref.proxy(); the None case wasn't handled correctly in all
cases.
- Fixed problem where PyWeakref_NewRef() and PyWeakref_NewProxy()
assumed that initial existing entries in an object's weakref list
would not be removed while allocating a new weakref object. Since
GC could be invoked at that time, however, that assumption was
invalid. In a truly obscure case of GC being triggered during
creation for a new weakref object for an referent which already
has a weakref without a callback which is only referenced from
cyclic trash, a memory error can occur. This consistently created a
segfault in a debug build, but provided less predictable behavior in
a release build.
- input() builtin function now respects compiler flags such as
__future__ statements. SF patch 876178.
- Removed PendingDeprecationWarning from apply(). apply() remains
deprecated, but the nuisance warning will not be issued.
- At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage
collection twice, both before and after tearing down modules. The
call after tearing down modules has been disabled, because too much
of Python has been torn down then for __del__ methods and weakref
callbacks to execute sanely. The most common symptom was a sequence
of uninformative messages on stderr when Python shut down, produced
by threads trying to raise exceptions, but unable to report the nature
of their problems because too much of the sys module had already been
destroyed.
- Removed FutureWarnings related to hex/oct literals and conversions
and left shifts. (Thanks to Kalle Svensson for SF patch 849227.)
This addresses most of the remaining semantic changes promised by
PEP 237, except for repr() of a long, which still shows the trailing
'L'. The PEP appears to promise warnings for operations that
changed semantics compared to Python 2.3, but this is not
implemented; we've suffered through enough warnings related to
hex/oct literals and I think it's best to be silent now.
- For str and unicode objects, the ljust(), center(), and rjust()
methods now accept an optional argument specifying a fill
character other than a space.
- When method objects have an attribute that can be satisfied either
by the function object or by the method object, the function
object's attribute usually wins. Christian Tismer pointed out that
that this is really a mistake, because this only happens for special
methods (like __reduce__) where the method object's version is
really more appropriate than the function's attribute. So from now
on, all method attributes will have precedence over function
attributes with the same name.
- Critical bugfix, for SF bug 839548: if a weakref with a callback,
its callback, and its weakly referenced object, all became part of
cyclic garbage during a single run of garbage collection, the order
in which they were torn down was unpredictable. It was possible for
the callback to see partially-torn-down objects, leading to immediate
segfaults, or, if the callback resurrected garbage objects, to
resurrect insane objects that caused segfaults (or other surprises)
later. In one sense this wasn't surprising, because Python's cyclic gc
had no knowledge of Python's weakref objects. It does now. When
weakrefs with callbacks become part of cyclic garbage now, those
weakrefs are cleared first. The callbacks don't trigger then,
preventing the problems. If you need callbacks to trigger, then just
as when cyclic gc is not involved, you need to write your code so
that weakref objects outlive the objects they weakly reference.
- Critical bugfix, for SF bug 840829: if cyclic garbage collection
happened to occur during a weakref callback for a new-style class
instance, subtle memory corruption was the result (in a release build;
in a debug build, a segfault occurred reliably very soon after).
This has been repaired.
- Compiler flags set in PYTHONSTARTUP are now active in __main__.
- Added two builtin types, set() and frozenset().
- Added a reversed() builtin function that returns a reverse iterator
over a sequence.
- Added a sorted() builtin function that returns a new sorted list
from any iterable.
- CObjects are now mutable (on the C level) through PyCObject_SetVoidPtr.
- list.sort() now supports three keyword arguments: cmp, key, and reverse.
The key argument can be a function of one argument that extracts a
comparison key from the original record: mylist.sort(key=str.lower).
The reverse argument is a boolean value and if True will change the
sort order as if the comparison arguments were reversed. In addition,
the documentation has been amended to provide a guarantee that all sorts
starting with Py2.3 are guaranteed to be stable (the relative order of
records with equal keys is unchanged).
- Added test whether wchar_t is signed or not. A signed wchar_t is not
usable as internal unicode type base for Py_UNICODE since the
unicode implementation assumes an unsigned type.
- Fixed a bug in the cache of length-one Unicode strings that could
lead to a seg fault. The specific problem occurred when an earlier,
non-fatal error left an uninitialized Unicode object in the
freelist.
- The % formatting operator now supports '%F' which is equivalent to
'%f'. This has always been documented but never implemented.
- complex(obj) could leak a little memory if obj wasn't a string or
number.
- zip() with no arguments now returns an empty list instead of raising
a TypeError exception.
- obj.__contains__() now returns True/False instead of 1/0. SF patch
820195.
- Python no longer tries to be smart about recursive comparisons.
When comparing containers with cyclic references to themselves it
will now just hit the recursion limit. See SF patch 825639.
- str and unicode builtin types now have an rsplit() method that is
same as split() except that it scans the string from the end
working towards the beginning. See SF feature request 801847.
- Fixed a bug in object.__reduce_ex__ when using protocol 2. Failure
to clear the error when attempts to get the __getstate__ attribute
fail caused intermittent errors and odd behavior.
- buffer objects based on other objects no longer cache a pointer to
the data and the data length. Instead, the appropriate tp_as_buffer
method is called as necessary.
- fixed: if a file is opened with an explicit buffer size >= 1, repeated
close() calls would attempt to free() the buffer already free()ed on
the first call.
Extension modules
-----------------
- Added socket.getservbyport(), and make the second argument in
getservbyname() and getservbyport() optional.
- time module code that deals with input POSIX timestamps will now raise
ValueError if more than a second is lost in precision when the
timestamp is cast to the platform C time_t type. There's no chance
that the platform will do anything sensible with the result in such
cases. This includes ctime(), localtime() and gmtime(). Assorted
fromtimestamp() and utcfromtimestamp() methods in the datetime module
were also protected. Closes bugs #919012 and 975996.
- fcntl.ioctl now warns if the mutate flag is not specified.
- nt now properly allows to refer to UNC roots, e.g. in nt.stat().
- the weakref module now supports additional objects: array.array,
sre.pattern_objects, file objects, and sockets.
- operator.isMappingType() and operator.isSequenceType() now give
fewer false positives.
- socket.sslerror is now a subclass of socket.error . Also added
socket.error to the socket module's C API.
- Bug #920575: A problem where the _locale module segfaults on
nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed.
- array objects now support the copy module. Also, their resizing
scheme has been updated to match that used for list objects. This improves
the performance (speed and memory usage) of append() operations.
Also, array.array() and array.extend() now accept any iterable argument
for repeated appends without needing to create another temporary array.
- cStringIO.writelines() now accepts any iterable argument and writes
the lines one at a time rather than joining them and writing once.
Made a parallel change to StringIO.writelines(). Saves memory and
makes suitable for use with generator expressions.
- time.strftime() now checks that the values in its time tuple argument
are within the proper boundaries to prevent possible crashes from the
platform's C library implementation of strftime(). Can possibly
break code that uses values outside the range that didn't cause
problems previously (such as sitting day of year to 0). Fixes bug
#897625.
- The socket module now supports Bluetooth sockets, if the
system has <bluetooth/bluetooth.h>
- Added a collections module containing a new datatype, deque(),
offering high-performance, thread-safe, memory friendly appends
and pops on either side of the deque.
- Several modules now take advantage of collections.deque() for
improved performance: Queue, mutex, shlex, threading, and pydoc.
- The operator module has two new functions, attrgetter() and
itemgetter() which are useful for creating fast data extractor
functions for map(), list.sort(), itertools.groupby(), and
other functions that expect a function argument.
- socket.SHUT_{RD,WR,RDWR} was added.
- os.getsid was added.
- The pwd module incorrectly advertised its struct type as
struct_pwent; this has been renamed to struct_passwd. (The old name
is still supported for backwards compatibility.)
- The xml.parsers.expat module now provides Expat 1.95.7.
- socket.IPPROTO_IPV6 was added.
- readline.clear_history was added.
- select.select() now accepts sequences for its first three arguments.
- cStringIO now supports the f.closed attribute.
- The signal module now exposes SIGRTMIN and SIGRTMAX (if available).
- curses module now supports use_default_colors(). [patch #739124]
- Bug #811028: ncurses.h breakage on FreeBSD/MacOS X
- Bug #814613: INET_ADDRSTRLEN fix needed for all compilers on SGI
- Implemented non-recursive SRE matching scheme (#757624).
- Implemented (?(id/name)yes|no) support in SRE (#572936).
- random.seed() with no arguments or None uses time.time() as a default
seed. Modified to match Py2.2 behavior and use fractional seconds so
that successive runs are more likely to produce different sequences.
- random.Random has a new method, getrandbits(k), which returns an int
with k random bits. This method is now an optional part of the API
for user defined generators. Any generator that defines genrandbits()
can now use randrange() for ranges with a length >= 2**53. Formerly,
randrange would return only even numbers for ranges that large (see
SF bug #812202). Generators that do not define genrandbits() now
issue a warning when randrange() is called with a range that large.
- itertools has a new function, groupby() for aggregating iterables
into groups sharing the same key (as determined by a key function).
It offers some of functionality of SQL's groupby keyword and of
the Unix uniq filter.
- itertools now has a new tee() function which produces two independent
iterators from a single iterable.
- itertools.izip() with no arguments now returns an empty iterator instead
of raising a TypeError exception.
- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
as parameter.
Library
-------
- Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects
the documented behavior: the function passed to the onerror()
handler can now also be os.listdir.
- Bug #754449: threading.Thread objects no longer mask exceptions raised during
interpreter shutdown with another exception from attempting to handle the
original exception.
- Added decimal.py per PEP 327.
- Bug #981299: rsync is now a recognized protocol in urlparse that uses a
"netloc" portion of a URL.
- Bug #919012: shutil.move() will not try to move a directory into itself.
Thanks Johannes Gijsbers.
- Bug #934282: pydoc.stripid() is now case-insensitive. Thanks Robin Becker.
- Bug #823209: cmath.log() now takes an optional base argument so that its
API matches math.log().
- Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions
that generate a -debuginfo.rpm
- os.path.devnull has been added for all supported platforms.
- Fixed #877165: distutils now picks the right C++ compiler command
on cygwin and mingw32.
- urllib.urlopen().readline() now handles HTTP/0.9 correctly.
- refactored site.py into functions. Also wrote regression tests for the
module.
- The distutils install command now supports the --home option and
installation scheme for all platforms.
- asyncore.loop now has a repeat count parameter that defaults to
looping forever.
- The distutils sdist command now ignores all .svn directories, in
addition to CVS and RCS directories. .svn directories hold
administrative files for the Subversion source control system.
- Added a new module: cookielib. Automatic cookie handling for HTTP
clients. Also, support for cookielib has been added to urllib2, so
urllib2.urlopen() can transparently handle cookies.
- stringprep.py now uses built-in set() instead of sets.Set().
- Bug #876278: Unbounded recursion in modulefinder
- Bug #780300: Swap public and system ID in LexicalHandler.startDTD.
Applications relying on the wrong order need to be corrected.
- Bug #926075: Fixed a bug that returns a wrong pattern object
for a string or unicode object in sre.compile() when a different
type pattern with the same value exists.
- Added countcallers arg to trace.Trace class (--trackcalls command line arg
when run from the command prompt).
- Fixed a caching bug in platform.platform() where the argument of 'terse' was
not taken into consideration when caching value.
- Added two new command-line arguments for profile (output file and
default sort).
- Added global runctx function to profile module
- Add hlist missing entryconfigure and entrycget methods.
- The ptcp154 codec was added for Kazakh character set support.
- Support non-anonymous ftp URLs in urllib2.
- The encodings package will now apply codec name aliases
first before starting to try the import of the codec module.
This simplifies overriding built-in codecs with external
packages, e.g. the included CJK codecs with the JapaneseCodecs
package, by adjusting the aliases dictionary in encodings.aliases
accordingly.
- base64 now supports RFC 3548 Base16, Base32, and Base64 encoding and
decoding standards.
- urllib2 now supports processors. A processor is a handler that
implements an xxx_request or xxx_response method. These methods are
called for all requests.
- distutils compilers now compile source files in the same order as
they are passed to the compiler.
- pprint.pprint() and pprint.pformat() now have additional parameters
indent, width and depth.
- Patch #750542: pprint now will pretty print subclasses of list, tuple
and dict too, as long as they don't overwrite __repr__().
- Bug #848614: distutils' msvccompiler fails to find the MSVC6
compiler because of incomplete registry entries.
- httplib.HTTP.putrequest now offers to omit the implicit Accept-Encoding.
- Patch #841977: modulefinder didn't find extension modules in packages
- imaplib.IMAP4.thread was added.
- Plugged a minor hole in tempfile.mktemp() due to the use of
os.path.exists(), switched to using os.lstat() directly if possible.
- bisect.py and heapq.py now have underlying C implementations
for better performance.
- heapq.py has two new functions, nsmallest() and nlargest().
- traceback.format_exc has been added (similar to print_exc but it returns
a string).
- xmlrpclib.MultiCall has been added.
- poplib.POP3_SSL has been added.
- tmpfile.mkstemp now returns an absolute path even if dir is relative.
- urlparse is RFC 2396 compliant.
- The fieldnames argument to the csv module's DictReader constructor is now
optional. If omitted, the first row of the file will be used as the
list of fieldnames.
- encodings.bz2_codec was added for access to bz2 compression
using "a long string".encode('bz2')
- Various improvements to unittest.py, realigned with PyUnit CVS.
- dircache now passes exceptions to the caller, instead of returning
empty lists.
- The bsddb module and dbhash module now support the iterator and
mapping protocols which make them more substitutable for dictionaries
and shelves.
- The csv module's DictReader and DictWriter classes now accept keyword
arguments. This was an omission in the initial implementation.
- The email package handles some RFC 2231 parameters with missing
CHARSET fields better. It also includes a patch to parameter
parsing when semicolons appear inside quotes.
- sets.py now runs under Py2.2. In addition, the argument restrictions
for most set methods (but not the operators) have been relaxed to
allow any iterable.
- _strptime.py now has a behind-the-scenes caching mechanism for the most
recent TimeRE instance used along with the last five unique directive
patterns. The overall module was also made more thread-safe.
- random.cunifvariate() and random.stdgamma() were deprecated in Py2.3
and removed in Py2.4.
- Bug #823328: urllib2.py's HTTP Digest Auth support works again.
- Patch #873597: CJK codecs are imported into rank of default codecs.
Tools/Demos
-----------
- A hotshotmain script was added to the Tools/scripts directory that
makes it easy to run a script under control of the hotshot profiler.
- The db2pickle and pickle2db scripts can now dump/load gdbm files.
- The file order on the command line of the pickle2db script was reversed.
It is now [ picklefile ] dbfile. This provides better symmetry with
db2pickle. The file arguments to both scripts are now source followed by
destination in situations where both files are given.
- The pydoc script will display a link to the module documentation for
modules determined to be part of the core distribution. The documentation
base directory defaults to http://www.python.org/doc/current/lib/ but can
be changed by setting the PYTHONDOCS environment variable.
- texcheck.py now detects double word errors.
- md5sum.py mistakenly opened input files in text mode by default, a
silent and dangerous change from previous releases. It once again
opens input files in binary mode by default. The -t and -b flags
remain for compatibility with the 2.3 release, but -b is the default
now.
- py-electric-colon now works when pending-delete/delete-selection mode is
in effect
- py-help-at-point is no longer bound to the F1 key - it's still bound to
C-c C-h
- Pynche was fixed to not crash when there is no ~/.pynche file and no
-d option was given.
Build
-----
- Bug #978645: Modules/getpath.c now builds properly in --disable-framework
build under OS X.
- Profiling using gprof is now available if Python is configured with
--enable-profiling.
- Profiling the VM using the Pentium TSC is now possible if Python
is configured --with-tsc.
- In order to find libraries, setup.py now also looks in /lib64, for use
on AMD64.
- Bug #934635: Fixed a bug where the configure script couldn't detect
getaddrinfo() properly if the KAME stack had SCTP support.
- Support for missing ANSI C header files (limits.h, stddef.h, etc) was
removed.
- Systems requiring the D4, D6 or D7 variants of pthreads are no longer
supported (see PEP 11).
- Universal newline support can no longer be disabled (see PEP 11).
- Support for DGUX, SunOS 4, IRIX 4 and Minix was removed (see PEP 11).
- Support for systems requiring --with-dl-dld or --with-sgi-dl was removed
(see PEP 11).
- Tests for sizeof(char) were removed since ANSI C mandates that
sizeof(char) must be 1.
C API
-----
- Thanks to Anthony Tuininga, the datetime module now supplies a C API
containing type-check macros and constructors. See new docs in the
Python/C API Reference Manual for details.
- Private function _PyTime_DoubleToTimet added, to convert a Python
timestamp (C double) to platform time_t with some out-of-bounds
checking. Declared in new header file timefuncs.h. It would be
good to expose some other internal timemodule.c functions there.
- New public functions PyEval_EvaluateFrame and PyGen_New to expose
generator objects.
- New public functions Py_IncRef() and Py_DecRef(), exposing the
functionality of the Py_XINCREF() and Py_XDECREF macros. Useful for
runtime dynamic embedding of Python. See patch #938302, by Bob
Ippolito.
- Added a new macro, PySequence_Fast_ITEMS, which retrieves a fast sequence's
underlying array of PyObject pointers. Useful for high speed looping.
- Created a new method flag, METH_COEXIST, which causes a method to be loaded
even if already defined by a slot wrapper. This allows a __contains__
method, for example, to co-exist with a defined sq_contains slot. This
is helpful because the PyCFunction can take advantage of optimized calls
whenever METH_O or METH_NOARGS flags are defined.
- Added a new function, PyDict_Contains(d, k) which is like
PySequence_Contains() but is specific to dictionaries and executes
about 10% faster.
- Added three new macros: Py_RETURN_NONE, Py_RETURN_TRUE, and Py_RETURN_FALSE.
Each return the singleton they mention after Py_INCREF()ing them.
- Added a new function, PyTuple_Pack(n, ...) for constructing tuples from a
variable length argument list of Python objects without having to invoke
the more complex machinery of Py_BuildValue(). PyTuple_Pack(3, a, b, c)
is equivalent to Py_BuildValue("(OOO)", a, b, c).
Windows
-------
- The _winreg module could segfault when reading very large registry
values, due to unchecked alloca() calls (SF bug 851056). The fix is
uses either PyMem_Malloc(n) or PyString_FromStringAndSize(NULL, n),
as appropriate, followed by a size check.
- file.truncate() could misbehave if the file was open for update
(modes r+, rb+, w+, wb+), and the most recent file operation before
the truncate() call was an input operation. SF bug 801631.
What's New in Python 2.3 final?
===============================
*Release date: 29-Jul-2003*
IDLE
----
- Bug 778400: IDLE hangs when selecting "Edit with IDLE" from explorer.
This was unique to Windows, and was fixed by adding an -n switch to
the command the Windows installer creates to execute "Edit with IDLE"
context-menu actions.
- IDLE displays a new message upon startup: some "personal firewall"
kinds of programs (for example, ZoneAlarm) open a dialog of their
own when any program opens a socket. IDLE does use sockets, talking
on the computer's internal loopback interface. This connection is not
visible on any external interface and no data is sent to or received
from the Internet. So, if you get such a dialog when opening IDLE,
asking whether to let pythonw.exe talk to address 127.0.0.1, say yes,
and rest assured no communication external to your machine is taking
place. If you don't allow it, IDLE won't be able to start.
What's New in Python 2.3 release candidate 2?
=============================================
*Release date: 24-Jul-2003*
Core and builtins
-----------------
- It is now possible to import from zipfiles containing additional
data bytes before the zip compatible archive. Zipfiles containing a
comment at the end are still unsupported.
Extension modules
-----------------
- A longstanding bug in the parser module's initialization could cause
fatal internal refcount confusion when the module got initialized more
than once. This has been fixed.
- Fixed memory leak in pyexpat; using the parser's ParseFile() method
with open files that aren't instances of the standard file type
caused an instance of the bound .read() method to be leaked on every
call.
- Fixed some leaks in the locale module.
Library
-------
- Lib/encodings/rot_13.py when used as a script, now more properly
uses the first Python interpreter on your path.
- Removed caching of TimeRE (and thus LocaleTime) in _strptime.py to
fix a locale related bug in the test suite. Although another patch
was needed to actually fix the problem, the cache code was not
restored.
IDLE
----
- Calltips patches.
Build
-----
- For MacOSX, added -mno-fused-madd to BASECFLAGS to fix test_coercion
on Panther (OSX 10.3).
C API
-----
Windows
-------
- The tempfile module could do insane imports on Windows if PYTHONCASEOK
was set, making temp file creation impossible. Repaired.
- Add a patch to workaround pthread_sigmask() bugs in Cygwin.
Mac
---
- Various fixes to pimp.
- Scripts runs with pythonw no longer had full window manager access.
- Don't force boot-disk-only install, for reasons unknown it causes
more problems than it solves.
What's New in Python 2.3 release candidate 1?
=============================================
*Release date: 18-Jul-2003*
Core and builtins
-----------------
- The new function sys.getcheckinterval() returns the last value set
by sys.setcheckinterval().
- Several bugs in the symbol table phase of the compiler have been
fixed. Errors could be lost and compilation could fail without
reporting an error. SF patch 763201.
- The interpreter is now more robust about importing the warnings
module. In an executable generated by freeze or similar programs,
earlier versions of 2.3 would fail if the warnings module could
not be found on the file system. Fixes SF bug 771097.
- A warning about assignments to module attributes that shadow
builtins, present in earlier releases of 2.3, has been removed.
- It is not possible to create subclasses of builtin types like str
and tuple that define an itemsize. Earlier releases of Python 2.3
allowed this by mistake, leading to crashes and other problems.
- The thread_id is now initialized to 0 in a non-thread build. SF bug
770247.
- SF bug 762891: "del p[key]" on proxy object no longer raises SystemError.
Extension modules
-----------------
- weakref.proxy() can now handle "del obj[i]" for proxy objects
defining __delitem__. Formerly, it generated a SystemError.
- SSL no longer crashes the interpreter when the remote side disconnects.
- On Unix the mmap module can again be used to map device files.
- time.strptime now exclusively uses the Python implementation
contained within the _strptime module.
- The print slot of weakref proxy objects was removed, because it was
not consistent with the object's repr slot.
- The mmap module only checks file size for regular files, not
character or block devices. SF patch 708374.
- The cPickle Pickler garbage collection support was fixed to traverse
the find_class attribute, if present.
- There are several fixes for the bsddb3 wrapper module.
bsddb3 no longer crashes if an environment is closed before a cursor
(SF bug 763298).
The DB and DBEnv set_get_returns_none function was extended to take
a level instead of a boolean flag. The new level 2 means that in
addition, cursor.set()/.get() methods return None instead of raising
an exception.
A typo was fixed in DBCursor.join_item(), preventing a crash.
Library
-------
- distutils now supports MSVC 7.1
- doctest now examines all docstrings by default. Previously, it would
skip over functions with private names (as indicated by the underscore
naming convention). The old default created too much of a risk that
user tests were being skipped inadvertently. Note, this change could
break code in the unlikely case that someone had intentionally put
failing tests in the docstrings of private functions. The breakage
is easily fixable by specifying the old behavior when calling testmod()
or Tester().
- There were several fixes to the way dumbdbms are closed. It's vital
that a dumbdbm database be closed properly, else the on-disk data
and directory files can be left in mutually inconsistent states.
dumbdbm.py's _Database.__del__() method attempted to close the
database properly, but a shutdown race in _Database._commit() could
prevent this from working, so that a program trusting __del__() to
get the on-disk files in synch could be badly surprised. The race
has been repaired. A sync() method was also added so that shelve
can guarantee data is written to disk.
The close() method can now be called more than once without complaint.
- The classes in threading.py are now new-style classes. That they
weren't before was an oversight.
- The urllib2 digest authentication handlers now define the correct
auth_header. The earlier versions would fail at runtime.
- SF bug 763023: fix uncaught ZeroDivisionError in difflib ratio methods
when there are no lines.
- SF bug 763637: fix exception in Tkinter with after_cancel
which could occur with Tk 8.4
- SF bug 770601: CGIHTTPServer.py now passes the entire environment
to child processes.
- SF bug 765238: add filter to fnmatch's __all__.
- SF bug 748201: make time.strptime() error messages more helpful.
- SF patch 764470: Do not dump the args attribute of a Fault object in
xmlrpclib.
- SF patch 549151: urllib and urllib2 now redirect POSTs on 301
responses.
- SF patch 766650: The whichdb module was fixed to recognize dbm files
generated by gdbm on OS/2 EMX.
- SF bugs 763047 and 763052: fixes bug of timezone value being left as
-1 when ``time.tzname[0] == time.tzname[1] and not time.daylight``
is true when it should only when time.daylight is true.
- SF bug 764548: re now allows subclasses of str and unicode to be
used as patterns.
- SF bug 763637: In Tkinter, change after_cancel() to handle tuples
of varying sizes. Tk 8.4 returns a different number of values
than Tk 8.3.
- SF bug 763023: difflib.ratio() did not catch zero division.
- The Queue module now has an __all__ attribute.
Tools/Demos
-----------
- See Lib/idlelib/NEWS.txt for IDLE news.
- SF bug 753592: webchecker/wsgui now handles user supplied directories.
- The trace.py script has been removed. It is now in the standard library.
Build
-----
- Python now compiles with -fno-strict-aliasing if possible (SF bug 766696).
- The socket module compiles on IRIX 6.5.10.
- An irix64 system is treated the same way as an irix6 system (SF
patch 764560).
- Several definitions were missing on FreeBSD 5.x unless the
__BSD_VISIBLE symbol was defined. configure now defines it as
needed.
C API
-----
- Unicode objects now support mbcs as a built-in encoding, so the C
API can use it without deferring to the encodings package.
Windows
-------
- The Windows implementation of PyThread_start_new_thread() never
checked error returns from Windows functions correctly. As a result,
it could claim to start a new thread even when the Microsoft
_beginthread() function failed (due to "too many threads" -- this is
on the order of thousands when it happens). In these cases, the
Python exception ::
thread.error: can't start new thread
is raised now.
- SF bug 766669: Prevent a GPF on interpreter exit when sockets are in
use. The interpreter now calls WSACleanup() from Py_Finalize()
instead of from DLL teardown.
Mac
---
- Bundlebuilder now inherits default values in the right way. It was
previously possible for app bundles to get a type of "BNDL" instead
of "APPL." Other improvements include, a --build-id option to
specify the CFBundleIdentifier and using the --python option to set
the executable in the bundle.
- Fixed two bugs in MacOSX framework handling.
- pythonw did not allow user interaction in 2.3rc1, this has been fixed.
- Python is now compiled with -mno-fused-madd, making all tests pass
on Panther.
What's New in Python 2.3 beta 2?
================================
*Release date: 29-Jun-2003*
Core and builtins
-----------------
- A program can now set the environment variable PYTHONINSPECT to some
string value in Python, and cause the interpreter to enter the
interactive prompt at program exit, as if Python had been invoked
with the -i option.
- list.index() now accepts optional start and stop arguments. Similar
changes were made to UserList.index(). SF feature request 754014.
- SF patch 751998 fixes an unwanted side effect of the previous fix
for SF bug 742860 (the next item).
- SF bug 742860: "WeakKeyDictionary __delitem__ uses iterkeys". This
wasn't threadsafe, was very inefficient (expected time O(len(dict))
instead of O(1)), and could raise a spurious RuntimeError if another
thread mutated the dict during __delitem__, or if a comparison function
mutated it. It also neglected to raise KeyError when the key wasn't
present; didn't raise TypeError when the key wasn't of a weakly
referencable type; and broke various more-or-less obscure dict
invariants by using a sequence of equality comparisons over the whole
set of dict keys instead of computing the key's hash code to narrow
the search to those keys with the same hash code. All of these are
considered to be bugs. A new implementation of __delitem__ repairs all
that, but note that fixing these bugs may change visible behavior in
code relying (whether intentionally or accidentally) on old behavior.
- SF bug 734869: Fixed a compiler bug that caused a fatal error when
compiling a list comprehension that contained another list comprehension
embedded in a lambda expression.
- SF bug 705231: builtin pow() no longer lets the platform C pow()
raise -1.0 to integer powers, because (at least) glibc gets it wrong
in some cases. The result should be -1.0 if the power is odd and 1.0
if the power is even, and any float with a sufficiently large exponent
is (mathematically) an exact even integer.
- SF bug 759227: A new-style class that implements __nonzero__() must
return a bool or int (but not an int subclass) from that method. This
matches the restriction on classic classes.
- The encoding attribute has been added for file objects, and set to
the terminal encoding on Unix and Windows.
- The softspace attribute of file objects became read-only by oversight.
It's writable again.
- Reverted a 2.3 beta 1 change to iterators for subclasses of list and
tuple. By default, the iterators now access data elements directly
instead of going through __getitem__. If __getitem__ access is
preferred, then __iter__ can be overridden.
- SF bug 735247: The staticmethod and super types participate in
garbage collection. Before this change, it was possible for leaks to
occur in functions with non-global free variables that used these types.
Extension modules
-----------------
- the socket module has a new exception, socket.timeout, to allow
timeouts to be handled separately from other socket errors.
- SF bug 751276: cPickle has fixed to propagate exceptions raised in
user code. In earlier versions, cPickle caught and ignored any
exception when it performed operations that it expected to raise
specific exceptions like AttributeError.
- cPickle Pickler and Unpickler objects now participate in garbage
collection.
- mimetools.choose_boundary() could return duplicate strings at times,
especially likely on Windows. The strings returned are now guaranteed
unique within a single program run.
- thread.interrupt_main() raises KeyboardInterrupt in the main thread.
dummy_thread has also been modified to try to simulate the behavior.
- array.array.insert() now treats negative indices as being relative
to the end of the array, just like list.insert() does. (SF bug #739313)
- The datetime module classes datetime, time, and timedelta are now
properly subclassable.
- _tkinter.{get|set}busywaitinterval was added.
- itertools.islice() now accepts stop=None as documented.
Fixes SF bug #730685.
- the bsddb185 module is built in one restricted instance -
/usr/include/db.h exists and defines HASHVERSION to be 2. This is true
for many BSD-derived systems.
Library
-------
- Some happy doctest extensions from Jim Fulton have been added to
doctest.py. These are already being used in Zope3. The two
primary ones:
doctest.debug(module, name) extracts the doctests from the named object
in the given module, puts them in a temp file, and starts pdb running
on that file. This is great when a doctest fails.
doctest.DocTestSuite(module=None) returns a synthesized unittest
TestSuite instance, to be run by the unittest framework, which
runs all the doctests in the module. This allows writing tests in
doctest style (which can be clearer and shorter than writing tests
in unittest style), without losing unittest's powerful testing
framework features (which doctest lacks).
- For compatibility with doctests created before 2.3, if an expected
output block consists solely of "1" and the actual output block
consists solely of "True", it's accepted as a match; similarly
for "0" and "False". This is quite un-doctest-like, but is practical.
The behavior can be disabled by passing the new doctest module
constant DONT_ACCEPT_TRUE_FOR_1 to the new optionflags optional
argument.
- ZipFile.testzip() now only traps BadZipfile exceptions. Previously,
a bare except caught to much and reported all errors as a problem
in the archive.
- The logging module now has a new function, makeLogRecord() making
LogHandler easier to interact with DatagramHandler and SocketHandler.
- The cgitb module has been extended to support plain text display (SF patch
569574).
- A brand new version of IDLE (from the IDLEfork project at
SourceForge) is now included as Lib/idlelib. The old Tools/idle is
no more.
- Added a new module: trace (documentation missing). This module used
to be distributed in Tools/scripts. It uses sys.settrace() to trace
code execution -- either function calls or individual lines. It can
generate tracing output during execution or a post-mortem report of
code coverage.
- The threading module has new functions settrace() and setprofile()
that cooperate with the functions of the same name in the sys
module. A function registered with the threading module will
be used for all threads it creates. The new trace module uses this
to provide tracing for code running in threads.
- copy.py: applied SF patch 707900, fixing bug 702858, by Steven
Taschuk. Copying a new-style class that had a reference to itself
didn't work. (The same thing worked fine for old-style classes.)
Builtin functions are now treated as atomic, fixing bug #746304.
- difflib.py has two new functions: context_diff() and unified_diff().
- More fixes to urllib (SF 549151): (a) When redirecting, always use
GET. This is common practice and more-or-less sanctioned by the
HTTP standard. (b) Add a handler for 307 redirection, which becomes
an error for POST, but a regular redirect for GET and HEAD
- Added optional 'onerror' argument to os.walk(), to control error
handling.
- inspect.is{method|data}descriptor was added, to allow pydoc display
__doc__ of data descriptors.
- Fixed socket speed loss caused by use of the _socketobject wrapper class
in socket.py.
- timeit.py now checks the current directory for imports.
- urllib2.py now knows how to order proxy classes, so the user doesn't
have to insert it in front of other classes, nor do dirty tricks like
inserting a "dummy" HTTPHandler after a ProxyHandler when building an
opener with proxy support.
- Iterators have been added for dbm keys.
- random.Random objects can now be pickled.
Tools/Demos
-----------
- pydoc now offers help on keywords and topics.
- Tools/idle is gone; long live Lib/idlelib.
- diff.py prints file diffs in context, unified, or ndiff formats,
providing a command line interface to difflib.py.
- texcheck.py is a new script for making a rough validation of Python LaTeX
files.
Build
-----
- Setting DESTDIR during 'make install' now allows specifying a
different root directory.
C API
-----
- PyType_Ready(): If a type declares that it participates in gc
(Py_TPFLAGS_HAVE_GC), and its base class does not, and its base class's
tp_free slot is the default _PyObject_Del, and type does not define
a tp_free slot itself, _PyObject_GC_Del is assigned to type->tp_free.
Previously _PyObject_Del was inherited, which could at best lead to a
segfault. In addition, if even after this magic the type's tp_free
slot is _PyObject_Del or NULL, and the type is a base type
(Py_TPFLAGS_BASETYPE), TypeError is raised: since the type is a base
type, its dealloc function must call type->tp_free, and since the type
is gc'able, tp_free must not be NULL or _PyObject_Del.
- PyThreadState_SetAsyncExc(): A new API (deliberately accessible only
from C) to interrupt a thread by sending it an exception. It is
intentional that you have to write your own C extension to call it
from Python.
New platforms
-------------
None this time.
Tests
-----
- test_imp rewritten so that it doesn't raise RuntimeError if run as a
side effect of being imported ("import test.autotest").
Windows
-------
- The Windows installer ships with Tcl/Tk 8.4.3 (upgraded from 8.4.1).
- The installer always suggested that Python be installed on the C:
drive, due to a hardcoded "C:" generated by the Wise installation
wizard. People with machines where C: is not the system drive
usually want Python installed on whichever drive is their system drive
instead. We removed the hardcoded "C:", and two testers on machines
where C: is not the system drive report that the installer now
suggests their system drive. Note that you can always select the
directory you want in the "Select Destination Directory" dialog --
that's what it's for.
Mac
---
- There's a new module called "autoGIL", which offers a mechanism to
automatically release the Global Interpreter Lock when an event loop
goes to sleep, allowing other threads to run. It's currently only
supported on OSX, in the Mach-O version.
- The OSA modules now allow direct access to properties of the
toplevel application class (in AppleScript terminology).
- The Package Manager can now update itself.
SourceForge Bugs and Patches Applied
------------------------------------
430160, 471893, 501716, 542562, 549151, 569574, 595837, 596434,
598163, 604210, 604716, 610332, 612627, 614770, 620190, 621891,
622042, 639139, 640236, 644345, 649742, 649742, 658233, 660022,
661318, 661676, 662807, 662923, 666219, 672855, 678325, 682347,
683486, 684981, 685773, 686254, 692776, 692959, 693094, 696777,
697989, 700827, 703666, 708495, 708604, 708901, 710733, 711902,
713722, 715782, 718286, 719359, 719367, 723136, 723831, 723962,
724588, 724767, 724767, 725942, 726150, 726446, 726869, 727051,
727719, 727719, 727805, 728277, 728563, 728656, 729096, 729103,
729293, 729297, 729300, 729317, 729395, 729622, 729817, 730170,
730296, 730594, 730685, 730826, 730963, 731209, 731403, 731504,
731514, 731626, 731635, 731643, 731644, 731644, 731689, 732124,
732143, 732234, 732284, 732284, 732479, 732761, 732783, 732951,
733667, 733781, 734118, 734231, 734869, 735051, 735293, 735527,
735613, 735694, 736962, 736962, 737970, 738066, 739313, 740055,
740234, 740301, 741806, 742126, 742741, 742860, 742860, 742911,
744041, 744104, 744238, 744687, 744877, 745055, 745478, 745525,
745620, 746012, 746304, 746366, 746801, 746953, 747348, 747667,
747954, 748846, 748849, 748973, 748975, 749191, 749210, 749759,
749831, 749911, 750008, 750092, 750542, 750595, 751038, 751107,
751276, 751451, 751916, 751941, 751956, 751998, 752671, 753451,
753602, 753617, 753845, 753925, 754014, 754340, 754447, 755031,
755087, 755147, 755245, 755683, 755987, 756032, 756996, 757058,
757229, 757818, 757821, 757822, 758112, 758910, 759227, 759889,
760257, 760703, 760792, 761104, 761337, 761519, 761830, 762455
What's New in Python 2.3 beta 1?
================================
*Release date: 25-Apr-2003*
Core and builtins
-----------------
- New format codes B, H, I, k and K have been implemented for
PyArg_ParseTuple and PyBuild_Value.
- New builtin function sum(seq, start=0) returns the sum of all the
items in iterable object seq, plus start (items are normally numbers,
and cannot be strings).
- bool() called without arguments now returns False rather than
raising an exception. This is consistent with calling the
constructors for the other builtin types -- called without argument
they all return the false value of that type. (SF patch #724135)
- In support of PEP 269 (making the pgen parser generator accessible
from Python), some changes to the pgen code structure were made; a
few files that used to be linked only with pgen are now linked with
Python itself.
- The repr() of a weakref object now shows the __name__ attribute of
the referenced object, if it has one.
- super() no longer ignores data descriptors, except __class__. See
the thread started at
http://mail.python.org/pipermail/python-dev/2003-April/034338.html
- list.insert(i, x) now interprets negative i as it would be
interpreted by slicing, so negative values count from the end of the
list. This was the only place where such an interpretation was not
placed on a list index.
- range() now works even if the arguments are longs with magnitude
larger than sys.maxint, as long as the total length of the sequence
fits. E.g., range(2**100, 2**101, 2**100) is the following list:
[1267650600228229401496703205376L]. (SF patch #707427.)
- Some horridly obscure problems were fixed involving interaction
between garbage collection and old-style classes with "ambitious"
getattr hooks. If an old-style instance didn't have a __del__ method,
but did have a __getattr__ hook, and the instance became reachable
only from an unreachable cycle, and the hook resurrected or deleted
unreachable objects when asked to resolve "__del__", anything up to
a segfault could happen. That's been repaired.
- dict.pop now takes an optional argument specifying a default
value to return if the key is not in the dict. If a default is not
given and the key is not found, a KeyError will still be raised.
Parallel changes were made to UserDict.UserDict and UserDict.DictMixin.
[SF patch #693753] (contributed by Michael Stone.)
- sys.getfilesystemencoding() was added to expose
Py_FileSystemDefaultEncoding.
- New function sys.exc_clear() clears the current exception. This is
rarely needed, but can sometimes be useful to release objects
referenced by the traceback held in sys.exc_info()[2]. (SF patch
#693195.)
- On 64-bit systems, a dictionary could contain duplicate long/int keys
if the key value was larger than 2**32. See SF bug #689659.
- Fixed SF bug #663074. The codec system was using global static
variables to store internal data. As a result, any attempts to use the
unicode system with multiple active interpreters, or successive
interpreter executions, would fail.
- "%c" % u"a" now returns a unicode string instead of raising a
TypeError. u"%c" % 0xffffffff now raises a OverflowError instead
of a ValueError to be consistent with "%c" % 256. See SF patch #710127.
Extension modules
-----------------
- The socket module now provides the functions inet_pton and inet_ntop
for converting between string and packed representation of IP
addresses. There is also a new module variable, has_ipv6, which is
True iff the current Python has IPv6 support. See SF patch #658327.
- Tkinter wrappers around Tcl variables now pass objects directly
to Tcl, instead of first converting them to strings.
- The .*? pattern in the re module is now special-cased to avoid the
recursion limit. (SF patch #720991 -- many thanks to Gary Herron
and Greg Chapman.)
- New function sys.call_tracing() allows pdb to debug code
recursively.
- New function gc.get_referents(obj) returns a list of objects
directly referenced by obj. In effect, it exposes what the object's
tp_traverse slot does, and can be helpful when debugging memory
leaks.
- The iconv module has been removed from this release.
- The platform-independent routines for packing floats in IEEE formats
(struct.pack's <f, >f, <d, and >d codes; pickle and cPickle's protocol 1
pickling of floats) ignored that rounding can cause a carry to
propagate. The worst consequence was that, in rare cases, <f and >f
could produce strings that, when unpacked again, were a factor of 2
away from the original float. This has been fixed. See SF bug
#705836.
- New function time.tzset() provides access to the C library tzset()
function, if supported. (SF patch #675422.)
- Using createfilehandler, deletefilehandler, createtimerhandler functions
on Tkinter.tkinter (_tkinter module) no longer crashes the interpreter.
See SF bug #692416.
- Modified the fcntl.ioctl() function to allow modification of a passed
mutable buffer (for details see the reference documentation).
- Made user requested changes to the itertools module.
Subsumed the times() function into repeat().
Added chain() and cycle().
- The rotor module is now deprecated; the encryption algorithm it uses
is not believed to be secure, and including crypto code with Python
has implications for exporting and importing it in various countries.
- The socket module now always uses the _socketobject wrapper class, even on
platforms which have dup(2). The makefile() method is built directly
on top of the socket without duplicating the file descriptor, allowing
timeouts to work properly.
Library
-------
- New generator function os.walk() is an easy-to-use alternative to
os.path.walk(). See os module docs for details. os.path.walk()
isn't deprecated at this time, but may become deprecated in a
future release.
- Added new module "platform" which provides a wide range of tools
for querying platform dependent features.
- netrc now allows ASCII punctuation characters in passwords.
- shelve now supports the optional writeback argument, and exposes
pickle protocol versions.
- Several methods of nntplib.NNTP have grown an optional file argument
which specifies a file where to divert the command's output
(already supported by the body() method). (SF patch #720468)
- The self-documenting XML server library DocXMLRPCServer was added.
- Support for internationalized domain names has been added through
the 'idna' and 'punycode' encodings, the 'stringprep' module, the
'mkstringprep' tool, and enhancements to the socket and httplib
modules.
- htmlentitydefs has two new dictionaries: name2codepoint maps
HTML entity names to Unicode codepoints (as integers).
codepoint2name is the reverse mapping. See SF patch #722017.
- pdb has a new command, "debug", which lets you step through
arbitrary code from the debugger's (pdb) prompt.
- unittest.failUnlessEqual and its equivalent unittest.assertEqual now
return 'not a == b' rather than 'a != b'. This gives the desired
result for classes that define __eq__ without defining __ne__.
- sgmllib now supports SGML marked sections, in particular the
MS Office extensions.
- The urllib module now offers support for the iterator protocol.
SF patch 698520 contributed by Brett Cannon.
- New module timeit provides a simple framework for timing the
execution speed of expressions and statements.
- sets.Set objects now support mixed-type __eq__ and __ne__, instead
of raising TypeError. If x is a Set object and y is a non-Set object,
x == y is False, and x != y is True. This is akin to the change made
for mixed-type comparisons of datetime objects in 2.3a2; more info
about the rationale is in the NEWS entry for that. See also SF bug
report <http://www.python.org/sf/693121>.
- On Unix platforms, if os.listdir() is called with a Unicode argument,
it now returns Unicode strings. (This behavior was added earlier
to the Windows NT/2k/XP version of os.listdir().)
- Distutils: both 'py_modules' and 'packages' keywords can now be specified
in core.setup(). Previously you could supply one or the other, but
not both of them. (SF patch #695090 from Bernhard Herzog)
- New csv package makes it easy to read/write CSV files.
- Module shlex has been extended to allow posix-like shell parsings,
including a split() function for easy spliting of quoted strings and
commands. An iterator interface was also implemented.
Tools/Demos
-----------
- New script combinerefs.py helps analyze new PYTHONDUMPREFS output.
See the module docstring for details.
Build
-----
- Fix problem building on OSF1 because the compiler only accepted
preprocessor directives that start in column 1. (SF bug #691793.)
C API
-----
- Added PyGC_Collect(), equivalent to calling gc.collect().
- PyThreadState_GetDict() was changed not to raise an exception or
issue a fatal error when no current thread state is available. This
makes it possible to print dictionaries when no thread is active.
- LONG_LONG was renamed to PY_LONG_LONG. Extensions that use this and
need compatibility with previous versions can use this:
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
- Added PyObject_SelfIter() to fill the tp_iter slot for the
typical case where the method returns its self argument.
- The extended type structure used for heap types (new-style
classes defined by Python code using a class statement) is now
exported from object.h as PyHeapTypeObject. (SF patch #696193.)
New platforms
-------------
None this time.
Tests
-----
- test_timeout now requires -u network to be passed to regrtest to run.
See SF bug #692988.
Windows
-------
- os.fsync() now exists on Windows, and calls the Microsoft _commit()
function.
- New function winsound.MessageBeep() wraps the Win32 API
MessageBeep().
Mac
---
- os.listdir() now returns Unicode strings on MacOS X when called with
a Unicode argument. See the general news item under "Library".
- A new method MacOS.WMAvailable() returns true if it is safe to access
the window manager, false otherwise.
- EasyDialogs dialogs are now movable-modal, and if the application is
currently in the background they will ask to be moved to the foreground
before displaying.
- OSA Scripting support has improved a lot, and gensuitemodule.py can now
be used by mere mortals. The documentation is now also more or less
complete.
- The IDE (in a framework build) now includes introductory documentation
in Apple Help Viewer format.
What's New in Python 2.3 alpha 2?
=================================
*Release date: 19-Feb-2003*
Core and builtins
-----------------
- Negative positions returned from PEP 293 error callbacks are now
treated as being relative to the end of the input string. Positions
that are out of bounds raise an IndexError.
- sys.path[0] (the directory from which the script is loaded) is now
turned into an absolute pathname, unless it is the empty string.
(SF patch #664376.)
- Finally fixed the bug in compile() and exec where a string ending
with an indented code block but no newline would raise SyntaxError.
This would have been a four-line change in parsetok.c... Except
codeop.py depends on this behavior, so a compilation flag had to be
invented that causes the tokenizer to revert to the old behavior;
this required extra changes to 2 .h files, 2 .c files, and 2 .py
files. (Fixes SF bug #501622.)
- If a new-style class defines neither __new__ nor __init__, its
constructor would ignore all arguments. This is changed now: the
constructor refuses arguments in this case. This might break code
that worked under Python 2.2. The simplest fix is to add a no-op
__init__: ``def __init__(self, *args, **kw): pass``.
- Through a bytecode optimizer bug (and I bet you didn't even know
Python *had* a bytecode optimizer :-), "unsigned" hex/oct constants
with a leading minus sign would come out with the wrong sign.
("Unsigned" hex/oct constants are those with a face value in the
range sys.maxint+1 through sys.maxint*2+1, inclusive; these have
always been interpreted as negative numbers through sign folding.)
E.g. 0xffffffff is -1, and -(0xffffffff) is 1, but -0xffffffff would
come out as -4294967295. This was the case in Python 2.2 through
2.2.2 and 2.3a1, and in Python 2.4 it will once again have that
value, but according to PEP 237 it really needs to be 1 now. This
will be backported to Python 2.2.3 a well. (SF #660455)
- int(s, base) sometimes sign-folds hex and oct constants; it only
does this when base is 0 and s.strip() starts with a '0'. When the
sign is actually folded, as in int("0xffffffff", 0) on a 32-bit
machine, which returns -1, a FutureWarning is now issued; in Python
2.4, this will return 4294967295L, as do int("+0xffffffff", 0) and
int("0xffffffff", 16) right now. (PEP 347)
- super(X, x): x may now be a proxy for an X instance, i.e.
issubclass(x.__class__, X) but not issubclass(type(x), X).
- isinstance(x, X): if X is a new-style class, this is now equivalent
to issubclass(type(x), X) or issubclass(x.__class__, X). Previously
only type(x) was tested. (For classic classes this was already the
case.)
- compile(), eval() and the exec statement now fully support source code
passed as unicode strings.
- int subclasses can be initialized with longs if the value fits in an int.
See SF bug #683467.
- long(string, base) takes time linear in len(string) when base is a power
of 2 now. It used to take time quadratic in len(string).
- filter returns now Unicode results for Unicode arguments.
- raw_input can now return Unicode objects.
- List objects' sort() method now accepts None as the comparison function.
Passing None is semantically identical to calling sort() with no
arguments.
- Fixed crash when printing a subclass of str and __str__ returned self.
See SF bug #667147.
- Fixed an invalid RuntimeWarning and an undetected error when trying
to convert a long integer into a float which couldn't fit.
See SF bug #676155.
- Function objects now have a __module__ attribute that is bound to
the name of the module in which the function was defined. This
applies for C functions and methods as well as functions and methods
defined in Python. This attribute is used by pickle.whichmodule(),
which changes the behavior of whichmodule slightly. In Python 2.2
whichmodule() returns "__main__" for functions that are not defined
at the top-level of a module (examples: methods, nested functions).
Now whichmodule() will return the proper module name.
Extension modules
-----------------
- operator.isNumberType() now checks that the object has a nb_int or
nb_float slot, rather than simply checking whether it has a non-NULL
tp_as_number pointer.
- The imp module now has ways to acquire and release the "import
lock": imp.acquire_lock() and imp.release_lock(). Note: this is a
reentrant lock, so releasing the lock only truly releases it when
this is the last release_lock() call. You can check with
imp.lock_held(). (SF bug #580952 and patch #683257.)
- Change to cPickle to match pickle.py (see below and PEP 307).
- Fix some bugs in the parser module. SF bug #678518.
- Thanks to Scott David Daniels, a subtle bug in how the zlib
extension implemented flush() was fixed. Scott also rewrote the
zlib test suite using the unittest module. (SF bug #640230 and
patch #678531.)
- Added an itertools module containing high speed, memory efficient
looping constructs inspired by tools from Haskell and SML.
- The SSL module now handles sockets with a timeout set correctly (SF
patch #675750, fixing SF bug #675552).
- os/posixmodule has grown the sysexits.h constants (EX_OK and friends).
- Fixed broken threadstate swap in readline that could cause fatal
errors when a readline hook was being invoked while a background
thread was active. (SF bugs #660476 and #513033.)
- fcntl now exposes the strops.h I_* constants.
- Fix a crash on Solaris that occurred when calling close() on
an mmap'ed file which was already closed. (SF patch #665913)
- Fixed several serious bugs in the zipimport implementation.
- datetime changes:
The date class is now properly subclassable. (SF bug #720908)
The datetime and datetimetz classes have been collapsed into a single
datetime class, and likewise the time and timetz classes into a single
time class. Previously, a datetimetz object with tzinfo=None acted
exactly like a datetime object, and similarly for timetz. This wasn't
enough of a difference to justify distinct classes, and life is simpler
now.
today() and now() now round system timestamps to the closest
microsecond <http://www.python.org/sf/661086>. This repairs an
irritation most likely seen on Windows systems.
In dt.astimezone(tz), if tz.utcoffset(dt) returns a duration,
ValueError is raised if tz.dst(dt) returns None (2.3a1 treated it
as 0 instead, but a tzinfo subclass wishing to participate in
time zone conversion has to take a stand on whether it supports
DST; if you don't care about DST, then code dst() to return 0 minutes,
meaning that DST is never in effect).
The tzinfo methods utcoffset() and dst() must return a timedelta object
(or None) now. In 2.3a1 they could also return an int or long, but that
was an unhelpfully redundant leftover from an earlier version wherein
they couldn't return a timedelta. TOOWTDI.
The example tzinfo class for local time had a bug. It was replaced
by a later example coded by Guido.
datetime.astimezone(tz) no longer raises an exception when the
input datetime has no UTC equivalent in tz. For typical "hybrid" time
zones (a single tzinfo subclass modeling both standard and daylight
time), this case can arise one hour per year, at the hour daylight time
ends. See new docs for details. In short, the new behavior mimics
the local wall clock's behavior of repeating an hour in local time.
dt.astimezone() can no longer be used to convert between naive and aware
datetime objects. If you merely want to attach, or remove, a tzinfo
object, without any conversion of date and time members, use
dt.replace(tzinfo=whatever) instead, where "whatever" is None or a
tzinfo subclass instance.
A new method tzinfo.fromutc(dt) can be overridden in tzinfo subclasses
to give complete control over how a UTC time is to be converted to
a local time. The default astimezone() implementation calls fromutc()
as its last step, so a tzinfo subclass can affect that too by overriding
fromutc(). It's expected that the default fromutc() implementation will
be suitable as-is for "almost all" time zone subclasses, but the
creativity of political time zone fiddling appears unbounded -- fromutc()
allows the highly motivated to emulate any scheme expressible in Python.
datetime.now(): The optional tzinfo argument was undocumented (that's
repaired), and its name was changed to tz ("tzinfo" is overloaded enough
already). With a tz argument, now(tz) used to return the local date
and time, and attach tz to it, without any conversion of date and time
members. This was less than useful. Now now(tz) returns the current
date and time as local time in tz's time zone, akin to ::
tz.fromutc(datetime.utcnow().replace(tzinfo=utc))
where "utc" is an instance of a tzinfo subclass modeling UTC. Without
a tz argument, now() continues to return the current local date and time,
as a naive datetime object.
datetime.fromtimestamp(): Like datetime.now() above, this had less than
useful behavior when the optional tinzo argument was specified. See
also SF bug report <http://www.python.org/sf/660872>.
date and datetime comparison: In order to prevent comparison from
falling back to the default compare-object-addresses strategy, these
raised TypeError whenever they didn't understand the other object type.
They still do, except when the other object has a "timetuple" attribute,
in which case they return NotImplemented now. This gives other
datetime objects (e.g., mxDateTime) a chance to intercept the
comparison.
date, time, datetime and timedelta comparison: When the exception
for mixed-type comparisons in the last paragraph doesn't apply, if
the comparison is == then False is returned, and if the comparison is
!= then True is returned. Because dict lookup and the "in" operator
only invoke __eq__, this allows, for example, ::
if some_datetime in some_sequence:
and ::
some_dict[some_timedelta] = whatever
to work as expected, without raising TypeError just because the
sequence is heterogeneous, or the dict has mixed-type keys. [This
seems like a good idea to implement for all mixed-type comparisons
that don't want to allow falling back to address comparison.]
The constructors building a datetime from a timestamp could raise
ValueError if the platform C localtime()/gmtime() inserted "leap
seconds". Leap seconds are ignored now. On such platforms, it's
possible to have timestamps that differ by a second, yet where
datetimes constructed from them are equal.
The pickle format of date, time and datetime objects has changed
completely. The undocumented pickler and unpickler functions no
longer exist. The undocumented __setstate__() and __getstate__()
methods no longer exist either.
Library
-------
- The logging module was updated slightly; the WARN level was renamed
to WARNING, and the matching function/method warn() to warning().
- The pickle and cPickle modules were updated with a new pickling
protocol (documented by pickletools.py, see below) and several
extensions to the pickle customization API (__reduce__, __setstate__
etc.). The copy module now uses more of the pickle customization
API to copy objects that don't implement __copy__ or __deepcopy__.
See PEP 307 for details.
- The distutils "register" command now uses http://www.python.org/pypi
as the default repository. (See PEP 301.)
- the platform dependent path related variables sep, altsep, extsep,
pathsep, curdir, pardir and defpath are now defined in the platform
dependent path modules (e.g. ntpath.py) rather than os.py, so these
variables are now available via os.path. They continue to be
available from the os module.
(see <http://www.python.org/sf/680789>).
- array.array was added to the types repr.py knows about (see
<http://www.python.org/sf/680789>).
- The new pickletools.py contains lots of documentation about pickle
internals, and supplies some helpers for working with pickles, such as
a symbolic pickle disassembler.
- Xmlrpclib.py now supports the builtin boolean type.
- py_compile has a new 'doraise' flag and a new PyCompileError
exception.
- SimpleXMLRPCServer now supports CGI through the CGIXMLRPCRequestHandler
class.
- The sets module now raises TypeError in __cmp__, to clarify that
sets are not intended to be three-way-compared; the comparison
operators are overloaded as subset/superset tests.
- Bastion.py and rexec.py are disabled. These modules are not safe in
Python 2.2. or 2.3.
- realpath is now exported when doing ``from poxixpath import *``.
It is also exported for ntpath, macpath, and os2emxpath.
See SF bug #659228.
- New module tarfile from Lars Gustbel provides a comprehensive interface
to tar archive files with transparent gzip and bzip2 compression.
See SF patch #651082.
- urlparse can now parse imap:// URLs. See SF feature request #618024.
- Tkinter.Canvas.scan_dragto() provides an optional parameter to support
the gain value which is passed to Tk. SF bug# 602259.
- Fix logging.handlers.SysLogHandler protocol when using UNIX domain sockets.
See SF patch #642974.
- The dospath module was deleted. Use the ntpath module when manipulating
DOS paths from other platforms.
Tools/Demos
-----------
- Two new scripts (db2pickle.py and pickle2db.py) were added to the
Tools/scripts directory to facilitate conversion from the old bsddb module
to the new one. While the user-visible API of the new module is
compatible with the old one, it's likely that the version of the
underlying database library has changed. To convert from the old library,
run the db2pickle.py script using the old version of Python to convert it
to a pickle file. After upgrading Python, run the pickle2db.py script
using the new version of Python to reconstitute your database. For
example:
% python2.2 db2pickle.py -h some.db > some.pickle
% python2.3 pickle2db.py -h some.db.new < some.pickle
Run the scripts without any args to get a usage message.
Build
-----
- The audio driver tests (test_ossaudiodev.py and
test_linuxaudiodev.py) are no longer run by default. This is
because they don't always work, depending on your hardware and
software. To run these tests, you must use an invocation like ::
./python Lib/test/regrtest.py -u audio test_ossaudiodev
- On systems which build using the configure script, compiler flags which
used to be lumped together using the OPT flag have been split into two
groups, OPT and BASECFLAGS. OPT is meant to carry just optimization- and
debug-related flags like "-g" and "-O3". BASECFLAGS is meant to carry
compiler flags that are required to get a clean compile. On some
platforms (many Linux flavors in particular) BASECFLAGS will be empty by
default. On others, such as Mac OS X and SCO, it will contain required
flags. This change allows people building Python to override OPT without
fear of clobbering compiler flags which are required to get a clean build.
- On Darwin/Mac OS X platforms, /sw/lib and /sw/include are added to the
relevant search lists in setup.py. This allows users building Python to
take advantage of the many packages available from the fink project
<http://fink.sf.net/>.
- A new Makefile target, scriptsinstall, installs a number of useful scripts
from the Tools/scripts directory.
C API
-----
- PyEval_GetFrame() is now declared to return a ``PyFrameObject *``
instead of a plain ``PyObject *``. (SF patch #686601.)
- PyNumber_Check() now checks that the object has a nb_int or nb_float
slot, rather than simply checking whether it has a non-NULL
tp_as_number pointer.
- A C type that inherits from a base type that defines tp_as_buffer
will now inherit the tp_as_buffer pointer if it doesn't define one.
(SF #681367)
- The PyArg_Parse functions now issue a DeprecationWarning if a float
argument is provided when an integer is specified (this affects the 'b',
'B', 'h', 'H', 'i', and 'l' codes). Future versions of Python will
raise a TypeError.
Tests
-----
- Several tests weren't being run from regrtest.py (test_timeout.py,
test_tarfile.py, test_netrc.py, test_multifile.py,
test_importhooks.py and test_imp.py). Now they are. (Note to
developers: please read Lib/test/README when creating a new test, to
make sure to do it right! All tests need to use either unittest or
pydoc.)
- Added test_posix.py, a test suite for the posix module.
- Added test_hexoct.py, a test suite for hex/oct constant folding.
Windows
-------
- The timeout code for socket connect() didn't work right; this has
now been fixed. test_timeout.py should pass (at least most of the
time).
- distutils' msvccompiler class now passes the preprocessor options to
the resource compiler. See SF patch #669198.
- The bsddb module now ships with Sleepycat's 4.1.25.NC, the latest
release without strong cryptography.
- sys.path[0], if it contains a directory name, is now always an
absolute pathname. (SF patch #664376.)
- The new logging package is now installed by the Windows installer. It
wasn't in 2.3a1 due to oversight.
Mac
---
- There are new dialogs EasyDialogs.AskFileForOpen, AskFileForSave
and AskFolder. The old macfs.StandardGetFile and friends are deprecated.
- Most of the standard library now uses pathnames or FSRefs in preference
of FSSpecs, and use the underlying Carbon.File and Carbon.Folder modules
in stead of macfs. macfs will probably be deprecated in the future.
- Type Carbon.File.FSCatalogInfo and supporting methods have been implemented.
This also makes macfs.FSSpec.SetDates() work again.
- There is a new module pimp, the package install manager for Python, and
accompanying applet PackageManager. These allow you to easily download
and install pretested extension packages either in source or binary
form. Only in MacPython-OSX.
- Applets are now built with bundlebuilder in MacPython-OSX, which should make
them more robust and also provides a path towards BuildApplication. The
downside of this change is that applets can no longer be run from the
Terminal window, this will hopefully be fixed in the 2.3b1.
What's New in Python 2.3 alpha 1?
=================================
*Release date: 31-Dec-2002*
Type/class unification and new-style classes
--------------------------------------------
- One can now assign to __bases__ and __name__ of new-style classes.
- dict() now accepts keyword arguments so that dict(one=1, two=2)
is the equivalent of {"one": 1, "two": 2}. Accordingly,
the existing (but undocumented) 'items' keyword argument has
been eliminated. This means that dict(items=someMapping) now has
a different meaning than before.
- int() now returns a long object if the argument is outside the
integer range, so int("4" * 1000), int(1e200) and int(1L<<1000) will
all return long objects instead of raising an OverflowError.
- Assignment to __class__ is disallowed if either the old or 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
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
-----------------
- Import from zipfiles is now supported. The name of a zipfile placed
on sys.path causes the import statement to look for importable Python
modules (with .py, pyc and .pyo extensions) and packages inside the
zipfile. The zipfile import follows the specification (though not
the sample implementation) of PEP 273. The semantics of __path__ are
compatible with those that have been implemented in Jython since
Jython 2.1.
- PEP 302 has been accepted. Although it was initially developed to
support zipimport, it offers a new, general import hook mechanism.
Several new variables have been added to the sys module:
sys.meta_path, sys.path_hooks, and sys.path_importer_cache; these
make extending the import statement much more convenient than
overriding the __import__ built-in function. For a description of
these, see PEP 302.
- A frame object's f_lineno attribute can now be written to from a
trace function to change which line will execute next. A command to
exploit this from pdb has been added. [SF patch #643835]
- The _codecs support module for codecs.py was turned into a builtin
module to assure that at least the builtin codecs are available
to the Python parser for source code decoding according to PEP 263.
- issubclass now supports a tuple as the second argument, just like
isinstance does. ``issubclass(X, (A, B))`` is equivalent to
``issubclass(X, A) or issubclass(X, B)``.
- Thanks to Armin Rigo, the last known way to provoke a system crash
by cleverly arranging for a comparison function to mutate a list
during a list.sort() operation has been fixed. The effect of
attempting to mutate a list, or even to inspect its contents or
length, while a sort is in progress, is not defined by the language.
The C implementation of Python 2.3 attempts to detect mutations,
and raise ValueError if one occurs, but there's no guarantee that
all mutations will be caught, or that any will be caught across
releases or implementations.
- Unicode file name processing for Windows (PEP 277) is implemented.
All platforms now have an os.path.supports_unicode_filenames attribute,
which is set to True on Windows NT/2000/XP, and False elsewhere.
- Codec error handling callbacks (PEP 293) are implemented.
Error handling in unicode.encode or str.decode can now be customized.
- A subtle change to the semantics of the built-in function intern():
interned strings are no longer immortal. You must keep a reference
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.
- 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 only kept up
to date when there is a trace function set).
- 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<<n where this currently doesn't yield the same value
as long(x)<<n; in Python 2.4, the outcome will be long(x)<<n.
- Conversions from ints to string that show negative values as
unsigned ints in the inclusive range [0x80000000..0xffffffff];
this affects the functions hex() and oct(), and the string
formatting codes %u, %o, %x, and %X. In Python 2.4, these will
show signed values (e.g. hex(-1) currently returns "0xffffffff";
in Python 2.4 it will return "-0x1").
- The bits manipulated under the cover by sys.setcheckinterval() have
been changed. Both the check interval and the ticker used to be
per-thread values. They are now just a pair of global variables.
In addition, the default check interval was boosted from 10 to 100
bytecode instructions. This may have some effect on systems that
relied on the old default value. In particular, in multi-threaded
applications which try to be highly responsive, response time will
increase by some (perhaps imperceptible) amount.
- When multiplying very large integers, a version of the so-called
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. 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
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
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
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
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
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. Thanks to Oren Tirosh!
- Encoding declarations (PEP 263, phase 1) have been implemented. A
comment of the form "# -*- coding: <encodingname> -*-" in the first
or second line of a Python source file indicates the encoding.
- 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 <http://www.python.org/sf/587076> 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
raise StopIteration. There used to be various counterexamples to
this behavior, which could caused confusion or subtle program
breakage, without any benefits. (Note that this is still an
iterator's responsibility; the iterator framework does not enforce
this.)
- 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
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]
- sys.getwindowsversion() has been added on Windows. This
returns a tuple with information about the version of Windows
currently running.
- Slices and repetitions of buffer objects now consistently return
a string. Formerly, strings would be returned most of the time,
but a buffer object would be returned when the repetition count
was one or when the slice range was all inclusive.
- Unicode objects in sys.path are no longer ignored but treated
as directory names.
- Fixed string.startswith and string.endswith builtin methods
so they accept negative indices. [SF bug 493951]
- Fixed a bug with a continue inside a try block and a yield in the
finally clause. [SF bug 567538]
- Most builtin sequences now support "extended slices", i.e. slices
with a third "stride" parameter. For example, "hello world"[::-1]
gives "dlrow olleh".
- A new warning PendingDeprecationWarning was added to provide
direction on features which are in the process of being deprecated.
The warning will not be printed by default. To see the pending
deprecations, use -Walways::PendingDeprecationWarning::
as a command line option or warnings.filterwarnings() in code.
- Deprecated features of xrange objects have been removed as
promised. The start, stop, and step attributes and the tolist()
method no longer exist. xrange repetition and slicing have been
removed.
- New builtin function enumerate(x), from PEP 279. Example:
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
The argument can be an arbitrary iterable object.
- The assert statement no longer tests __debug__ at runtime. This means
that assert statements cannot be disabled by assigning a false value
to __debug__.
- A method zfill() was added to str and unicode, that fills a numeric
string to the left with zeros. For example,
"+123".zfill(6) -> "+00123".
- Complex numbers supported divmod() and the // and % operators, but
these make no sense. Since this was documented, they're being
deprecated now.
- String and unicode methods lstrip(), rstrip() and strip() now take
an optional argument that specifies the characters to strip. For
example, "Foo!!!?!?!?".rstrip("?!") -> "Foo".
- There's a new dictionary constructor (a class method of the dict
class), dict.fromkeys(iterable, value=None). It constructs a
dictionary with keys taken from the iterable and all values set to a
single value. It can be used for building sets and for removing
duplicates from sequences.
- Added a new dict method pop(key). This removes and returns the
value corresponding to key. [SF patch #539949]
- 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
other operations that return a truth value have been changed to
return a bool instead. Read PEP 285 for an explanation of why this
is backward compatible.
- Fixed two bugs reported as SF #535905: under certain conditions,
deallocating a deeply nested structure could cause a segfault in the
garbage collector, due to interaction with the "trashcan" code;
access to the current frame during destruction of a local variable
could access a pointer to freed memory.
- The optional object allocator ("pymalloc") has been enabled by
default. The recommended practice for memory allocation and
deallocation has been streamlined. A header file is included,
Misc/pymemcompat.h, which can be bundled with 3rd party extensions
and lets them use the same API with Python versions from 1.5.2
onwards.
- PyErr_Display will provide file and line information for all exceptions
that have an attribute print_file_and_line, not just SyntaxErrors.
- The UTF-8 codec will now encode and decode Unicode surrogates
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
a ValueError when the xreadlines.next() method was called.
- sys.exit() inadvertently allowed more than one argument.
An exception will now be raised if more than one argument is used.
- Changed evaluation order of dictionary literals to conform to the
general left to right evaluation order rule. Now {f1(): f2()} will
evaluate f1 first.
- Fixed bug #521782: when a file was in non-blocking mode, file.read()
could silently lose data or wrongly throw an unknown error.
- The sq_repeat, sq_inplace_repeat, sq_concat and sq_inplace_concat
slots are now always tried after trying the corresponding nb_* slots.
This fixes a number of minor bugs (see bug #624807).
- Fix problem with dynamic loading on 64-bit AIX (see bug #639945).
Extension modules
-----------------
- Added three operators to the operator module:
operator.pow(a,b) which is equivalent to: a**b.
operator.is_(a,b) which is equivalent to: a is b.
operator.is_not(a,b) which is equivalent to: a is not b.
- posix.openpty now works on all systems that have /dev/ptmx.
- A module zipimport exists to support importing code from zip
archives.
- The new datetime module supplies classes for manipulating dates and
times. The basic design came from the Zope "fishbowl process", and
favors practical commercial applications over calendar esoterica. See
http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage
- _tkinter now returns Tcl objects, instead of strings. Objects which
have Python equivalents are converted to Python objects, other objects
are wrapped. This can be configured through the wantobjects method,
or Tkinter.wantobjects.
- The PyBSDDB wrapper around the Sleepycat Berkeley DB library has
been added as the package bsddb. The traditional bsddb module is
still available in source code, but not built automatically anymore,
and is now named bsddb185. This supports Berkeley DB versions from
3.0 to 4.1. For help converting your databases from the old module (which
probably used an obsolete version of Berkeley DB) to the new module, see
the db2pickle.py and pickle2db.py scripts described in the Tools/Demos
section above.
- unicodedata was updated to Unicode 3.2. It supports normalization
and names for Hangul syllables and CJK unified ideographs.
- resource.getrlimit() now returns longs instead of ints.
- readline now dynamically adjusts its input/output stream if
sys.stdin/stdout changes.
- The _tkinter module (and hence Tkinter) has dropped support for
Tcl/Tk 8.0 and 8.1. Only Tcl/Tk versions 8.2, 8.3 and 8.4 are
supported.
- cPickle.BadPickleGet is now a class.
- The time stamps in os.stat_result are floating point numbers
after stat_float_times has been called.
- If the size passed to mmap.mmap() is larger than the length of the
file on non-Windows platforms, a ValueError is raised. [SF bug 585792]
- The xreadlines module is slated for obsolescence.
- The strptime function in the time module is now always available (a
Python implementation is used when the C library doesn't define it).
- The 'new' module is no longer an extension, but a Python module that
only exists for backwards compatibility. Its contents are no longer
functions but callable type objects.
- The bsddb.*open functions can now take 'None' as a filename.
This will create a temporary in-memory bsddb that won't be
written to disk.
- posix.getloadavg, posix.lchown, posix.killpg, posix.mknod, and
posix.getpgid have been added where available.
- The locale module now exposes the C library's gettext interface. It
also has a new function getpreferredencoding.
- A security hole ("double free") was found in zlib-1.1.3, a popular
third party compression library used by some Python modules. The
hole was quickly plugged in zlib-1.1.4, and the Windows build of
Python now ships with zlib-1.1.4.
- pwd, grp, and resource return enhanced tuples now, with symbolic
field names.
- array.array is now a type object. A new format character
'u' indicates Py_UNICODE arrays. For those, .tounicode and
.fromunicode methods are available. Arrays now support __iadd__
and __imul__.
- dl now builds on every system that has dlfcn.h. Failure in case
of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open
is called.
- The sys module acquired a new attribute, api_version, which evaluates
to the value of the PYTHON_API_VERSION macro with which the
interpreter was compiled.
- Fixed bug #470582: sre module would return a tuple (None, 'a', 'ab')
when applying the regular expression '^((a)c)?(ab)$' on 'ab'. It now
returns (None, None, 'ab'), as expected. Also fixed handling of
lastindex/lastgroup match attributes in similar cases. For example,
when running the expression r'(a)(b)?b' over 'ab', lastindex must be
1, not 2.
- Fixed bug #581080: sre scanner was not checking the buffer limit
before increasing the current pointer. This was creating an infinite
loop in the search function, once the pointer exceeded the buffer
limit.
- The os.fdopen function now enforces a file mode starting with the
letter 'r', 'w' or 'a', otherwise a ValueError is raised. This fixes
bug #623464.
- The linuxaudiodev module is now deprecated; it is being replaced by
ossaudiodev. The interface has been extended to cover a lot more of
OSS (see www.opensound.com), including most DSP ioctls and the
OSS mixer API. Documentation forthcoming in 2.3a2.
Library
-------
- imaplib.py now supports SSL (Tino Lange and Piers Lauder).
- Freeze's modulefinder.py has been moved to the standard library;
slightly improved so it will issue less false missing submodule
reports (see sf path #643711 for details). Documentation will follow
with Python 2.3a2.
- os.path exposes getctime.
- unittest.py now has two additional methods called assertAlmostEqual()
and failIfAlmostEqual(). They implement an approximate comparison
by rounding the difference between the two arguments and comparing
the result to zero. Approximate comparison is essential for
unit tests of floating point results.
- calendar.py now depends on the new datetime module rather than
the time module. As a result, the range of allowable dates
has been increased.
- pdb has a new 'j(ump)' command to select the next line to be
executed.
- The distutils created windows installers now can run a
postinstallation script.
- doctest.testmod can now be called without argument, which means to
test the current module.
- When canceling a server that implemented threading with a keyboard
interrupt, the server would shut down but not terminate (waiting on
client threads). A new member variable, daemon_threads, was added to
the ThreadingMixIn class in SocketServer.py to make it explicit that
this behavior needs to be controlled.
- A new module, optparse, provides a fancy alternative to getopt for
command line parsing. It is a slightly modified version of Greg
Ward's Optik package.
- UserDict.py now defines a DictMixin class which defines all dictionary
methods for classes that already have a minimum mapping interface.
This greatly simplifies writing classes that need to be substitutable
for dictionaries (such as the shelve module).
- shelve.py now subclasses from UserDict.DictMixin. Now shelve supports
all dictionary methods. This eases the transition to persistent
storage for scripts originally written with dictionaries in mind.
- shelve.open and the various classes in shelve.py now accept an optional
binary flag, which defaults to False. If True, the values stored in the
shelf are binary pickles.
- A new package, logging, implements the logging API defined by PEP
282. The code is written by Vinay Sajip.
- StreamReader, StreamReaderWriter and StreamRecoder in the codecs
modules are iterators now.
- gzip.py now handles files exceeding 2GB. Files over 4GB also work
now (provided the OS supports it, and Python is configured with large
file support), but in that case the underlying gzip file format can
record only the least-significant 32 bits of the file size, so that
some tools working with gzipped files may report an incorrect file
size.
- xml.sax.saxutils.unescape has been added, to replace entity references
with their entity value.
- Queue.Queue.{put,get} now support an optional timeout argument.
- Various features of Tk 8.4 are exposed in Tkinter.py. The multiple
option of tkFileDialog is exposed as function askopenfile{,name}s.
- Various configure methods of Tkinter have been stream-lined, so that
tag_configure, image_configure, window_configure now return a
dictionary when invoked with no argument.
- Importing the readline module now no longer has the side effect of
calling setlocale(LC_CTYPE, ""). The initial "C" locale, or
whatever locale is explicitly set by the user, is preserved. If you
want repr() of 8-bit strings in your preferred encoding to preserve
all printable characters of that encoding, you have to add the
following code to your $PYTHONSTARTUP file or to your application's
main():
import locale
locale.setlocale(locale.LC_CTYPE, "")
- shutil.move was added. shutil.copytree now reports errors as an
exception at the end, instead of printing error messages.
- Encoding name normalization was generalized to not only
replace hyphens with underscores, but also all other non-alphanumeric
characters (with the exception of the dot which is used for Python
package names during lookup). The aliases.py mapping was updated
to the new standard.
- mimetypes has two new functions: guess_all_extensions() which
returns a list of all known extensions for a mime type, and
add_type() which adds one mapping between a mime type and
an extension to the database.
- New module: sets, defines the class Set that implements a mutable
set type using the keys of a dict to represent the set. There's
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.
- Added random.sample(population,k) for random sampling without replacement.
Returns a k length list of unique elements chosen from the population.
- 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.
- Thanks to Raymond Hettinger, random.random() now uses a new core
generator. The Mersenne Twister algorithm is implemented in C,
threadsafe, faster than the previous generator, has an astronomically
large period (2**19937-1), creates random floats to full 53-bit
precision, and may be the most widely tested random number generator
in existence.
The random.jumpahead(n) method has different semantics for the new
generator. Instead of jumping n steps ahead, it uses n and the
existing state to create a new state. This means that jumpahead()
continues to support multi-threaded code needing generators of
non-overlapping sequences. However, it will break code which relies
on jumpahead moving a specific number of steps forward.
The attributes random.whseed and random.__whseed have no meaning for
the new generator. Code using these attributes should switch to a
new class, random.WichmannHill which is provided for backward
compatibility and to make an alternate generator available.
- New "algorithms" module: heapq, implements a heap queue. Thanks to
Kevin O'Connor for the code and Franois Pinard for an entertaining
write-up explaining the theory and practical uses of heaps.
- New encoding for the Palm OS character set: palmos.
- binascii.crc32() and the zipfile module had problems on some 64-bit
platforms. These have been fixed. On a platform with 8-byte C longs,
crc32() now returns a signed-extended 4-byte result, so that its value
as a Python int is equal to the value computed a 32-bit platform.
- xml.dom.minidom.toxml and toprettyxml now take an optional encoding
argument.
- Some fixes in the copy module: when an object is copied through its
__reduce__ method, there was no check for a __setstate__ method on
the result [SF patch 565085]; deepcopy should treat instances of
custom metaclasses the same way it treats instances of type 'type'
[SF patch 560794].
- Sockets now support timeout mode. After s.settimeout(T), where T is
a float expressing seconds, subsequent operations raise an exception
if they cannot be completed within T seconds. To disable timeout
mode, use s.settimeout(None). There's also a module function,
socket.setdefaulttimeout(T), which sets the default for all sockets
created henceforth.
- getopt.gnu_getopt was added. This supports GNU-style option
processing, where options can be mixed with non-option arguments.
- Stop using strings for exceptions. String objects used for
exceptions are now classes deriving from Exception. The objects
changed were: Tkinter.TclError, bdb.BdbQuit, macpath.norm_error,
tabnanny.NannyNag, and xdrlib.Error.
- Constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and
big endian systems were added to the codecs module. The old names
BOM32_* and BOM64_* were off by a factor of 2.
- Added conversion functions math.degrees() and math.radians().
- math.log() now takes an optional argument: math.log(x[, base]).
- ftplib.retrlines() now tests for callback is None rather than testing
for False. Was causing an error when given a callback object which
was callable but also returned len() as zero. The change may
create new breakage if the caller relied on the undocumented behavior
and called with callback set to [] or some other False value not
identical to None.
- random.gauss() uses a piece of hidden state used by nothing else,
and the .seed() and .whseed() methods failed to reset it. In other
words, setting the seed didn't completely determine the sequence of
results produced by random.gauss(). It does now. Programs repeatedly
mixing calls to a seed method with calls to gauss() may see different
results now.
- The pickle.Pickler class grew a clear_memo() method to mimic that
provided by cPickle.Pickler.
- difflib's SequenceMatcher class now does a dynamic analysis of
which elements are so frequent as to constitute noise. For
comparing files as sequences of lines, this generally works better
than the IS_LINE_JUNK function, and function ndiff's linejunk
argument defaults to None now as a result. A happy benefit is
that SequenceMatcher may run much faster now when applied
to large files with many duplicate lines (for example, C program
text with lots of repeated "}" and "return NULL;" lines).
- New Text.dump() method in Tkinter module.
- New distutils commands for building packagers were added to
support pkgtool on Solaris and swinstall on HP-UX.
- distutils now has a new abstract binary packager base class
command/bdist_packager, which simplifies writing packagers.
This will hopefully provide the missing bits to encourage
people to submit more packagers, e.g. for Debian, FreeBSD
and other systems.
- The UTF-16, -LE and -BE stream readers now raise a
NotImplementedError for all calls to .readline(). Previously, they
used to just produce garbage or fail with an encoding error --
UTF-16 is a 2-byte encoding and the C lib's line reading APIs don't
work well with these.
- compileall now supports quiet operation.
- The BaseHTTPServer now implements optional HTTP/1.1 persistent
connections.
- socket module: the SSL support was broken out of the main
_socket module C helper and placed into a new _ssl helper
which now gets imported by socket.py if available and working.
- encodings package: added aliases for all supported IANA character
sets
- ftplib: to safeguard the user's privacy, anonymous login will use
"anonymous@" as default password, rather than the real user and host
name.
- webbrowser: tightened up the command passed to os.system() so that
arbitrary shell code can't be executed because a bogus URL was
passed in.
- gettext.translation has an optional fallback argument, and
gettext.find an optional all argument. Translations will now fallback
on a per-message basis. The module supports plural forms, by means
of gettext.[d]ngettext and Translation.[u]ngettext.
- distutils bdist commands now offer a --skip-build option.
- warnings.warn now accepts a Warning instance as first argument.
- The xml.sax.expatreader.ExpatParser class will no longer create
circular references by using itself as the locator that gets passed
to the content handler implementation. [SF bug #535474]
- The email.Parser.Parser class now properly parses strings regardless
of their line endings, which can be any of \r, \n, or \r\n (CR, LF,
or CRLF). Also, the Header class's constructor default arguments
has changed slightly so that an explicit maxlinelen value is always
honored, and so unicode conversion error handling can be specified.
- distutils' build_ext command now links C++ extensions with the C++
compiler available in the Makefile or CXX environment variable, if
running under \*nix.
- New module bz2: provides a comprehensive interface for the bz2 compression
library. It implements a complete file interface, one-shot (de)compression
functions, and types for sequential (de)compression.
- New pdb command 'pp' which is like 'p' except that it pretty-prints
the value of its expression argument.
- Now bdist_rpm distutils command understands a verify_script option in
the config file, including the contents of the referred filename in
the "%verifyscript" section of the rpm spec file.
- Fixed bug #495695: webbrowser module would run graphic browsers in a
unix environment even if DISPLAY was not set. Also, support for
skipstone browser was included.
- Fixed bug #636769: rexec would run unallowed code if subclasses of
strings were used as parameters for certain functions.
Tools/Demos
-----------
- pygettext.py now supports globbing on Windows, and accepts module
names in addition to accepting file names.
- The SGI demos (Demo/sgi) have been removed. Nobody thought they
were interesting any more. (The SGI library modules and extensions
are still there; it is believed that at least some of these are
still used and useful.)
- IDLE supports the new encoding declarations (PEP 263); it can also
deal with legacy 8-bit files if they use the locale's encoding. It
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
the generated binary.
Build
-----
- On Unix, IDLE is now installed automatically.
- The fpectl module is not built by default; it's dangerous or useless
except in the hands of experts.
- The public Python C API will generally be declared using PyAPI_FUNC
and PyAPI_DATA macros, while Python extension module init functions
will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros
are deprecated.
- A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or
get into infinite loops, when a new-style class got garbage-collected.
Unfortunately, to avoid this, the way COUNT_ALLOCS works requires
that new-style classes be immortal in COUNT_ALLOCS builds. Note that
COUNT_ALLOCS is not enabled by default, in either release or debug
builds, and that new-style classes are immortal only in COUNT_ALLOCS
builds.
- Compiling out the cyclic garbage collector is no longer an option.
The old symbol WITH_CYCLE_GC is now ignored, and Python.h arranges
that it's always defined (for the benefit of any extension modules
that may be conditionalizing on it). A bonus is that any extension
type participating in cyclic gc can choose to participate in the
Py_TRASHCAN mechanism now too; in the absence of cyclic gc, this used
to require editing the core to teach the trashcan mechanism about the
new type.
- According to Annex F of the current C standard,
The Standard C macro HUGE_VAL and its float and long double analogs,
HUGE_VALF and HUGE_VALL, expand to expressions whose values are
positive infinities.
Python only uses the double HUGE_VAL, and only to #define its own symbol
Py_HUGE_VAL. Some platforms have incorrect definitions for HUGE_VAL.
pyport.h used to try to worm around that, but the workarounds triggered
other bugs on other platforms, so we gave up. If your platform defines
HUGE_VAL incorrectly, you'll need to #define Py_HUGE_VAL to something
that works on your platform. The only instance of this I'm sure about
is on an unknown subset of Cray systems, described here:
http://www.cray.com/swpubs/manuals/SN-2194_2.0/html-SN-2194_2.0/x3138.htm
Presumably 2.3a1 breaks such systems. If anyone uses such a system, help!
- The configure option --without-doc-strings can be used to remove the
doc strings from the builtin functions and modules; this reduces the
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.
- All uses of the CACHE_HASH, INTERN_STRINGS, and DONT_SHARE_SHORT_STRINGS
preprocessor symbols were eliminated. The internal decisions they
controlled stopped being experimental long ago.
- The tools used to build the documentation now work under Cygwin as
well as Unix.
- The bsddb and dbm module builds have been changed to try and avoid version
skew problems and disable linkage with Berkeley DB 1.85 unless the
installer knows what s/he's doing. See the section on building these
modules in the README file for details.
C API
-----
- PyNumber_Check() now returns true for string and unicode objects.
This is a result of these types having a partially defined
tp_as_number slot. (This is not a feature, but an indication that
PyNumber_Check() is not very useful to determine numeric behavior.
It may be deprecated.)
- 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; there is 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'
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.
- New functions PyErr_SetExcFromWindowsErr() and
PyErr_SetExcFromWindowsErrWithFilename(). Similar to
PyErr_SetFromWindowsErrWithFilename() and
PyErr_SetFromWindowsErr(), but they allow to specify
the exception type to raise. Available on Windows.
- Py_FatalError() is now declared as taking a const char* argument. It
was previously declared without const. This should not affect working
code.
- Added new macro PySequence_ITEM(o, i) that directly calls
sq_item without rechecking that o is a sequence and without
adjusting for negative indices.
- PyRange_New() now raises ValueError if the fourth argument is not 1.
This is part of the removal of deprecated features of the xrange
object.
- PyNumber_Coerce() and PyNumber_CoerceEx() now also invoke the type's
coercion if both arguments have the same type but this type has the
CHECKTYPES flag set. This is to better support proxies.
- The type of tp_free has been changed from "``void (*)(PyObject *)``" to
"``void (*)(void *)``".
- PyObject_Del, PyObject_GC_Del are now functions instead of macros.
- A type can now inherit its metatype from its base type. Previously,
when PyType_Ready() was called, if ob_type was found to be NULL, it
was always set to &PyType_Type; now it is set to base->ob_type,
where base is tp_base, defaulting to &PyObject_Type.
- PyType_Ready() accidentally did not inherit tp_is_gc; now it does.
- The PyCore_* family of APIs have been removed.
- The "u#" parser marker will now pass through Unicode objects as-is
without going through the buffer API.
- The enumerators of cmp_op have been renamed to use the prefix ``PyCmp_``.
- An old #define of ANY as void has been removed from pyport.h. This
hasn't been used since Python's pre-ANSI days, and the #define has
been marked as obsolete since then. SF bug 495548 says it created
conflicts with other packages, so keeping it around wasn't harmless.
- Because Python's magic number scheme broke on January 1st, we decided
to stop Python development. Thanks for all the fish!
- Some of us don't like fish, so we changed Python's magic number
scheme to a new one. See Python/import.c for details.
New platforms
-------------
- OpenVMS is now supported.
- AtheOS is now supported.
- the EMX runtime environment on OS/2 is now supported.
- GNU/Hurd is now supported.
Tests
-----
- The regrtest.py script's -u option now provides a way to say "allow
all resources except this one." For example, to allow everything
except bsddb, give the option '-uall,-bsddb'.
Windows
-------
- The Windows distribution now ships with version 4.0.14 of the
Sleepycat Berkeley database library. This should be a huge
improvement over the previous Berkeley DB 1.85, which had many
bugs.
XXX What are the licensing issues here?
XXX If a user has a database created with a previous version of
XXX Python, what must they do to convert it?
XXX I'm still not sure how to link this thing (see PCbuild/readme.txt).
XXX The version # is likely to change before 2.3a1.
- The Windows distribution now ships with a Secure Sockets Library (SLL)
module (_ssl.pyd)
- The Windows distribution now ships with Tcl/Tk version 8.4.1 (it
previously shipped with Tcl/Tk 8.3.2).
- When Python is built under a Microsoft compiler, sys.version now
includes the compiler version number (_MSC_VER). For example, under
MSVC 6, sys.version contains the substring "MSC v.1200 ". 1200 is
the value of _MSC_VER under MSVC 6.
- Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause
of that has been fixed in the installer (disabled Wise's "delete in-
use files" uninstall option).
- Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031]
- The installer now installs Start menu shortcuts under (the local
equivalent of) "All Users" when doing an Admin install.
- file.truncate([newsize]) now works on Windows for all newsize values.
It used to fail if newsize didn't fit in 32 bits, reflecting a
limitation of MS _chsize (which is no longer used).
- os.waitpid() is now implemented for Windows, and can be used to block
until a specified process exits. This is similar to, but not exactly
the same as, os.waitpid() on POSIX systems. If you're waiting for
a specific process whose pid was obtained from one of the spawn()
functions, the same Python os.waitpid() code works across platforms.
See the docs for details. The docs were changed to clarify that
spawn functions return, and waitpid requires, a process handle on
Windows (not the same thing as a Windows process id).
- New tempfile.TemporaryFile implementation for Windows: this doesn't
need a TemporaryFileWrapper wrapper anymore, and should be immune
to a nasty problem: before 2.3, if you got a temp file on Windows, it
got wrapped in an object whose close() method first closed the
underlying file, then deleted the file. This usually worked fine.
However, the spawn family of functions on Windows create (at a low C
level) the same set of open files in the spawned process Q as were
open in the spawning process P. If a temp file f was among them, then
doing f.close() in P first closed P's C-level file handle on f, but Q's
C-level file handle on f remained open, so the attempt in P to delete f
blew up with a "Permission denied" error (Windows doesn't allow
deleting open files). This was surprising, subtle, and difficult to
work around.
- The os module now exports all the symbolic constants usable with the
low-level os.open() on Windows: the new constants in 2.3 are
O_NOINHERIT, O_SHORT_LIVED, O_TEMPORARY, O_RANDOM and O_SEQUENTIAL.
The others were also available in 2.2: O_APPEND, O_BINARY, O_CREAT,
O_EXCL, O_RDONLY, O_RDWR, O_TEXT, O_TRUNC and O_WRONLY. Contrary
to Microsoft docs, O_SHORT_LIVED does not seem to imply O_TEMPORARY
(so specify both if you want both; note that neither is useful unless
specified with O_CREAT too).
Mac
----
- Mac/Relnotes is gone, the release notes are now here.
- Python (the OSX-only, unix-based version, not the OS9-compatible CFM
version) now fully supports unicode strings as arguments to various file
system calls, eg. open(), file(), os.stat() and os.listdir().
- The current naming convention for Python on the Macintosh is that MacPython
refers to the unix-based OSX-only version, and MacPython-OS9 refers to the
CFM-based version that runs on both OS9 and OSX.
- All MacPython-OS9 functionality is now available in an OSX unix build,
including the Carbon modules, the IDE, OSA support, etc. A lot of this
will only work correctly in a framework build, though, because you cannot
talk to the window manager unless your application is run from a .app
bundle. There is a command line tool "pythonw" that runs your script
with an interpreter living in such a .app bundle, this interpreter should
be used to run any Python script using the window manager (including
Tkinter or wxPython scripts).
- Most of Mac/Lib has moved to Lib/plat-mac, which is again used both in
MacPython-OSX and MacPython-OS9. The only modules remaining in Mac/Lib
are specifically for MacPython-OS9 (CFM support, preference resources, etc).
- A new utility PythonLauncher will start a Python interpreter when a .py or
.pyw script is double-clicked in the Finder. By default .py scripts are
run with a normal Python interpreter in a Terminal window and .pyw
files are run with a window-aware pythonw interpreter without a Terminal
window, but all this can be customized.
- MacPython-OS9 is now Carbon-only, so it runs on Mac OS 9 or Mac OS X and
possibly on Mac OS 8.6 with the right CarbonLib installed, but not on earlier
releases.
- Many tools such as BuildApplet.py and gensuitemodule.py now support a command
line interface too.
- All the Carbon classes are now PEP253 compliant, meaning that you can
subclass them from Python. Most of the attributes have gone, you should
now use the accessor function call API, which is also what Apple's
documentation uses. Some attributes such as grafport.visRgn are still
available for convenience.
- New Carbon modules File (implementing the APIs in Files.h and Aliases.h)
and Folder (APIs from Folders.h). The old macfs builtin module is
gone, and replaced by a Python wrapper around the new modules.
- Pathname handling should now be fully consistent: MacPython-OSX always uses
unix pathnames and MacPython-OS9 always uses colon-separated Mac pathnames
(also when running on Mac OS X).
- New Carbon modules Help and AH give access to the Carbon Help Manager.
There are hooks in the IDE to allow accessing the Python documentation
(and Apple's Carbon and Cocoa documentation) through the Help Viewer.
See Mac/OSX/README for converting the Python documentation to a
Help Viewer compatible form and installing it.
- OSA support has been redesigned and the generated Python classes now
mirror the inheritance defined by the underlying OSA classes.
- MacPython no longer maps both \r and \n to \n on input for any text file.
This feature has been replaced by universal newline support (PEP278).
- The default encoding for Python sourcefiles in MacPython-OS9 is no longer
mac-roman (or whatever your local Mac encoding was) but "ascii", like on
other platforms. If you really need sourcefiles with Mac characters in them
you can change this in site.py.
What's New in Python 2.2 final?
===============================
*Release date: 21-Dec-2001*
Type/class unification and new-style classes
--------------------------------------------
- pickle.py, cPickle: allow pickling instances of new-style classes
with a custom metaclass.
Core and builtins
-----------------
- weakref proxy object: when comparing, unwrap both arguments if both
are proxies.
Extension modules
-----------------
- binascii.b2a_base64(): fix a potential buffer overrun when encoding
very short strings.
- cPickle: the obscure "fast" mode was suspected of causing stack
overflows on the Mac. Hopefully fixed this by setting the recursion
limit much smaller. If the limit is too low (it only affects
performance), you can change it by defining PY_CPICKLE_FAST_LIMIT
when compiling cPickle.c (or in pyconfig.h).
Library
-------
- dumbdbm.py: fixed a dumb old bug (the file didn't get synched at
close or delete time).
- rfc822.py: fixed a bug where the address '<>' was converted to None
instead of an empty string (also fixes the email.Utils module).
- xmlrpclib.py: version 1.0.0; uses precision for doubles.
- test suite: the pickle and cPickle tests were not executing any code
when run from the standard regression test.
Tools/Demos
-----------
Build
-----
C API
-----
New platforms
-------------
Tests
-----
Windows
-------
- distutils package: fixed broken Windows installers (bdist_wininst).
- tempfile.py: prevent mysterious warnings when TemporaryFileWrapper
instances are deleted at process exit time.
- socket.py: prevent mysterious warnings when socket instances are
deleted at process exit time.
- posixmodule.c: fix a Windows crash with stat() of a filename ending
in backslash.
Mac
----
- The Carbon toolbox modules have been upgraded to Universal Headers
3.4, and experimental CoreGraphics and CarbonEvents modules have
been added. All only for framework-enabled MacOSX.
What's New in Python 2.2c1?
===========================
*Release date: 14-Dec-2001*
Type/class unification and new-style classes
--------------------------------------------
- Guido's tutorial introduction to the new type/class features has
been extensively updated. See
http://www.python.org/2.2/descrintro.html
That remains the primary documentation in this area.
- Fixed a leak: instance variables declared with __slots__ were never
deleted!
- The "delete attribute" method of descriptor objects is called
__delete__, not __del__. In previous releases, it was mistakenly
called __del__, which created an unfortunate overloading condition
with finalizers. (The "get attribute" and "set attribute" methods
are still called __get__ and __set__, respectively.)
- Some subtle issues with the super built-in were fixed:
(a) When super itself is subclassed, its __get__ method would still
return an instance of the base class (i.e., of super).
(b) super(C, C()).__class__ would return C rather than super. This
is confusing. To fix this, I decided to change the semantics of
super so that it only applies to code attributes, not to data
attributes. After all, overriding data attributes is not
supported anyway.
(c) The __get__ method didn't check whether the argument was an
instance of the type used in creation of the super instance.
- Previously, hash() of an instance of a subclass of a mutable type
(list or dictionary) would return some value, rather than raising
TypeError. This has been fixed. Also, directly calling
dict.__hash__ and list.__hash__ now raises the same TypeError
(previously, these were the same as object.__hash__).
- New-style objects now support deleting their __dict__. This is for
all intents and purposes equivalent to assigning a brand new empty
dictionary, but saves space if the object is not used further.
Core and builtins
-----------------
- -Qnew now works as documented in PEP 238: when -Qnew is passed on
the command line, all occurrences of "/" use true division instead
of classic division. See the PEP for details. Note that "all"
means all instances in library and 3rd-party modules, as well as in
your own code. As the PEP says, -Qnew is intended for use only in
educational environments with control over the libraries in use.
Note that test_coercion.py in the standard Python test suite fails
under -Qnew; this is expected, and won't be repaired until true
division becomes the default (in the meantime, test_coercion is
testing the current rules).
- complex() now only allows the first argument to be a string
argument, and raises TypeError if either the second arg is a string
or if the second arg is specified when the first is a string.
Extension modules
-----------------
- gc.get_referents was renamed to gc.get_referrers.
Library
-------
- Functions in the os.spawn() family now release the global interpreter
lock around calling the platform spawn. They should always have done
this, but did not before 2.2c1. Multithreaded programs calling
an os.spawn function with P_WAIT will no longer block all Python threads
until the spawned program completes. It's possible that some programs
relies on blocking, although more likely by accident than by design.
- webbrowser defaults to netscape.exe on OS/2 now.
- Tix.ResizeHandle exposes detach_widget, hide, and show.
- The charset alias windows_1252 has been added.
- types.StringTypes is a tuple containing the defined string types;
usually this will be (str, unicode), but if Python was compiled
without Unicode support it will be just (str,).
- The pulldom and minidom modules were synchronized to PyXML.
Tools/Demos
-----------
- A new script called Tools/scripts/google.py was added, which fires
off a search on Google.
Build
-----
- Note that release builds of Python should arrange to define the
preprocessor symbol NDEBUG on the command line (or equivalent).
In the 2.2 pre-release series we tried to define this by magic in
Python.h instead, but it proved to cause problems for extension
authors. The Unix, Windows and Mac builds now all define NDEBUG in
release builds via cmdline (or equivalent) instead. Ports to
other platforms should do likewise.
- It is no longer necessary to use --with-suffix when building on a
case-insensitive file system (such as Mac OS X HFS+). In the build
directory an extension is used, but not in the installed python.
C API
-----
- New function PyDict_MergeFromSeq2() exposes the builtin dict
constructor's logic for updating a dictionary from an iterable object
producing key-value pairs.
- PyArg_ParseTupleAndKeywords() requires that the number of entries in
the keyword list equal the number of argument specifiers. This
wasn't checked correctly, and PyArg_ParseTupleAndKeywords could even
dump core in some bad cases. This has been repaired. As a result,
PyArg_ParseTupleAndKeywords may raise RuntimeError in bad cases that
previously went unchallenged.
New platforms
-------------
Tests
-----
Windows
-------
Mac
----
- In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
without any trailing digits.
- Changed logic for finding python home in Mac OS X framework Pythons.
Now sys.executable points to the executable again, in stead of to
the shared library. The latter is used only for locating the python
home.
What's New in Python 2.2b2?
===========================
*Release date: 16-Nov-2001*
Type/class unification and new-style classes
--------------------------------------------
- Multiple inheritance mixing new-style and classic classes in the
list of base classes is now allowed, so this works now:
class Classic: pass
class Mixed(Classic, object): pass
The MRO (method resolution order) for each base class is respected
according to its kind, but the MRO for the derived class is computed
using new-style MRO rules if any base class is a new-style class.
This needs to be documented.
- The new builtin dictionary() constructor, and dictionary type, have
been renamed to dict. This reflects a decade of common usage.
- dict() now accepts an iterable object producing 2-sequences. For
example, dict(d.items()) == d for any dictionary d. The argument,
and the elements of the argument, can be any iterable objects.
- New-style classes can now have a __del__ method, which is called
when the instance is deleted (just like for classic classes).
- Assignment to object.__dict__ is now possible, for objects that are
instances of new-style classes that have a __dict__ (unless the base
class forbids it).
- Methods of built-in types now properly check for keyword arguments
(formerly these were silently ignored). The only built-in methods
that take keyword arguments are __call__, __init__ and __new__.
- The socket function has been converted to a type; see below.
Core and builtins
-----------------
- Assignment to __debug__ raises SyntaxError at compile-time. This
was promised when 2.1c1 was released as "What's New in Python 2.1c1"
(see below) says.
- Clarified the error messages for unsupported operands to an operator
(like 1 + '').
Extension modules
-----------------
- mmap has a new keyword argument, "access", allowing a uniform way for
both Windows and Unix users to create read-only, write-through and
copy-on-write memory mappings. This was previously possible only on
Unix. A new keyword argument was required to support this in a
uniform way because the mmap() signatures had diverged across
platforms. Thanks to Jay T Miller for repairing this!
- By default, the gc.garbage list now contains only those instances in
unreachable cycles that have __del__ methods; in 2.1 it contained all
instances in unreachable cycles. "Instances" here has been generalized
to include instances of both new-style and old-style classes.
- The socket module defines a new method for socket objects,
sendall(). This is like send() but may make multiple calls to
send() until all data has been sent. Also, the socket function has
been converted to a subclassable type, like list and tuple (etc.)
before it; socket and SocketType are now the same thing.
- Various bugfixes to the curses module. There is now a test suite
for the curses module (you have to run it manually).
- binascii.b2a_base64 no longer places an arbitrary restriction of 57
bytes on its input.
Library
-------
- tkFileDialog exposes a Directory class and askdirectory
convenience function.
- Symbolic group names in regular expressions must be unique. For
example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
single name can't mean both "group 1" and "group 2" simultaneously.
Python 2.2 detects this error at regexp compilation time;
previously, the error went undetected, and results were
unpredictable. Also in sre, the pattern.split(), pattern.sub(), and
pattern.subn() methods have been rewritten in C. Also, an
experimental function/method finditer() has been added, which works
like findall() but returns an iterator.
- Tix exposes more commands through the classes DirSelectBox,
DirSelectDialog, ListNoteBook, Meter, CheckList, and the
methods tix_addbitmapdir, tix_cget, tix_configure, tix_filedialog,
tix_getbitmap, tix_getimage, tix_option_get, and tix_resetoptions.
- Traceback objects are now scanned by cyclic garbage collection, so
cycles created by casual use of sys.exc_info() no longer cause
permanent memory leaks (provided garbage collection is enabled).
- os.extsep -- a new variable needed by the RISCOS support. It is the
separator used by extensions, and is '.' on all platforms except
RISCOS, where it is '/'. There is no need to use this variable
unless you have a masochistic desire to port your code to RISCOS.
- mimetypes.py has optional support for non-standard, but commonly
found types. guess_type() and guess_extension() now accept an
optional 'strict' flag, defaulting to true, which controls whether
recognize non-standard types or not. A few non-standard types we
know about have been added. Also, when run as a script, there are
new -l and -e options.
- statcache is now deprecated.
- email.Utils.formatdate() now produces the preferred RFC 2822 style
dates with numeric timezones (it used to produce obsolete dates
hard coded to "GMT" timezone). An optional 'localtime' flag is
added to produce dates in the local timezone, with daylight savings
time properly taken into account.
- In pickle and cPickle, instead of masking errors in load() by
transforming them into SystemError, we let the original exception
propagate out. Also, implement support for __safe_for_unpickling__
in pickle, as it already was supported in cPickle.
Tools/Demos
-----------
Build
-----
- The dbm module is built using libdb1 if available. The bsddb module
is built with libdb3 if available.
- Misc/Makefile.pre.in has been removed by BDFL pronouncement.
C API
-----
- New function PySequence_Fast_GET_SIZE() returns the size of a non-
NULL result from PySequence_Fast(), more quickly than calling
PySequence_Size().
- New argument unpacking function PyArg_UnpackTuple() added.
- New functions PyObject_CallFunctionObjArgs() and
PyObject_CallMethodObjArgs() have been added to make it more
convenient and efficient to call functions and methods from C.
- PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
possible that this will propagate errors it didn't before.
- New function PyObject_CheckReadBuffer(), which returns true if its
argument supports the single-segment readable buffer interface.
New platforms
-------------
- We've finally confirmed that this release builds on HP-UX 11.00,
*with* threads, and passes the test suite.
- Thanks to a series of patches from Michael Muller, Python may build
again under OS/2 Visual Age C++.
- Updated RISCOS port by Dietmar Schwertberger.
Tests
-----
- Added a test script for the curses module. It isn't run automatically;
regrtest.py must be run with '-u curses' to enable it.
Windows
-------
Mac
----
- PythonScript has been moved to unsupported and is slated to be
removed completely in the next release.
- It should now be possible to build applets that work on both OS9 and
OSX.
- The core is now linked with CoreServices not Carbon; as a side
result, default 8bit encoding on OSX is now ASCII.
- Python should now build on OSX 10.1.1
What's New in Python 2.2b1?
===========================
*Release date: 19-Oct-2001*
Type/class unification and new-style classes
--------------------------------------------
- New-style classes are now always dynamic (except for built-in and
extension types). There is no longer a performance penalty, and I
no longer see another reason to keep this baggage around. One relic
remains: the __dict__ of a new-style class is a read-only proxy; you
must set the class's attribute to modify it. As a consequence, the
__defined__ attribute of new-style types no longer exists, for lack
of need: there is once again only one __dict__ (although in the
future a __cache__ may be resurrected with a similar function, if I
can prove that it actually speeds things up).
- C.__doc__ now works as expected for new-style classes (in 2.2a4 it
always returned None, even when there was a class docstring).
- doctest now finds and runs docstrings attached to new-style classes,
class methods, static methods, and properties.
Core and builtins
-----------------
- A very subtle syntactical pitfall in list comprehensions was fixed.
For example: [a+b for a in 'abc', for b in 'def']. The comma in
this example is a mistake. Previously, this would silently let 'a'
iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error.
Note that [a for a in <singleton>] is a convoluted way to say
[<singleton>] anyway, so it's not like any expressiveness is lost.
- getattr(obj, name, default) now only catches AttributeError, as
documented, rather than returning the default value for all
exceptions (which could mask bugs in a __getattr__ hook, for
example).
- Weak reference objects are now part of the core and offer a C API.
A bug which could allow a core dump when binary operations involved
proxy reference has been fixed. weakref.ReferenceError is now a
built-in exception.
- unicode(obj) now behaves more like str(obj), accepting arbitrary
objects, and calling a __unicode__ method if it exists.
unicode(obj, encoding) and unicode(obj, encoding, errors) still
require an 8-bit string or character buffer argument.
- isinstance() now allows any object as the first argument and a
class, a type or something with a __bases__ tuple attribute for the
second argument. The second argument may also be a tuple of a
class, type, or something with __bases__, in which case isinstance()
will return true if the first argument is an instance of any of the
things contained in the second argument tuple. E.g.
isinstance(x, (A, B))
returns true if x is an instance of A or B.
Extension modules
-----------------
- thread.start_new_thread() now returns the thread ID (previously None).
- binascii has now two quopri support functions, a2b_qp and b2a_qp.
- readline now supports setting the startup_hook and the
pre_event_hook, and adds the add_history() function.
- os and posix supports chroot(), setgroups() and unsetenv() where
available. The stat(), fstat(), statvfs() and fstatvfs() functions
now return "pseudo-sequences" -- the various fields can now be
accessed as attributes (e.g. os.stat("/").st_mtime) but for
backwards compatibility they also behave as a fixed-length sequence.
Some platform-specific fields (e.g. st_rdev) are only accessible as
attributes.
- time: localtime(), gmtime() and strptime() now return a
pseudo-sequence similar to the os.stat() return value, with
attributes like tm_year etc.
- Decompression objects in the zlib module now accept an optional
second parameter to decompress() that specifies the maximum amount
of memory to use for the uncompressed data.
- optional SSL support in the socket module now exports OpenSSL
functions RAND_add(), RAND_egd(), and RAND_status(). These calls
are useful on platforms like Solaris where OpenSSL does not
automatically seed its PRNG. Also, the keyfile and certfile
arguments to socket.ssl() are now optional.
- posixmodule (and by extension, the os module on POSIX platforms) now
exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
Library
-------
- doctest now excludes functions and classes not defined by the module
being tested, thanks to Tim Hochberg.
- HotShot, a new profiler implemented using a C-based callback, has
been added. This substantially reduces the overhead of profiling,
but it is still quite preliminary. Support modules and
documentation will be added in upcoming releases (before 2.2 final).
- profile now produces correct output in situations where an exception
raised in Python is cleared by C code (e.g. hasattr()). This used
to cause wrong output, including spurious claims of recursive
functions and attribution of time spent to the wrong function.
The code and documentation for the derived OldProfile and HotProfile
profiling classes was removed. The code hasn't worked for years (if
you tried to use them, they raised exceptions). OldProfile
intended to reproduce the behavior of the profiler Python used more
than 7 years ago, and isn't interesting anymore. HotProfile intended
to provide a faster profiler (but producing less information), and
that's a worthy goal we intend to meet via a different approach (but
without losing information).
- Profile.calibrate() has a new implementation that should deliver
a much better system-specific calibration constant. The constant can
now be specified in an instance constructor, or as a Profile class or
instance variable, instead of by editing profile.py's source code.
Calibration must still be done manually (see the docs for the profile
module).
Note that Profile.calibrate() must be overridden by subclasses.
Improving the accuracy required exploiting detailed knowledge of
profiler internals; the earlier method abstracted away the details
and measured a simplified model instead, but consequently computed
a constant too small by a factor of 2 on some modern machines.
- quopri's encode and decode methods take an optional header parameter,
which indicates whether output is intended for the header 'Q'
encoding.
- The SocketServer.ThreadingMixIn class now closes the request after
finish_request() returns. (Not when it errors out though.)
- The nntplib module's NNTP.body() method has grown a 'file' argument
to allow saving the message body to a file.
- The email package has added a class email.Parser.HeaderParser which
only parses headers and does not recurse into the message's body.
Also, the module/class MIMEAudio has been added for representing
audio data (contributed by Anthony Baxter).
- ftplib should be able to handle files > 2GB.
- ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
ON, and OFF.
- xml.dom.minidom NodeList objects now support the length attribute
and item() method as required by the DOM specifications.
Tools/Demos
-----------
- Demo/dns was removed. It no longer serves any purpose; a package
derived from it is now maintained by Anthony Baxter, see
http://PyDNS.SourceForge.net.
- The freeze tool has been made more robust, and two new options have
been added: -X and -E.
Build
-----
- configure will use CXX in LINKCC if CXX is used to build main() and
the system requires to link a C++ main using the C++ compiler.
C API
-----
- The documentation for the tp_compare slot is updated to require that
the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
not correct. This is not yet enforced but will be enforced in
Python 2.3; even later, we may use -2 to indicate errors and +2 for
"NotImplemented". Right now, -1 should be used for an error return.
- PyLong_AsLongLong() now accepts int (as well as long) arguments.
Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
as long) arguments.
- PyThread_start_new_thread() now returns a long int giving the thread
ID, if one can be calculated; it returns -1 for error, 0 if no
thread ID is calculated (this is an incompatible change, but only
the thread module used this API). This code has only really been
tested on Linux and Windows; other platforms please beware (and
report any bugs or strange behavior).
- PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
input.
New platforms
-------------
Tests
-----
Windows
-------
- Installer: If you install IDLE, and don't disable file-extension
registration, a new "Edit with IDLE" context (right-click) menu entry
is created for .py and .pyw files.
- The signal module now supports SIGBREAK on Windows, thanks to Steven
Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK
action remains to call Win32 ExitProcess(). This can be changed via
signal.signal(). For example::
# Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
# (SIGINT) behavior.
import signal
signal.signal(signal.SIGBREAK, signal.default_int_handler)
try:
while 1:
pass
except KeyboardInterrupt:
# We get here on Ctrl+C or Ctrl+Break now; if we had not changed
# SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
# program without the possibility for any Python-level cleanup).
print "Clean exit"
What's New in Python 2.2a4?
===========================
*Release date: 28-Sep-2001*
Type/class unification and new-style classes
--------------------------------------------
- pydoc and inspect are now aware of new-style classes;
e.g. help(list) at the interactive prompt now shows proper
documentation for all operations on list objects.
- Applications using Jim Fulton's ExtensionClass module can now safely
be used with Python 2.2. In particular, Zope 2.4.1 now works with
Python 2.2 (as well as with Python 2.1.1). The Demo/metaclass
examples also work again. It is hoped that Gtk and Boost also work
with 2.2a4 and beyond. (If you can confirm this, please write
webmaster@python.org; if there are still problems, please open a bug
report on SourceForge.)
- property() now takes 4 keyword arguments: fget, fset, fdel and doc.
These map to read-only attributes 'fget', 'fset', 'fdel', and '__doc__'
in the constructed property object. fget, fset and fdel weren't
discoverable from Python in 2.2a3. __doc__ is new, and allows to
associate a docstring with a property.
- Comparison overloading is now more completely implemented. For
example, a str subclass instance can properly be compared to a str
instance, and it can properly overload comparison. Ditto for most
other built-in object types.
- The repr() of new-style classes has changed; instead of <type
'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
*except* for built-in types, which are still rendered as <type
'Foo'> (to avoid upsetting existing code that might parse or
otherwise rely on repr() of certain type objects).
- The repr() of new-style objects is now always <Foo object at XXX>;
previously, it was sometimes <Foo instance at XXX>.
- For new-style classes, what was previously called __getattr__ is now
called __getattribute__. This method, if defined, is called for
*every* attribute access. A new __getattr__ hook more similar to the
one in classic classes is defined which is called only if regular
attribute access raises AttributeError; to catch *all* attribute
access, you can use __getattribute__ (for new-style classes). If
both are defined, __getattribute__ is called first, and if it raises
AttributeError, __getattr__ is called.
- The __class__ attribute of new-style objects can be assigned to.
The new class must have the same C-level object layout as the old
class.
- The builtin file type can be subclassed now. In the usual pattern,
"file" is the name of the builtin type, and file() is a new builtin
constructor, with the same signature as the builtin open() function.
file() is now the preferred way to open a file.
- Previously, __new__ would only see sequential arguments passed to
the type in a constructor call; __init__ would see both sequential
and keyword arguments. This made no sense whatsoever any more, so
now both __new__ and __init__ see all arguments.
- Previously, hash() applied to an instance of a subclass of str or
unicode always returned 0. This has been repaired.
- Previously, an operation on an instance of a subclass of an
immutable type (int, long, float, complex, tuple, str, unicode),
where the subtype didn't override the operation (and so the
operation was handled by the builtin type), could return that
instance instead a value of the base type. For example, if s was of
a str subclass type, s[:] returned s as-is. Now it returns a str
with the same value as s.
- Provisional support for pickling new-style objects has been added.
Core
----
- file.writelines() now accepts any iterable object producing strings.
- PyUnicode_FromEncodedObject() now works very much like
PyObject_Str(obj) in that it tries to use __str__/tp_str
on the object if the object is not a string or buffer. This
makes unicode() behave like str() when applied to non-string/buffer
objects.
- PyFile_WriteObject now passes Unicode objects to the file's write
method. As a result, all file-like objects which may be the target
of a print statement must support Unicode objects, i.e. they must
at least convert them into ASCII strings.
- Thread scheduling on Solaris should be improved; it is no longer
necessary to insert a small sleep at the start of a thread in order
to let other runnable threads be scheduled.
Library
-------
- StringIO.StringIO instances and cStringIO.StringIO instances support
read character buffer compatible objects for their .write() methods.
These objects are converted to strings and then handled as such
by the instances.
- The "email" package has been added. This is basically a port of the
mimelib package <http://sf.net/projects/mimelib> with API changes
and some implementations updated to use iterators and generators.
- difflib.ndiff() and difflib.Differ.compare() are generators now. This
restores the ability of Tools/scripts/ndiff.py to start producing output
before the entire comparison is complete.
- StringIO.StringIO instances and cStringIO.StringIO instances support
iteration just like file objects (i.e. their .readline() method is
called for each iteration until it returns an empty string).
- The codecs module has grown four new helper APIs to access
builtin codecs: getencoder(), getdecoder(), getreader(),
getwriter().
- SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
simplifies writing XML RPC servers.
- os.path.realpath(): a new function that returns the absolute pathname
after interpretation of symbolic links. On non-Unix systems, this
is an alias for os.path.abspath().
- operator.indexOf() (PySequence_Index() in the C API) now works with any
iterable object.
- smtplib now supports various authentication and security features of
the SMTP protocol through the new login() and starttls() methods.
- hmac: a new module implementing keyed hashing for message
authentication.
- mimetypes now recognizes more extensions and file types. At the
same time, some mappings not sanctioned by IANA were removed.
- The "compiler" package has been brought up to date to the state of
Python 2.2 bytecode generation. It has also been promoted from a
Tool to a standard library package. (Tools/compiler still exists as
a sample driver.)
Build
-----
- Large file support (LFS) is now automatic when the platform supports
it; no more manual configuration tweaks are needed. On Linux, at
least, it's possible to have a system whose C library supports large
files but whose kernel doesn't; in this case, large file support is
still enabled but doesn't do you any good unless you upgrade your
kernel or share your Python executable with another system whose
kernel has large file support.
- The configure script now supplies plausible defaults in a
cross-compilation environment. This doesn't mean that the supplied
values are always correct, or that cross-compilation now works
flawlessly -- but it's a first step (and it shuts up most of
autoconf's warnings about AC_TRY_RUN).
- The Unix build is now a bit less chatty, courtesy of the parser
generator. The build is completely silent (except for errors) when
using "make -s", thanks to a -q option to setup.py.
C API
-----
- The "structmember" API now supports some new flag bits to deny read
and/or write access to attributes in restricted execution mode.
New platforms
-------------
- Compaq's iPAQ handheld, running the "familiar" Linux distribution
(http://familiar.handhelds.org).
Tests
-----
- The "classic" standard tests, which work by comparing stdout to
an expected-output file under Lib/test/output/, no longer stop at
the first mismatch. Instead the test is run to completion, and a
variant of ndiff-style comparison is used to report all differences.
This is much easier to understand than the previous style of reporting.
- The unittest-based standard tests now use regrtest's test_main()
convention, instead of running as a side-effect of merely being
imported. This allows these tests to be run in more natural and
flexible ways as unittests, outside the regrtest framework.
- regrtest.py is much better integrated with unittest and doctest now,
especially in regard to reporting errors.
Windows
-------
- Large file support now also works for files > 4GB, on filesystems
that support it (NTFS under Windows 2000). See "What's New in
Python 2.2a3" for more detail.
What's New in Python 2.2a3?
===========================
*Release Date: 07-Sep-2001*
Core
----
- Conversion of long to float now raises OverflowError if the long is too
big to represent as a C double.
- The 3-argument builtin pow() no longer allows a third non-None argument
if either of the first two arguments is a float, or if both are of
integer types and the second argument is negative (in which latter case
the arguments are converted to float, so this is really the same
restriction).
- The builtin dir() now returns more information, and sometimes much
more, generally naming all attributes of an object, and all attributes
reachable from the object via its class, and from its class's base
classes, and so on from them too. Example: in 2.2a2, dir([]) returned
an empty list. In 2.2a3,
>>> dir([])
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
'__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
'__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
'__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
'__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
'reverse', 'sort']
dir(module) continues to return only the module's attributes, though.
- Overflowing operations on plain ints now return a long int rather
than raising OverflowError. This is a partial implementation of PEP
237. You can use -Wdefault::OverflowWarning to enable a warning for
this situation, and -Werror::OverflowWarning to revert to the old
OverflowError exception.
- A new command line option, -Q<arg>, is added to control run-time
warnings for the use of classic division. (See PEP 238.) Possible
values are -Qold, -Qwarn, -Qwarnall, and -Qnew. The default is
-Qold, meaning the / operator has its classic meaning and no
warnings are issued. Using -Qwarn issues a run-time warning about
all uses of classic division for int and long arguments; -Qwarnall
also warns about classic division for float and complex arguments
(for use with fixdiv.py).
[Note: the remainder of this item (preserved below) became
obsolete in 2.2c1 -- -Qnew has global effect in 2.2] ::
Using -Qnew is questionable; it turns on new division by default, but
only in the __main__ module. You can usefully combine -Qwarn or
-Qwarnall and -Qnew: this gives the __main__ module new division, and
warns about classic division everywhere else.
- Many built-in types can now be subclassed. This applies to int,
long, float, str, unicode, and tuple. (The types complex, list and
dictionary can also be subclassed; this was introduced earlier.)
Note that restrictions apply when subclassing immutable built-in
types: you can only affect the value of the instance by overloading
__new__. You can add mutable attributes, and the subclass instances
will have a __dict__ attribute, but you cannot change the "value"
(as implemented by the base class) of an immutable subclass instance
once it is created.
- The dictionary constructor now takes an optional argument, a
mapping-like object, and initializes the dictionary from its
(key, value) pairs.
- A new built-in type, super, has been added. This facilitates making
"cooperative super calls" in a multiple inheritance setting. For an
explanation, see http://www.python.org/2.2/descrintro.html#cooperation
- A new built-in type, property, has been added. This enables the
creation of "properties". These are attributes implemented by
getter and setter functions (or only one of these for read-only or
write-only attributes), without the need to override __getattr__.
See http://www.python.org/2.2/descrintro.html#property
- The syntax of floating-point and imaginary literals has been
liberalized, to allow leading zeroes. Examples of literals now
legal that were SyntaxErrors before:
00.0 0e3 0100j 07.5 00000000000000000008.
- An old tokenizer bug allowed floating point literals with an incomplete
exponent, such as 1e and 3.1e-. Such literals now raise SyntaxError.
Library
-------
- telnetlib includes symbolic names for the options, and support for
setting an option negotiation callback. It also supports processing
of suboptions.
- The new C standard no longer requires that math libraries set errno to
ERANGE on overflow. For platform libraries that exploit this new
freedom, Python's overflow-checking was wholly broken. A new overflow-
checking scheme attempts to repair that, but may not be reliable on all
platforms (C doesn't seem to provide anything both useful and portable
in this area anymore).
- Asynchronous timeout actions are available through the new class
threading.Timer.
- math.log and math.log10 now return sensible results for even huge
long arguments. For example, math.log10(10 ** 10000) ~= 10000.0.
- A new function, imp.lock_held(), returns 1 when the import lock is
currently held. See the docs for the imp module.
- pickle, cPickle and marshal on 32-bit platforms can now correctly read
dumps containing ints written on platforms where Python ints are 8 bytes.
When read on a box where Python ints are 4 bytes, such values are
converted to Python longs.
- In restricted execution mode (using the rexec module), unmarshalling
code objects is no longer allowed. This plugs a security hole.
- unittest.TestResult instances no longer store references to tracebacks
generated by test failures. This prevents unexpected dangling references
to objects that should be garbage collected between tests.
Tools
-----
- Tools/scripts/fixdiv.py has been added which can be used to fix
division operators as per PEP 238.
Build
-----
- If you are an adventurous person using Mac OS X you may want to look at
Mac/OSX. There is a Makefile there that will build Python as a real Mac
application, which can be used for experimenting with Carbon or Cocoa.
Discussion of this on pythonmac-sig, please.
C API
-----
- New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
- Note that PyLong_AsDouble can fail! This has always been true, but no
callers checked for it. It's more likely to fail now, because overflow
errors are properly detected now. The proper way to check::
double x = PyLong_AsDouble(some_long_object);
if (x == -1.0 && PyErr_Occurred()) {
/* The conversion failed. */
}
- The GC API has been changed. Extensions that use the old API will still
compile but will not participate in GC. To upgrade an extension
module:
- rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
- use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
PyObject_GC_Del to deallocate them
- rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
to PyObject_GC_UnTrack
- remove PyGC_HEAD_SIZE from object size calculations
- remove calls to PyObject_AS_GC and PyObject_FROM_GC
- Two new functions: PyString_FromFormat() and PyString_FromFormatV().
These can be used safely to construct string objects from a
sprintf-style format string (similar to the format string supported
by PyErr_Format()).
New platforms
-------------
- Stephen Hansen contributed patches sufficient to get a clean compile
under Borland C (Windows), but he reports problems running it and ran
out of time to complete the port. Volunteers? Expect a MemoryError
when importing the types module; this is probably shallow, and
causing later failures too.
Tests
-----
Windows
-------
- Large file support is now enabled on Win32 platforms as well as on
Win64. This means that, for example, you can use f.tell() and f.seek()
to manipulate files larger than 2 gigabytes (provided you have enough
disk space, and are using a Windows filesystem that supports large
partitions). Windows filesystem limits: FAT has a 2GB (gigabyte)
filesize limit, and large file support makes no difference there.
FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
NTFS has no practical limit on file size, and files of any size can be
used from Python now.
- The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
points to command.com (patch from Brian Quinlan).
What's New in Python 2.2a2?
===========================
*Release Date: 22-Aug-2001*
Build
-----
- Tim Peters developed a brand new Windows installer using Wise 8.1,
generously donated to us by Wise Solutions.
- configure supports a new option --enable-unicode, with the values
ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
type and supporting code is completely removed from the interpreter.
- A new configure option --enable-framework builds a Mac OS X framework,
which "make frameworkinstall" will install. This provides a starting
point for more mac-like functionality, join pythonmac-sig@python.org
if you are interested in helping.
- The NeXT platform is no longer supported.
- The 'new' module is now statically linked.
Tools
-----
- The new Tools/scripts/cleanfuture.py can be used to automatically
edit out obsolete future statements from Python source code. See
the module docstring for details.
Tests
-----
- regrtest.py now knows which tests are expected to be skipped on some
platforms, allowing to give clearer test result output. regrtest
also has optional --use/-u switch to run normally disabled tests
which require network access or consume significant disk resources.
- Several new tests in the standard test suite, with special thanks to
Nick Mathewson.
Core
----
- The floor division operator // has been added as outlined in PEP
238. The / operator still provides classic division (and will until
Python 3.0) unless "from __future__ import division" is included, in
which case the / operator will provide true division. The operator
module provides truediv() and floordiv() functions. Augmented
assignment variants are included, as are the equivalent overloadable
methods and C API methods. See the PEP for a full discussion:
<http://python.sf.net/peps/pep-0238.html>
- Future statements are now effective in simulated interactive shells
(like IDLE). This should "just work" by magic, but read Michael
Hudson's "Future statements in simulated shells" PEP 264 for full
details: <http://python.sf.net/peps/pep-0264.html>.
- The type/class unification (PEP 252-253) was integrated into the
trunk and is not so tentative any more (the exact specification of
some features is still tentative). A lot of work has done on fixing
bugs and adding robustness and features (performance still has to
come a long way).
- Warnings about a mismatch in the Python API during extension import
now use the Python warning framework (which makes it possible to
write filters for these warnings).
- A function's __dict__ (aka func_dict) will now always be a
dictionary. It used to be possible to delete it or set it to None,
but now both actions raise TypeErrors. It is still legal to set it
to a dictionary object. Getting func.__dict__ before any attributes
have been assigned now returns an empty dictionary instead of None.
- A new command line option, -E, was added which disables the use of
all environment variables, or at least those that are specifically
significant to Python. Usually those have a name starting with
"PYTHON". This was used to fix a problem where the tests fail if
the user happens to have PYTHONHOME or PYTHONPATH pointing to an
older distribution.
Library
-------
- New class Differ and new functions ndiff() and restore() in difflib.py.
These package the algorithms used by the popular Tools/scripts/ndiff.py,
for programmatic reuse.
- New function xml.sax.saxutils.quoteattr(): Quote an XML attribute
value using the minimal quoting required for the value; more
reliable than using xml.sax.saxutils.escape() for attribute values.
- Readline completion support for cmd.Cmd was added.
- Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
- Added function threading.BoundedSemaphore()
- Added Ka-Ping Yee's cgitb.py module.
- The 'new' module now exposes the CO_xxx flags.
- The gc module offers the get_referents function.
New platforms
-------------
C API
-----
- Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
which provide a cross-platform implementations for the
relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
the standard sprintf() and vsprintf() C lib APIs, these versions
apply bounds checking on the used buffer which enhances protection
against buffer overruns.
- Unicode APIs now use name mangling to assure that mixing interpreters
and extensions using different Unicode widths is rendered next to
impossible. Trying to import an incompatible Unicode-aware extension
will result in an ImportError. Unicode extensions writers must make
sure to check the Unicode width compatibility in their extensions by
using at least one of the mangled Unicode APIs in the extension.
- Two new flags METH_NOARGS and METH_O are available in method definition
tables to simplify implementation of methods with no arguments and a
single untyped argument. Calling such methods is more efficient than
calling corresponding METH_VARARGS methods. METH_OLDARGS is now
deprecated.
Windows
-------
- "import module" now compiles module.pyw if it exists and nothing else
relevant is found.
What's New in Python 2.2a1?
===========================
*Release date: 18-Jul-2001*
Core
----
- TENTATIVELY, a large amount of code implementing much of what's
described in PEP 252 (Making Types Look More Like Classes) and PEP
253 (Subtyping Built-in Types) was added. This will be released
with Python 2.2a1. Documentation will be provided separately
through http://www.python.org/2.2/. The purpose of releasing this
with Python 2.2a1 is to test backwards compatibility. It is
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.
- Generators were added; this is a new way to create an iterator (see
below) using what looks like a simple function containing one or
more 'yield' statements. See PEP 255. Since this adds a new
keyword to the language, this feature must be enabled by including a
future statement: "from __future__ import generators" (see PEP 236).
Generators will become a standard feature in a future release
(probably 2.3). Without this future statement, 'yield' remains an
ordinary identifier, but a warning is issued each time it is used.
(These warnings currently don't conform to the warnings framework of
PEP 230; we intend to fix this in 2.2a2.)
- The UTF-16 codec was modified to be more RFC compliant. It will now
only remove BOM characters at the start of the string and then
only if running in native mode (UTF-16-LE and -BE won't remove a
leading BMO character).
- Strings now have a new method .decode() to complement the already
existing .encode() method. These two methods provide direct access
to the corresponding decoders and encoders of the registered codecs.
To enhance the usability of the .encode() method, the special
casing of Unicode object return values was dropped (Unicode objects
were auto-magically converted to string using the default encoding).
Both methods will now return whatever the codec in charge of the
requested encoding returns as object, e.g. Unicode codecs will
return Unicode objects when decoding is requested ("".decode("latin-1")
will return u""). This enables codec writer to create codecs
for various simple to use conversions.
New codecs were added to demonstrate these new features (the .encode()
and .decode() columns indicate the type of the returned objects):
+---------+-----------+-----------+-----------------------------+
|Name | .encode() | .decode() | Description |
+=========+===========+===========+=============================+
|uu | string | string | UU codec (e.g. for email) |
+---------+-----------+-----------+-----------------------------+
|base64 | string | string | base64 codec |
+---------+-----------+-----------+-----------------------------+
|quopri | string | string | quoted-printable codec |
+---------+-----------+-----------+-----------------------------+
|zlib | string | string | zlib compression |
+---------+-----------+-----------+-----------------------------+
|hex | string | string | 2-byte hex codec |
+---------+-----------+-----------+-----------------------------+
|rot-13 | string | Unicode | ROT-13 Unicode charmap codec|
+---------+-----------+-----------+-----------------------------+
- Some operating systems now support the concept of a default Unicode
encoding for file system operations. Notably, Windows supports 'mbcs'
as the default. The Macintosh will also adopt this concept in the medium
term, although the default encoding for that platform will be other than
'mbcs'.
On operating system that support non-ASCII filenames, it is common for
functions that return filenames (such as os.listdir()) to return Python
string objects pre-encoded using the default file system encoding for
the platform. As this encoding is likely to be different from Python's
default encoding, converting this name to a Unicode object before passing
it back to the Operating System would result in a Unicode error, as Python
would attempt to use its default encoding (generally ASCII) rather than
the default encoding for the file system.
In general, this change simply removes surprises when working with
Unicode and the file system, making these operations work as you expect,
increasing the transparency of Unicode objects in this context.
See [????] for more details, including examples.
- Float (and complex) literals in source code were evaluated to full
precision only when running from a .py file; the same code loaded from a
.pyc (or .pyo) file could suffer numeric differences starting at about the
12th significant decimal digit. For example, on a machine with IEEE-754
floating arithmetic,
x = 9007199254740992.0
print long(x)
printed 9007199254740992 if run directly from .py, but 9007199254740000
if from a compiled (.pyc or .pyo) file. This was due to marshal using
str(float) instead of repr(float) when building code objects. marshal
now uses repr(float) instead, which should reproduce floats to full
machine precision (assuming the platform C float<->string I/O conversion
functions are of good quality).
This may cause floating-point results to change in some cases, and
usually for the better, but may also cause numerically unstable
algorithms to break.
- The implementation of dicts suffers fewer collisions, which has speed
benefits. However, the order in which dict entries appear in dict.keys(),
dict.values() and dict.items() may differ from previous releases for a
given dict. Nothing is defined about this order, so no program should
rely on it. Nevertheless, it's easy to write test cases that rely on the
order by accident, typically because of printing the str() or repr() of a
dict to an "expected results" file. See Lib/test/test_support.py's new
sortdict(dict) function for a simple way to display a dict in sorted
order.
- Many other small changes to dicts were made, resulting in faster
operation along the most common code paths.
- Dictionary objects now support the "in" operator: "x in dict" means
the same as dict.has_key(x).
- The update() method of dictionaries now accepts generic mapping
objects. Specifically the argument object must support the .keys()
and __getitem__() methods. This allows you to say, for example,
{}.update(UserDict())
- Iterators were added; this is a generalized way of providing values
to a for loop. See PEP 234. There's a new built-in function iter()
to return an iterator. There's a new protocol to get the next value
from an iterator using the next() method (in Python) or the
tp_iternext slot (in C). There's a new protocol to get iterators
using the __iter__() method (in Python) or the tp_iter slot (in C).
Iterating (i.e. a for loop) over a dictionary generates its keys.
Iterating over a file generates its lines.
- The following functions were generalized to work nicely with iterator
arguments::
map(), filter(), reduce(), zip()
list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
max(), min()
join() method of strings
extend() method of lists
'x in y' and 'x not in y' (PySequence_Contains() in C API)
operator.countOf() (PySequence_Count() in C API)
right-hand side of assignment statements with multiple targets, such as ::
x, y, z = some_iterable_object_returning_exactly_3_values
- Accessing module attributes is significantly faster (for example,
random.random or os.path or yourPythonModule.yourAttribute).
- Comparing dictionary objects via == and != is faster, and now works even
if the keys and values don't support comparisons other than ==.
- Comparing dictionaries in ways other than == and != is slower: there were
insecurities in the dict comparison implementation that could cause Python
to crash if the element comparison routines for the dict keys and/or
values mutated the dicts. Making the code bulletproof slowed it down.
- Collisions in dicts are resolved via a new approach, which can help
dramatically in bad cases. For example, looking up every key in a dict
d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
faster now. Thanks to Christian Tismer for pointing out the cause and
the nature of an effective cure (last December! better late than never).
- repr() is much faster for large containers (dict, list, tuple).
Library
-------
- 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.
- The flags used in dlopen calls can now be configured using
sys.setdlopenflags and queried using sys.getdlopenflags.
- Fredrik Lundh's xmlrpclib is now a standard library module. This
provides full client-side XML-RPC support. In addition,
Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
one asyncore-based). Thanks to Eric Raymond for the documentation.
- The xrange() object is simplified: it no longer supports slicing,
repetition, comparisons, efficient 'in' checking, the tolist()
method, or the start, stop and step attributes. See PEP 260.
- A new function fnmatch.filter to filter lists of file names was added.
- calendar.py uses month and day names based on the current locale.
- strop is now *really* obsolete (this was announced before with 1.6),
and issues DeprecationWarning when used (except for the four items
that are still imported into string.py).
- Cookie.py now sorts key+value pairs by key in output strings.
- pprint.isrecursive(object) didn't correctly identify recursive objects.
Now it does.
- pprint functions now much faster for large containers (tuple, list, dict).
- New 'q' and 'Q' format codes in the struct module, corresponding to C
types "long long" and "unsigned long long" (on Windows, __int64). In
native mode, these can be used only when the platform C compiler supports
these types (when HAVE_LONG_LONG is #define'd by the Python config
process), and then they inherit the sizes and alignments of the C types.
In standard mode, 'q' and 'Q' are supported on all platforms, and are
8-byte integral types.
- The site module installs a new built-in function 'help' that invokes
pydoc.help. It must be invoked as 'help()'; when invoked as 'help',
it displays a message reminding the user to use 'help()' or
'help(object)'.
Tests
-----
- 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.
C API
-----
- Removed the unused last_is_sticky argument from the internal
_PyTuple_Resize(). If this affects you, you were cheating.
----
**(For information about older versions, consult the HISTORY file.)**
|