summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-12-13 04:49:30 (GMT)
committerThomas Wouters <thomas@python.org>2006-12-13 04:49:30 (GMT)
commit89f507fe8c497b3f70fdcecce8bc240f9af2bbe2 (patch)
tree8acfdf7de23d9802924a2cef9f8ed32222eaa8f4 /Modules
parent16f3e03283cdbea6101d21960743d3901ddf8d57 (diff)
downloadcpython-89f507fe8c497b3f70fdcecce8bc240f9af2bbe2.zip
cpython-89f507fe8c497b3f70fdcecce8bc240f9af2bbe2.tar.gz
cpython-89f507fe8c497b3f70fdcecce8bc240f9af2bbe2.tar.bz2
Four months of trunk changes (including a few releases...)
Merged revisions 51434-53004 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r51434 | neal.norwitz | 2006-08-21 20:20:10 +0200 (Mon, 21 Aug 2006) | 1 line Fix a couple of ssize-t issues reported by Alexander Belopolsky on python-dev ........ r51439 | neal.norwitz | 2006-08-21 21:47:08 +0200 (Mon, 21 Aug 2006) | 6 lines Patch #1542451: disallow continue anywhere under a finally I'm undecided if this should be backported to 2.5 or 2.5.1. Armin suggested to wait (I'm of the same opinion). Thomas W thinks it's fine to go in 2.5. ........ r51443 | neal.norwitz | 2006-08-21 22:16:24 +0200 (Mon, 21 Aug 2006) | 4 lines Handle a few more error conditions. Klocwork 301 and 302. Will backport. ........ r51450 | neal.norwitz | 2006-08-22 00:21:19 +0200 (Tue, 22 Aug 2006) | 5 lines Patch #1541585: fix buffer overrun when performing repr() on a unicode string in a build with wide unicode (UCS-4) support. This code could be improved, so add an XXX comment. ........ r51456 | neal.norwitz | 2006-08-22 01:44:48 +0200 (Tue, 22 Aug 2006) | 1 line Try to get the windows bots working again with the new peephole.c ........ r51461 | anthony.baxter | 2006-08-22 09:36:59 +0200 (Tue, 22 Aug 2006) | 1 line patch for documentation for recent uuid changes (from ping) ........ r51473 | neal.norwitz | 2006-08-22 15:56:56 +0200 (Tue, 22 Aug 2006) | 1 line Alexander Belopolsky pointed out that pos is a size_t ........ r51489 | jeremy.hylton | 2006-08-22 22:46:00 +0200 (Tue, 22 Aug 2006) | 2 lines Expose column offset information in parse trees. ........ r51497 | andrew.kuchling | 2006-08-23 01:13:43 +0200 (Wed, 23 Aug 2006) | 1 line Move functional howto into trunk ........ r51515 | jeremy.hylton | 2006-08-23 20:37:43 +0200 (Wed, 23 Aug 2006) | 2 lines Baby steps towards better tests for tokenize ........ r51525 | alex.martelli | 2006-08-23 22:42:02 +0200 (Wed, 23 Aug 2006) | 6 lines x**2 should about equal x*x (including for a float x such that the result is inf) but didn't; added a test to test_float to verify that, and ignored the ERANGE value for errno in the pow operation to make the new test pass (with help from Marilyn Davis at the Google Python Sprint -- thanks!). ........ r51526 | jeremy.hylton | 2006-08-23 23:14:03 +0200 (Wed, 23 Aug 2006) | 20 lines Bug fixes large and small for tokenize. Small: Always generate a NL or NEWLINE token following a COMMENT token. The old code did not generate an NL token if the comment was on a line by itself. Large: The output of untokenize() will now match the input exactly if it is passed the full token sequence. The old, crufty output is still generated if a limited input sequence is provided, where limited means that it does not include position information for tokens. Remaining bug: There is no CONTINUATION token (\) so there is no way for untokenize() to handle such code. Also, expanded the number of doctests in hopes of eventually removing the old-style tests that compare against a golden file. Bug fix candidate for Python 2.5.1. (Sigh.) ........ r51527 | jeremy.hylton | 2006-08-23 23:26:46 +0200 (Wed, 23 Aug 2006) | 5 lines Replace dead code with an assert. Now that COMMENT tokens are reliably followed by NL or NEWLINE, there is never a need to add extra newlines in untokenize. ........ r51530 | alex.martelli | 2006-08-24 00:17:59 +0200 (Thu, 24 Aug 2006) | 7 lines Reverting the patch that tried to fix the issue whereby x**2 raises OverflowError while x*x succeeds and produces infinity; apparently these inconsistencies cannot be fixed across ``all'' platforms and there's a widespread feeling that therefore ``every'' platform should keep suffering forevermore. Ah well. ........ r51565 | thomas.wouters | 2006-08-24 20:40:20 +0200 (Thu, 24 Aug 2006) | 6 lines Fix SF bug #1545837: array.array borks on deepcopy. array.__deepcopy__() needs to take an argument, even if it doesn't actually use it. Will backport to 2.5 and 2.4 (if applicable.) ........ r51580 | martin.v.loewis | 2006-08-25 02:03:34 +0200 (Fri, 25 Aug 2006) | 3 lines Patch #1545507: Exclude ctypes package in Win64 MSI file. Will backport to 2.5. ........ r51589 | neal.norwitz | 2006-08-25 03:52:49 +0200 (Fri, 25 Aug 2006) | 1 line importing types is not necessary if we use isinstance ........ r51604 | thomas.heller | 2006-08-25 09:27:33 +0200 (Fri, 25 Aug 2006) | 3 lines Port _ctypes.pyd to win64 on AMD64. ........ r51605 | thomas.heller | 2006-08-25 09:34:51 +0200 (Fri, 25 Aug 2006) | 3 lines Add missing file for _ctypes.pyd port to win64 on AMD64. ........ r51606 | thomas.heller | 2006-08-25 11:26:33 +0200 (Fri, 25 Aug 2006) | 6 lines Build _ctypes.pyd for win AMD64 into the MSVC project file. Since MSVC doesn't know about .asm files, a helper batch file is needed to find ml64.exe in predefined locations. The helper script hardcodes the path to the MS Platform SDK. ........ r51608 | armin.rigo | 2006-08-25 14:44:28 +0200 (Fri, 25 Aug 2006) | 4 lines The regular expression engine in '_sre' can segfault when interpreting bogus bytecode. It is unclear whether this is a real bug or a "won't fix" case like bogus_code_obj.py. ........ r51617 | tim.peters | 2006-08-26 00:05:39 +0200 (Sat, 26 Aug 2006) | 2 lines Whitespace normalization. ........ r51618 | tim.peters | 2006-08-26 00:06:44 +0200 (Sat, 26 Aug 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r51619 | tim.peters | 2006-08-26 00:26:21 +0200 (Sat, 26 Aug 2006) | 3 lines A new test here relied on preserving invisible trailing whitespace in expected output. Stop that. ........ r51624 | jack.diederich | 2006-08-26 20:42:06 +0200 (Sat, 26 Aug 2006) | 4 lines - Move functions common to all path modules into genericpath.py and have the OS speicifc path modules import them. - Have os2emxpath import common functions fron ntpath instead of using copies ........ r51642 | neal.norwitz | 2006-08-29 07:40:58 +0200 (Tue, 29 Aug 2006) | 1 line Fix a couple of typos. ........ r51647 | marc-andre.lemburg | 2006-08-29 12:34:12 +0200 (Tue, 29 Aug 2006) | 5 lines Fix a buglet in the error reporting (SF bug report #1546372). This should probably go into Python 2.5 or 2.5.1 as well. ........ r51663 | armin.rigo | 2006-08-31 10:51:06 +0200 (Thu, 31 Aug 2006) | 3 lines Doc fix: hashlib objects don't always return a digest of 16 bytes. Backport candidate for 2.5. ........ r51664 | nick.coghlan | 2006-08-31 14:00:43 +0200 (Thu, 31 Aug 2006) | 1 line Fix the wrongheaded implementation of context management in the decimal module and add unit tests. (python-dev discussion is ongoing regarding what we do about Python 2.5) ........ r51665 | nick.coghlan | 2006-08-31 14:51:25 +0200 (Thu, 31 Aug 2006) | 1 line Remove the old decimal context management tests from test_contextlib (guess who didn't run the test suite before committing...) ........ r51669 | brett.cannon | 2006-08-31 20:54:26 +0200 (Thu, 31 Aug 2006) | 4 lines Make sure memory is properly cleaned up in file_init. Backport candidate. ........ r51671 | brett.cannon | 2006-08-31 23:47:52 +0200 (Thu, 31 Aug 2006) | 2 lines Fix comment about indentation level in C files. ........ r51674 | brett.cannon | 2006-09-01 00:42:37 +0200 (Fri, 01 Sep 2006) | 3 lines Have pre-existing C files use 8 spaces indents (to match old PEP 7 style), but have all new files use 4 spaces (to match current PEP 7 style). ........ r51676 | fred.drake | 2006-09-01 05:57:19 +0200 (Fri, 01 Sep 2006) | 3 lines - SF patch #1550263: Enhance and correct unittest docs - various minor cleanups for improved consistency ........ r51677 | georg.brandl | 2006-09-02 00:30:52 +0200 (Sat, 02 Sep 2006) | 2 lines evalfile() should be execfile(). ........ r51681 | neal.norwitz | 2006-09-02 04:43:17 +0200 (Sat, 02 Sep 2006) | 1 line SF #1547931, fix typo (missing and). Will backport to 2.5 ........ r51683 | neal.norwitz | 2006-09-02 04:50:35 +0200 (Sat, 02 Sep 2006) | 1 line Bug #1548092: fix curses.tparm seg fault on invalid input. Needs backport to 2.5.1 and earlier. ........ r51684 | neal.norwitz | 2006-09-02 04:58:13 +0200 (Sat, 02 Sep 2006) | 4 lines Bug #1550714: fix SystemError from itertools.tee on negative value for n. Needs backport to 2.5.1 and earlier. ........ r51685 | nick.coghlan | 2006-09-02 05:54:17 +0200 (Sat, 02 Sep 2006) | 1 line Make decimal.ContextManager a private implementation detail of decimal.localcontext() ........ r51686 | nick.coghlan | 2006-09-02 06:04:18 +0200 (Sat, 02 Sep 2006) | 1 line Further corrections to the decimal module context management documentation ........ r51688 | raymond.hettinger | 2006-09-02 19:07:23 +0200 (Sat, 02 Sep 2006) | 1 line Fix documentation nits for decimal context managers. ........ r51690 | neal.norwitz | 2006-09-02 20:51:34 +0200 (Sat, 02 Sep 2006) | 1 line Add missing word in comment ........ r51691 | neal.norwitz | 2006-09-02 21:40:19 +0200 (Sat, 02 Sep 2006) | 7 lines Hmm, this test has failed at least twice recently on the OpenBSD and Debian sparc buildbots. Since this goes through a lot of tests and hits the disk a lot it could be slow (especially if NFS is involved). I'm not sure if that's the problem, but printing periodic msgs shouldn't hurt. The code was stolen from test_compiler. ........ r51693 | nick.coghlan | 2006-09-03 03:02:00 +0200 (Sun, 03 Sep 2006) | 1 line Fix final documentation nits before backporting decimal module fixes to 2.5 ........ r51694 | nick.coghlan | 2006-09-03 03:06:07 +0200 (Sun, 03 Sep 2006) | 1 line Typo fix for decimal docs ........ r51697 | nick.coghlan | 2006-09-03 03:20:46 +0200 (Sun, 03 Sep 2006) | 1 line NEWS entry on trunk for decimal module changes ........ r51704 | raymond.hettinger | 2006-09-04 17:32:48 +0200 (Mon, 04 Sep 2006) | 1 line Fix endcase for str.rpartition() ........ r51716 | tim.peters | 2006-09-05 04:18:09 +0200 (Tue, 05 Sep 2006) | 12 lines "Conceptual" merge of rev 51711 from the 2.5 branch. i_divmod(): As discussed on Python-Dev, changed the overflow checking to live happily with recent gcc optimizations that assume signed integer arithmetic never overflows. This differs from the corresponding change on the 2.5 and 2.4 branches, using a less obscure approach, but one that /may/ tickle platform idiocies in their definitions of LONG_MIN. The 2.4 + 2.5 change avoided introducing a dependence on LONG_MIN, at the cost of substantially goofier code. ........ r51717 | tim.peters | 2006-09-05 04:21:19 +0200 (Tue, 05 Sep 2006) | 2 lines Whitespace normalization. ........ r51719 | tim.peters | 2006-09-05 04:22:17 +0200 (Tue, 05 Sep 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r51720 | neal.norwitz | 2006-09-05 04:24:03 +0200 (Tue, 05 Sep 2006) | 2 lines Fix SF bug #1546288, crash in dict_equal. ........ r51721 | neal.norwitz | 2006-09-05 04:25:41 +0200 (Tue, 05 Sep 2006) | 1 line Fix SF #1552093, eval docstring typo (3 ps in mapping) ........ r51724 | neal.norwitz | 2006-09-05 04:35:08 +0200 (Tue, 05 Sep 2006) | 1 line This was found by Guido AFAIK on p3yk (sic) branch. ........ r51725 | neal.norwitz | 2006-09-05 04:36:20 +0200 (Tue, 05 Sep 2006) | 1 line Add a NEWS entry for str.rpartition() change ........ r51728 | neal.norwitz | 2006-09-05 04:57:01 +0200 (Tue, 05 Sep 2006) | 1 line Patch #1540470, for OpenBSD 4.0. Backport candidate for 2.[34]. ........ r51729 | neal.norwitz | 2006-09-05 05:53:08 +0200 (Tue, 05 Sep 2006) | 12 lines Bug #1520864 (again): unpacking singleton tuples in list comprehensions and generator expressions (x for x, in ... ) works again. Sigh, I only fixed for loops the first time, not list comps and genexprs too. I couldn't find any more unpacking cases where there is a similar bug lurking. This code should be refactored to eliminate the duplication. I'm sure the listcomp/genexpr code can be refactored. I'm not sure if the for loop can re-use any of the same code though. Will backport to 2.5 (the only place it matters). ........ r51731 | neal.norwitz | 2006-09-05 05:58:26 +0200 (Tue, 05 Sep 2006) | 1 line Add a comment about some refactoring. (There's probably more that should be done.) I will reformat this file in the next checkin due to the inconsistent tabs/spaces. ........ r51732 | neal.norwitz | 2006-09-05 06:00:12 +0200 (Tue, 05 Sep 2006) | 1 line M-x untabify ........ r51737 | hyeshik.chang | 2006-09-05 14:07:09 +0200 (Tue, 05 Sep 2006) | 7 lines Fix a few bugs on cjkcodecs found by Oren Tirosh: - 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. ........ r51738 | hyeshik.chang | 2006-09-05 14:14:57 +0200 (Tue, 05 Sep 2006) | 2 lines Fix a typo: 2013 -> 0213 ........ r51740 | georg.brandl | 2006-09-05 14:44:58 +0200 (Tue, 05 Sep 2006) | 3 lines Bug #1552618: change docs of dict.has_key() to reflect recommendation to use "in". ........ r51742 | andrew.kuchling | 2006-09-05 15:02:40 +0200 (Tue, 05 Sep 2006) | 1 line Rearrange example a bit, and show rpartition() when separator is not found ........ r51744 | andrew.kuchling | 2006-09-05 15:15:41 +0200 (Tue, 05 Sep 2006) | 1 line [Bug #1525469] SimpleXMLRPCServer still uses the sys.exc_{value,type} module-level globals instead of calling sys.exc_info(). Reported by Russell Warren ........ r51745 | andrew.kuchling | 2006-09-05 15:19:18 +0200 (Tue, 05 Sep 2006) | 3 lines [Bug #1526834] Fix crash in pdb when you do 'b f('; the function name was placed into a regex pattern and the unbalanced paren caused re.compile() to report an error ........ r51751 | kristjan.jonsson | 2006-09-05 19:58:12 +0200 (Tue, 05 Sep 2006) | 6 lines Update the PCBuild8 solution. Facilitate cross-compilation by having binaries in separate Win32 and x64 directories. Rationalized configs by making proper use of platforms/configurations. Remove pythoncore_pgo project. Add new PGIRelease and PGORelease configurations to perform Profile Guided Optimisation. Removed I64 support, but this can be easily added by copying the x64 platform settings. ........ r51758 | gustavo.niemeyer | 2006-09-06 03:58:52 +0200 (Wed, 06 Sep 2006) | 3 lines Fixing #1531862: Do not close standard file descriptors in the subprocess module. ........ r51760 | neal.norwitz | 2006-09-06 05:58:34 +0200 (Wed, 06 Sep 2006) | 1 line Revert 51758 because it broke all the buildbots ........ r51762 | georg.brandl | 2006-09-06 08:03:59 +0200 (Wed, 06 Sep 2006) | 3 lines Bug #1551427: fix a wrong NULL pointer check in the win32 version of os.urandom(). ........ r51765 | georg.brandl | 2006-09-06 08:09:31 +0200 (Wed, 06 Sep 2006) | 3 lines Bug #1550983: emit better error messages for erroneous relative imports (if not in package and if beyond toplevel package). ........ r51767 | neal.norwitz | 2006-09-06 08:28:06 +0200 (Wed, 06 Sep 2006) | 1 line with and as are now keywords. There are some generated files I can't recreate. ........ r51770 | georg.brandl | 2006-09-06 08:50:05 +0200 (Wed, 06 Sep 2006) | 5 lines Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack. Also make sure that every exception class has __module__ set to 'exceptions'. ........ r51785 | georg.brandl | 2006-09-06 22:05:58 +0200 (Wed, 06 Sep 2006) | 2 lines Fix missing import of the types module in logging.config. ........ r51789 | marc-andre.lemburg | 2006-09-06 22:40:22 +0200 (Wed, 06 Sep 2006) | 3 lines Add news item for bug fix of SF bug report #1546372. ........ r51797 | gustavo.niemeyer | 2006-09-07 02:48:33 +0200 (Thu, 07 Sep 2006) | 3 lines Fixed subprocess bug #1531862 again, after removing tests offending buildbot ........ r51798 | raymond.hettinger | 2006-09-07 04:42:48 +0200 (Thu, 07 Sep 2006) | 1 line Fix refcounts and add error checks. ........ r51803 | nick.coghlan | 2006-09-07 12:50:34 +0200 (Thu, 07 Sep 2006) | 1 line Fix the speed regression in inspect.py by adding another cache to speed up getmodule(). Patch #1553314 ........ r51805 | ronald.oussoren | 2006-09-07 14:03:10 +0200 (Thu, 07 Sep 2006) | 2 lines Fix a glaring error and update some version numbers. ........ r51814 | andrew.kuchling | 2006-09-07 15:56:23 +0200 (Thu, 07 Sep 2006) | 1 line Typo fix ........ r51815 | andrew.kuchling | 2006-09-07 15:59:38 +0200 (Thu, 07 Sep 2006) | 8 lines [Bug #1552726] Avoid repeatedly polling in interactive mode -- only put a timeout on the select() if an input hook has been defined. Patch by Richard Boulton. This select() code is only executed with readline 2.1, or if READLINE_CALLBACKS is defined. Backport candidate for 2.5, 2.4, probably earlier versions too. ........ r51816 | armin.rigo | 2006-09-07 17:06:00 +0200 (Thu, 07 Sep 2006) | 2 lines Add a warning notice on top of the generated grammar.txt. ........ r51819 | thomas.heller | 2006-09-07 20:56:28 +0200 (Thu, 07 Sep 2006) | 5 lines Anonymous structure fields that have a bit-width specified did not work, and they gave a strange error message from PyArg_ParseTuple: function takes exactly 2 arguments (3 given). With tests. ........ r51820 | thomas.heller | 2006-09-07 21:09:54 +0200 (Thu, 07 Sep 2006) | 4 lines The cast function did not accept c_char_p or c_wchar_p instances as first argument, and failed with a 'bad argument to internal function' error message. ........ r51827 | nick.coghlan | 2006-09-08 12:04:38 +0200 (Fri, 08 Sep 2006) | 1 line Add missing NEWS entry for rev 51803 ........ r51828 | andrew.kuchling | 2006-09-08 15:25:23 +0200 (Fri, 08 Sep 2006) | 1 line Add missing word ........ r51829 | andrew.kuchling | 2006-09-08 15:35:49 +0200 (Fri, 08 Sep 2006) | 1 line Explain SQLite a bit more clearly ........ r51830 | andrew.kuchling | 2006-09-08 15:36:36 +0200 (Fri, 08 Sep 2006) | 1 line Explain SQLite a bit more clearly ........ r51832 | andrew.kuchling | 2006-09-08 16:02:45 +0200 (Fri, 08 Sep 2006) | 1 line Use native SQLite types ........ r51833 | andrew.kuchling | 2006-09-08 16:03:01 +0200 (Fri, 08 Sep 2006) | 1 line Use native SQLite types ........ r51835 | andrew.kuchling | 2006-09-08 16:05:10 +0200 (Fri, 08 Sep 2006) | 1 line Fix typo in example ........ r51837 | brett.cannon | 2006-09-09 09:11:46 +0200 (Sat, 09 Sep 2006) | 6 lines Remove the __unicode__ method from exceptions. Allows unicode() to be called on exception classes. Would require introducing a tp_unicode slot to make it work otherwise. Fixes bug #1551432 and will be backported. ........ r51854 | neal.norwitz | 2006-09-11 06:24:09 +0200 (Mon, 11 Sep 2006) | 8 lines Forward port of 51850 from release25-maint branch. As mentioned on python-dev, reverting patch #1504333 because it introduced an infinite loop in rev 47154. This patch also adds a test to prevent the regression. ........ r51855 | neal.norwitz | 2006-09-11 06:28:16 +0200 (Mon, 11 Sep 2006) | 5 lines Properly handle a NULL returned from PyArena_New(). (Also fix some whitespace) Klocwork #364. ........ r51856 | neal.norwitz | 2006-09-11 06:32:57 +0200 (Mon, 11 Sep 2006) | 1 line Add a "crasher" taken from the sgml bug report referenced in the comment ........ r51858 | georg.brandl | 2006-09-11 11:38:35 +0200 (Mon, 11 Sep 2006) | 12 lines Forward-port of rev. 51857: Building with HP's cc on HP-UX turned up a couple of problems. _PyGILState_NoteThreadState was declared as static inconsistently. Make it static as it's not necessary outside of this module. Some tests failed because errno was reset to 0. (I think the tests that failed were at least: test_fcntl and test_mailbox). Ensure that errno doesn't change after a call to Py_END_ALLOW_THREADS. This only affected debug builds. ........ r51865 | martin.v.loewis | 2006-09-12 21:49:20 +0200 (Tue, 12 Sep 2006) | 2 lines Forward-port 51862: Add sgml_input.html. ........ r51866 | andrew.kuchling | 2006-09-12 22:50:23 +0200 (Tue, 12 Sep 2006) | 1 line Markup typo fix ........ r51867 | andrew.kuchling | 2006-09-12 23:09:02 +0200 (Tue, 12 Sep 2006) | 1 line Some editing, markup fixes ........ r51868 | andrew.kuchling | 2006-09-12 23:21:51 +0200 (Tue, 12 Sep 2006) | 1 line More wordsmithing ........ r51877 | andrew.kuchling | 2006-09-14 13:22:18 +0200 (Thu, 14 Sep 2006) | 1 line Make --help mention that -v can be supplied multiple times ........ r51878 | andrew.kuchling | 2006-09-14 13:28:50 +0200 (Thu, 14 Sep 2006) | 1 line Rewrite help message to remove some of the parentheticals. (There were a lot of them.) ........ r51883 | ka-ping.yee | 2006-09-15 02:34:19 +0200 (Fri, 15 Sep 2006) | 2 lines Fix grammar errors and improve clarity. ........ r51885 | georg.brandl | 2006-09-15 07:22:24 +0200 (Fri, 15 Sep 2006) | 3 lines Correct elementtree module index entry. ........ r51889 | fred.drake | 2006-09-15 17:18:04 +0200 (Fri, 15 Sep 2006) | 4 lines - fix module name in links in formatted documentation - minor markup cleanup (forward-ported from release25-maint revision 51888) ........ r51891 | fred.drake | 2006-09-15 18:11:27 +0200 (Fri, 15 Sep 2006) | 3 lines revise explanation of returns_unicode to reflect bool values and to include the default value (merged from release25-maint revision 51890) ........ r51897 | martin.v.loewis | 2006-09-16 19:36:37 +0200 (Sat, 16 Sep 2006) | 2 lines Patch #1557515: Add RLIMIT_SBSIZE. ........ r51903 | ronald.oussoren | 2006-09-17 20:42:53 +0200 (Sun, 17 Sep 2006) | 2 lines Port of revision 51902 in release25-maint to the trunk ........ r51904 | ronald.oussoren | 2006-09-17 21:23:27 +0200 (Sun, 17 Sep 2006) | 3 lines Tweak Mac/Makefile in to ensure that pythonw gets rebuild when the major version of python changes (2.5 -> 2.6). Bug #1552935. ........ r51913 | guido.van.rossum | 2006-09-18 23:36:16 +0200 (Mon, 18 Sep 2006) | 2 lines Make this thing executable. ........ r51920 | gregory.p.smith | 2006-09-19 19:35:04 +0200 (Tue, 19 Sep 2006) | 5 lines Fixes a bug with bsddb.DB.stat where the flags and txn keyword arguments are transposed. (reported by Louis Zechtzer) ..already committed to release24-maint ..needs committing to release25-maint ........ r51926 | brett.cannon | 2006-09-20 20:34:28 +0200 (Wed, 20 Sep 2006) | 3 lines Accidentally didn't commit Misc/NEWS entry on when __unicode__() was removed from exceptions. ........ r51927 | brett.cannon | 2006-09-20 20:43:13 +0200 (Wed, 20 Sep 2006) | 6 lines Allow exceptions to be directly sliced again (e.g., ``BaseException(1,2,3)[0:2]``). Discovered in Python 2.5.0 by Thomas Heller and reported to python-dev. This should be backported to 2.5 . ........ r51928 | brett.cannon | 2006-09-20 21:28:35 +0200 (Wed, 20 Sep 2006) | 2 lines Make python.vim output more deterministic. ........ r51949 | walter.doerwald | 2006-09-21 17:09:55 +0200 (Thu, 21 Sep 2006) | 2 lines Fix typo. ........ r51950 | jack.diederich | 2006-09-21 19:50:26 +0200 (Thu, 21 Sep 2006) | 5 lines * regression bug, count_next was coercing a Py_ssize_t to an unsigned Py_size_t which breaks negative counts * added test for negative numbers will backport to 2.5.1 ........ r51953 | jack.diederich | 2006-09-21 22:34:49 +0200 (Thu, 21 Sep 2006) | 1 line added itertools.count(-n) fix ........ r51971 | neal.norwitz | 2006-09-22 10:16:26 +0200 (Fri, 22 Sep 2006) | 10 lines Fix %zd string formatting on Mac OS X so it prints negative numbers. In addition to testing positive numbers, verify negative numbers work in configure. In order to avoid compiler warnings on OS X 10.4, also change the order of the check for the format character to use (PY_FORMAT_SIZE_T) in the sprintf format for Py_ssize_t. This patch changes PY_FORMAT_SIZE_T from "" to "l" if it wasn't defined at configure time. Need to verify the buildbot results. Backport candidate (if everyone thinks this patch can't be improved). ........ r51972 | neal.norwitz | 2006-09-22 10:18:10 +0200 (Fri, 22 Sep 2006) | 7 lines Bug #1557232: fix seg fault with def f((((x)))) and def f(((x),)). These tests should be improved. Hopefully this fixes variations when flipping back and forth between fpdef and fplist. Backport candidate. ........ r51975 | neal.norwitz | 2006-09-22 10:47:23 +0200 (Fri, 22 Sep 2006) | 4 lines Mostly revert this file to the same version as before. Only force setting of PY_FORMAT_SIZE_T to "l" for Mac OSX. I don't know a better define to use. This should get rid of the warnings on other platforms and Mac too. ........ r51986 | fred.drake | 2006-09-23 02:26:31 +0200 (Sat, 23 Sep 2006) | 1 line add boilerplate "What's New" document so the docs will build ........ r51987 | neal.norwitz | 2006-09-23 06:11:38 +0200 (Sat, 23 Sep 2006) | 1 line Remove extra semi-colons reported by Johnny Lee on python-dev. Backport if anyone cares. ........ r51989 | neal.norwitz | 2006-09-23 20:11:58 +0200 (Sat, 23 Sep 2006) | 1 line SF Bug #1563963, add missing word and cleanup first sentance ........ r51990 | brett.cannon | 2006-09-23 21:53:20 +0200 (Sat, 23 Sep 2006) | 3 lines Make output on test_strptime() be more verbose in face of failure. This is in hopes that more information will help debug the failing test on HPPA Ubuntu. ........ r51991 | georg.brandl | 2006-09-24 12:36:01 +0200 (Sun, 24 Sep 2006) | 2 lines Fix webbrowser.BackgroundBrowser on Windows. ........ r51993 | georg.brandl | 2006-09-24 14:35:36 +0200 (Sun, 24 Sep 2006) | 4 lines Fix a bug in the parser's future statement handling that led to "with" not being recognized as a keyword after, e.g., this statement: from __future__ import division, with_statement ........ r51995 | georg.brandl | 2006-09-24 14:50:24 +0200 (Sun, 24 Sep 2006) | 4 lines Fix a bug in traceback.format_exception_only() that led to an error being raised when print_exc() was called without an exception set. In version 2.4, this printed "None", restored that behavior. ........ r52000 | armin.rigo | 2006-09-25 17:16:26 +0200 (Mon, 25 Sep 2006) | 2 lines Another crasher. ........ r52011 | brett.cannon | 2006-09-27 01:38:24 +0200 (Wed, 27 Sep 2006) | 2 lines Make the error message for when the time data and format do not match clearer. ........ r52014 | andrew.kuchling | 2006-09-27 18:37:30 +0200 (Wed, 27 Sep 2006) | 1 line Add news item for rev. 51815 ........ r52018 | andrew.kuchling | 2006-09-27 21:23:05 +0200 (Wed, 27 Sep 2006) | 1 line Make examples do error checking on Py_InitModule ........ r52032 | brett.cannon | 2006-09-29 00:10:14 +0200 (Fri, 29 Sep 2006) | 2 lines Very minor grammatical fix in a comment. ........ r52048 | george.yoshida | 2006-09-30 07:14:02 +0200 (Sat, 30 Sep 2006) | 4 lines SF bug #1567976 : fix typo Will backport to 2.5. ........ r52051 | gregory.p.smith | 2006-09-30 08:08:20 +0200 (Sat, 30 Sep 2006) | 2 lines wording change ........ r52053 | georg.brandl | 2006-09-30 09:24:48 +0200 (Sat, 30 Sep 2006) | 2 lines Bug #1567375: a minor logical glitch in example description. ........ r52056 | georg.brandl | 2006-09-30 09:31:57 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1565661: in webbrowser, split() the command for the default GNOME browser in case it is a command with args. ........ r52058 | georg.brandl | 2006-09-30 10:43:30 +0200 (Sat, 30 Sep 2006) | 4 lines Patch #1567691: super() and new.instancemethod() now don't accept keyword arguments any more (previously they accepted them, but didn't use them). ........ r52061 | georg.brandl | 2006-09-30 11:03:42 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1566800: make sure that EnvironmentError can be called with any number of arguments, as was the case in Python 2.4. ........ r52063 | georg.brandl | 2006-09-30 11:06:45 +0200 (Sat, 30 Sep 2006) | 2 lines Bug #1566663: remove obsolete example from datetime docs. ........ r52065 | georg.brandl | 2006-09-30 11:13:21 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1566602: correct failure of posixpath unittest when $HOME ends with a slash. ........ r52068 | georg.brandl | 2006-09-30 12:58:01 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1457823: cgi.(Sv)FormContentDict's constructor now takes keep_blank_values and strict_parsing keyword arguments. ........ r52069 | georg.brandl | 2006-09-30 13:06:47 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1560617: in pyclbr, return full module name not only for classes, but also for functions. ........ r52072 | georg.brandl | 2006-09-30 13:17:34 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1556784: allow format strings longer than 127 characters in datetime's strftime function. ........ r52075 | georg.brandl | 2006-09-30 13:22:28 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1446043: correctly raise a LookupError if an encoding name given to encodings.search_function() contains a dot. ........ r52078 | georg.brandl | 2006-09-30 14:02:57 +0200 (Sat, 30 Sep 2006) | 3 lines Bug #1546052: clarify that PyString_FromString(AndSize) copies the string pointed to by its parameter. ........ r52080 | georg.brandl | 2006-09-30 14:16:03 +0200 (Sat, 30 Sep 2006) | 3 lines Convert test_import to unittest. ........ r52083 | kurt.kaiser | 2006-10-01 23:16:45 +0200 (Sun, 01 Oct 2006) | 5 lines Some syntax errors were being caught by tokenize during the tabnanny check, resulting in obscure error messages. Do the syntax check first. Bug 1562716, 1562719 ........ r52084 | kurt.kaiser | 2006-10-01 23:54:37 +0200 (Sun, 01 Oct 2006) | 3 lines Add comment explaining that error msgs may be due to user code when running w/o subprocess. ........ r52086 | martin.v.loewis | 2006-10-02 16:55:51 +0200 (Mon, 02 Oct 2006) | 3 lines Fix test for uintptr_t. Fixes #1568842. Will backport. ........ r52089 | martin.v.loewis | 2006-10-02 17:20:37 +0200 (Mon, 02 Oct 2006) | 3 lines Guard uintptr_t test with HAVE_STDINT_H, test for stdint.h. Will backport. ........ r52100 | vinay.sajip | 2006-10-03 20:02:37 +0200 (Tue, 03 Oct 2006) | 1 line Documentation omitted the additional parameter to LogRecord.__init__ which was added in 2.5. (See SF #1569622). ........ r52101 | vinay.sajip | 2006-10-03 20:20:26 +0200 (Tue, 03 Oct 2006) | 1 line Documentation clarified to mention optional parameters. ........ r52102 | vinay.sajip | 2006-10-03 20:21:56 +0200 (Tue, 03 Oct 2006) | 1 line Modified LogRecord.__init__ to make the func parameter optional. (See SF #1569622). ........ r52121 | brett.cannon | 2006-10-03 23:58:55 +0200 (Tue, 03 Oct 2006) | 2 lines Fix minor typo in a comment. ........ r52123 | brett.cannon | 2006-10-04 01:23:14 +0200 (Wed, 04 Oct 2006) | 2 lines Convert test_imp over to unittest. ........ r52128 | barry.warsaw | 2006-10-04 04:06:36 +0200 (Wed, 04 Oct 2006) | 3 lines decode_rfc2231(): As Christian Robottom Reis points out, it makes no sense to test for parts > 3 when we use .split(..., 2). ........ r52129 | jeremy.hylton | 2006-10-04 04:24:52 +0200 (Wed, 04 Oct 2006) | 9 lines Fix for SF bug 1569998: break permitted inside try. The compiler was checking that there was something on the fblock stack, but not that there was a loop on the stack. Fixed that and added a test for the specific syntax error. Bug fix candidate. ........ r52130 | martin.v.loewis | 2006-10-04 07:47:34 +0200 (Wed, 04 Oct 2006) | 4 lines Fix integer negation and absolute value to not rely on undefined behaviour of the C compiler anymore. Will backport to 2.5 and 2.4. ........ r52135 | martin.v.loewis | 2006-10-04 11:21:20 +0200 (Wed, 04 Oct 2006) | 1 line Forward port r52134: Add uuids for 2.4.4. ........ r52137 | armin.rigo | 2006-10-04 12:23:57 +0200 (Wed, 04 Oct 2006) | 3 lines Compilation problem caused by conflicting typedefs for uint32_t (unsigned long vs. unsigned int). ........ r52139 | armin.rigo | 2006-10-04 14:17:45 +0200 (Wed, 04 Oct 2006) | 23 lines Forward-port of r52136,52138: a review of overflow-detecting code. * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests... ........ r52147 | andrew.kuchling | 2006-10-04 15:42:43 +0200 (Wed, 04 Oct 2006) | 6 lines Cause a PyObject_Malloc() failure to trigger a MemoryError, and then add 'if (PyErr_Occurred())' checks to various places so that NULL is returned properly. 2.4 backport candidate. ........ r52148 | martin.v.loewis | 2006-10-04 17:25:28 +0200 (Wed, 04 Oct 2006) | 1 line Add MSVC8 project files to create wininst-8.exe. ........ r52196 | brett.cannon | 2006-10-06 00:02:31 +0200 (Fri, 06 Oct 2006) | 7 lines Clarify what "re-initialization" means for init_builtin() and init_dynamic(). Also remove warning about re-initialization as possibly raising an execption as both call _PyImport_FindExtension() which pulls any module that was already imported from the Python process' extension cache and just copies the __dict__ into the module stored in sys.modules. ........ r52200 | fred.drake | 2006-10-06 02:03:45 +0200 (Fri, 06 Oct 2006) | 3 lines - update links - remove Sleepycat name now that they have been bought ........ r52204 | andrew.kuchling | 2006-10-06 12:41:01 +0200 (Fri, 06 Oct 2006) | 1 line Case fix ........ r52208 | georg.brandl | 2006-10-06 14:46:08 +0200 (Fri, 06 Oct 2006) | 3 lines Fix name. ........ r52211 | andrew.kuchling | 2006-10-06 15:18:26 +0200 (Fri, 06 Oct 2006) | 1 line [Bug #1545341] Allow 'classifier' parameter to be a tuple as well as a list. Will backport. ........ r52212 | armin.rigo | 2006-10-06 18:33:22 +0200 (Fri, 06 Oct 2006) | 4 lines A very minor bug fix: this code looks like it is designed to accept any hue value and do the modulo itself, except it doesn't quite do it in all cases. At least, the "cannot get here" comment was wrong. ........ r52213 | andrew.kuchling | 2006-10-06 20:51:55 +0200 (Fri, 06 Oct 2006) | 1 line Comment grammar ........ r52218 | skip.montanaro | 2006-10-07 13:05:02 +0200 (Sat, 07 Oct 2006) | 6 lines Note that the excel_tab class is registered as the "excel-tab" dialect. Fixes 1572471. Make a similar change for the excel class and clean up references to the Dialects and Formatting Parameters section in a few places. ........ r52221 | georg.brandl | 2006-10-08 09:11:54 +0200 (Sun, 08 Oct 2006) | 3 lines Add missing NEWS entry for rev. 52129. ........ r52223 | hyeshik.chang | 2006-10-08 15:48:34 +0200 (Sun, 08 Oct 2006) | 3 lines Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. (Submitted by Ray Chason) ........ r52227 | ronald.oussoren | 2006-10-08 19:37:58 +0200 (Sun, 08 Oct 2006) | 4 lines Add version number to the link to the python documentation in /Developer/Documentation/Python, better for users that install multiple versions of python. ........ r52229 | ronald.oussoren | 2006-10-08 19:40:02 +0200 (Sun, 08 Oct 2006) | 2 lines Fix for bug #1570284 ........ r52233 | ronald.oussoren | 2006-10-08 19:49:52 +0200 (Sun, 08 Oct 2006) | 6 lines MacOSX: distutils changes the values of BASECFLAGS and LDFLAGS when using a universal build of python on OSX 10.3 to ensure that those flags can be used to compile code (the universal build uses compiler flags that aren't supported on 10.3). This patches gives the same treatment to CFLAGS, PY_CFLAGS and BLDSHARED. ........ r52236 | ronald.oussoren | 2006-10-08 19:51:46 +0200 (Sun, 08 Oct 2006) | 5 lines MacOSX: The universal build requires that users have the MacOSX10.4u SDK installed to build extensions. This patch makes distutils emit a warning when the compiler should use an SDK but that SDK is not installed, hopefully reducing some confusion. ........ r52238 | ronald.oussoren | 2006-10-08 20:18:26 +0200 (Sun, 08 Oct 2006) | 3 lines MacOSX: add more logic to recognize the correct startup file to patch to the shell profile patching post-install script. ........ r52242 | andrew.kuchling | 2006-10-09 19:10:12 +0200 (Mon, 09 Oct 2006) | 1 line Add news item for rev. 52211 change ........ r52245 | andrew.kuchling | 2006-10-09 20:05:19 +0200 (Mon, 09 Oct 2006) | 1 line Fix wording in comment ........ r52251 | georg.brandl | 2006-10-09 21:03:06 +0200 (Mon, 09 Oct 2006) | 2 lines Patch #1572724: fix typo ('=' instead of '==') in _msi.c. ........ r52255 | barry.warsaw | 2006-10-09 21:43:24 +0200 (Mon, 09 Oct 2006) | 2 lines List gc.get_count() in the module docstring. ........ r52257 | martin.v.loewis | 2006-10-09 22:44:25 +0200 (Mon, 09 Oct 2006) | 1 line Bug #1565150: Fix subsecond processing for os.utime on Windows. ........ r52268 | ronald.oussoren | 2006-10-10 09:55:06 +0200 (Tue, 10 Oct 2006) | 2 lines MacOSX: fix permission problem in the generated installer ........ r52293 | georg.brandl | 2006-10-12 09:38:04 +0200 (Thu, 12 Oct 2006) | 2 lines Bug #1575746: fix typo in property() docs. ........ r52295 | georg.brandl | 2006-10-12 09:57:21 +0200 (Thu, 12 Oct 2006) | 3 lines Bug #813342: Start the IDLE subprocess with -Qnew if the parent is started with that option. ........ r52297 | georg.brandl | 2006-10-12 10:22:53 +0200 (Thu, 12 Oct 2006) | 2 lines Bug #1565919: document set types in the Language Reference. ........ r52299 | georg.brandl | 2006-10-12 11:20:33 +0200 (Thu, 12 Oct 2006) | 3 lines Bug #1550524: better heuristics to find correct class definition in inspect.findsource(). ........ r52301 | georg.brandl | 2006-10-12 11:47:12 +0200 (Thu, 12 Oct 2006) | 4 lines Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode arguments with the system default encoding just like the write() method does, instead of converting it to a raw buffer. ........ r52303 | georg.brandl | 2006-10-12 13:14:40 +0200 (Thu, 12 Oct 2006) | 2 lines Bug #1546628: add a note about urlparse.urljoin() and absolute paths. ........ r52305 | georg.brandl | 2006-10-12 13:27:59 +0200 (Thu, 12 Oct 2006) | 3 lines Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. ........ r52307 | georg.brandl | 2006-10-12 13:41:11 +0200 (Thu, 12 Oct 2006) | 3 lines Add a note to fpectl docs that it's not built by default (bug #1556261). ........ r52309 | georg.brandl | 2006-10-12 13:46:57 +0200 (Thu, 12 Oct 2006) | 3 lines Bug #1560114: the Mac filesystem does have accurate information about the case of filenames. ........ r52311 | georg.brandl | 2006-10-12 13:59:27 +0200 (Thu, 12 Oct 2006) | 2 lines Small grammar fix, thanks Sjoerd. ........ r52313 | georg.brandl | 2006-10-12 14:03:07 +0200 (Thu, 12 Oct 2006) | 2 lines Fix tarfile depending on buggy int('1\0', base) behavior. ........ r52315 | georg.brandl | 2006-10-12 14:33:07 +0200 (Thu, 12 Oct 2006) | 2 lines Bug #1283491: follow docstring convention wrt. keyword-able args in sum(). ........ r52316 | georg.brandl | 2006-10-12 15:08:16 +0200 (Thu, 12 Oct 2006) | 3 lines Bug #1560179: speed up posixpath.(dir|base)name ........ r52327 | brett.cannon | 2006-10-14 08:36:45 +0200 (Sat, 14 Oct 2006) | 3 lines Clean up the language of a sentence relating to the connect() function and user-defined datatypes. ........ r52332 | neal.norwitz | 2006-10-14 23:33:38 +0200 (Sat, 14 Oct 2006) | 3 lines Update the peephole optimizer to remove more dead code (jumps after returns) and inline jumps to returns. ........ r52333 | martin.v.loewis | 2006-10-15 09:54:40 +0200 (Sun, 15 Oct 2006) | 4 lines Patch #1576954: Update VC6 build directory; remove redundant files in VC7. Will backport to 2.5. ........ r52335 | martin.v.loewis | 2006-10-15 10:43:33 +0200 (Sun, 15 Oct 2006) | 1 line Patch #1576166: Support os.utime for directories on Windows NT+. ........ r52336 | martin.v.loewis | 2006-10-15 10:51:22 +0200 (Sun, 15 Oct 2006) | 2 lines Patch #1577551: Add ctypes and ET build support for VC6. Will backport to 2.5. ........ r52338 | martin.v.loewis | 2006-10-15 11:35:51 +0200 (Sun, 15 Oct 2006) | 1 line Loosen the test for equal time stamps. ........ r52339 | martin.v.loewis | 2006-10-15 11:43:39 +0200 (Sun, 15 Oct 2006) | 2 lines Bug #1567666: Emulate GetFileAttributesExA for Win95. Will backport to 2.5. ........ r52341 | martin.v.loewis | 2006-10-15 13:02:07 +0200 (Sun, 15 Oct 2006) | 2 lines Round to int, because some systems support sub-second time stamps in stat, but not in utime. Also be consistent with modifying only mtime, not atime. ........ r52342 | martin.v.loewis | 2006-10-15 13:57:40 +0200 (Sun, 15 Oct 2006) | 2 lines Set the eol-style for project files to "CRLF". ........ r52343 | martin.v.loewis | 2006-10-15 13:59:56 +0200 (Sun, 15 Oct 2006) | 3 lines Drop binary property on dsp files, set eol-style to CRLF instead. ........ r52344 | martin.v.loewis | 2006-10-15 14:01:43 +0200 (Sun, 15 Oct 2006) | 2 lines Remove binary property, set eol-style to CRLF instead. ........ r52346 | martin.v.loewis | 2006-10-15 16:30:38 +0200 (Sun, 15 Oct 2006) | 2 lines Mention the bdist_msi module. Will backport to 2.5. ........ r52354 | brett.cannon | 2006-10-16 05:09:52 +0200 (Mon, 16 Oct 2006) | 3 lines Fix turtle so that you can launch the demo2 function on its own instead of only when the module is launched as a script. ........ r52356 | martin.v.loewis | 2006-10-17 17:18:06 +0200 (Tue, 17 Oct 2006) | 2 lines Patch #1457736: Update VC6 to use current PCbuild settings. Will backport to 2.5. ........ r52360 | martin.v.loewis | 2006-10-17 20:09:55 +0200 (Tue, 17 Oct 2006) | 2 lines Remove obsolete file. Will backport. ........ r52363 | martin.v.loewis | 2006-10-17 20:59:23 +0200 (Tue, 17 Oct 2006) | 4 lines Forward-port r52358: - 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. ........ r52365 | thomas.heller | 2006-10-17 21:30:48 +0200 (Tue, 17 Oct 2006) | 6 lines ctypes callback functions only support 'fundamental' result types. Check this and raise an error when something else is used - before this change ctypes would hang or crash when such a callback was called. This is a partial fix for #1574584. Will backport to release25-maint. ........ r52377 | tim.peters | 2006-10-18 07:06:06 +0200 (Wed, 18 Oct 2006) | 2 lines newIobject(): repaired incorrect cast to quiet MSVC warning. ........ r52378 | tim.peters | 2006-10-18 07:09:12 +0200 (Wed, 18 Oct 2006) | 2 lines Whitespace normalization. ........ r52379 | tim.peters | 2006-10-18 07:10:28 +0200 (Wed, 18 Oct 2006) | 2 lines Add missing svn:eol-style to text files. ........ r52387 | martin.v.loewis | 2006-10-19 12:58:46 +0200 (Thu, 19 Oct 2006) | 3 lines Add check for the PyArg_ParseTuple format, and declare it if it is supported. ........ r52388 | martin.v.loewis | 2006-10-19 13:00:37 +0200 (Thu, 19 Oct 2006) | 3 lines Fix various minor errors in passing arguments to PyArg_ParseTuple. ........ r52389 | martin.v.loewis | 2006-10-19 18:01:37 +0200 (Thu, 19 Oct 2006) | 2 lines Restore CFLAGS after checking for __attribute__ ........ r52390 | andrew.kuchling | 2006-10-19 23:55:55 +0200 (Thu, 19 Oct 2006) | 1 line [Bug #1576348] Fix typo in example ........ r52414 | walter.doerwald | 2006-10-22 10:59:41 +0200 (Sun, 22 Oct 2006) | 2 lines Port test___future__ to unittest. ........ r52415 | ronald.oussoren | 2006-10-22 12:45:18 +0200 (Sun, 22 Oct 2006) | 3 lines Patch #1580674: with this patch os.readlink uses the filesystem encoding to decode unicode objects and returns an unicode object when the argument is one. ........ r52416 | martin.v.loewis | 2006-10-22 12:46:18 +0200 (Sun, 22 Oct 2006) | 3 lines Patch #1580872: Remove duplicate declaration of PyCallable_Check. Will backport to 2.5. ........ r52418 | martin.v.loewis | 2006-10-22 12:55:15 +0200 (Sun, 22 Oct 2006) | 4 lines - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that ctypes isn't considered as requiring executable stacks. Will backport to 2.5. ........ r52420 | martin.v.loewis | 2006-10-22 15:45:13 +0200 (Sun, 22 Oct 2006) | 3 lines Remove passwd.adjunct.byname from list of maps for test_nis. Will backport to 2.5. ........ r52431 | georg.brandl | 2006-10-24 18:54:16 +0200 (Tue, 24 Oct 2006) | 2 lines Patch [ 1583506 ] tarfile.py: 100-char filenames are truncated ........ r52446 | andrew.kuchling | 2006-10-26 21:10:46 +0200 (Thu, 26 Oct 2006) | 1 line [Bug #1579796] Wrong syntax for PyDateTime_IMPORT in documentation. Reported by David Faure. ........ r52449 | andrew.kuchling | 2006-10-26 21:16:46 +0200 (Thu, 26 Oct 2006) | 1 line Typo fix ........ r52452 | martin.v.loewis | 2006-10-27 08:16:31 +0200 (Fri, 27 Oct 2006) | 3 lines Patch #1549049: Rewrite type conversion in structmember. Fixes #1545696 and #1566140. Will backport to 2.5. ........ r52454 | martin.v.loewis | 2006-10-27 08:42:27 +0200 (Fri, 27 Oct 2006) | 2 lines Check for values.h. Will backport. ........ r52456 | martin.v.loewis | 2006-10-27 09:06:52 +0200 (Fri, 27 Oct 2006) | 2 lines Get DBL_MAX from float.h not values.h. Will backport. ........ r52458 | martin.v.loewis | 2006-10-27 09:13:28 +0200 (Fri, 27 Oct 2006) | 2 lines Patch #1567274: Support SMTP over TLS. ........ r52459 | andrew.kuchling | 2006-10-27 13:33:29 +0200 (Fri, 27 Oct 2006) | 1 line Set svn:keywords property ........ r52460 | andrew.kuchling | 2006-10-27 13:36:41 +0200 (Fri, 27 Oct 2006) | 1 line Add item ........ r52461 | andrew.kuchling | 2006-10-27 13:37:01 +0200 (Fri, 27 Oct 2006) | 1 line Some wording changes and markup fixes ........ r52462 | andrew.kuchling | 2006-10-27 14:18:38 +0200 (Fri, 27 Oct 2006) | 1 line [Bug #1585690] Note that line_num was added in Python 2.5 ........ r52464 | andrew.kuchling | 2006-10-27 14:50:38 +0200 (Fri, 27 Oct 2006) | 1 line [Bug #1583946] Reword description of server and issuer ........ r52466 | andrew.kuchling | 2006-10-27 15:06:25 +0200 (Fri, 27 Oct 2006) | 1 line [Bug #1562583] Mention the set_reuse_addr() method ........ r52469 | andrew.kuchling | 2006-10-27 15:22:46 +0200 (Fri, 27 Oct 2006) | 4 lines [Bug #1542016] Report PCALL_POP value. This makes the return value of sys.callstats() match its docstring. Backport candidate. Though it's an API change, this is a pretty obscure portion of the API. ........ r52473 | andrew.kuchling | 2006-10-27 16:53:41 +0200 (Fri, 27 Oct 2006) | 1 line Point users to the subprocess module in the docs for os.system, os.spawn*, os.popen2, and the popen2 and commands modules ........ r52476 | andrew.kuchling | 2006-10-27 18:39:10 +0200 (Fri, 27 Oct 2006) | 1 line [Bug #1576241] Let functools.wraps work with built-in functions ........ r52478 | andrew.kuchling | 2006-10-27 18:55:34 +0200 (Fri, 27 Oct 2006) | 1 line [Bug #1575506] The _singlefileMailbox class was using the wrong file object in its flush() method, causing an error ........ r52480 | andrew.kuchling | 2006-10-27 19:06:16 +0200 (Fri, 27 Oct 2006) | 1 line Clarify docstring ........ r52481 | andrew.kuchling | 2006-10-27 19:11:23 +0200 (Fri, 27 Oct 2006) | 5 lines [Patch #1574068 by Scott Dial] urllib and urllib2 were using base64.encodestring() for encoding authentication data. encodestring() can include newlines for very long input, which produced broken HTTP headers. ........ r52483 | andrew.kuchling | 2006-10-27 20:13:46 +0200 (Fri, 27 Oct 2006) | 1 line Check db_setup_debug for a few print statements; change sqlite_setup_debug to False ........ r52484 | andrew.kuchling | 2006-10-27 20:15:02 +0200 (Fri, 27 Oct 2006) | 1 line [Patch #1503717] Tiny patch from Chris AtLee to stop a lengthy line from being printed ........ r52485 | thomas.heller | 2006-10-27 20:31:36 +0200 (Fri, 27 Oct 2006) | 5 lines WindowsError.str should display the windows error code, not the posix error code; with test. Fixes #1576174. Will backport to release25-maint. ........ r52487 | thomas.heller | 2006-10-27 21:05:53 +0200 (Fri, 27 Oct 2006) | 4 lines Modulefinder now handles absolute and relative imports, including tests. Will backport to release25-maint. ........ r52488 | georg.brandl | 2006-10-27 22:39:43 +0200 (Fri, 27 Oct 2006) | 2 lines Patch #1552024: add decorator support to unparse.py demo script. ........ r52492 | walter.doerwald | 2006-10-28 12:47:12 +0200 (Sat, 28 Oct 2006) | 2 lines Port test_bufio to unittest. ........ r52493 | georg.brandl | 2006-10-28 15:10:17 +0200 (Sat, 28 Oct 2006) | 6 lines Convert test_global, test_scope and test_grammar to unittest. I tried to enclose all tests which must be run at the toplevel (instead of inside a method) in exec statements. ........ r52494 | georg.brandl | 2006-10-28 15:11:41 +0200 (Sat, 28 Oct 2006) | 3 lines Update outstanding bugs test file. ........ r52495 | georg.brandl | 2006-10-28 15:51:49 +0200 (Sat, 28 Oct 2006) | 3 lines Convert test_math to unittest. ........ r52496 | georg.brandl | 2006-10-28 15:56:58 +0200 (Sat, 28 Oct 2006) | 3 lines Convert test_opcodes to unittest. ........ r52497 | georg.brandl | 2006-10-28 18:04:04 +0200 (Sat, 28 Oct 2006) | 2 lines Fix nth() itertool recipe. ........ r52500 | georg.brandl | 2006-10-28 22:25:09 +0200 (Sat, 28 Oct 2006) | 2 lines make test_grammar pass with python -O ........ r52501 | neal.norwitz | 2006-10-28 23:15:30 +0200 (Sat, 28 Oct 2006) | 6 lines Add some asserts. In sysmodule, I think these were to try to silence some warnings from Klokwork. They verify the assumptions of the format of svn version output. The assert in the thread module helped debug a problem on HP-UX. ........ r52502 | neal.norwitz | 2006-10-28 23:16:54 +0200 (Sat, 28 Oct 2006) | 5 lines Fix warnings with HP's C compiler. It doesn't recognize that infinite loops are, um, infinite. These conditions should not be able to happen. Will backport. ........ r52503 | neal.norwitz | 2006-10-28 23:17:51 +0200 (Sat, 28 Oct 2006) | 5 lines Fix crash in test on HP-UX. Apparently, it's not possible to delete a lock if it's held (even by the current thread). Will backport. ........ r52504 | neal.norwitz | 2006-10-28 23:19:07 +0200 (Sat, 28 Oct 2006) | 6 lines Fix bug #1565514, SystemError not raised on too many nested blocks. It seems like this should be a different error than SystemError, but I don't have any great ideas and SystemError was raised in 2.4 and earlier. Will backport. ........ r52505 | neal.norwitz | 2006-10-28 23:20:12 +0200 (Sat, 28 Oct 2006) | 4 lines Prevent crash if alloc of garbage fails. Found by Typo.pl. Will backport. ........ r52506 | neal.norwitz | 2006-10-28 23:21:00 +0200 (Sat, 28 Oct 2006) | 4 lines Don't inline Py_ADDRESS_IN_RANGE with gcc 4+ either. Will backport. ........ r52513 | neal.norwitz | 2006-10-28 23:56:49 +0200 (Sat, 28 Oct 2006) | 2 lines Fix test_modulefinder so it doesn't fail when run after test_distutils. ........ r52514 | neal.norwitz | 2006-10-29 00:12:26 +0200 (Sun, 29 Oct 2006) | 4 lines From SF 1557890, fix problem of using wrong type in example. Will backport. ........ r52517 | georg.brandl | 2006-10-29 09:39:22 +0100 (Sun, 29 Oct 2006) | 4 lines Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and fix all codecs file wrappers to work correctly with the "with" statement (bug #1586513). ........ r52519 | georg.brandl | 2006-10-29 09:47:08 +0100 (Sun, 29 Oct 2006) | 3 lines Clean up a leftover from old listcomp generation code. ........ r52520 | georg.brandl | 2006-10-29 09:53:06 +0100 (Sun, 29 Oct 2006) | 4 lines Bug #1586448: the compiler module now emits the same bytecode for list comprehensions as the builtin compiler, using the LIST_APPEND opcode. ........ r52521 | georg.brandl | 2006-10-29 10:01:01 +0100 (Sun, 29 Oct 2006) | 3 lines Remove trailing comma. ........ r52522 | georg.brandl | 2006-10-29 10:05:04 +0100 (Sun, 29 Oct 2006) | 3 lines Bug #1357915: allow all sequence types for shell arguments in subprocess. ........ r52524 | georg.brandl | 2006-10-29 10:16:12 +0100 (Sun, 29 Oct 2006) | 3 lines Patch #1583880: fix tarfile's problems with long names and posix/ GNU modes. ........ r52526 | georg.brandl | 2006-10-29 10:18:00 +0100 (Sun, 29 Oct 2006) | 3 lines Test assert if __debug__ is true. ........ r52527 | georg.brandl | 2006-10-29 10:32:16 +0100 (Sun, 29 Oct 2006) | 2 lines Fix the new EncodedFile test to work with big endian platforms. ........ r52529 | georg.brandl | 2006-10-29 15:39:09 +0100 (Sun, 29 Oct 2006) | 2 lines Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. ........ r52532 | georg.brandl | 2006-10-29 19:01:08 +0100 (Sun, 29 Oct 2006) | 2 lines Bug #1586773: extend hashlib docstring. ........ r52534 | neal.norwitz | 2006-10-29 19:30:10 +0100 (Sun, 29 Oct 2006) | 4 lines Update comments, remove commented out code. Move assembler structure next to assembler code to make it easier to move it to a separate file. ........ r52535 | georg.brandl | 2006-10-29 19:31:42 +0100 (Sun, 29 Oct 2006) | 3 lines Bug #1576657: when setting a KeyError for a tuple key, make sure that the tuple isn't used as the "exception arguments tuple". ........ r52537 | georg.brandl | 2006-10-29 20:13:40 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_mmap to unittest. ........ r52538 | georg.brandl | 2006-10-29 20:20:45 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_poll to unittest. ........ r52539 | georg.brandl | 2006-10-29 20:24:43 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_nis to unittest. ........ r52540 | georg.brandl | 2006-10-29 20:35:03 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_types to unittest. ........ r52541 | georg.brandl | 2006-10-29 20:51:16 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_cookie to unittest. ........ r52542 | georg.brandl | 2006-10-29 21:09:12 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_cgi to unittest. ........ r52543 | georg.brandl | 2006-10-29 21:24:01 +0100 (Sun, 29 Oct 2006) | 3 lines Completely convert test_httplib to unittest. ........ r52544 | georg.brandl | 2006-10-29 21:28:26 +0100 (Sun, 29 Oct 2006) | 2 lines Convert test_MimeWriter to unittest. ........ r52545 | georg.brandl | 2006-10-29 21:31:17 +0100 (Sun, 29 Oct 2006) | 3 lines Convert test_openpty to unittest. ........ r52546 | georg.brandl | 2006-10-29 21:35:12 +0100 (Sun, 29 Oct 2006) | 3 lines Remove leftover test output file. ........ r52547 | georg.brandl | 2006-10-29 22:54:18 +0100 (Sun, 29 Oct 2006) | 3 lines Move the check for openpty to the beginning. ........ r52548 | walter.doerwald | 2006-10-29 23:06:28 +0100 (Sun, 29 Oct 2006) | 2 lines Add tests for basic argument errors. ........ r52549 | walter.doerwald | 2006-10-30 00:02:27 +0100 (Mon, 30 Oct 2006) | 3 lines Add tests for incremental codecs with an errors argument. ........ r52550 | neal.norwitz | 2006-10-30 00:39:03 +0100 (Mon, 30 Oct 2006) | 1 line Fix refleak ........ r52552 | neal.norwitz | 2006-10-30 00:58:36 +0100 (Mon, 30 Oct 2006) | 1 line I'm assuming this is correct, it fixes the tests so they pass again ........ r52555 | vinay.sajip | 2006-10-31 18:32:37 +0100 (Tue, 31 Oct 2006) | 1 line Change to improve speed of _fixupChildren ........ r52556 | vinay.sajip | 2006-10-31 18:34:31 +0100 (Tue, 31 Oct 2006) | 1 line Added relativeCreated to Formatter doc (has been in the system for a long time - was unaccountably left out of the docs and not noticed until now). ........ r52588 | thomas.heller | 2006-11-02 20:48:24 +0100 (Thu, 02 Nov 2006) | 5 lines Replace the XXX marker in the 'Arrays and pointers' reference manual section with a link to the tutorial sections. Will backport to release25-maint. ........ r52592 | thomas.heller | 2006-11-02 21:22:29 +0100 (Thu, 02 Nov 2006) | 6 lines Fix a code example by adding a missing import. Fixes #1557890. Will backport to release25-maint. ........ r52598 | tim.peters | 2006-11-03 03:32:46 +0100 (Fri, 03 Nov 2006) | 2 lines Whitespace normalization. ........ r52619 | martin.v.loewis | 2006-11-04 19:14:06 +0100 (Sat, 04 Nov 2006) | 4 lines - Patch #1060577: Extract list of RPM files from spec file in bdist_rpm Will backport to 2.5. ........ r52621 | neal.norwitz | 2006-11-04 20:25:22 +0100 (Sat, 04 Nov 2006) | 4 lines Bug #1588287: fix invalid assertion for `1,2` in debug builds. Will backport ........ r52630 | andrew.kuchling | 2006-11-05 22:04:37 +0100 (Sun, 05 Nov 2006) | 1 line Update link ........ r52631 | skip.montanaro | 2006-11-06 15:34:52 +0100 (Mon, 06 Nov 2006) | 1 line note that user can control directory location even if default dir is used ........ r52644 | ronald.oussoren | 2006-11-07 16:53:38 +0100 (Tue, 07 Nov 2006) | 2 lines Fix a number of typos in strings and comments (sf#1589070) ........ r52647 | ronald.oussoren | 2006-11-07 17:00:34 +0100 (Tue, 07 Nov 2006) | 2 lines Whitespace changes to make the source more compliant with PEP8 (SF#1589070) ........ r52651 | thomas.heller | 2006-11-07 19:01:18 +0100 (Tue, 07 Nov 2006) | 3 lines Fix markup. Will backport to release25-maint. ........ r52653 | thomas.heller | 2006-11-07 19:20:47 +0100 (Tue, 07 Nov 2006) | 3 lines Fix grammatical error as well. Will backport to release25-maint. ........ r52657 | andrew.kuchling | 2006-11-07 21:39:16 +0100 (Tue, 07 Nov 2006) | 1 line Add missing word ........ r52662 | martin.v.loewis | 2006-11-08 07:46:37 +0100 (Wed, 08 Nov 2006) | 4 lines Correctly forward exception in instance_contains(). Fixes #1591996. Patch contributed by Neal Norwitz. Will backport. ........ r52664 | martin.v.loewis | 2006-11-08 07:48:36 +0100 (Wed, 08 Nov 2006) | 2 lines News entry for 52662. ........ r52665 | martin.v.loewis | 2006-11-08 08:35:55 +0100 (Wed, 08 Nov 2006) | 2 lines Patch #1351744: Add askyesnocancel helper for tkMessageBox. ........ r52666 | georg.brandl | 2006-11-08 08:45:59 +0100 (Wed, 08 Nov 2006) | 2 lines Patch #1592072: fix docs for return value of PyErr_CheckSignals. ........ r52668 | georg.brandl | 2006-11-08 11:04:29 +0100 (Wed, 08 Nov 2006) | 3 lines Bug #1592533: rename variable in heapq doc example, to avoid shadowing "sorted". ........ r52671 | andrew.kuchling | 2006-11-08 14:35:34 +0100 (Wed, 08 Nov 2006) | 1 line Add section on the functional module ........ r52672 | andrew.kuchling | 2006-11-08 15:14:30 +0100 (Wed, 08 Nov 2006) | 1 line Add section on operator module; make a few edits ........ r52673 | andrew.kuchling | 2006-11-08 15:24:03 +0100 (Wed, 08 Nov 2006) | 1 line Add table of contents; this required fixing a few headings. Some more smalle edits. ........ r52674 | andrew.kuchling | 2006-11-08 15:30:14 +0100 (Wed, 08 Nov 2006) | 1 line More edits ........ r52686 | martin.v.loewis | 2006-11-09 12:06:03 +0100 (Thu, 09 Nov 2006) | 3 lines Patch #838546: Make terminal become controlling in pty.fork(). Will backport to 2.5. ........ r52688 | martin.v.loewis | 2006-11-09 12:27:32 +0100 (Thu, 09 Nov 2006) | 2 lines Patch #1592250: Add elidge argument to Tkinter.Text.search. ........ r52690 | andrew.kuchling | 2006-11-09 14:27:07 +0100 (Thu, 09 Nov 2006) | 7 lines [Bug #1569790] mailbox.Maildir.get_folder() loses factory information Both the Maildir and MH classes had this bug; the patch fixes both classes and adds a test. Will backport to 25-maint. ........ r52692 | andrew.kuchling | 2006-11-09 14:51:14 +0100 (Thu, 09 Nov 2006) | 1 line [Patch #1514544 by David Watson] use fsync() to ensure data is really on disk ........ r52695 | walter.doerwald | 2006-11-09 17:23:26 +0100 (Thu, 09 Nov 2006) | 2 lines Replace C++ comment with C comment (fixes SF bug #1593525). ........ r52712 | andrew.kuchling | 2006-11-09 22:16:46 +0100 (Thu, 09 Nov 2006) | 11 lines [Patch #1514543] mailbox (Maildir): avoid losing messages on name clash Two changes: Where possible, use link()/remove() to move files into a directory; this makes it easier to avoid overwriting an existing file. Use _create_carefully() to create files in tmp/, which uses O_EXCL. Backport candidate. ........ r52716 | phillip.eby | 2006-11-10 01:33:36 +0100 (Fri, 10 Nov 2006) | 4 lines Fix SF#1566719: not creating site-packages (or other target directory) when installing .egg-info for a project that contains no modules or packages, while using --root (as in bdist_rpm). ........ r52719 | andrew.kuchling | 2006-11-10 14:14:01 +0100 (Fri, 10 Nov 2006) | 1 line Reword entry ........ r52725 | andrew.kuchling | 2006-11-10 15:39:01 +0100 (Fri, 10 Nov 2006) | 1 line [Feature request #1542920] Link to wsgi.org ........ r52731 | georg.brandl | 2006-11-11 19:29:11 +0100 (Sat, 11 Nov 2006) | 2 lines Bug #1594742: wrong word in stringobject doc. ........ r52733 | georg.brandl | 2006-11-11 19:32:47 +0100 (Sat, 11 Nov 2006) | 2 lines Bug #1594758: wording improvement for dict.update() docs. ........ r52736 | martin.v.loewis | 2006-11-12 11:32:47 +0100 (Sun, 12 Nov 2006) | 3 lines Patch #1065257: Support passing open files as body in HTTPConnection.request(). ........ r52737 | martin.v.loewis | 2006-11-12 11:41:39 +0100 (Sun, 12 Nov 2006) | 2 lines Patch #1355023: support whence argument for GzipFile.seek. ........ r52738 | martin.v.loewis | 2006-11-12 19:24:26 +0100 (Sun, 12 Nov 2006) | 2 lines Bug #1067760: Deprecate passing floats to file.seek. ........ r52739 | martin.v.loewis | 2006-11-12 19:48:13 +0100 (Sun, 12 Nov 2006) | 3 lines Patch #1359217: Ignore 2xx response before 150 response. Will backport to 2.5. ........ r52741 | martin.v.loewis | 2006-11-12 19:56:03 +0100 (Sun, 12 Nov 2006) | 4 lines Patch #1360200: Use unmangled_version RPM spec field to deal with file name mangling. Will backport to 2.5. ........ r52753 | walter.doerwald | 2006-11-15 17:23:46 +0100 (Wed, 15 Nov 2006) | 2 lines Fix typo. ........ r52754 | georg.brandl | 2006-11-15 18:42:03 +0100 (Wed, 15 Nov 2006) | 2 lines Bug #1594809: add a note to README regarding PYTHONPATH and make install. ........ r52762 | georg.brandl | 2006-11-16 16:05:14 +0100 (Thu, 16 Nov 2006) | 2 lines Bug #1597576: mention that the new base64 api has been introduced in py2.4. ........ r52764 | georg.brandl | 2006-11-16 17:50:59 +0100 (Thu, 16 Nov 2006) | 3 lines Bug #1597824: return the registered function from atexit.register() to facilitate usage as a decorator. ........ r52765 | georg.brandl | 2006-11-16 18:08:45 +0100 (Thu, 16 Nov 2006) | 4 lines Bug #1588217: don't parse "= " as a soft line break in binascii's a2b_qp() function, instead leave it in the string as quopri.decode() does. ........ r52776 | andrew.kuchling | 2006-11-17 14:30:25 +0100 (Fri, 17 Nov 2006) | 17 lines Remove file-locking in MH.pack() method. This change looks massive but it's mostly a re-indenting after removing some try...finally blocks. Also adds a test case that does a pack() while the mailbox is locked; this test would have turned up bugs in the original code on some platforms. In both nmh and GNU Mailutils' implementation of MH-format mailboxes, no locking is done of individual message files when renaming them. The original mailbox.py code did do locking, which meant that message files had to be opened. This code was buggy on certain platforms (found through reading the code); there were code paths that closed the file object and then called _unlock_file() on it. Will backport to 25-maint once I see how the buildbots react to this patch. ........ r52780 | martin.v.loewis | 2006-11-18 19:00:23 +0100 (Sat, 18 Nov 2006) | 5 lines Patch #1538878: Don't make tkSimpleDialog dialogs transient if the parent window is withdrawn. This mirrors what dialog.tcl does. Will backport to 2.5. ........ r52782 | martin.v.loewis | 2006-11-18 19:05:35 +0100 (Sat, 18 Nov 2006) | 4 lines Patch #1594554: Always close a tkSimpleDialog on ok(), even if an exception occurs. Will backport to 2.5. ........ r52784 | martin.v.loewis | 2006-11-18 19:42:11 +0100 (Sat, 18 Nov 2006) | 3 lines Patch #1472877: Fix Tix subwidget name resolution. Will backport to 2.5. ........ r52786 | andrew.kuchling | 2006-11-18 23:17:33 +0100 (Sat, 18 Nov 2006) | 1 line Expand checking in test_sha ........ r52787 | georg.brandl | 2006-11-19 09:48:30 +0100 (Sun, 19 Nov 2006) | 3 lines Patch [ 1586791 ] better error msgs for some TypeErrors ........ r52788 | martin.v.loewis | 2006-11-19 11:41:41 +0100 (Sun, 19 Nov 2006) | 4 lines Make cStringIO.truncate raise IOError for negative arguments (even for -1). Fixes the last bit of #1359365. ........ r52789 | andrew.kuchling | 2006-11-19 19:40:01 +0100 (Sun, 19 Nov 2006) | 1 line Add a test case of data w/ bytes > 127 ........ r52790 | martin.v.loewis | 2006-11-19 19:51:54 +0100 (Sun, 19 Nov 2006) | 3 lines Patch #1070046: Marshal new-style objects like InstanceType in xmlrpclib. ........ r52792 | neal.norwitz | 2006-11-19 22:26:53 +0100 (Sun, 19 Nov 2006) | 4 lines Speed up function calls into the math module by using METH_O. There should be no functional changes. However, the error msgs are slightly different. Also verified that the module dict is not NULL on init. ........ r52794 | george.yoshida | 2006-11-20 03:24:48 +0100 (Mon, 20 Nov 2006) | 2 lines markup fix ........ r52795 | georg.brandl | 2006-11-20 08:12:58 +0100 (Mon, 20 Nov 2006) | 3 lines Further markup fix. ........ r52800 | andrew.kuchling | 2006-11-20 14:39:37 +0100 (Mon, 20 Nov 2006) | 2 lines Jython compatibility fix: if uu.decode() opened its output file, be sure to close it. ........ r52811 | neal.norwitz | 2006-11-21 06:26:22 +0100 (Tue, 21 Nov 2006) | 9 lines Bug #1599782: Fix segfault on bsddb.db.DB().type(). The problem is that _DB_get_type() can't be called without the GIL because it calls a bunch of PyErr_* APIs when an error occurs. There were no other cases in this file that it was called without the GIL. Removing the BEGIN/END THREAD around _DB_get_type() made everything work. Will backport. ........ r52814 | neal.norwitz | 2006-11-21 06:51:51 +0100 (Tue, 21 Nov 2006) | 1 line Oops, convert tabs to spaces ........ r52815 | neal.norwitz | 2006-11-21 07:23:44 +0100 (Tue, 21 Nov 2006) | 1 line Fix SF #1599879, socket.gethostname should ref getfqdn directly. ........ r52817 | martin.v.loewis | 2006-11-21 19:20:25 +0100 (Tue, 21 Nov 2006) | 4 lines Conditionalize definition of _CRT_SECURE_NO_DEPRECATE and _CRT_NONSTDC_NO_DEPRECATE. Will backport. ........ r52821 | martin.v.loewis | 2006-11-22 09:50:02 +0100 (Wed, 22 Nov 2006) | 4 lines Patch #1362975: Rework CodeContext indentation algorithm to avoid hard-coding pixel widths. Also make the text's scrollbar a child of the text frame, not the top widget. ........ r52826 | walter.doerwald | 2006-11-23 06:03:56 +0100 (Thu, 23 Nov 2006) | 3 lines Change decode() so that it works with a buffer (i.e. unicode(..., 'utf-8-sig')) SF bug #1601501. ........ r52833 | georg.brandl | 2006-11-23 10:55:07 +0100 (Thu, 23 Nov 2006) | 2 lines Bug #1601630: little improvement to getopt docs ........ r52835 | michael.hudson | 2006-11-23 14:54:04 +0100 (Thu, 23 Nov 2006) | 3 lines a test for an error condition not covered by existing tests (noticed this when writing the equivalent code for pypy) ........ r52839 | raymond.hettinger | 2006-11-23 22:06:03 +0100 (Thu, 23 Nov 2006) | 1 line Fix and/add typo ........ r52840 | raymond.hettinger | 2006-11-23 22:35:19 +0100 (Thu, 23 Nov 2006) | 1 line ... and the number of the counting shall be three. ........ r52841 | thomas.heller | 2006-11-24 19:45:39 +0100 (Fri, 24 Nov 2006) | 1 line Fix bug #1598620: A ctypes structure cannot contain itself. ........ r52843 | martin.v.loewis | 2006-11-25 16:39:19 +0100 (Sat, 25 Nov 2006) | 3 lines Disable _XOPEN_SOURCE on NetBSD 1.x. Will backport to 2.5 ........ r52845 | georg.brandl | 2006-11-26 20:27:47 +0100 (Sun, 26 Nov 2006) | 2 lines Bug #1603321: make pstats.Stats accept Unicode file paths. ........ r52850 | georg.brandl | 2006-11-27 19:46:21 +0100 (Mon, 27 Nov 2006) | 2 lines Bug #1603789: grammatical error in Tkinter docs. ........ r52855 | thomas.heller | 2006-11-28 21:21:54 +0100 (Tue, 28 Nov 2006) | 7 lines Fix #1563807: _ctypes built on AIX fails with ld ffi error. The contents of ffi_darwin.c must be compiled unless __APPLE__ is defined and __ppc__ is not. Will backport. ........ r52862 | armin.rigo | 2006-11-29 22:59:22 +0100 (Wed, 29 Nov 2006) | 3 lines Forgot a case where the locals can now be a general mapping instead of just a dictionary. (backporting...) ........ r52872 | guido.van.rossum | 2006-11-30 20:23:13 +0100 (Thu, 30 Nov 2006) | 2 lines Update version. ........ r52890 | walter.doerwald | 2006-12-01 17:59:47 +0100 (Fri, 01 Dec 2006) | 3 lines Move xdrlib tests from the module into a separate test script, port the tests to unittest and add a few new tests. ........ r52900 | raymond.hettinger | 2006-12-02 03:00:39 +0100 (Sat, 02 Dec 2006) | 1 line Add name to credits (for untokenize). ........ r52905 | martin.v.loewis | 2006-12-03 10:54:46 +0100 (Sun, 03 Dec 2006) | 2 lines Move IDLE news into NEWS.txt. ........ r52906 | martin.v.loewis | 2006-12-03 12:23:45 +0100 (Sun, 03 Dec 2006) | 4 lines Patch #1544279: Improve thread-safety of the socket module by moving the sock_addr_t storage out of the socket object. Will backport to 2.5. ........ r52908 | martin.v.loewis | 2006-12-03 13:01:53 +0100 (Sun, 03 Dec 2006) | 3 lines Patch #1371075: Make ConfigParser accept optional dict type for ordering, sorting, etc. ........ r52910 | matthias.klose | 2006-12-03 18:16:41 +0100 (Sun, 03 Dec 2006) | 2 lines - Fix build failure on kfreebsd and on the hurd. ........ r52915 | george.yoshida | 2006-12-04 12:41:54 +0100 (Mon, 04 Dec 2006) | 2 lines fix a versionchanged tag ........ r52917 | george.yoshida | 2006-12-05 06:39:50 +0100 (Tue, 05 Dec 2006) | 3 lines Fix pickle doc typo Patch #1608758 ........ r52938 | georg.brandl | 2006-12-06 23:21:18 +0100 (Wed, 06 Dec 2006) | 2 lines Patch #1610437: fix a tarfile bug with long filename headers. ........ r52945 | brett.cannon | 2006-12-07 00:38:48 +0100 (Thu, 07 Dec 2006) | 3 lines Fix a bad assumption that all objects assigned to '__loader__' on a module will have a '_files' attribute. ........ r52951 | georg.brandl | 2006-12-07 10:30:06 +0100 (Thu, 07 Dec 2006) | 3 lines RFE #1592899: mention string.maketrans() in docs for str.translate, remove reference to the old regex module in the former's doc. ........ r52962 | raymond.hettinger | 2006-12-08 04:17:18 +0100 (Fri, 08 Dec 2006) | 1 line Eliminate two redundant calls to PyObject_Hash(). ........ r52963 | raymond.hettinger | 2006-12-08 05:24:33 +0100 (Fri, 08 Dec 2006) | 3 lines Port Armin's fix for a dict resize vulnerability (svn revision 46589, sf bug 1456209). ........ r52964 | raymond.hettinger | 2006-12-08 05:57:50 +0100 (Fri, 08 Dec 2006) | 4 lines Port Georg's dictobject.c fix keys that were tuples got unpacked on the way to setting a KeyError (svn revision 52535, sf bug 1576657). ........ r52966 | raymond.hettinger | 2006-12-08 18:35:25 +0100 (Fri, 08 Dec 2006) | 2 lines Add test for SF bug 1576657 ........ r52970 | georg.brandl | 2006-12-08 21:46:11 +0100 (Fri, 08 Dec 2006) | 3 lines #1577756: svnversion doesn't react to LANG=C, use LC_ALL=C to force English output. ........ r52972 | georg.brandl | 2006-12-09 10:08:29 +0100 (Sat, 09 Dec 2006) | 3 lines Patch #1608267: fix a race condition in os.makedirs() is the directory to be created is already there. ........ r52975 | matthias.klose | 2006-12-09 13:15:27 +0100 (Sat, 09 Dec 2006) | 2 lines - Fix the build of the library reference in info format. ........ r52994 | neal.norwitz | 2006-12-11 02:01:06 +0100 (Mon, 11 Dec 2006) | 1 line Fix a typo ........ r52996 | georg.brandl | 2006-12-11 08:56:33 +0100 (Mon, 11 Dec 2006) | 2 lines Move errno imports back to individual functions. ........ r52998 | vinay.sajip | 2006-12-11 15:07:16 +0100 (Mon, 11 Dec 2006) | 1 line Patch by Jeremy Katz (SF #1609407) ........ r53000 | vinay.sajip | 2006-12-11 15:26:23 +0100 (Mon, 11 Dec 2006) | 1 line Patch by "cuppatea" (SF #1503765) ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bsddb.c6
-rw-r--r--Modules/_ctypes/_ctypes.c15
-rw-r--r--Modules/_ctypes/_ctypes_test.c10
-rw-r--r--Modules/_ctypes/callbacks.c9
-rw-r--r--Modules/_ctypes/callproc.c39
-rw-r--r--Modules/_ctypes/cfield.c8
-rw-r--r--Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c2
-rw-r--r--Modules/_ctypes/libffi/src/x86/sysv.S4
-rw-r--r--Modules/_ctypes/libffi_msvc/ffi.c143
-rw-r--r--Modules/_ctypes/libffi_msvc/ffi.h10
-rw-r--r--Modules/_ctypes/libffi_msvc/ffitarget.h6
-rw-r--r--Modules/_ctypes/libffi_msvc/win64.asm156
-rw-r--r--Modules/_ctypes/stgdict.c20
-rw-r--r--Modules/_cursesmodule.c4
-rw-r--r--Modules/_sre.c23
-rw-r--r--Modules/_ssl.c2
-rw-r--r--Modules/_testcapimodule.c132
-rw-r--r--Modules/almodule.c2
-rw-r--r--Modules/arraymodule.c2
-rw-r--r--Modules/audioop.c11
-rw-r--r--Modules/binascii.c3
-rw-r--r--Modules/bz2module.c4
-rw-r--r--Modules/cPickle.c12
-rw-r--r--Modules/cStringIO.c18
-rw-r--r--Modules/cjkcodecs/_codecs_cn.c35
-rw-r--r--Modules/cjkcodecs/_codecs_iso2022.c51
-rw-r--r--Modules/cjkcodecs/cjkcodecs.h17
-rw-r--r--Modules/datetimemodule.c4
-rw-r--r--Modules/dbmmodule.c8
-rw-r--r--Modules/gcmodule.c1
-rw-r--r--Modules/itertoolsmodule.c10
-rw-r--r--Modules/linuxaudiodev.c2
-rw-r--r--Modules/main.c17
-rw-r--r--Modules/mathmodule.c118
-rw-r--r--Modules/mmapmodule.c2
-rw-r--r--Modules/ossaudiodev.c2
-rw-r--r--Modules/parsermodule.c45
-rw-r--r--Modules/posixmodule.c159
-rw-r--r--Modules/readline.c8
-rw-r--r--Modules/resource.c4
-rw-r--r--Modules/socketmodule.c97
-rw-r--r--Modules/socketmodule.h1
-rw-r--r--Modules/threadmodule.c1
-rw-r--r--Modules/unicodedata.c2
44 files changed, 930 insertions, 295 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index ad45936..79f06dc 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -98,7 +98,7 @@
#error "eek! DBVER can't handle minor versions > 9"
#endif
-#define PY_BSDDB_VERSION "4.4.5"
+#define PY_BSDDB_VERSION "4.4.6"
static char *rcs_id = "$Id$";
@@ -1779,9 +1779,7 @@ DB_get_type(DBObject* self, PyObject* args)
return NULL;
CHECK_DB_NOT_CLOSED(self);
- MYDB_BEGIN_ALLOW_THREADS;
type = _DB_get_type(self);
- MYDB_END_ALLOW_THREADS;
if (type == -1)
return NULL;
return PyInt_FromLong(type);
@@ -2430,7 +2428,7 @@ DB_stat(DBObject* self, PyObject* args, PyObject* kwargs)
#if (DBVER >= 43)
PyObject* txnobj = NULL;
DB_TXN *txn = NULL;
- static char* kwnames[] = { "txn", "flags", NULL };
+ static char* kwnames[] = { "flags", "txn", NULL };
#else
static char* kwnames[] = { "flags", NULL };
#endif
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 7948516..dc7feeb 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2589,16 +2589,22 @@ static PPROC FindAddress(void *handle, char *name, PyObject *type)
PPROC address;
char *mangled_name;
int i;
- StgDictObject *dict = PyType_stgdict((PyObject *)type);
+ StgDictObject *dict;
address = (PPROC)GetProcAddress(handle, name);
+#ifdef _WIN64
+ /* win64 has no stdcall calling conv, so it should
+ also not have the name mangling of it.
+ */
+ return address;
+#else
if (address)
return address;
-
if (((size_t)name & ~0xFFFF) == 0) {
return NULL;
}
+ dict = PyType_stgdict((PyObject *)type);
/* It should not happen that dict is NULL, but better be safe */
if (dict==NULL || dict->flags & FUNCFLAG_CDECL)
return address;
@@ -2617,6 +2623,7 @@ static PPROC FindAddress(void *handle, char *name, PyObject *type)
return address;
}
return NULL;
+#endif
}
#endif
@@ -4588,11 +4595,11 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
if (obj->b_objects == NULL)
goto failed;
}
+ Py_XINCREF(obj->b_objects);
result->b_objects = obj->b_objects;
- if (result->b_objects) {
+ if (result->b_objects && PyDict_Check(result->b_objects)) {
PyObject *index;
int rc;
- Py_INCREF(obj->b_objects);
index = PyLong_FromVoidPtr((void *)src);
if (index == NULL)
goto failed;
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index 7331d01..d13fec4 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -25,6 +25,16 @@
/* some functions handy for testing */
+EXPORT(int)myprintf(char *fmt, ...)
+{
+ int result;
+ va_list argptr;
+ va_start(argptr, fmt);
+ result = vprintf(fmt, argptr);
+ va_end(argptr);
+ return result;
+}
+
EXPORT(char *)my_strtok(char *token, const char *delim)
{
return strtok(token, delim);
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index d5ab43b..89b44aa 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -294,14 +294,17 @@ ffi_info *AllocFunctionCallback(PyObject *callable,
p->restype = &ffi_type_void;
} else {
StgDictObject *dict = PyType_stgdict(restype);
- if (dict == NULL)
- goto error;
+ if (dict == NULL || dict->setfunc == NULL) {
+ PyErr_SetString(PyExc_TypeError,
+ "invalid result type for callback function");
+ goto error;
+ }
p->setfunc = dict->setfunc;
p->restype = &dict->ffi_type_pointer;
}
cc = FFI_DEFAULT_ABI;
-#if defined(MS_WIN32) && !defined(_WIN32_WCE)
+#if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64)
if (is_cdecl == 0)
cc = FFI_STDCALL;
#endif
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index e0765e9..18e1991 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -638,7 +638,7 @@ static int _call_function_pointer(int flags,
}
cc = FFI_DEFAULT_ABI;
-#if defined(MS_WIN32) && !defined(_WIN32_WCE)
+#if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(_WIN32_WCE)
if ((flags & FUNCFLAG_CDECL) == 0)
cc = FFI_STDCALL;
#endif
@@ -683,6 +683,14 @@ static int _call_function_pointer(int flags,
return -1;
}
#endif
+#ifdef MS_WIN64
+ if (delta != 0) {
+ PyErr_Format(PyExc_RuntimeError,
+ "ffi_call failed with code %d",
+ delta);
+ return -1;
+ }
+#else
if (delta < 0) {
if (flags & FUNCFLAG_CDECL)
PyErr_Format(PyExc_ValueError,
@@ -704,6 +712,7 @@ static int _call_function_pointer(int flags,
return -1;
}
#endif
+#endif
if ((flags & FUNCFLAG_PYTHONAPI) && PyErr_Occurred())
return -1;
return 0;
@@ -979,7 +988,11 @@ PyObject *_CallProc(PPROC pProc,
}
for (i = 0; i < argcount; ++i) {
atypes[i] = args[i].ffi_type;
- if (atypes[i]->type == FFI_TYPE_STRUCT)
+ if (atypes[i]->type == FFI_TYPE_STRUCT
+#ifdef _WIN64
+ && atypes[i]->size <= sizeof(void *)
+#endif
+ )
avalues[i] = (void *)args[i].value.p;
else
avalues[i] = (void *)&args[i].value;
@@ -1099,7 +1112,11 @@ static PyObject *load_library(PyObject *self, PyObject *args)
hMod = LoadLibrary(name);
if (!hMod)
return PyErr_SetFromWindowsErr(GetLastError());
+#ifdef _WIN64
+ return PyLong_FromVoidPtr(hMod);
+#else
return Py_BuildValue("i", hMod);
+#endif
}
static char free_library_doc[] =
@@ -1230,11 +1247,11 @@ static PyObject *py_dl_open(PyObject *self, PyObject *args)
static PyObject *py_dl_close(PyObject *self, PyObject *args)
{
- void * handle;
+ int handle;
if (!PyArg_ParseTuple(args, "i:dlclose", &handle))
return NULL;
- if (dlclose(handle)) {
+ if (dlclose((void*)handle)) {
PyErr_SetString(PyExc_OSError,
ctypes_dlerror());
return NULL;
@@ -1246,12 +1263,12 @@ static PyObject *py_dl_close(PyObject *self, PyObject *args)
static PyObject *py_dl_sym(PyObject *self, PyObject *args)
{
char *name;
- void *handle;
+ int handle;
void *ptr;
if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name))
return NULL;
- ptr = ctypes_dlsym(handle, name);
+ ptr = ctypes_dlsym((void*)handle, name);
if (!ptr) {
PyErr_SetString(PyExc_OSError,
ctypes_dlerror());
@@ -1269,7 +1286,7 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args)
static PyObject *
call_function(PyObject *self, PyObject *args)
{
- PPROC func;
+ int func;
PyObject *arguments;
PyObject *result;
@@ -1279,7 +1296,7 @@ call_function(PyObject *self, PyObject *args)
&PyTuple_Type, &arguments))
return NULL;
- result = _CallProc(func,
+ result = _CallProc((PPROC)func,
arguments,
#ifdef MS_WIN32
NULL,
@@ -1300,7 +1317,7 @@ call_function(PyObject *self, PyObject *args)
static PyObject *
call_cdeclfunction(PyObject *self, PyObject *args)
{
- PPROC func;
+ int func;
PyObject *arguments;
PyObject *result;
@@ -1310,7 +1327,7 @@ call_cdeclfunction(PyObject *self, PyObject *args)
&PyTuple_Type, &arguments))
return NULL;
- result = _CallProc(func,
+ result = _CallProc((PPROC)func,
arguments,
#ifdef MS_WIN32
NULL,
@@ -1493,7 +1510,7 @@ resize(PyObject *self, PyObject *args)
#else
"On:resize",
#endif
- (PyObject *)&obj, &size))
+ &obj, &size))
return NULL;
dict = PyObject_stgdict((PyObject *)obj);
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index c16a387..ad83195 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1315,7 +1315,11 @@ z_set(void *ptr, PyObject *value, unsigned size)
*(char **)ptr = PyString_AS_STRING(str);
return str;
} else if (PyInt_Check(value) || PyLong_Check(value)) {
+#if SIZEOF_VOID_P == SIZEOF_LONG_LONG
+ *(char **)ptr = (char *)PyInt_AsUnsignedLongLongMask(value);
+#else
*(char **)ptr = (char *)PyInt_AsUnsignedLongMask(value);
+#endif
_RET(value);
}
PyErr_Format(PyExc_TypeError,
@@ -1360,7 +1364,11 @@ Z_set(void *ptr, PyObject *value, unsigned size)
if (!value)
return NULL;
} else if (PyInt_Check(value) || PyLong_Check(value)) {
+#if SIZEOF_VOID_P == SIZEOF_LONG_LONG
+ *(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongLongMask(value);
+#else
*(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongMask(value);
+#endif
Py_INCREF(Py_None);
return Py_None;
} else if (!PyUnicode_Check(value)) {
diff --git a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
index 1595b00..55af70c 100644
--- a/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
+++ b/Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c
@@ -1,4 +1,4 @@
-#ifdef __ppc__
+#if !(defined(__APPLE__) && !defined(__ppc__))
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998 Geoffrey Keating
diff --git a/Modules/_ctypes/libffi/src/x86/sysv.S b/Modules/_ctypes/libffi/src/x86/sysv.S
index 46759f4..9542fba 100644
--- a/Modules/_ctypes/libffi/src/x86/sysv.S
+++ b/Modules/_ctypes/libffi/src/x86/sysv.S
@@ -376,3 +376,7 @@ ffi_closure_raw_SYSV:
#endif
#endif /* ifndef __x86_64__ */
+
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/Modules/_ctypes/libffi_msvc/ffi.c b/Modules/_ctypes/libffi_msvc/ffi.c
index 9af6b71..3f23a05 100644
--- a/Modules/_ctypes/libffi_msvc/ffi.c
+++ b/Modules/_ctypes/libffi_msvc/ffi.c
@@ -34,6 +34,8 @@
/* ffi_prep_args is called by the assembly routine once stack space
has been allocated for the function's arguments */
+extern void Py_FatalError(char *msg);
+
/*@-exportheader@*/
void ffi_prep_args(char *stack, extended_cif *ecif)
/*@=exportheader@*/
@@ -44,11 +46,10 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
register ffi_type **p_arg;
argp = stack;
-
if (ecif->cif->rtype->type == FFI_TYPE_STRUCT)
{
*(void **) argp = ecif->rvalue;
- argp += 4;
+ argp += sizeof(void *);
}
p_argv = ecif->avalue;
@@ -60,8 +61,8 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
size_t z;
/* Align if necessary */
- if ((sizeof(int) - 1) & (unsigned) argp)
- argp = (char *) ALIGN(argp, sizeof(int));
+ if ((sizeof(void *) - 1) & (size_t) argp)
+ argp = (char *) ALIGN(argp, sizeof(void *));
z = (*p_arg)->size;
if (z < sizeof(int))
@@ -108,7 +109,11 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
p_argv++;
argp += z;
}
-
+
+ if (argp - stack > ecif->cif->bytes)
+ {
+ Py_FatalError("FFI BUG: not enough stack space for arguments");
+ }
return;
}
@@ -128,6 +133,9 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
break;
case FFI_TYPE_UINT64:
+#ifdef _WIN64
+ case FFI_TYPE_POINTER:
+#endif
cif->flags = FFI_TYPE_SINT64;
break;
@@ -139,6 +147,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
return FFI_OK;
}
+#ifdef _WIN32
/*@-declundef@*/
/*@-exportheader@*/
extern int
@@ -160,6 +169,16 @@ ffi_call_STDCALL(void (*)(char *, extended_cif *),
void (*fn)());
/*@=declundef@*/
/*@=exportheader@*/
+#endif
+
+#ifdef _WIN64
+extern int
+ffi_call_AMD64(void (*)(char *, extended_cif *),
+ /*@out@*/ extended_cif *,
+ unsigned, unsigned,
+ /*@out@*/ unsigned *,
+ void (*fn)());
+#endif
int
ffi_call(/*@dependent@*/ ffi_cif *cif,
@@ -188,6 +207,7 @@ ffi_call(/*@dependent@*/ ffi_cif *cif,
switch (cif->abi)
{
+#if !defined(_WIN64)
case FFI_SYSV:
/*@-usedef@*/
return ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes,
@@ -201,6 +221,14 @@ ffi_call(/*@dependent@*/ ffi_cif *cif,
cif->flags, ecif.rvalue, fn);
/*@=usedef@*/
break;
+#else
+ case FFI_SYSV:
+ /*@-usedef@*/
+ return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes,
+ cif->flags, ecif.rvalue, fn);
+ /*@=usedef@*/
+ break;
+#endif
default:
FFI_ASSERT(0);
@@ -213,10 +241,14 @@ ffi_call(/*@dependent@*/ ffi_cif *cif,
/** private members **/
static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
- void** args, ffi_cif* cif);
+ void** args, ffi_cif* cif);
/* This function is jumped to by the trampoline */
+#ifdef _WIN64
+void *
+#else
static void __fastcall
+#endif
ffi_closure_SYSV (ffi_closure *closure, int *argp)
{
// this is our return value storage
@@ -244,6 +276,7 @@ ffi_closure_SYSV (ffi_closure *closure, int *argp)
rtype = cif->flags;
+#if defined(_WIN32) && !defined(_WIN64)
#ifdef _MSC_VER
/* now, do a generic return based on the value of rtype */
if (rtype == FFI_TYPE_INT)
@@ -303,6 +336,15 @@ ffi_closure_SYSV (ffi_closure *closure, int *argp)
: "eax", "edx");
}
#endif
+#endif
+
+#ifdef _WIN64
+ /* The result is returned in rax. This does the right thing for
+ result types except for floats; we have to 'mov xmm0, rax' in the
+ caller to correct this.
+ */
+ return *(void **)resp;
+#endif
}
/*@-exportheader@*/
@@ -330,8 +372,8 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
size_t z;
/* Align if necessary */
- if ((sizeof(int) - 1) & (unsigned) argp) {
- argp = (char *) ALIGN(argp, sizeof(int));
+ if ((sizeof(char *) - 1) & (size_t) argp) {
+ argp = (char *) ALIGN(argp, sizeof(char*));
}
z = (*p_arg)->size;
@@ -347,24 +389,8 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
return;
}
-/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */
-
-#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,BYTES) \
-{ unsigned char *__tramp = (unsigned char*)(TRAMP); \
- unsigned int __fun = (unsigned int)(FUN); \
- unsigned int __ctx = (unsigned int)(CTX); \
- unsigned int __dis = __fun - ((unsigned int) __tramp + 8 + 4); \
- *(unsigned char*) &__tramp[0] = 0xb9; \
- *(unsigned int*) &__tramp[1] = __ctx; /* mov ecx, __ctx */ \
- *(unsigned char*) &__tramp[5] = 0x8b; \
- *(unsigned char*) &__tramp[6] = 0xd4; /* mov edx, esp */ \
- *(unsigned char*) &__tramp[7] = 0xe8; \
- *(unsigned int*) &__tramp[8] = __dis; /* call __fun */ \
- *(unsigned char*) &__tramp[12] = 0xC2; /* ret BYTES */ \
- *(unsigned short*) &__tramp[13] = BYTES; \
- }
-
/* the cif must already be prep'ed */
+extern void ffi_closure_OUTER();
ffi_status
ffi_prep_closure (ffi_closure* closure,
@@ -373,19 +399,78 @@ ffi_prep_closure (ffi_closure* closure,
void *user_data)
{
short bytes;
+ char *tramp;
+#ifdef _WIN64
+ int mask;
+#endif
FFI_ASSERT (cif->abi == FFI_SYSV);
if (cif->abi == FFI_SYSV)
bytes = 0;
+#if !defined(_WIN64)
else if (cif->abi == FFI_STDCALL)
bytes = cif->bytes;
+#endif
else
return FFI_BAD_ABI;
- FFI_INIT_TRAMPOLINE (&closure->tramp[0],
- &ffi_closure_SYSV,
- (void*)closure,
- bytes);
+ tramp = &closure->tramp[0];
+
+#define BYTES(text) memcpy(tramp, text, sizeof(text)), tramp += sizeof(text)-1
+#define POINTER(x) *(void**)tramp = (void*)(x), tramp += sizeof(void*)
+#define SHORT(x) *(short*)tramp = x, tramp += sizeof(short)
+#define INT(x) *(int*)tramp = x, tramp += sizeof(int)
+
+#ifdef _WIN64
+ if (cif->nargs >= 1 &&
+ (cif->arg_types[0]->type == FFI_TYPE_FLOAT
+ || cif->arg_types[0]->type == FFI_TYPE_DOUBLE))
+ mask |= 1;
+ if (cif->nargs >= 2 &&
+ (cif->arg_types[1]->type == FFI_TYPE_FLOAT
+ || cif->arg_types[1]->type == FFI_TYPE_DOUBLE))
+ mask |= 2;
+ if (cif->nargs >= 3 &&
+ (cif->arg_types[2]->type == FFI_TYPE_FLOAT
+ || cif->arg_types[2]->type == FFI_TYPE_DOUBLE))
+ mask |= 4;
+ if (cif->nargs >= 4 &&
+ (cif->arg_types[3]->type == FFI_TYPE_FLOAT
+ || cif->arg_types[3]->type == FFI_TYPE_DOUBLE))
+ mask |= 8;
+
+ /* 41 BB ---- mov r11d,mask */
+ BYTES("\x41\xBB"); INT(mask);
+
+ /* 48 B8 -------- mov rax, closure */
+ BYTES("\x48\xB8"); POINTER(closure);
+
+ /* 49 BA -------- mov r10, ffi_closure_OUTER */
+ BYTES("\x49\xBA"); POINTER(ffi_closure_OUTER);
+
+ /* 41 FF E2 jmp r10 */
+ BYTES("\x41\xFF\xE2");
+
+#else
+
+ /* mov ecx, closure */
+ BYTES("\xb9"); POINTER(closure);
+
+ /* mov edx, esp */
+ BYTES("\x8b\xd4");
+
+ /* call ffi_closure_SYSV */
+ BYTES("\xe8"); POINTER((char*)&ffi_closure_SYSV - (tramp + 4));
+
+ /* ret bytes */
+ BYTES("\xc2");
+ SHORT(bytes);
+
+#endif
+
+ if (tramp - &closure->tramp[0] > FFI_TRAMPOLINE_SIZE)
+ Py_FatalError("FFI_TRAMPOLINE_SIZE too small in " __FILE__);
+
closure->cif = cif;
closure->user_data = user_data;
closure->fun = fun;
diff --git a/Modules/_ctypes/libffi_msvc/ffi.h b/Modules/_ctypes/libffi_msvc/ffi.h
index 203142d..a88d874 100644
--- a/Modules/_ctypes/libffi_msvc/ffi.h
+++ b/Modules/_ctypes/libffi_msvc/ffi.h
@@ -174,12 +174,10 @@ typedef struct {
/* ---- Definitions for the raw API -------------------------------------- */
-#ifndef FFI_SIZEOF_ARG
-# if LONG_MAX == 2147483647
-# define FFI_SIZEOF_ARG 4
-# elif LONG_MAX == 9223372036854775807
-# define FFI_SIZEOF_ARG 8
-# endif
+#ifdef _WIN64
+#define FFI_SIZEOF_ARG 8
+#else
+#define FFI_SIZEOF_ARG 4
#endif
typedef union {
diff --git a/Modules/_ctypes/libffi_msvc/ffitarget.h b/Modules/_ctypes/libffi_msvc/ffitarget.h
index 78c0c37..0da79d4 100644
--- a/Modules/_ctypes/libffi_msvc/ffitarget.h
+++ b/Modules/_ctypes/libffi_msvc/ffitarget.h
@@ -44,7 +44,9 @@ typedef enum ffi_abi {
/* ---- Intel x86 Win32 ---------- */
FFI_SYSV,
+#ifndef _WIN64
FFI_STDCALL,
+#endif
/* TODO: Add fastcall support for the sake of completeness */
FFI_DEFAULT_ABI = FFI_SYSV,
@@ -67,8 +69,8 @@ typedef enum ffi_abi {
#define FFI_CLOSURES 1
-#ifdef X86_64
-#define FFI_TRAMPOLINE_SIZE 24
+#ifdef _WIN64
+#define FFI_TRAMPOLINE_SIZE 29
#define FFI_NATIVE_RAW_API 0
#else
#define FFI_TRAMPOLINE_SIZE 15
diff --git a/Modules/_ctypes/libffi_msvc/win64.asm b/Modules/_ctypes/libffi_msvc/win64.asm
new file mode 100644
index 0000000..301188b
--- /dev/null
+++ b/Modules/_ctypes/libffi_msvc/win64.asm
@@ -0,0 +1,156 @@
+PUBLIC ffi_call_AMD64
+
+EXTRN __chkstk:NEAR
+EXTRN ffi_closure_SYSV:NEAR
+
+_TEXT SEGMENT
+
+;;; ffi_closure_OUTER will be called with these registers set:
+;;; rax points to 'closure'
+;;; r11 contains a bit mask that specifies which of the
+;;; first four parameters are float or double
+;;;
+;;; It must move the parameters passed in registers to their stack location,
+;;; call ffi_closure_SYSV for the actual work, then return the result.
+;;;
+ffi_closure_OUTER PROC FRAME
+ ;; save actual arguments to their stack space.
+ test r11, 1
+ jne first_is_float
+ mov QWORD PTR [rsp+8], rcx
+ jmp second
+first_is_float:
+ movlpd QWORD PTR [rsp+8], xmm0
+
+second:
+ test r11, 2
+ jne second_is_float
+ mov QWORD PTR [rsp+16], rdx
+ jmp third
+second_is_float:
+ movlpd QWORD PTR [rsp+16], xmm1
+
+third:
+ test r11, 4
+ jne third_is_float
+ mov QWORD PTR [rsp+24], r8
+ jmp forth
+third_is_float:
+ movlpd QWORD PTR [rsp+24], xmm2
+
+forth:
+ test r11, 8
+ jne forth_is_float
+ mov QWORD PTR [rsp+32], r9
+ jmp done
+forth_is_float:
+ movlpd QWORD PTR [rsp+32], xmm3
+
+done:
+.ALLOCSTACK 40
+ sub rsp, 40
+.ENDPROLOG
+ mov rcx, rax ; context is first parameter
+ mov rdx, rsp ; stack is second parameter
+ add rdx, 40 ; correct our own area
+ mov rax, ffi_closure_SYSV
+ call rax ; call the real closure function
+ ;; Here, code is missing that handles float return values
+ add rsp, 40
+ movd xmm0, rax ; In case the closure returned a float.
+ ret 0
+ffi_closure_OUTER ENDP
+
+
+;;; ffi_call_AMD64
+
+stack$ = 0
+prepfunc$ = 32
+ecif$ = 40
+bytes$ = 48
+flags$ = 56
+rvalue$ = 64
+fn$ = 72
+
+ffi_call_AMD64 PROC FRAME
+
+ mov QWORD PTR [rsp+32], r9
+ mov QWORD PTR [rsp+24], r8
+ mov QWORD PTR [rsp+16], rdx
+ mov QWORD PTR [rsp+8], rcx
+.PUSHREG rbp
+ push rbp
+.ALLOCSTACK 48
+ sub rsp, 48 ; 00000030H
+.SETFRAME rbp, 32
+ lea rbp, QWORD PTR [rsp+32]
+.ENDPROLOG
+
+ mov eax, DWORD PTR bytes$[rbp]
+ add rax, 15
+ and rax, -16
+ call __chkstk
+ sub rsp, rax
+ lea rax, QWORD PTR [rsp+32]
+ mov QWORD PTR stack$[rbp], rax
+
+ mov rdx, QWORD PTR ecif$[rbp]
+ mov rcx, QWORD PTR stack$[rbp]
+ call QWORD PTR prepfunc$[rbp]
+
+ mov rsp, QWORD PTR stack$[rbp]
+
+ movlpd xmm3, QWORD PTR [rsp+24]
+ movd r9, xmm3
+
+ movlpd xmm2, QWORD PTR [rsp+16]
+ movd r8, xmm2
+
+ movlpd xmm1, QWORD PTR [rsp+8]
+ movd rdx, xmm1
+
+ movlpd xmm0, QWORD PTR [rsp]
+ movd rcx, xmm0
+
+ call QWORD PTR fn$[rbp]
+ret_int$:
+ cmp DWORD PTR flags$[rbp], 1 ; FFI_TYPE_INT
+ jne ret_float$
+
+ mov rcx, QWORD PTR rvalue$[rbp]
+ mov DWORD PTR [rcx], eax
+ jmp SHORT ret_nothing$
+
+ret_float$:
+ cmp DWORD PTR flags$[rbp], 2 ; FFI_TYPE_FLOAT
+ jne SHORT ret_double$
+
+ mov rax, QWORD PTR rvalue$[rbp]
+ movlpd QWORD PTR [rax], xmm0
+ jmp SHORT ret_nothing$
+
+ret_double$:
+ cmp DWORD PTR flags$[rbp], 3 ; FFI_TYPE_DOUBLE
+ jne SHORT ret_int64$
+
+ mov rax, QWORD PTR rvalue$[rbp]
+ movlpd QWORD PTR [rax], xmm0
+ jmp SHORT ret_nothing$
+
+ret_int64$:
+ cmp DWORD PTR flags$[rbp], 12 ; FFI_TYPE_SINT64
+ jne ret_nothing$
+
+ mov rcx, QWORD PTR rvalue$[rbp]
+ mov QWORD PTR [rcx], rax
+ jmp SHORT ret_nothing$
+
+ret_nothing$:
+ xor eax, eax
+
+ lea rsp, QWORD PTR [rbp+16]
+ pop rbp
+ ret 0
+ffi_call_AMD64 ENDP
+_TEXT ENDS
+END
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 0942b48..c34ae01 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -173,11 +173,11 @@ MakeFields(PyObject *type, CFieldObject *descr,
for (i = 0; i < PySequence_Fast_GET_SIZE(fieldlist); ++i) {
PyObject *pair = PySequence_Fast_GET_ITEM(fieldlist, i); /* borrowed */
- PyObject *fname, *ftype;
+ PyObject *fname, *ftype, *bits;
CFieldObject *fdescr;
CFieldObject *new_descr;
/* Convert to PyArg_UnpackTuple... */
- if (!PyArg_ParseTuple(pair, "OO", &fname, &ftype)) {
+ if (!PyArg_ParseTuple(pair, "OO|O", &fname, &ftype, &bits)) {
Py_DECREF(fieldlist);
return -1;
}
@@ -335,14 +335,14 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct)
stgdict = PyType_stgdict(type);
if (!stgdict)
return -1;
+ /* If this structure/union is already marked final we cannot assign
+ _fields_ anymore. */
+
if (stgdict->flags & DICTFLAG_FINAL) {/* is final ? */
PyErr_SetString(PyExc_AttributeError,
"_fields_ is final");
return -1;
}
- /* XXX This should probably be moved to a point when all this
- stuff is sucessfully finished. */
- stgdict->flags |= DICTFLAG_FINAL; /* set final */
if (stgdict->ffi_type_pointer.elements)
PyMem_Free(stgdict->ffi_type_pointer.elements);
@@ -476,5 +476,15 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct)
stgdict->size = size;
stgdict->align = total_align;
stgdict->length = len; /* ADD ffi_ofs? */
+
+ /* We did check that this flag was NOT set above, it must not
+ have been set until now. */
+ if (stgdict->flags & DICTFLAG_FINAL) {
+ PyErr_SetString(PyExc_AttributeError,
+ "Structure or union cannot contain itself");
+ return -1;
+ }
+ stgdict->flags |= DICTFLAG_FINAL;
+
return MakeAnonFields(type);
}
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 2921d53..aeb1ef5 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2334,6 +2334,10 @@ PyCurses_tparm(PyObject *self, PyObject *args)
}
result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9);
+ if (!result) {
+ PyErr_SetString(PyCursesError, "tparm() returned NULL");
+ return NULL;
+ }
return PyString_FromString(result);
}
diff --git a/Modules/_sre.c b/Modules/_sre.c
index d30a350..a24f286 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -1166,9 +1166,10 @@ entrance:
/* install new repeat context */
ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));
- /* XXX(nnorwitz): anything else we need to do on error? */
- if (!ctx->u.rep)
+ if (!ctx->u.rep) {
+ PyErr_NoMemory();
RETURN_FAILURE;
+ }
ctx->u.rep->count = -1;
ctx->u.rep->pattern = ctx->pattern;
ctx->u.rep->prev = state->repeat;
@@ -1884,6 +1885,8 @@ pattern_match(PatternObject* self, PyObject* args, PyObject* kw)
}
TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr));
+ if (PyErr_Occurred())
+ return NULL;
state_fini(&state);
@@ -1922,6 +1925,9 @@ pattern_search(PatternObject* self, PyObject* args, PyObject* kw)
state_fini(&state);
+ if (PyErr_Occurred())
+ return NULL;
+
return pattern_new_match(self, &state, status);
}
@@ -2071,6 +2077,9 @@ pattern_findall(PatternObject* self, PyObject* args, PyObject* kw)
#endif
}
+ if (PyErr_Occurred())
+ goto error;
+
if (status <= 0) {
if (status == 0)
break;
@@ -2198,6 +2207,9 @@ pattern_split(PatternObject* self, PyObject* args, PyObject* kw)
#endif
}
+ if (PyErr_Occurred())
+ goto error;
+
if (status <= 0) {
if (status == 0)
break;
@@ -2347,6 +2359,9 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
#endif
}
+ if (PyErr_Occurred())
+ goto error;
+
if (status <= 0) {
if (status == 0)
break;
@@ -3250,6 +3265,8 @@ scanner_match(ScannerObject* self, PyObject *unused)
status = sre_umatch(state, PatternObject_GetCode(self->pattern));
#endif
}
+ if (PyErr_Occurred())
+ return NULL;
match = pattern_new_match((PatternObject*) self->pattern,
state, status);
@@ -3281,6 +3298,8 @@ scanner_search(ScannerObject* self, PyObject *unused)
status = sre_usearch(state, PatternObject_GetCode(self->pattern));
#endif
}
+ if (PyErr_Occurred())
+ return NULL;
match = pattern_new_match((PatternObject*) self->pattern,
state, status);
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 3b91b24..f1e1092 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -317,7 +317,7 @@ PySocket_ssl(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!|zz:ssl",
PySocketModule.Sock_Type,
- (PyObject*)&Sock,
+ &Sock,
&key_file, &cert_file))
return NULL;
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index f5f3ab2..b11f0ae 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -6,6 +6,8 @@
*/
#include "Python.h"
+#include <float.h>
+#include "structmember.h"
#ifdef WITH_THREAD
#include "pythread.h"
@@ -35,13 +37,13 @@ raiseTestError(const char* test_name, const char* msg)
platforms have these hardcoded. Better safe than sorry.
*/
static PyObject*
-sizeof_error(const char* fatname, const char* typename,
+sizeof_error(const char* fatname, const char* typname,
int expected, int got)
{
char buf[1024];
PyOS_snprintf(buf, sizeof(buf),
"%.200s #define == %d but sizeof(%.200s) == %d",
- fatname, expected, typename, got);
+ fatname, expected, typname, got);
PyErr_SetString(TestError, buf);
return (PyObject*)NULL;
}
@@ -615,7 +617,7 @@ _make_call(void *callable)
{
PyObject *rc;
PyGILState_STATE s = PyGILState_Ensure();
- rc = PyObject_CallFunction(callable, "");
+ rc = PyObject_CallFunction((PyObject *)callable, "");
Py_XDECREF(rc);
PyGILState_Release(s);
}
@@ -665,6 +667,9 @@ test_thread_state(PyObject *self, PyObject *args)
PyThread_acquire_lock(thread_done, 1); /* wait for thread to finish */
Py_END_ALLOW_THREADS
+ /* Release lock we acquired above. This is required on HP-UX. */
+ PyThread_release_lock(thread_done);
+
PyThread_free_lock(thread_done);
Py_RETURN_NONE;
}
@@ -756,6 +761,105 @@ static PyMethodDef TestMethods[] = {
#define AddSym(d, n, f, v) {PyObject *o = f(v); PyDict_SetItemString(d, n, o); Py_DECREF(o);}
+typedef struct {
+ char byte_member;
+ unsigned char ubyte_member;
+ short short_member;
+ unsigned short ushort_member;
+ int int_member;
+ unsigned int uint_member;
+ long long_member;
+ unsigned long ulong_member;
+ float float_member;
+ double double_member;
+} all_structmembers;
+
+typedef struct {
+ PyObject_HEAD
+ all_structmembers structmembers;
+} test_structmembers;
+
+static struct PyMemberDef test_members[] = {
+ {"T_BYTE", T_BYTE, offsetof(test_structmembers, structmembers.byte_member), 0, NULL},
+ {"T_UBYTE", T_UBYTE, offsetof(test_structmembers, structmembers.ubyte_member), 0, NULL},
+ {"T_SHORT", T_SHORT, offsetof(test_structmembers, structmembers.short_member), 0, NULL},
+ {"T_USHORT", T_USHORT, offsetof(test_structmembers, structmembers.ushort_member), 0, NULL},
+ {"T_INT", T_INT, offsetof(test_structmembers, structmembers.int_member), 0, NULL},
+ {"T_UINT", T_UINT, offsetof(test_structmembers, structmembers.uint_member), 0, NULL},
+ {"T_LONG", T_LONG, offsetof(test_structmembers, structmembers.long_member), 0, NULL},
+ {"T_ULONG", T_ULONG, offsetof(test_structmembers, structmembers.ulong_member), 0, NULL},
+ {"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL},
+ {"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL},
+ {NULL}
+};
+
+
+static PyObject *test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs){
+ static char *keywords[]={"T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT", "T_INT", "T_UINT",
+ "T_LONG", "T_ULONG", "T_FLOAT", "T_DOUBLE", NULL};
+ test_structmembers *ob=PyObject_New(test_structmembers, type);
+ if (ob==NULL)
+ return NULL;
+ memset(&ob->structmembers, 0, sizeof(all_structmembers));
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|bBhHiIlkfd", keywords,
+ &ob->structmembers.byte_member, &ob->structmembers.ubyte_member,
+ &ob->structmembers.short_member, &ob->structmembers.ushort_member,
+ &ob->structmembers.int_member, &ob->structmembers.uint_member,
+ &ob->structmembers.long_member, &ob->structmembers.ulong_member,
+ &ob->structmembers.float_member, &ob->structmembers.double_member)){
+ Py_DECREF(ob);
+ return NULL;
+ }
+ return (PyObject *)ob;
+}
+
+static void test_structmembers_free(PyObject *ob){
+ PyObject_FREE(ob);
+}
+
+static PyTypeObject test_structmembersType = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "test_structmembersType",
+ sizeof(test_structmembers), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ test_structmembers_free, /* destructor tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ PyObject_GenericGetAttr,
+ PyObject_GenericSetAttr,
+ 0, /* tp_as_buffer */
+ 0, /* tp_flags */
+ "Type containing all structmember types",
+ 0, /* traverseproc tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ test_members, /* tp_members */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ test_structmembers_new, /* tp_new */
+};
+
+
PyMODINIT_FUNC
init_testcapi(void)
{
@@ -765,16 +869,28 @@ init_testcapi(void)
if (m == NULL)
return;
+ test_structmembersType.ob_type=&PyType_Type;
+ Py_INCREF(&test_structmembersType);
+ PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType);
+
+ PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX));
+ PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN));
PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX));
+ PyModule_AddObject(m, "SHRT_MAX", PyInt_FromLong(SHRT_MAX));
+ PyModule_AddObject(m, "SHRT_MIN", PyInt_FromLong(SHRT_MIN));
PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX));
+ PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX));
+ PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN));
PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX));
- PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX));
- PyModule_AddObject(m, "INT_MIN", PyInt_FromLong(INT_MIN));
- PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN));
- PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN));
- PyModule_AddObject(m, "INT_MAX", PyInt_FromLong(INT_MAX));
PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX));
+ PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN));
+ PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX));
+ PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX));
+ PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN));
+ PyModule_AddObject(m, "DBL_MAX", PyFloat_FromDouble(DBL_MAX));
+ PyModule_AddObject(m, "DBL_MIN", PyFloat_FromDouble(DBL_MIN));
PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX));
+ PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN));
TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
Py_INCREF(TestError);
diff --git a/Modules/almodule.c b/Modules/almodule.c
index fbeb13a..0a45d2e 100644
--- a/Modules/almodule.c
+++ b/Modules/almodule.c
@@ -1686,7 +1686,7 @@ al_GetParamInfo(PyObject *self, PyObject *args)
{
int res, param;
ALparamInfo pinfo;
- PyObject *v, *item;;
+ PyObject *v, *item;
if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, &param))
return NULL;
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 6ce6b07..552f80c 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1495,7 +1495,7 @@ PyMethodDef array_methods[] = {
copy_doc},
{"count", (PyCFunction)array_count, METH_O,
count_doc},
- {"__deepcopy__",(PyCFunction)array_copy, METH_NOARGS,
+ {"__deepcopy__",(PyCFunction)array_copy, METH_O,
copy_doc},
{"extend", (PyCFunction)array_extend, METH_O,
extend_doc},
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 8f5d30c..ce00975 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -472,8 +472,12 @@ audioop_findfit(PyObject *self, PyObject *args)
double aj_m1, aj_lm1;
double sum_ri_2, sum_aij_2, sum_aij_ri, result, best_result, factor;
+ /* Passing a short** for an 's' argument is correct only
+ if the string contents is aligned for interpretation
+ as short[]. Due to the definition of PyStringObject,
+ this is currently (Python 2.6) the case. */
if ( !PyArg_ParseTuple(args, "s#s#:findfit",
- &cp1, &len1, &cp2, &len2) )
+ (char**)&cp1, &len1, (char**)&cp2, &len2) )
return 0;
if ( len1 & 1 || len2 & 1 ) {
PyErr_SetString(AudioopError, "Strings should be even-sized");
@@ -530,7 +534,7 @@ audioop_findfactor(PyObject *self, PyObject *args)
double sum_ri_2, sum_aij_ri, result;
if ( !PyArg_ParseTuple(args, "s#s#:findfactor",
- &cp1, &len1, &cp2, &len2) )
+ (char**)&cp1, &len1, (char**)&cp2, &len2) )
return 0;
if ( len1 & 1 || len2 & 1 ) {
PyErr_SetString(AudioopError, "Strings should be even-sized");
@@ -562,7 +566,8 @@ audioop_findmax(PyObject *self, PyObject *args)
double aj_m1, aj_lm1;
double result, best_result;
- if ( !PyArg_ParseTuple(args, "s#i:findmax", &cp1, &len1, &len2) )
+ if ( !PyArg_ParseTuple(args, "s#i:findmax",
+ (char**)&cp1, &len1, &len2) )
return 0;
if ( len1 & 1 ) {
PyErr_SetString(AudioopError, "Strings should be even-sized");
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 3b2c8b2..4dee451 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -1057,8 +1057,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs)
in++;
if (in >= datalen) break;
/* Soft line breaks */
- if ((data[in] == '\n') || (data[in] == '\r') ||
- (data[in] == ' ') || (data[in] == '\t')) {
+ if ((data[in] == '\n') || (data[in] == '\r')) {
if (data[in] != '\n') {
while (in < datalen && data[in] != '\n') in++;
}
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 146e2ee..5a4e5d9 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -1016,12 +1016,12 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
case MODE_CLOSED:
PyErr_SetString(PyExc_ValueError,
"I/O operation on closed file");
- goto cleanup;;
+ goto cleanup;
default:
PyErr_SetString(PyExc_IOError,
"seek works only while reading");
- goto cleanup;;
+ goto cleanup;
}
if (where == 2) {
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index fabc3cd..f3178ab 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -1024,7 +1024,7 @@ save_int(Picklerobject *self, PyObject *args)
static int
save_long(Picklerobject *self, PyObject *args)
{
- int size;
+ Py_ssize_t size;
int res = -1;
PyObject *repr = NULL;
@@ -1066,7 +1066,7 @@ save_long(Picklerobject *self, PyObject *args)
* byte at the start, and cut it back later if possible.
*/
nbytes = (nbits >> 3) + 1;
- if ((int)nbytes < 0 || (size_t)(int)nbytes != nbytes) {
+ if (nbytes > INT_MAX) {
PyErr_SetString(PyExc_OverflowError, "long too large "
"to pickle");
goto finally;
@@ -1208,12 +1208,14 @@ save_string(Picklerobject *self, PyObject *args, int doput)
c_str[1] = size;
len = 2;
}
- else {
+ else if (size <= INT_MAX) {
c_str[0] = BINSTRING;
for (i = 1; i < 5; i++)
c_str[i] = (int)(size >> ((i - 1) * 8));
len = 5;
}
+ else
+ return -1; /* string too large */
if (self->write_func(self, c_str, len) < 0)
return -1;
@@ -1286,7 +1288,7 @@ modified_EncodeRawUnicodeEscape(const Py_UNICODE *s, int size)
static int
save_unicode(Picklerobject *self, PyObject *args, int doput)
{
- int size, len;
+ Py_ssize_t size, len;
PyObject *repr=0;
if (!PyUnicode_Check(args))
@@ -1325,6 +1327,8 @@ save_unicode(Picklerobject *self, PyObject *args, int doput)
if ((size = PyString_Size(repr)) < 0)
goto err;
+ if (size > INT_MAX)
+ return -1; /* string too large */
c_str[0] = BINUNICODE;
for (i = 1; i < 5; i++)
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 4debb72..3f762b0 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -289,7 +289,17 @@ IO_truncate(IOobject *self, PyObject *args) {
if (!IO__opencheck(self)) return NULL;
if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) return NULL;
- if (pos < 0) pos = self->pos;
+
+ if (PyTuple_Size(args) == 0) {
+ /* No argument passed, truncate to current position */
+ pos = self->pos;
+ }
+
+ if (pos < 0) {
+ errno = EINVAL;
+ PyErr_SetFromErrno(PyExc_IOError);
+ return NULL;
+ }
if (self->string_size > pos) self->string_size = pos;
self->pos = self->string_size;
@@ -657,11 +667,9 @@ newIobject(PyObject *s) {
char *buf;
Py_ssize_t size;
- if (PyObject_AsReadBuffer(s, (const void **)&buf, &size)) {
- PyErr_Format(PyExc_TypeError, "expected read buffer, %.200s found",
- s->ob_type->tp_name);
+ if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0)
return NULL;
- }
+
self = PyObject_New(Iobject, &Itype);
if (!self) return NULL;
Py_INCREF(s);
diff --git a/Modules/cjkcodecs/_codecs_cn.c b/Modules/cjkcodecs/_codecs_cn.c
index fb51297..c811a67 100644
--- a/Modules/cjkcodecs/_codecs_cn.c
+++ b/Modules/cjkcodecs/_codecs_cn.c
@@ -15,14 +15,26 @@
#undef hz
#endif
-#define GBK_PREDECODE(dc1, dc2, assi) \
+/* GBK and GB2312 map differently in few codepoints that are listed below:
+ *
+ * gb2312 gbk
+ * A1A4 U+30FB KATAKANA MIDDLE DOT U+00B7 MIDDLE DOT
+ * A1AA U+2015 HORIZONTAL BAR U+2014 EM DASH
+ * A844 undefined U+2015 HORIZONTAL BAR
+ */
+
+#define GBK_DECODE(dc1, dc2, assi) \
if ((dc1) == 0xa1 && (dc2) == 0xaa) (assi) = 0x2014; \
else if ((dc1) == 0xa8 && (dc2) == 0x44) (assi) = 0x2015; \
- else if ((dc1) == 0xa1 && (dc2) == 0xa4) (assi) = 0x00b7;
-#define GBK_PREENCODE(code, assi) \
+ else if ((dc1) == 0xa1 && (dc2) == 0xa4) (assi) = 0x00b7; \
+ else TRYMAP_DEC(gb2312, assi, dc1 ^ 0x80, dc2 ^ 0x80); \
+ else TRYMAP_DEC(gbkext, assi, dc1, dc2);
+
+#define GBK_ENCODE(code, assi) \
if ((code) == 0x2014) (assi) = 0xa1aa; \
else if ((code) == 0x2015) (assi) = 0xa844; \
- else if ((code) == 0x00b7) (assi) = 0xa1a4;
+ else if ((code) == 0x00b7) (assi) = 0xa1a4; \
+ else if ((code) != 0x30fb && TRYMAP_ENC_COND(gbcommon, assi, code));
/*
* GB2312 codec
@@ -99,8 +111,7 @@ ENCODER(gbk)
REQUIRE_OUTBUF(2)
- GBK_PREENCODE(c, code)
- else TRYMAP_ENC(gbcommon, code, c);
+ GBK_ENCODE(c, code)
else return 1;
OUT1((code >> 8) | 0x80)
@@ -129,9 +140,7 @@ DECODER(gbk)
REQUIRE_INBUF(2)
- GBK_PREDECODE(c, IN2, **outbuf)
- else TRYMAP_DEC(gb2312, **outbuf, c ^ 0x80, IN2 ^ 0x80);
- else TRYMAP_DEC(gbkext, **outbuf, c, IN2);
+ GBK_DECODE(c, IN2, **outbuf)
else return 2;
NEXT(2, 1)
@@ -187,9 +196,7 @@ ENCODER(gb18030)
REQUIRE_OUTBUF(2)
- GBK_PREENCODE(c, code)
- else TRYMAP_ENC(gbcommon, code, c);
- else TRYMAP_ENC(gb18030ext, code, c);
+ GBK_ENCODE(c, code)
else {
const struct _gb18030_to_unibmp_ranges *utrrange;
@@ -287,9 +294,7 @@ DECODER(gb18030)
return 4;
}
- GBK_PREDECODE(c, c2, **outbuf)
- else TRYMAP_DEC(gb2312, **outbuf, c ^ 0x80, c2 ^ 0x80);
- else TRYMAP_DEC(gbkext, **outbuf, c, c2);
+ GBK_DECODE(c, c2, **outbuf)
else TRYMAP_DEC(gb18030ext, **outbuf, c, c2);
else return 2;
diff --git a/Modules/cjkcodecs/_codecs_iso2022.c b/Modules/cjkcodecs/_codecs_iso2022.c
index 8a2ab7e..55196a9 100644
--- a/Modules/cjkcodecs/_codecs_iso2022.c
+++ b/Modules/cjkcodecs/_codecs_iso2022.c
@@ -592,9 +592,11 @@ ksx1001_encoder(const ucs4_t *data, Py_ssize_t *length)
{
DBCHAR coded;
assert(*length == 1);
- TRYMAP_ENC(cp949, coded, *data)
- if (!(coded & 0x8000))
- return coded;
+ if (*data < 0x10000) {
+ TRYMAP_ENC(cp949, coded, *data)
+ if (!(coded & 0x8000))
+ return coded;
+ }
return MAP_UNMAPPABLE;
}
@@ -628,11 +630,13 @@ jisx0208_encoder(const ucs4_t *data, Py_ssize_t *length)
{
DBCHAR coded;
assert(*length == 1);
- if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */
- return 0x2140;
- else TRYMAP_ENC(jisxcommon, coded, *data) {
- if (!(coded & 0x8000))
- return coded;
+ if (*data < 0x10000) {
+ if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */
+ return 0x2140;
+ else TRYMAP_ENC(jisxcommon, coded, *data) {
+ if (!(coded & 0x8000))
+ return coded;
+ }
}
return MAP_UNMAPPABLE;
}
@@ -665,9 +669,11 @@ jisx0212_encoder(const ucs4_t *data, Py_ssize_t *length)
{
DBCHAR coded;
assert(*length == 1);
- TRYMAP_ENC(jisxcommon, coded, *data) {
- if (coded & 0x8000)
- return coded & 0x7fff;
+ if (*data < 0x10000) {
+ TRYMAP_ENC(jisxcommon, coded, *data) {
+ if (coded & 0x8000)
+ return coded & 0x7fff;
+ }
}
return MAP_UNMAPPABLE;
}
@@ -854,7 +860,7 @@ jisx0213_2000_2_encoder(const ucs4_t *data, Py_ssize_t *length)
if (coded == MAP_UNMAPPABLE || coded == MAP_MULTIPLE_AVAIL)
return coded;
else if (coded & 0x8000)
- return coded;
+ return coded & 0x7fff;
else
return MAP_UNMAPPABLE;
}
@@ -901,7 +907,7 @@ jisx0213_2004_2_encoder(const ucs4_t *data, Py_ssize_t *length)
if (coded == MAP_UNMAPPABLE || coded == MAP_MULTIPLE_AVAIL)
return coded;
else if (coded & 0x8000)
- return coded;
+ return coded & 0x7fff;
else
return MAP_UNMAPPABLE;
}
@@ -970,9 +976,11 @@ gb2312_encoder(const ucs4_t *data, Py_ssize_t *length)
{
DBCHAR coded;
assert(*length == 1);
- TRYMAP_ENC(gbcommon, coded, *data) {
- if (!(coded & 0x8000))
- return coded;
+ if (*data < 0x10000) {
+ TRYMAP_ENC(gbcommon, coded, *data) {
+ if (!(coded & 0x8000))
+ return coded;
+ }
}
return MAP_UNMAPPABLE;
}
@@ -992,7 +1000,10 @@ dummy_encoder(const ucs4_t *data, Py_ssize_t *length)
/*-*- registry tables -*-*/
-#define REGISTRY_KSX1001 { CHARSET_KSX1001, 1, 2, \
+#define REGISTRY_KSX1001_G0 { CHARSET_KSX1001, 0, 2, \
+ ksx1001_init, \
+ ksx1001_decoder, ksx1001_encoder }
+#define REGISTRY_KSX1001_G1 { CHARSET_KSX1001, 1, 2, \
ksx1001_init, \
ksx1001_decoder, ksx1001_encoder }
#define REGISTRY_JISX0201_R { CHARSET_JISX0201_R, 0, 1, \
@@ -1034,7 +1045,7 @@ dummy_encoder(const ucs4_t *data, Py_ssize_t *length)
jisx0213_init, \
jisx0213_2004_2_decoder, \
jisx0213_2004_2_encoder }
-#define REGISTRY_GB2312 { CHARSET_GB2312, 1, 2, \
+#define REGISTRY_GB2312 { CHARSET_GB2312, 0, 2, \
gb2312_init, \
gb2312_decoder, gb2312_encoder }
#define REGISTRY_CNS11643_1 { CHARSET_CNS11643_1, 1, 2, \
@@ -1054,7 +1065,7 @@ dummy_encoder(const ucs4_t *data, Py_ssize_t *length)
};
static const struct iso2022_designation iso2022_kr_designations[] = {
- REGISTRY_KSX1001, REGISTRY_SENTINEL
+ REGISTRY_KSX1001_G1, REGISTRY_SENTINEL
};
CONFIGDEF(kr, 0)
@@ -1071,7 +1082,7 @@ static const struct iso2022_designation iso2022_jp_1_designations[] = {
CONFIGDEF(jp_1, NO_SHIFT | USE_JISX0208_EXT)
static const struct iso2022_designation iso2022_jp_2_designations[] = {
- REGISTRY_JISX0208, REGISTRY_JISX0212, REGISTRY_KSX1001,
+ REGISTRY_JISX0208, REGISTRY_JISX0212, REGISTRY_KSX1001_G0,
REGISTRY_GB2312, REGISTRY_JISX0201_R, REGISTRY_JISX0208_O,
REGISTRY_ISO8859_1, REGISTRY_ISO8859_7, REGISTRY_SENTINEL
};
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index b266c8f..71c54f0 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -159,29 +159,32 @@ static const struct dbcs_map *mapping_list;
#endif
#define _TRYMAP_ENC(m, assi, val) \
- if ((m)->map != NULL && (val) >= (m)->bottom && \
+ ((m)->map != NULL && (val) >= (m)->bottom && \
(val)<= (m)->top && ((assi) = (m)->map[(val) - \
(m)->bottom]) != NOCHAR)
-#define TRYMAP_ENC(charset, assi, uni) \
+#define TRYMAP_ENC_COND(charset, assi, uni) \
_TRYMAP_ENC(&charset##_encmap[(uni) >> 8], assi, (uni) & 0xff)
+#define TRYMAP_ENC(charset, assi, uni) \
+ if TRYMAP_ENC_COND(charset, assi, uni)
+
#define _TRYMAP_DEC(m, assi, val) \
- if ((m)->map != NULL && (val) >= (m)->bottom && \
+ ((m)->map != NULL && (val) >= (m)->bottom && \
(val)<= (m)->top && ((assi) = (m)->map[(val) - \
(m)->bottom]) != UNIINV)
#define TRYMAP_DEC(charset, assi, c1, c2) \
- _TRYMAP_DEC(&charset##_decmap[c1], assi, c2)
+ if _TRYMAP_DEC(&charset##_decmap[c1], assi, c2)
#define _TRYMAP_ENC_MPLANE(m, assplane, asshi, asslo, val) \
- if ((m)->map != NULL && (val) >= (m)->bottom && \
+ ((m)->map != NULL && (val) >= (m)->bottom && \
(val)<= (m)->top && \
((assplane) = (m)->map[((val) - (m)->bottom)*3]) != 0 && \
(((asshi) = (m)->map[((val) - (m)->bottom)*3 + 1]), 1) && \
(((asslo) = (m)->map[((val) - (m)->bottom)*3 + 2]), 1))
#define TRYMAP_ENC_MPLANE(charset, assplane, asshi, asslo, uni) \
- _TRYMAP_ENC_MPLANE(&charset##_encmap[(uni) >> 8], \
+ if _TRYMAP_ENC_MPLANE(&charset##_encmap[(uni) >> 8], \
assplane, asshi, asslo, (uni) & 0xff)
#define TRYMAP_DEC_MPLANE(charset, assi, plane, c1, c2) \
- _TRYMAP_DEC(&charset##_decmap[plane][c1], assi, c2)
+ if _TRYMAP_DEC(&charset##_decmap[plane][c1], assi, c2)
#if Py_UNICODE_SIZE == 2
#define DECODE_SURROGATE(c) \
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index b57ccbc..7ffa316 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -1149,9 +1149,9 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
PyObject *newfmt = NULL; /* py string, the output format */
char *pnew; /* pointer to available byte in output format */
- char totalnew; /* number bytes total in output format buffer,
+ int totalnew; /* number bytes total in output format buffer,
exclusive of trailing \0 */
- char usednew; /* number bytes used so far in output format buffer */
+ int usednew; /* number bytes used so far in output format buffer */
char *ptoappend; /* pointer to string to append to output buffer */
int ntoappend; /* # of bytes to append to output buffer */
diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c
index ee5a7f0..83f5f43 100644
--- a/Modules/dbmmodule.c
+++ b/Modules/dbmmodule.c
@@ -246,11 +246,13 @@ dbm_get(register dbmobject *dp, PyObject *args)
{
datum key, val;
PyObject *defvalue = Py_None;
+ char *tmp_ptr;
int tmp_size;
if (!PyArg_ParseTuple(args, "s#|O:get",
- &key.dptr, &tmp_size, &defvalue))
+ &tmp_ptr, &tmp_size, &defvalue))
return NULL;
+ key.dptr = tmp_ptr;
key.dsize = tmp_size;
check_dbmobject_open(dp);
val = dbm_fetch(dp->di_dbm, key);
@@ -267,11 +269,13 @@ dbm_setdefault(register dbmobject *dp, PyObject *args)
{
datum key, val;
PyObject *defvalue = NULL;
+ char *tmp_ptr;
int tmp_size;
if (!PyArg_ParseTuple(args, "s#|S:setdefault",
- &key.dptr, &tmp_size, &defvalue))
+ &tmp_ptr, &tmp_size, &defvalue))
return NULL;
+ key.dptr = tmp_ptr;
key.dsize = tmp_size;
check_dbmobject_open(dp);
val = dbm_fetch(dp->di_dbm, key);
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 99f2897..2dd058e 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -1153,6 +1153,7 @@ PyDoc_STRVAR(gc__doc__,
"disable() -- Disable automatic garbage collection.\n"
"isenabled() -- Returns true if automatic collection is enabled.\n"
"collect() -- Do a full collection right now.\n"
+"get_count() -- Return the current collection counts.\n"
"set_debug() -- Set debugging flags.\n"
"get_debug() -- Get debugging flags.\n"
"set_threshold() -- Set the collection thresholds.\n"
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index d913890..7fcbb10 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -618,11 +618,15 @@ static PyTypeObject tee_type = {
static PyObject *
tee(PyObject *self, PyObject *args)
{
- int i, n=2;
+ Py_ssize_t i, n=2;
PyObject *it, *iterable, *copyable, *result;
- if (!PyArg_ParseTuple(args, "O|i", &iterable, &n))
+ if (!PyArg_ParseTuple(args, "O|n", &iterable, &n))
return NULL;
+ if (n < 0) {
+ PyErr_SetString(PyExc_ValueError, "n must be >= 0");
+ return NULL;
+ }
result = PyTuple_New(n);
if (result == NULL)
return NULL;
@@ -2068,7 +2072,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject *
count_next(countobject *lz)
{
- return PyInt_FromSize_t(lz->cnt++);
+ return PyInt_FromSsize_t(lz->cnt++);
}
static PyObject *
diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c
index c1c7363..b435d76 100644
--- a/Modules/linuxaudiodev.c
+++ b/Modules/linuxaudiodev.c
@@ -28,7 +28,9 @@
#if defined(linux)
#include <linux/soundcard.h>
+#ifndef HAVE_STDINT_H
typedef unsigned long uint32_t;
+#endif
#elif defined(__FreeBSD__)
#include <machine/soundcard.h>
diff --git a/Modules/main.c b/Modules/main.c
index 3f39c9b..ac6b38d 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -59,31 +59,32 @@ static char *usage_line =
static char *usage_1 = "\
Options and arguments (and corresponding environment variables):\n\
-c cmd : program passed in as string (terminates option list)\n\
--d : debug output from parser (also PYTHONDEBUG=x)\n\
+-d : debug output from parser; also PYTHONDEBUG=x\n\
-E : ignore environment variables (such as PYTHONPATH)\n\
-h : print this help message and exit (also --help)\n\
--i : inspect interactively after running script, (also PYTHONINSPECT=x)\n\
- and force prompts, even if stdin does not appear to be a terminal\n\
+-i : inspect interactively after running script; forces a prompt even\n\
+ if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\
";
static char *usage_2 = "\
-m mod : run library module as a script (terminates option list)\n\
--O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)\n\
+-O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
-OO : remove doc-strings in addition to the -O optimizations\n\
-S : don't imply 'import site' on initialization\n\
-t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\
--u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\
+-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n\
";
static char *usage_3 = "\
see man page for details on internal buffering relating to '-u'\n\
--v : verbose (trace import statements) (also PYTHONVERBOSE=x)\n\
+-v : verbose (trace import statements); also PYTHONVERBOSE=x\n\
+ can be supplied multiple times to increase verbosity\n\
-V : print the Python version number and exit (also --version)\n\
--W arg : warning control (arg is action:message:category:module:lineno)\n\
+-W arg : warning control; arg is action:message:category:module:lineno\n\
-x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
file : program read from script file\n\
- : program read from stdin (default; interactive mode if a tty)\n\
";
static char *usage_4 = "\
-arg ...: arguments passed to program in sys.argv[1:]\n\
+arg ...: arguments passed to program in sys.argv[1:]\n\n\
Other environment variables:\n\
PYTHONSTARTUP: file executed on interactive startup (no default)\n\
PYTHONPATH : '%c'-separated list of directories prefixed to the\n\
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 731b1d9..632dffd 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -48,10 +48,10 @@ is_error(double x)
}
static PyObject *
-math_1(PyObject *args, double (*func) (double), char *argsfmt)
+math_1(PyObject *arg, double (*func) (double))
{
- double x;
- if (! PyArg_ParseTuple(args, argsfmt, &x))
+ double x = PyFloat_AsDouble(arg);
+ if (x == -1.0 && PyErr_Occurred())
return NULL;
errno = 0;
PyFPE_START_PROTECT("in math_1", return 0)
@@ -65,10 +65,15 @@ math_1(PyObject *args, double (*func) (double), char *argsfmt)
}
static PyObject *
-math_2(PyObject *args, double (*func) (double, double), char *argsfmt)
+math_2(PyObject *args, double (*func) (double, double), char *funcname)
{
+ PyObject *ox, *oy;
double x, y;
- if (! PyArg_ParseTuple(args, argsfmt, &x, &y))
+ if (! PyArg_UnpackTuple(args, funcname, 2, 2, &ox, &oy))
+ return NULL;
+ x = PyFloat_AsDouble(ox);
+ y = PyFloat_AsDouble(oy);
+ if ((x == -1.0 || y == -1.0) && PyErr_Occurred())
return NULL;
errno = 0;
PyFPE_START_PROTECT("in math_2", return 0)
@@ -83,13 +88,13 @@ math_2(PyObject *args, double (*func) (double, double), char *argsfmt)
#define FUNC1(funcname, func, docstring) \
static PyObject * math_##funcname(PyObject *self, PyObject *args) { \
- return math_1(args, func, "d:" #funcname); \
+ return math_1(args, func); \
}\
PyDoc_STRVAR(math_##funcname##_doc, docstring);
#define FUNC2(funcname, func, docstring) \
static PyObject * math_##funcname(PyObject *self, PyObject *args) { \
- return math_2(args, func, "dd:" #funcname); \
+ return math_2(args, func, #funcname); \
}\
PyDoc_STRVAR(math_##funcname##_doc, docstring);
@@ -135,11 +140,11 @@ FUNC1(tanh, tanh,
"tanh(x)\n\nReturn the hyperbolic tangent of x.")
static PyObject *
-math_frexp(PyObject *self, PyObject *args)
+math_frexp(PyObject *self, PyObject *arg)
{
- double x;
int i;
- if (! PyArg_ParseTuple(args, "d:frexp", &x))
+ double x = PyFloat_AsDouble(arg);
+ if (x == -1.0 && PyErr_Occurred())
return NULL;
errno = 0;
x = frexp(x, &i);
@@ -179,10 +184,10 @@ PyDoc_STRVAR(math_ldexp_doc,
"ldexp(x, i) -> x * (2**i)");
static PyObject *
-math_modf(PyObject *self, PyObject *args)
+math_modf(PyObject *self, PyObject *arg)
{
- double x, y;
- if (! PyArg_ParseTuple(args, "d:modf", &x))
+ double y, x = PyFloat_AsDouble(arg);
+ if (x == -1.0 && PyErr_Occurred())
return NULL;
errno = 0;
x = modf(x, &y);
@@ -208,7 +213,7 @@ PyDoc_STRVAR(math_modf_doc,
*/
static PyObject*
-loghelper(PyObject* args, double (*func)(double), char *format, PyObject *arg)
+loghelper(PyObject* arg, double (*func)(double), char *funcname)
{
/* If it is long, do it ourselves. */
if (PyLong_Check(arg)) {
@@ -229,7 +234,7 @@ loghelper(PyObject* args, double (*func)(double), char *format, PyObject *arg)
}
/* Else let libm handle it by itself. */
- return math_1(args, func, format);
+ return math_1(arg, func);
}
static PyObject *
@@ -239,28 +244,15 @@ math_log(PyObject *self, PyObject *args)
PyObject *base = NULL;
PyObject *num, *den;
PyObject *ans;
- PyObject *newargs;
if (!PyArg_UnpackTuple(args, "log", 1, 2, &arg, &base))
return NULL;
- if (base == NULL)
- return loghelper(args, log, "d:log", arg);
- newargs = PyTuple_Pack(1, arg);
- if (newargs == NULL)
- return NULL;
- num = loghelper(newargs, log, "d:log", arg);
- Py_DECREF(newargs);
- if (num == NULL)
- return NULL;
+ num = loghelper(arg, log, "log");
+ if (num == NULL || base == NULL)
+ return num;
- newargs = PyTuple_Pack(1, base);
- if (newargs == NULL) {
- Py_DECREF(num);
- return NULL;
- }
- den = loghelper(newargs, log, "d:log", base);
- Py_DECREF(newargs);
+ den = loghelper(base, log, "log");
if (den == NULL) {
Py_DECREF(num);
return NULL;
@@ -277,25 +269,23 @@ PyDoc_STRVAR(math_log_doc,
If the base not specified, returns the natural logarithm (base e) of x.");
static PyObject *
-math_log10(PyObject *self, PyObject *args)
+math_log10(PyObject *self, PyObject *arg)
{
- PyObject *arg;
-
- if (!PyArg_UnpackTuple(args, "log10", 1, 1, &arg))
- return NULL;
- return loghelper(args, log10, "d:log10", arg);
+ return loghelper(arg, log10, "log10");
}
PyDoc_STRVAR(math_log10_doc,
"log10(x) -> the base 10 logarithm of x.");
+/* XXX(nnorwitz): Should we use the platform M_PI or something more accurate
+ like: 3.14159265358979323846264338327950288 */
static const double degToRad = 3.141592653589793238462643383 / 180.0;
static PyObject *
-math_degrees(PyObject *self, PyObject *args)
+math_degrees(PyObject *self, PyObject *arg)
{
- double x;
- if (! PyArg_ParseTuple(args, "d:degrees", &x))
+ double x = PyFloat_AsDouble(arg);
+ if (x == -1.0 && PyErr_Occurred())
return NULL;
return PyFloat_FromDouble(x / degToRad);
}
@@ -304,10 +294,10 @@ PyDoc_STRVAR(math_degrees_doc,
"degrees(x) -> converts angle x from radians to degrees");
static PyObject *
-math_radians(PyObject *self, PyObject *args)
+math_radians(PyObject *self, PyObject *arg)
{
- double x;
- if (! PyArg_ParseTuple(args, "d:radians", &x))
+ double x = PyFloat_AsDouble(arg);
+ if (x == -1.0 && PyErr_Occurred())
return NULL;
return PyFloat_FromDouble(x * degToRad);
}
@@ -316,31 +306,31 @@ PyDoc_STRVAR(math_radians_doc,
"radians(x) -> converts angle x from degrees to radians");
static PyMethodDef math_methods[] = {
- {"acos", math_acos, METH_VARARGS, math_acos_doc},
- {"asin", math_asin, METH_VARARGS, math_asin_doc},
- {"atan", math_atan, METH_VARARGS, math_atan_doc},
+ {"acos", math_acos, METH_O, math_acos_doc},
+ {"asin", math_asin, METH_O, math_asin_doc},
+ {"atan", math_atan, METH_O, math_atan_doc},
{"atan2", math_atan2, METH_VARARGS, math_atan2_doc},
- {"ceil", math_ceil, METH_VARARGS, math_ceil_doc},
- {"cos", math_cos, METH_VARARGS, math_cos_doc},
- {"cosh", math_cosh, METH_VARARGS, math_cosh_doc},
- {"degrees", math_degrees, METH_VARARGS, math_degrees_doc},
- {"exp", math_exp, METH_VARARGS, math_exp_doc},
- {"fabs", math_fabs, METH_VARARGS, math_fabs_doc},
- {"floor", math_floor, METH_VARARGS, math_floor_doc},
+ {"ceil", math_ceil, METH_O, math_ceil_doc},
+ {"cos", math_cos, METH_O, math_cos_doc},
+ {"cosh", math_cosh, METH_O, math_cosh_doc},
+ {"degrees", math_degrees, METH_O, math_degrees_doc},
+ {"exp", math_exp, METH_O, math_exp_doc},
+ {"fabs", math_fabs, METH_O, math_fabs_doc},
+ {"floor", math_floor, METH_O, math_floor_doc},
{"fmod", math_fmod, METH_VARARGS, math_fmod_doc},
- {"frexp", math_frexp, METH_VARARGS, math_frexp_doc},
+ {"frexp", math_frexp, METH_O, math_frexp_doc},
{"hypot", math_hypot, METH_VARARGS, math_hypot_doc},
{"ldexp", math_ldexp, METH_VARARGS, math_ldexp_doc},
{"log", math_log, METH_VARARGS, math_log_doc},
- {"log10", math_log10, METH_VARARGS, math_log10_doc},
- {"modf", math_modf, METH_VARARGS, math_modf_doc},
+ {"log10", math_log10, METH_O, math_log10_doc},
+ {"modf", math_modf, METH_O, math_modf_doc},
{"pow", math_pow, METH_VARARGS, math_pow_doc},
- {"radians", math_radians, METH_VARARGS, math_radians_doc},
- {"sin", math_sin, METH_VARARGS, math_sin_doc},
- {"sinh", math_sinh, METH_VARARGS, math_sinh_doc},
- {"sqrt", math_sqrt, METH_VARARGS, math_sqrt_doc},
- {"tan", math_tan, METH_VARARGS, math_tan_doc},
- {"tanh", math_tanh, METH_VARARGS, math_tanh_doc},
+ {"radians", math_radians, METH_O, math_radians_doc},
+ {"sin", math_sin, METH_O, math_sin_doc},
+ {"sinh", math_sinh, METH_O, math_sinh_doc},
+ {"sqrt", math_sqrt, METH_O, math_sqrt_doc},
+ {"tan", math_tan, METH_O, math_tan_doc},
+ {"tanh", math_tanh, METH_O, math_tanh_doc},
{NULL, NULL} /* sentinel */
};
@@ -358,6 +348,8 @@ initmath(void)
if (m == NULL)
goto finally;
d = PyModule_GetDict(m);
+ if (d == NULL)
+ goto finally;
if (!(v = PyFloat_FromDouble(atan(1.0) * 4.0)))
goto finally;
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index a728d3d..d39169a 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -470,7 +470,7 @@ static PyObject *
mmap_tell_method(mmap_object *self, PyObject *unused)
{
CHECK_VALID(NULL);
- return PyInt_FromLong((long) self->pos);
+ return PyInt_FromSize_t(self->pos);
}
static PyObject *
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 9716838..eb59c4d 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -34,7 +34,9 @@
#if defined(linux)
+#ifndef HAVE_STDINT_H
typedef unsigned long uint32_t;
+#endif
#elif defined(__FreeBSD__)
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 39394a5..78180b0 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -74,7 +74,8 @@ static PyObject*
node2tuple(node *n, /* node to convert */
SeqMaker mkseq, /* create sequence */
SeqInserter addelem, /* func. to add elem. in seq. */
- int lineno) /* include line numbers? */
+ int lineno, /* include line numbers? */
+ int col_offset) /* include column offsets? */
{
if (n == NULL) {
Py_INCREF(Py_None);
@@ -95,7 +96,7 @@ node2tuple(node *n, /* node to convert */
}
(void) addelem(v, 0, w);
for (i = 0; i < NCH(n); i++) {
- w = node2tuple(CHILD(n, i), mkseq, addelem, lineno);
+ w = node2tuple(CHILD(n, i), mkseq, addelem, lineno, col_offset);
if (w == NULL) {
Py_DECREF(v);
return ((PyObject*) NULL);
@@ -108,12 +109,14 @@ node2tuple(node *n, /* node to convert */
return (v);
}
else if (ISTERMINAL(TYPE(n))) {
- PyObject *result = mkseq(2 + lineno);
+ PyObject *result = mkseq(2 + lineno + col_offset);
if (result != NULL) {
(void) addelem(result, 0, PyInt_FromLong(TYPE(n)));
(void) addelem(result, 1, PyString_FromString(STR(n)));
if (lineno == 1)
(void) addelem(result, 2, PyInt_FromLong(n->n_lineno));
+ if (col_offset == 1)
+ (void) addelem(result, 3, PyInt_FromLong(n->n_col_offset));
}
return (result);
}
@@ -289,29 +292,35 @@ static PyObject*
parser_st2tuple(PyST_Object *self, PyObject *args, PyObject *kw)
{
PyObject *line_option = 0;
+ PyObject *col_option = 0;
PyObject *res = 0;
int ok;
- static char *keywords[] = {"ast", "line_info", NULL};
+ static char *keywords[] = {"ast", "line_info", "col_info", NULL};
if (self == NULL) {
- ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2tuple", keywords,
- &PyST_Type, &self, &line_option);
+ ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|OO:st2tuple", keywords,
+ &PyST_Type, &self, &line_option,
+ &col_option);
}
else
- ok = PyArg_ParseTupleAndKeywords(args, kw, "|O:totuple", &keywords[1],
- &line_option);
+ ok = PyArg_ParseTupleAndKeywords(args, kw, "|OO:totuple", &keywords[1],
+ &line_option, &col_option);
if (ok != 0) {
int lineno = 0;
+ int col_offset = 0;
if (line_option != NULL) {
lineno = (PyObject_IsTrue(line_option) != 0) ? 1 : 0;
}
+ if (col_option != NULL) {
+ col_offset = (PyObject_IsTrue(col_option) != 0) ? 1 : 0;
+ }
/*
* Convert ST into a tuple representation. Use Guido's function,
* since it's known to work already.
*/
res = node2tuple(((PyST_Object*)self)->st_node,
- PyTuple_New, PyTuple_SetItem, lineno);
+ PyTuple_New, PyTuple_SetItem, lineno, col_offset);
}
return (res);
}
@@ -327,28 +336,34 @@ static PyObject*
parser_st2list(PyST_Object *self, PyObject *args, PyObject *kw)
{
PyObject *line_option = 0;
+ PyObject *col_option = 0;
PyObject *res = 0;
int ok;
- static char *keywords[] = {"ast", "line_info", NULL};
+ static char *keywords[] = {"ast", "line_info", "col_info", NULL};
if (self == NULL)
- ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|O:st2list", keywords,
- &PyST_Type, &self, &line_option);
+ ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|OO:st2list", keywords,
+ &PyST_Type, &self, &line_option,
+ &col_option);
else
- ok = PyArg_ParseTupleAndKeywords(args, kw, "|O:tolist", &keywords[1],
- &line_option);
+ ok = PyArg_ParseTupleAndKeywords(args, kw, "|OO:tolist", &keywords[1],
+ &line_option, &col_option);
if (ok) {
int lineno = 0;
+ int col_offset = 0;
if (line_option != 0) {
lineno = PyObject_IsTrue(line_option) ? 1 : 0;
}
+ if (col_option != NULL) {
+ col_offset = (PyObject_IsTrue(col_option) != 0) ? 1 : 0;
+ }
/*
* Convert ST into a tuple representation. Use Guido's function,
* since it's known to work already.
*/
res = node2tuple(self->st_node,
- PyList_New, PyList_SetItem, lineno);
+ PyList_New, PyList_SetItem, lineno, col_offset);
}
return (res);
}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 5c67be6..3260c3d 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -792,7 +792,7 @@ time_t_to_FILE_TIME(int time_in, int nsec_in, FILETIME *out_ptr)
/* XXX endianness */
__int64 out;
out = time_in + secs_between_epochs;
- out = out * 10000000 + nsec_in;
+ out = out * 10000000 + nsec_in / 100;
memcpy(out_ptr, &out, sizeof(out));
}
@@ -828,6 +828,106 @@ attribute_data_to_stat(WIN32_FILE_ATTRIBUTE_DATA *info, struct win32_stat *resul
return 0;
}
+/* Emulate GetFileAttributesEx[AW] on Windows 95 */
+static int checked = 0;
+static BOOL (CALLBACK *gfaxa)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
+static BOOL (CALLBACK *gfaxw)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
+static void
+check_gfax()
+{
+ HINSTANCE hKernel32;
+ if (checked)
+ return;
+ checked = 1;
+ hKernel32 = GetModuleHandle("KERNEL32");
+ *(FARPROC*)&gfaxa = GetProcAddress(hKernel32, "GetFileAttributesExA");
+ *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW");
+}
+
+static BOOL WINAPI
+Py_GetFileAttributesExA(LPCSTR pszFile,
+ GET_FILEEX_INFO_LEVELS level,
+ LPVOID pv)
+{
+ BOOL result;
+ HANDLE hFindFile;
+ WIN32_FIND_DATAA FileData;
+ LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv;
+ /* First try to use the system's implementation, if that is
+ available and either succeeds to gives an error other than
+ that it isn't implemented. */
+ check_gfax();
+ if (gfaxa) {
+ result = gfaxa(pszFile, level, pv);
+ if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
+ return result;
+ }
+ /* It's either not present, or not implemented.
+ Emulate using FindFirstFile. */
+ if (level != GetFileExInfoStandard) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ /* Use GetFileAttributes to validate that the file name
+ does not contain wildcards (which FindFirstFile would
+ accept). */
+ if (GetFileAttributesA(pszFile) == 0xFFFFFFFF)
+ return FALSE;
+ hFindFile = FindFirstFileA(pszFile, &FileData);
+ if (hFindFile == INVALID_HANDLE_VALUE)
+ return FALSE;
+ FindClose(hFindFile);
+ pfad->dwFileAttributes = FileData.dwFileAttributes;
+ pfad->ftCreationTime = FileData.ftCreationTime;
+ pfad->ftLastAccessTime = FileData.ftLastAccessTime;
+ pfad->ftLastWriteTime = FileData.ftLastWriteTime;
+ pfad->nFileSizeHigh = FileData.nFileSizeHigh;
+ pfad->nFileSizeLow = FileData.nFileSizeLow;
+ return TRUE;
+}
+
+static BOOL WINAPI
+Py_GetFileAttributesExW(LPCWSTR pszFile,
+ GET_FILEEX_INFO_LEVELS level,
+ LPVOID pv)
+{
+ BOOL result;
+ HANDLE hFindFile;
+ WIN32_FIND_DATAW FileData;
+ LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv;
+ /* First try to use the system's implementation, if that is
+ available and either succeeds to gives an error other than
+ that it isn't implemented. */
+ check_gfax();
+ if (gfaxa) {
+ result = gfaxw(pszFile, level, pv);
+ if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
+ return result;
+ }
+ /* It's either not present, or not implemented.
+ Emulate using FindFirstFile. */
+ if (level != GetFileExInfoStandard) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ /* Use GetFileAttributes to validate that the file name
+ does not contain wildcards (which FindFirstFile would
+ accept). */
+ if (GetFileAttributesW(pszFile) == 0xFFFFFFFF)
+ return FALSE;
+ hFindFile = FindFirstFileW(pszFile, &FileData);
+ if (hFindFile == INVALID_HANDLE_VALUE)
+ return FALSE;
+ FindClose(hFindFile);
+ pfad->dwFileAttributes = FileData.dwFileAttributes;
+ pfad->ftCreationTime = FileData.ftCreationTime;
+ pfad->ftLastAccessTime = FileData.ftLastAccessTime;
+ pfad->ftLastWriteTime = FileData.ftLastWriteTime;
+ pfad->nFileSizeHigh = FileData.nFileSizeHigh;
+ pfad->nFileSizeLow = FileData.nFileSizeLow;
+ return TRUE;
+}
+
static int
win32_stat(const char* path, struct win32_stat *result)
{
@@ -835,7 +935,7 @@ win32_stat(const char* path, struct win32_stat *result)
int code;
char *dot;
/* XXX not supported on Win95 and NT 3.x */
- if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) {
+ if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) {
/* Protocol violation: we explicitly clear errno, instead of
setting it to a POSIX error. Callers should use GetLastError. */
errno = 0;
@@ -863,7 +963,7 @@ win32_wstat(const wchar_t* path, struct win32_stat *result)
const wchar_t *dot;
WIN32_FILE_ATTRIBUTE_DATA info;
/* XXX not supported on Win95 and NT 3.x */
- if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) {
+ if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) {
/* Protocol violation: we explicitly clear errno, instead of
setting it to a POSIX error. Callers should use GetLastError. */
errno = 0;
@@ -2458,7 +2558,8 @@ posix_utime(PyObject *self, PyObject *args)
wpath = PyUnicode_AS_UNICODE(obwpath);
Py_BEGIN_ALLOW_THREADS
hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0,
- NULL, OPEN_EXISTING, 0, NULL);
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL);
Py_END_ALLOW_THREADS
if (hFile == INVALID_HANDLE_VALUE)
return win32_error_unicode("utime", wpath);
@@ -2473,7 +2574,8 @@ posix_utime(PyObject *self, PyObject *args)
return NULL;
Py_BEGIN_ALLOW_THREADS
hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0,
- NULL, OPEN_EXISTING, 0, NULL);
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL);
Py_END_ALLOW_THREADS
if (hFile == INVALID_HANDLE_VALUE) {
win32_error("utime", apath);
@@ -2501,11 +2603,11 @@ posix_utime(PyObject *self, PyObject *args)
if (extract_time(PyTuple_GET_ITEM(arg, 0),
&atimesec, &ausec) == -1)
goto done;
- time_t_to_FILE_TIME(atimesec, ausec, &atime);
+ time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime);
if (extract_time(PyTuple_GET_ITEM(arg, 1),
&mtimesec, &musec) == -1)
goto done;
- time_t_to_FILE_TIME(mtimesec, musec, &mtime);
+ time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime);
}
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
/* Avoid putting the file name into the error here,
@@ -5585,17 +5687,53 @@ Return a string representing the path to which the symbolic link points.");
static PyObject *
posix_readlink(PyObject *self, PyObject *args)
{
+ PyObject* v;
char buf[MAXPATHLEN];
char *path;
int n;
- if (!PyArg_ParseTuple(args, "s:readlink", &path))
+#ifdef Py_USING_UNICODE
+ int arg_is_unicode = 0;
+#endif
+
+ if (!PyArg_ParseTuple(args, "et:readlink",
+ Py_FileSystemDefaultEncoding, &path))
return NULL;
+#ifdef Py_USING_UNICODE
+ v = PySequence_GetItem(args, 0);
+ if (v == NULL) return NULL;
+
+ if (PyUnicode_Check(v)) {
+ arg_is_unicode = 1;
+ }
+ Py_DECREF(v);
+#endif
+
Py_BEGIN_ALLOW_THREADS
n = readlink(path, buf, (int) sizeof buf);
Py_END_ALLOW_THREADS
if (n < 0)
return posix_error_with_filename(path);
- return PyString_FromStringAndSize(buf, n);
+
+ v = PyString_FromStringAndSize(buf, n);
+#ifdef Py_USING_UNICODE
+ if (arg_is_unicode) {
+ PyObject *w;
+
+ w = PyUnicode_FromEncodedObject(v,
+ Py_FileSystemDefaultEncoding,
+ "strict");
+ if (w != NULL) {
+ Py_DECREF(v);
+ v = w;
+ }
+ else {
+ /* fall back to the original byte string, as
+ discussed in patch #683592 */
+ PyErr_Clear();
+ }
+ }
+#endif
+ return v;
}
#endif /* HAVE_READLINK */
@@ -7877,7 +8015,7 @@ win32_urandom(PyObject *self, PyObject *args)
pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress(
hAdvAPI32, "CryptGenRandom");
- if (pCryptAcquireContext == NULL)
+ if (pCryptGenRandom == NULL)
return PyErr_Format(PyExc_NotImplementedError,
"CryptGenRandom not found");
@@ -8617,3 +8755,4 @@ INITFUNC(void)
}
#endif
+
diff --git a/Modules/readline.c b/Modules/readline.c
index 92f2d1f..853874b 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -768,10 +768,16 @@ readline_until_enter_or_signal(char *prompt, int *signal)
while (!has_input)
{ struct timeval timeout = {0, 100000}; /* 0.1 seconds */
+
+ /* [Bug #1552726] Only limit the pause if an input hook has been
+ defined. */
+ struct timeval *timeoutp = NULL;
+ if (PyOS_InputHook)
+ timeoutp = &timeout;
FD_SET(fileno(rl_instream), &selectset);
/* select resets selectset if no input was available */
has_input = select(fileno(rl_instream) + 1, &selectset,
- NULL, NULL, &timeout);
+ NULL, NULL, timeoutp);
if(PyOS_InputHook) PyOS_InputHook();
}
diff --git a/Modules/resource.c b/Modules/resource.c
index fe6f3b6..d38c660 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -298,6 +298,10 @@ initresource(void)
PyModule_AddIntConstant(m, "RLIMIT_MEMLOCK", RLIMIT_MEMLOCK);
#endif
+#ifdef RLIMIT_SBSIZE
+ PyModule_AddIntConstant(m, "RLIMIT_SBSIZE", RLIMIT_SBSIZE);
+#endif
+
#ifdef RUSAGE_SELF
PyModule_AddIntConstant(m, "RUSAGE_SELF", RUSAGE_SELF);
#endif
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index f03b34c..c9f0388 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -364,19 +364,16 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
#define BTPROTO_RFCOMM BLUETOOTH_PROTO_RFCOMM
#define sockaddr_l2 sockaddr_l2cap
#define sockaddr_rc sockaddr_rfcomm
-#define _BT_SOCKADDR_MEMB(s, proto) &((s)->sock_addr)
#define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb)
#elif defined(__NetBSD__)
#define sockaddr_l2 sockaddr_bt
#define sockaddr_rc sockaddr_bt
#define sockaddr_sco sockaddr_bt
-#define _BT_SOCKADDR_MEMB(s, proto) &((s)->sock_addr)
#define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb)
#define _BT_SCO_MEMB(sa, memb) ((sa)->bt_##memb)
#else
-#define _BT_SOCKADDR_MEMB(s, proto) (&((s)->sock_addr).bt_##proto)
#define _BT_L2_MEMB(sa, memb) ((sa)->l2_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->rc_##memb)
#define _BT_SCO_MEMB(sa, memb) ((sa)->sco_##memb)
@@ -388,6 +385,8 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
#define SEGMENT_SIZE (32 * 1024 -1)
#endif
+#define SAS2SA(x) ((struct sockaddr *)(x))
+
/*
* Constants for getnameinfo()
*/
@@ -1174,7 +1173,7 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
static int
getsockaddrarg(PySocketSockObject *s, PyObject *args,
- struct sockaddr **addr_ret, int *len_ret)
+ struct sockaddr *addr_ret, int *len_ret)
{
switch (s->sock_family) {
@@ -1184,9 +1183,10 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
struct sockaddr_un* addr;
char *path;
int len;
- addr = (struct sockaddr_un*)&(s->sock_addr).un;
if (!PyArg_Parse(args, "t#", &path, &len))
return 0;
+
+ addr = (struct sockaddr_un*)addr_ret;
#ifdef linux
if (len > 0 && path[0] == 0) {
/* Linux abstract namespace extension */
@@ -1209,7 +1209,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
}
addr->sun_family = s->sock_family;
memcpy(addr->sun_path, path, len);
- *addr_ret = (struct sockaddr *) addr;
#if defined(PYOS_OS2)
*len_ret = sizeof(*addr);
#else
@@ -1224,7 +1223,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
{
struct sockaddr_nl* addr;
int pid, groups;
- addr = (struct sockaddr_nl *)&(s->sock_addr).nl;
+ addr = (struct sockaddr_nl *)addr_ret;
if (!PyTuple_Check(args)) {
PyErr_Format(
PyExc_TypeError,
@@ -1238,7 +1237,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
addr->nl_family = AF_NETLINK;
addr->nl_pid = pid;
addr->nl_groups = groups;
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof(*addr);
return 1;
}
@@ -1249,7 +1247,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
struct sockaddr_in* addr;
char *host;
int port, result;
- addr=(struct sockaddr_in*)&(s->sock_addr).in;
if (!PyTuple_Check(args)) {
PyErr_Format(
PyExc_TypeError,
@@ -1261,6 +1258,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
if (!PyArg_ParseTuple(args, "eti:getsockaddrarg",
"idna", &host, &port))
return 0;
+ addr=(struct sockaddr_in*)addr_ret;
result = setipaddr(host, (struct sockaddr *)addr,
sizeof(*addr), AF_INET);
PyMem_Free(host);
@@ -1268,7 +1266,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
return 0;
addr->sin_family = AF_INET;
addr->sin_port = htons((short)port);
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
}
@@ -1279,7 +1276,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
struct sockaddr_in6* addr;
char *host;
int port, flowinfo, scope_id, result;
- addr = (struct sockaddr_in6*)&(s->sock_addr).in6;
flowinfo = scope_id = 0;
if (!PyTuple_Check(args)) {
PyErr_Format(
@@ -1294,6 +1290,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
&scope_id)) {
return 0;
}
+ addr = (struct sockaddr_in6*)addr_ret;
result = setipaddr(host, (struct sockaddr *)addr,
sizeof(*addr), AF_INET6);
PyMem_Free(host);
@@ -1303,7 +1300,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
addr->sin6_port = htons((short)port);
addr->sin6_flowinfo = flowinfo;
addr->sin6_scope_id = scope_id;
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
}
@@ -1315,9 +1311,10 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
switch (s->sock_proto) {
case BTPROTO_L2CAP:
{
- struct sockaddr_l2 *addr = (struct sockaddr_l2 *) _BT_SOCKADDR_MEMB(s, l2);
+ struct sockaddr_l2 *addr;
char *straddr;
+ addr = (struct sockaddr_l2 *)addr_ret;
_BT_L2_MEMB(addr, family) = AF_BLUETOOTH;
if (!PyArg_ParseTuple(args, "si", &straddr,
&_BT_L2_MEMB(addr, psm))) {
@@ -1328,15 +1325,15 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
if (setbdaddr(straddr, &_BT_L2_MEMB(addr, bdaddr)) < 0)
return 0;
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
}
case BTPROTO_RFCOMM:
{
- struct sockaddr_rc *addr = (struct sockaddr_rc *) _BT_SOCKADDR_MEMB(s, rc);
+ struct sockaddr_rc *addr;
char *straddr;
+ addr = (struct sockaddr_rc *)addr_ret;
_BT_RC_MEMB(addr, family) = AF_BLUETOOTH;
if (!PyArg_ParseTuple(args, "si", &straddr,
&_BT_RC_MEMB(addr, channel))) {
@@ -1347,16 +1344,16 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
if (setbdaddr(straddr, &_BT_RC_MEMB(addr, bdaddr)) < 0)
return 0;
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
}
#if !defined(__FreeBSD__)
case BTPROTO_SCO:
{
- struct sockaddr_sco *addr = (struct sockaddr_sco *) _BT_SOCKADDR_MEMB(s, sco);
+ struct sockaddr_sco *addr;
char *straddr;
+ addr = (struct sockaddr_sco *)addr_ret;
_BT_SCO_MEMB(addr, family) = AF_BLUETOOTH;
straddr = PyString_AsString(args);
if (straddr == NULL) {
@@ -1367,7 +1364,6 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
if (setbdaddr(straddr, &_BT_SCO_MEMB(addr, bdaddr)) < 0)
return 0;
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
}
@@ -1409,22 +1405,21 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
s->errorhandler();
return 0;
}
- addr = &(s->sock_addr.ll);
- addr->sll_family = AF_PACKET;
- addr->sll_protocol = htons((short)protoNumber);
- addr->sll_ifindex = ifr.ifr_ifindex;
- addr->sll_pkttype = pkttype;
- addr->sll_hatype = hatype;
if (halen > 8) {
PyErr_SetString(PyExc_ValueError,
"Hardware address must be 8 bytes or less");
return 0;
}
+ addr = (struct sockaddr_ll*)addr_ret;
+ addr->sll_family = AF_PACKET;
+ addr->sll_protocol = htons((short)protoNumber);
+ addr->sll_ifindex = ifr.ifr_ifindex;
+ addr->sll_pkttype = pkttype;
+ addr->sll_hatype = hatype;
if (halen != 0) {
memcpy(&addr->sll_addr, haddr, halen);
}
addr->sll_halen = halen;
- *addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
}
@@ -1551,8 +1546,7 @@ sock_accept(PySocketSockObject *s)
Py_BEGIN_ALLOW_THREADS
timeout = internal_select(s, 0);
if (!timeout)
- newfd = accept(s->sock_fd, (struct sockaddr *) &addrbuf,
- &addrlen);
+ newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
Py_END_ALLOW_THREADS
if (timeout == 1) {
@@ -1578,7 +1572,7 @@ sock_accept(PySocketSockObject *s)
SOCKETCLOSE(newfd);
goto finally;
}
- addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf,
+ addr = makesockaddr(s->sock_fd, SAS2SA(&addrbuf),
addrlen, s->sock_proto);
if (addr == NULL)
goto finally;
@@ -1819,14 +1813,14 @@ string of that length; otherwise it is an integer.");
static PyObject *
sock_bind(PySocketSockObject *s, PyObject *addro)
{
- struct sockaddr *addr;
+ sock_addr_t addrbuf;
int addrlen;
int res;
- if (!getsockaddrarg(s, addro, &addr, &addrlen))
+ if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen))
return NULL;
Py_BEGIN_ALLOW_THREADS
- res = bind(s->sock_fd, addr, addrlen);
+ res = bind(s->sock_fd, SAS2SA(&addrbuf), addrlen);
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
@@ -1952,16 +1946,16 @@ internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen,
static PyObject *
sock_connect(PySocketSockObject *s, PyObject *addro)
{
- struct sockaddr *addr;
+ sock_addr_t addrbuf;
int addrlen;
int res;
int timeout;
- if (!getsockaddrarg(s, addro, &addr, &addrlen))
+ if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen))
return NULL;
Py_BEGIN_ALLOW_THREADS
- res = internal_connect(s, addr, addrlen, &timeout);
+ res = internal_connect(s, SAS2SA(&addrbuf), addrlen, &timeout);
Py_END_ALLOW_THREADS
if (timeout == 1) {
@@ -1986,16 +1980,16 @@ is a pair (host, port).");
static PyObject *
sock_connect_ex(PySocketSockObject *s, PyObject *addro)
{
- struct sockaddr *addr;
+ sock_addr_t addrbuf;
int addrlen;
int res;
int timeout;
- if (!getsockaddrarg(s, addro, &addr, &addrlen))
+ if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen))
return NULL;
Py_BEGIN_ALLOW_THREADS
- res = internal_connect(s, addr, addrlen, &timeout);
+ res = internal_connect(s, SAS2SA(&addrbuf), addrlen, &timeout);
Py_END_ALLOW_THREADS
/* Signals are not errors (though they may raise exceptions). Adapted
@@ -2075,11 +2069,11 @@ sock_getsockname(PySocketSockObject *s)
return NULL;
memset(&addrbuf, 0, addrlen);
Py_BEGIN_ALLOW_THREADS
- res = getsockname(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen);
+ res = getsockname(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
- return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen,
+ return makesockaddr(s->sock_fd, SAS2SA(&addrbuf), addrlen,
s->sock_proto);
}
@@ -2104,11 +2098,11 @@ sock_getpeername(PySocketSockObject *s)
return NULL;
memset(&addrbuf, 0, addrlen);
Py_BEGIN_ALLOW_THREADS
- res = getpeername(s->sock_fd, (struct sockaddr *) &addrbuf, &addrlen);
+ res = getpeername(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
- return makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf, addrlen,
+ return makesockaddr(s->sock_fd, SAS2SA(&addrbuf), addrlen,
s->sock_proto);
}
@@ -2443,14 +2437,14 @@ sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, int len, int flags,
#ifndef MS_WINDOWS
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
n = recvfrom(s->sock_fd, cbuf, len, flags,
- (struct sockaddr *) &addrbuf, &addrlen);
+ SAS2SA(&addrbuf), &addrlen);
#else
n = recvfrom(s->sock_fd, cbuf, len, flags,
(void *) &addrbuf, &addrlen);
#endif
#else
n = recvfrom(s->sock_fd, cbuf, len, flags,
- (struct sockaddr *) &addrbuf, &addrlen);
+ SAS2SA(&addrbuf), &addrlen);
#endif
}
Py_END_ALLOW_THREADS
@@ -2464,7 +2458,7 @@ sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, int len, int flags,
return -1;
}
- if (!(*addr = makesockaddr(s->sock_fd, (struct sockaddr *) &addrbuf,
+ if (!(*addr = makesockaddr(s->sock_fd, SAS2SA(&addrbuf),
addrlen, s->sock_proto)))
return -1;
@@ -2664,7 +2658,7 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
{
PyObject *addro;
char *buf;
- struct sockaddr *addr;
+ sock_addr_t addrbuf;
int addrlen, len, n = -1, flags, timeout;
flags = 0;
@@ -2675,16 +2669,16 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
return NULL;
}
- if (!getsockaddrarg(s, addro, &addr, &addrlen))
- return NULL;
-
if (!IS_SELECTABLE(s))
return select_error();
+ if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen))
+ return NULL;
+
Py_BEGIN_ALLOW_THREADS
timeout = internal_select(s, 1);
if (!timeout)
- n = sendto(s->sock_fd, buf, len, flags, addr, addrlen);
+ n = sendto(s->sock_fd, buf, len, flags, SAS2SA(&addrbuf), addrlen);
Py_END_ALLOW_THREADS
if (timeout == 1) {
@@ -2973,10 +2967,9 @@ socket_gethostbyname(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:gethostbyname", &name))
return NULL;
- if (setipaddr(name, (struct sockaddr *)&addrbuf, sizeof(addrbuf), AF_INET) < 0)
+ if (setipaddr(name, SAS2SA(&addrbuf), sizeof(addrbuf), AF_INET) < 0)
return NULL;
- return makeipaddr((struct sockaddr *)&addrbuf,
- sizeof(struct sockaddr_in));
+ return makeipaddr(SAS2SA(&addrbuf), sizeof(struct sockaddr_in));
}
PyDoc_STRVAR(gethostbyname_doc,
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
index ae38c86..84f2422 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -114,7 +114,6 @@ typedef struct {
int sock_family; /* Address family, e.g., AF_INET */
int sock_type; /* Socket type, e.g., SOCK_STREAM */
int sock_proto; /* Protocol type, usually 0 */
- sock_addr_t sock_addr; /* Socket address */
PyObject *(*errorhandler)(void); /* Error handler; checks
errno, returns NULL and
sets a Python exception */
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 3614296..baf6673 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -25,6 +25,7 @@ typedef struct {
static void
lock_dealloc(lockobject *self)
{
+ assert(self->lock_lock);
/* Unlock the lock so it's safe to free it */
PyThread_acquire_lock(self->lock_lock, 0);
PyThread_release_lock(self->lock_lock);
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index a11a0b7..a30d30c 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -75,7 +75,7 @@ static PyMemberDef DB_members[] = {
{NULL}
};
-// forward declaration
+/* forward declaration */
static PyTypeObject UCD_Type;
static PyObject*