You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4810 lines
201 KiB

Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
15 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merged revisions 58095-58132,58136-58148,58151-58197 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r58096 | brett.cannon | 2007-09-10 23:38:27 +0200 (Mon, 10 Sep 2007) | 4 lines Fix a possible segfault from recursing too deep to get the repr of a list. Closes issue #1096. ........ r58097 | bill.janssen | 2007-09-10 23:51:02 +0200 (Mon, 10 Sep 2007) | 33 lines More work on SSL support. * Much expanded test suite: All protocols tested against all other protocols. All protocols tested with all certificate options. Tests for bad key and bad cert. Test of STARTTLS functionality. Test of RAND_* functions. * Fixes for threading/malloc bug. * Issue 1065 fixed: sslsocket class renamed to SSLSocket. sslerror class renamed to SSLError. Function "wrap_socket" now used to wrap an existing socket. * Issue 1583946 finally fixed: Support for subjectAltName added. Subject name now returned as proper DN list of RDNs. * SSLError exported from socket as "sslerror". * RAND_* functions properly exported from ssl.py. * Documentation improved: Example of how to create a self-signed certificate. Better indexing. ........ r58098 | guido.van.rossum | 2007-09-11 00:02:25 +0200 (Tue, 11 Sep 2007) | 9 lines Patch # 1140 (my code, approved by Effbot). Make sure the type of the return value of re.sub(x, y, z) is the type of y+x (i.e. unicode if either is unicode, str if they are both str) even if there are no substitutions or if x==z (which triggered various special cases in join_list()). Could be backported to 2.5; no need to port to 3.0. ........ r58099 | guido.van.rossum | 2007-09-11 00:36:02 +0200 (Tue, 11 Sep 2007) | 8 lines Patch # 1026 by Benjamin Aranguren (with Alex Martelli): Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same. ........ r58100 | bill.janssen | 2007-09-11 01:41:24 +0200 (Tue, 11 Sep 2007) | 3 lines A better way of finding an open port to test with. ........ r58101 | bill.janssen | 2007-09-11 03:09:19 +0200 (Tue, 11 Sep 2007) | 4 lines Make sure test_ssl doesn't reference the ssl module in a context where it can't be imported. ........ r58102 | bill.janssen | 2007-09-11 04:42:07 +0200 (Tue, 11 Sep 2007) | 3 lines Fix some documentation bugs. ........ r58103 | nick.coghlan | 2007-09-11 16:01:18 +0200 (Tue, 11 Sep 2007) | 1 line Always use the -E flag when spawning subprocesses in test_cmd_line (Issue 1056) ........ r58106 | thomas.heller | 2007-09-11 21:17:48 +0200 (Tue, 11 Sep 2007) | 3 lines Disable some tests that fail on the 'ppc Debian unstable' buildbot to find out if they cause the segfault on the 'alpha Debian' machine. ........ r58108 | brett.cannon | 2007-09-11 23:02:28 +0200 (Tue, 11 Sep 2007) | 6 lines Generators had their throw() method allowing string exceptions. That's a no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in. ........ r58112 | georg.brandl | 2007-09-12 20:03:51 +0200 (Wed, 12 Sep 2007) | 3 lines New documentation page for the bdb module. (This doesn't need to be merged to Py3k.) ........ r58114 | georg.brandl | 2007-09-12 20:05:57 +0200 (Wed, 12 Sep 2007) | 2 lines Bug #1152: use non-deprecated name in example. ........ r58115 | georg.brandl | 2007-09-12 20:08:33 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1122: wrong return type documented for various _Size() functions. ........ r58117 | georg.brandl | 2007-09-12 20:10:56 +0200 (Wed, 12 Sep 2007) | 2 lines Fix #1139: PyFile_Encoding really is PyFile_SetEncoding. ........ r58119 | georg.brandl | 2007-09-12 20:29:18 +0200 (Wed, 12 Sep 2007) | 2 lines bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier. ........ r58121 | bill.janssen | 2007-09-12 20:52:05 +0200 (Wed, 12 Sep 2007) | 1 line root certificate for https://svn.python.org/, used in test_ssl ........ r58122 | georg.brandl | 2007-09-12 21:00:07 +0200 (Wed, 12 Sep 2007) | 3 lines Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. ........ r58125 | georg.brandl | 2007-09-12 21:29:28 +0200 (Wed, 12 Sep 2007) | 4 lines #1120: put explicit version in the shebang lines of pydoc, idle and smtpd.py scripts that are installed by setup.py. That way, they work when only "make altinstall" is used. ........ r58139 | mark.summerfield | 2007-09-13 16:54:30 +0200 (Thu, 13 Sep 2007) | 9 lines Replaced variable o with obj in operator.rst because o is easy to confuse. Added a note about Python 3's collections.Mapping etc., above section that describes isMappingType() etc. Added xrefs between os, os.path, fileinput, and open(). ........ r58143 | facundo.batista | 2007-09-13 20:13:15 +0200 (Thu, 13 Sep 2007) | 7 lines Merged the decimal-branch (revisions 54886 to 58140). Decimal is now fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process. ........ r58145 | facundo.batista | 2007-09-13 20:42:09 +0200 (Thu, 13 Sep 2007) | 7 lines Put the parameter watchexp back in (changed watchexp from an int to a bool). Also second argument to watchexp is now converted to Decimal, just as with all the other two-argument operations. Thanks Mark Dickinson. ........ r58147 | andrew.kuchling | 2007-09-14 00:49:34 +0200 (Fri, 14 Sep 2007) | 1 line Add various items ........ r58148 | andrew.kuchling | 2007-09-14 00:50:10 +0200 (Fri, 14 Sep 2007) | 1 line Make target unique ........ r58154 | facundo.batista | 2007-09-14 20:58:34 +0200 (Fri, 14 Sep 2007) | 3 lines Included the new functions, and new descriptions. ........ r58155 | thomas.heller | 2007-09-14 21:40:35 +0200 (Fri, 14 Sep 2007) | 2 lines ctypes.util.find_library uses dump(1) instead of objdump(1) on Solaris. Fixes issue #1777530; will backport to release25-maint. ........ r58159 | facundo.batista | 2007-09-14 23:29:52 +0200 (Fri, 14 Sep 2007) | 3 lines Some additions (examples and a bit on the tutorial). ........ r58160 | georg.brandl | 2007-09-15 18:53:36 +0200 (Sat, 15 Sep 2007) | 2 lines Remove bdb from the "undocumented modules" list. ........ r58164 | bill.janssen | 2007-09-17 00:06:00 +0200 (Mon, 17 Sep 2007) | 15 lines Add support for asyncore server-side SSL support. This requires adding the 'makefile' method to ssl.SSLSocket, and importing the requisite fakefile class from socket.py, and making the appropriate changes to it to make it use the SSL connection. Added sample HTTPS server to test_ssl.py, and test that uses it. Change SSL tests to use https://svn.python.org/, instead of www.sf.net and pop.gmail.com. Added utility function to ssl module, get_server_certificate, to wrap up the several things to be done to pull a certificate from a remote server. ........ r58173 | bill.janssen | 2007-09-17 01:16:46 +0200 (Mon, 17 Sep 2007) | 1 line use binary mode when reading files for testAsyncore to make Windows happy ........ r58175 | raymond.hettinger | 2007-09-17 02:55:00 +0200 (Mon, 17 Sep 2007) | 7 lines Sync-up named tuples with the latest version of the ASPN recipe. Allows optional commas in the field-name spec (help when named tuples are used in conjuction with sql queries). Adds the __fields__ attribute for introspection and to support conversion to dictionary form. Adds a __replace__() method similar to str.replace() but using a named field as a target. Clean-up spelling and presentation in doc-strings. ........ r58176 | brett.cannon | 2007-09-17 05:28:34 +0200 (Mon, 17 Sep 2007) | 5 lines Add a bunch of GIL release/acquire points in tp_print implementations and for PyObject_Print(). Closes issue #1164. ........ r58177 | sean.reifschneider | 2007-09-17 07:45:04 +0200 (Mon, 17 Sep 2007) | 2 lines issue1597011: Fix for bz2 module corner-case error due to error checking bug. ........ r58180 | facundo.batista | 2007-09-17 18:26:50 +0200 (Mon, 17 Sep 2007) | 3 lines Decimal is updated, :) ........ r58181 | facundo.batista | 2007-09-17 19:30:13 +0200 (Mon, 17 Sep 2007) | 5 lines The methods always return Decimal classes, even if they're executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this. ........ r58183 | sean.reifschneider | 2007-09-17 22:53:21 +0200 (Mon, 17 Sep 2007) | 2 lines issue1082: Fixing platform and system for Vista. ........ r58185 | andrew.kuchling | 2007-09-18 03:36:16 +0200 (Tue, 18 Sep 2007) | 1 line Add item; sort properly ........ r58186 | raymond.hettinger | 2007-09-18 05:33:19 +0200 (Tue, 18 Sep 2007) | 1 line Handle corner cased on 0-tuples and 1-tuples. Add verbose option so people can see how it works. ........ r58192 | georg.brandl | 2007-09-18 09:24:40 +0200 (Tue, 18 Sep 2007) | 2 lines A bit of reordering, also show more subheadings in the lang ref index. ........ r58193 | facundo.batista | 2007-09-18 18:53:18 +0200 (Tue, 18 Sep 2007) | 4 lines Speed up of the various division operations (remainder, divide, divideint and divmod). Thanks Mark Dickinson. ........ r58197 | raymond.hettinger | 2007-09-19 00:18:02 +0200 (Wed, 19 Sep 2007) | 1 line Cleanup docs for NamedTuple. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
Merge the trunk changes in. Breaks socket.ssl for now. Merged revisions 57392-57619 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines Bug #1011: fix rfc822.Message.getheader docs. ........ r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1006: port test_winreg to unittest. ........ r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines Fix #1012: wrong URL to :mod:`site` in install/index.rst. ........ r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines Patch #1008: port test_signal to unittest. ........ r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_frozen to unittest. ........ r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines Document new utility functions in test_support. ........ r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines Remove test_rgbimg output file, there is no test_rgbimg.py. ........ r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines Remove output file for test_ossaudiodev, also properly close the dsp object. ........ r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev. ........ r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line Convert test_pkg to use unittest. ........ r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines Catch the correct errors. ........ r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines Port test_class to unittest. Patch #1671298. ........ r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line Make test_structmembers pass when run with regrtests's -R flag. ........ r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon) ........ r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line Revert compile.c changes that shouldn't have been included in previous checkin ........ r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line Fix bug 1764407 - the -i switch now does the right thing when using the -m switch ........ r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines Server-side SSL and certificate validation, by Bill Janssen. While cleaning up Bill's C style, I may have cleaned up some code he didn't touch as well (in _ssl.c). ........ r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines Try to get this to build with Visual Studio by moving all the variable declarations to the beginning of a scope. ........ r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line Fix test so it is skipped properly if there is no SSL support. ........ r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines Fix a few more variables to try to get this to compile with Visual Studio. ........ r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line Try to get this test to pass for systems that do not have SO_REUSEPORT ........ r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines keep setup.py from listing unneeded hash modules (_md5, _sha*) as missing when they were not built because _hashlib with openssl provided their functionality instead. don't build bsddb185 if bsddb was built. ........ r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line Fix typo in docstring (missing c in reacquire) ........ r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines Spell check (also americanify behaviour, it's almost 3 times as common) ........ r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines Reap children before the test starts so hopefully SocketServer won't find any old children left around which causes an exception in collect_children() and the test to fail. ........ r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line Fail gracefully if the cert files cannot be created ........ r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines Bill Janssen wrote: Here's a patch which makes test_ssl a better player in the buildbots environment. I deep-ended on "try-except-else" clauses. ........ r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line Get the test passing by commenting out some writes (should they be removed?) ........ r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines Catch IOError for when the device file doesn't exist or the user doesn't have permission to write to the device. ........ r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines Another patch from Bill Janssen that: 1) Fixes the bug that two class names are initial-lower-case. 2) Replaces the poll waiting for the server to become ready with a threading.Event signal. ........ r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line Stop using string.join (from the module) to ease upgrade to py3k ........ r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line Make a utility function for handling (printing) an error ........ r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines If we can't create a certificate, print a warning, but don't fail the test. Modified patch from what Bill Janssen sent on python-3000. ........ r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines Ignore test failures caused by 'resource temporarily unavailable' exceptions raised in the test server thread, since SimpleXMLRPCServer does not gracefully handle them. Changed number of requests handled by tests server thread to one (was 2) because no tests require more than one request. [GSoC - Alan McIntyre] ........ r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines > Regardless, building a fixed test certificate and checking it in sounds like > the better option. Then the openssl command in the test code can be turned > into a comment describing how the test data was pregenerated. Here's a patch that does that. Bill ........ r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines > Some of the code sets the error string in this directly before > returning NULL, and other pieces of the code call PySSL_SetError, > which creates the error string. I think some of the places which set > the string directly probably shouldn't; instead, they should call > PySSL_SetError to cons up the error name directly from the err code. > However, PySSL_SetError only works after the construction of an ssl > object, which means it can't be used there... I'll take a longer look > at it and see if there's a reasonable fix. Here's a patch which addresses this. It also fixes the indentation in PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning about one of the OpenSSL macros, and makes the namespace a bit more consistent. I've tested it on FC 7 and OS X 10.4. % ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl test_ssl beginning 6 repetitions 123456 ...... 1 test OK. [29244 refs] % [GvR: slightly edited to enforce 79-char line length, even if it required violating the style guide.] ........ r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines Patch 10124 by Bill Janssen, docs for the new ssl code. ........ r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines Patch # 1739906 by Christian Heimes -- add reduce to functools (importing it from __builtin__). ........ r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines News about functools.reduce. ........ r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines Document rev. 57574. ........ r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines Adding basic imputil documentation. ........ r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines Fix some glitches. ........ r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5) ........ r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines Improve extended slicing support in builtin types and classes. Specifically: - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality. ........
19 years ago
  1. # Test the support for SSL and sockets
  2. import sys
  3. import unittest
  4. import unittest.mock
  5. from test import support
  6. from test.support import import_helper
  7. from test.support import os_helper
  8. from test.support import socket_helper
  9. from test.support import threading_helper
  10. from test.support import warnings_helper
  11. import socket
  12. import select
  13. import time
  14. import datetime
  15. import gc
  16. import os
  17. import errno
  18. import pprint
  19. import urllib.request
  20. import threading
  21. import traceback
  22. import asyncore
  23. import weakref
  24. import platform
  25. import sysconfig
  26. import functools
  27. try:
  28. import ctypes
  29. except ImportError:
  30. ctypes = None
  31. ssl = import_helper.import_module("ssl")
  32. from ssl import TLSVersion, _TLSContentType, _TLSMessageType
  33. Py_DEBUG = hasattr(sys, 'gettotalrefcount')
  34. Py_DEBUG_WIN32 = Py_DEBUG and sys.platform == 'win32'
  35. PROTOCOLS = sorted(ssl._PROTOCOL_NAMES)
  36. HOST = socket_helper.HOST
  37. IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL')
  38. IS_OPENSSL_1_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 1)
  39. IS_OPENSSL_3_0_0 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (3, 0, 0)
  40. PY_SSL_DEFAULT_CIPHERS = sysconfig.get_config_var('PY_SSL_DEFAULT_CIPHERS')
  41. PROTOCOL_TO_TLS_VERSION = {}
  42. for proto, ver in (
  43. ("PROTOCOL_SSLv23", "SSLv3"),
  44. ("PROTOCOL_TLSv1", "TLSv1"),
  45. ("PROTOCOL_TLSv1_1", "TLSv1_1"),
  46. ):
  47. try:
  48. proto = getattr(ssl, proto)
  49. ver = getattr(ssl.TLSVersion, ver)
  50. except AttributeError:
  51. continue
  52. PROTOCOL_TO_TLS_VERSION[proto] = ver
  53. def data_file(*name):
  54. return os.path.join(os.path.dirname(__file__), *name)
  55. # The custom key and certificate files used in test_ssl are generated
  56. # using Lib/test/make_ssl_certs.py.
  57. # Other certificates are simply fetched from the Internet servers they
  58. # are meant to authenticate.
  59. CERTFILE = data_file("keycert.pem")
  60. BYTES_CERTFILE = os.fsencode(CERTFILE)
  61. ONLYCERT = data_file("ssl_cert.pem")
  62. ONLYKEY = data_file("ssl_key.pem")
  63. BYTES_ONLYCERT = os.fsencode(ONLYCERT)
  64. BYTES_ONLYKEY = os.fsencode(ONLYKEY)
  65. CERTFILE_PROTECTED = data_file("keycert.passwd.pem")
  66. ONLYKEY_PROTECTED = data_file("ssl_key.passwd.pem")
  67. KEY_PASSWORD = "somepass"
  68. CAPATH = data_file("capath")
  69. BYTES_CAPATH = os.fsencode(CAPATH)
  70. CAFILE_NEURONIO = data_file("capath", "4e1295a3.0")
  71. CAFILE_CACERT = data_file("capath", "5ed36f99.0")
  72. CERTFILE_INFO = {
  73. 'issuer': ((('countryName', 'XY'),),
  74. (('localityName', 'Castle Anthrax'),),
  75. (('organizationName', 'Python Software Foundation'),),
  76. (('commonName', 'localhost'),)),
  77. 'notAfter': 'Aug 26 14:23:15 2028 GMT',
  78. 'notBefore': 'Aug 29 14:23:15 2018 GMT',
  79. 'serialNumber': '98A7CF88C74A32ED',
  80. 'subject': ((('countryName', 'XY'),),
  81. (('localityName', 'Castle Anthrax'),),
  82. (('organizationName', 'Python Software Foundation'),),
  83. (('commonName', 'localhost'),)),
  84. 'subjectAltName': (('DNS', 'localhost'),),
  85. 'version': 3
  86. }
  87. # empty CRL
  88. CRLFILE = data_file("revocation.crl")
  89. # Two keys and certs signed by the same CA (for SNI tests)
  90. SIGNED_CERTFILE = data_file("keycert3.pem")
  91. SIGNED_CERTFILE_HOSTNAME = 'localhost'
  92. SIGNED_CERTFILE_INFO = {
  93. 'OCSP': ('http://testca.pythontest.net/testca/ocsp/',),
  94. 'caIssuers': ('http://testca.pythontest.net/testca/pycacert.cer',),
  95. 'crlDistributionPoints': ('http://testca.pythontest.net/testca/revocation.crl',),
  96. 'issuer': ((('countryName', 'XY'),),
  97. (('organizationName', 'Python Software Foundation CA'),),
  98. (('commonName', 'our-ca-server'),)),
  99. 'notAfter': 'Oct 28 14:23:16 2037 GMT',
  100. 'notBefore': 'Aug 29 14:23:16 2018 GMT',
  101. 'serialNumber': 'CB2D80995A69525C',
  102. 'subject': ((('countryName', 'XY'),),
  103. (('localityName', 'Castle Anthrax'),),
  104. (('organizationName', 'Python Software Foundation'),),
  105. (('commonName', 'localhost'),)),
  106. 'subjectAltName': (('DNS', 'localhost'),),
  107. 'version': 3
  108. }
  109. SIGNED_CERTFILE2 = data_file("keycert4.pem")
  110. SIGNED_CERTFILE2_HOSTNAME = 'fakehostname'
  111. SIGNED_CERTFILE_ECC = data_file("keycertecc.pem")
  112. SIGNED_CERTFILE_ECC_HOSTNAME = 'localhost-ecc'
  113. # Same certificate as pycacert.pem, but without extra text in file
  114. SIGNING_CA = data_file("capath", "ceff1710.0")
  115. # cert with all kinds of subject alt names
  116. ALLSANFILE = data_file("allsans.pem")
  117. IDNSANSFILE = data_file("idnsans.pem")
  118. NOSANFILE = data_file("nosan.pem")
  119. NOSAN_HOSTNAME = 'localhost'
  120. REMOTE_HOST = "self-signed.pythontest.net"
  121. EMPTYCERT = data_file("nullcert.pem")
  122. BADCERT = data_file("badcert.pem")
  123. NONEXISTINGCERT = data_file("XXXnonexisting.pem")
  124. BADKEY = data_file("badkey.pem")
  125. NOKIACERT = data_file("nokia.pem")
  126. NULLBYTECERT = data_file("nullbytecert.pem")
  127. TALOS_INVALID_CRLDP = data_file("talos-2019-0758.pem")
  128. DHFILE = data_file("ffdh3072.pem")
  129. BYTES_DHFILE = os.fsencode(DHFILE)
  130. # Not defined in all versions of OpenSSL
  131. OP_NO_COMPRESSION = getattr(ssl, "OP_NO_COMPRESSION", 0)
  132. OP_SINGLE_DH_USE = getattr(ssl, "OP_SINGLE_DH_USE", 0)
  133. OP_SINGLE_ECDH_USE = getattr(ssl, "OP_SINGLE_ECDH_USE", 0)
  134. OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0)
  135. OP_ENABLE_MIDDLEBOX_COMPAT = getattr(ssl, "OP_ENABLE_MIDDLEBOX_COMPAT", 0)
  136. OP_IGNORE_UNEXPECTED_EOF = getattr(ssl, "OP_IGNORE_UNEXPECTED_EOF", 0)
  137. # Ubuntu has patched OpenSSL and changed behavior of security level 2
  138. # see https://bugs.python.org/issue41561#msg389003
  139. def is_ubuntu():
  140. try:
  141. # Assume that any references of "ubuntu" implies Ubuntu-like distro
  142. # The workaround is not required for 18.04, but doesn't hurt either.
  143. with open("/etc/os-release", encoding="utf-8") as f:
  144. return "ubuntu" in f.read()
  145. except FileNotFoundError:
  146. return False
  147. if is_ubuntu():
  148. def seclevel_workaround(*ctxs):
  149. """"Lower security level to '1' and allow all ciphers for TLS 1.0/1"""
  150. for ctx in ctxs:
  151. if (
  152. hasattr(ctx, "minimum_version") and
  153. ctx.minimum_version <= ssl.TLSVersion.TLSv1_1
  154. ):
  155. ctx.set_ciphers("@SECLEVEL=1:ALL")
  156. else:
  157. def seclevel_workaround(*ctxs):
  158. pass
  159. def has_tls_protocol(protocol):
  160. """Check if a TLS protocol is available and enabled
  161. :param protocol: enum ssl._SSLMethod member or name
  162. :return: bool
  163. """
  164. if isinstance(protocol, str):
  165. assert protocol.startswith('PROTOCOL_')
  166. protocol = getattr(ssl, protocol, None)
  167. if protocol is None:
  168. return False
  169. if protocol in {
  170. ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_SERVER,
  171. ssl.PROTOCOL_TLS_CLIENT
  172. }:
  173. # auto-negotiate protocols are always available
  174. return True
  175. name = protocol.name
  176. return has_tls_version(name[len('PROTOCOL_'):])
  177. @functools.lru_cache
  178. def has_tls_version(version):
  179. """Check if a TLS/SSL version is enabled
  180. :param version: TLS version name or ssl.TLSVersion member
  181. :return: bool
  182. """
  183. if version == "SSLv2":
  184. # never supported and not even in TLSVersion enum
  185. return False
  186. if isinstance(version, str):
  187. version = ssl.TLSVersion.__members__[version]
  188. # check compile time flags like ssl.HAS_TLSv1_2
  189. if not getattr(ssl, f'HAS_{version.name}'):
  190. return False
  191. if IS_OPENSSL_3_0_0 and version < ssl.TLSVersion.TLSv1_2:
  192. # bpo43791: 3.0.0-alpha14 fails with TLSV1_ALERT_INTERNAL_ERROR
  193. return False
  194. # check runtime and dynamic crypto policy settings. A TLS version may
  195. # be compiled in but disabled by a policy or config option.
  196. ctx = ssl.SSLContext()
  197. if (
  198. hasattr(ctx, 'minimum_version') and
  199. ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and
  200. version < ctx.minimum_version
  201. ):
  202. return False
  203. if (
  204. hasattr(ctx, 'maximum_version') and
  205. ctx.maximum_version != ssl.TLSVersion.MAXIMUM_SUPPORTED and
  206. version > ctx.maximum_version
  207. ):
  208. return False
  209. return True
  210. def requires_tls_version(version):
  211. """Decorator to skip tests when a required TLS version is not available
  212. :param version: TLS version name or ssl.TLSVersion member
  213. :return:
  214. """
  215. def decorator(func):
  216. @functools.wraps(func)
  217. def wrapper(*args, **kw):
  218. if not has_tls_version(version):
  219. raise unittest.SkipTest(f"{version} is not available.")
  220. else:
  221. return func(*args, **kw)
  222. return wrapper
  223. return decorator
  224. requires_minimum_version = unittest.skipUnless(
  225. hasattr(ssl.SSLContext, 'minimum_version'),
  226. "required OpenSSL >= 1.1.0g"
  227. )
  228. def handle_error(prefix):
  229. exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
  230. if support.verbose:
  231. sys.stdout.write(prefix + exc_format)
  232. def _have_secp_curves():
  233. if not ssl.HAS_ECDH:
  234. return False
  235. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  236. try:
  237. ctx.set_ecdh_curve("secp384r1")
  238. except ValueError:
  239. return False
  240. else:
  241. return True
  242. HAVE_SECP_CURVES = _have_secp_curves()
  243. def utc_offset(): #NOTE: ignore issues like #1647654
  244. # local time = utc time + utc offset
  245. if time.daylight and time.localtime().tm_isdst > 0:
  246. return -time.altzone # seconds
  247. return -time.timezone
  248. def asn1time(cert_time):
  249. # Some versions of OpenSSL ignore seconds, see #18207
  250. # 0.9.8.i
  251. if ssl._OPENSSL_API_VERSION == (0, 9, 8, 9, 15):
  252. fmt = "%b %d %H:%M:%S %Y GMT"
  253. dt = datetime.datetime.strptime(cert_time, fmt)
  254. dt = dt.replace(second=0)
  255. cert_time = dt.strftime(fmt)
  256. # %d adds leading zero but ASN1_TIME_print() uses leading space
  257. if cert_time[4] == "0":
  258. cert_time = cert_time[:4] + " " + cert_time[5:]
  259. return cert_time
  260. needs_sni = unittest.skipUnless(ssl.HAS_SNI, "SNI support needed for this test")
  261. def test_wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLS, *,
  262. cert_reqs=ssl.CERT_NONE, ca_certs=None,
  263. ciphers=None, certfile=None, keyfile=None,
  264. **kwargs):
  265. context = ssl.SSLContext(ssl_version)
  266. if cert_reqs is not None:
  267. if cert_reqs == ssl.CERT_NONE:
  268. context.check_hostname = False
  269. context.verify_mode = cert_reqs
  270. if ca_certs is not None:
  271. context.load_verify_locations(ca_certs)
  272. if certfile is not None or keyfile is not None:
  273. context.load_cert_chain(certfile, keyfile)
  274. if ciphers is not None:
  275. context.set_ciphers(ciphers)
  276. return context.wrap_socket(sock, **kwargs)
  277. def testing_context(server_cert=SIGNED_CERTFILE):
  278. """Create context
  279. client_context, server_context, hostname = testing_context()
  280. """
  281. if server_cert == SIGNED_CERTFILE:
  282. hostname = SIGNED_CERTFILE_HOSTNAME
  283. elif server_cert == SIGNED_CERTFILE2:
  284. hostname = SIGNED_CERTFILE2_HOSTNAME
  285. elif server_cert == NOSANFILE:
  286. hostname = NOSAN_HOSTNAME
  287. else:
  288. raise ValueError(server_cert)
  289. client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  290. client_context.load_verify_locations(SIGNING_CA)
  291. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  292. server_context.load_cert_chain(server_cert)
  293. server_context.load_verify_locations(SIGNING_CA)
  294. return client_context, server_context, hostname
  295. class BasicSocketTests(unittest.TestCase):
  296. def test_constants(self):
  297. ssl.CERT_NONE
  298. ssl.CERT_OPTIONAL
  299. ssl.CERT_REQUIRED
  300. ssl.OP_CIPHER_SERVER_PREFERENCE
  301. ssl.OP_SINGLE_DH_USE
  302. if ssl.HAS_ECDH:
  303. ssl.OP_SINGLE_ECDH_USE
  304. ssl.OP_NO_COMPRESSION
  305. self.assertIn(ssl.HAS_SNI, {True, False})
  306. self.assertIn(ssl.HAS_ECDH, {True, False})
  307. ssl.OP_NO_SSLv2
  308. ssl.OP_NO_SSLv3
  309. ssl.OP_NO_TLSv1
  310. ssl.OP_NO_TLSv1_3
  311. ssl.OP_NO_TLSv1_1
  312. ssl.OP_NO_TLSv1_2
  313. self.assertEqual(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv23)
  314. def test_private_init(self):
  315. with self.assertRaisesRegex(TypeError, "public constructor"):
  316. with socket.socket() as s:
  317. ssl.SSLSocket(s)
  318. def test_str_for_enums(self):
  319. # Make sure that the PROTOCOL_* constants have enum-like string
  320. # reprs.
  321. proto = ssl.PROTOCOL_TLS
  322. self.assertEqual(str(proto), 'PROTOCOL_TLS')
  323. ctx = ssl.SSLContext(proto)
  324. self.assertIs(ctx.protocol, proto)
  325. def test_random(self):
  326. v = ssl.RAND_status()
  327. if support.verbose:
  328. sys.stdout.write("\n RAND_status is %d (%s)\n"
  329. % (v, (v and "sufficient randomness") or
  330. "insufficient randomness"))
  331. data, is_cryptographic = ssl.RAND_pseudo_bytes(16)
  332. self.assertEqual(len(data), 16)
  333. self.assertEqual(is_cryptographic, v == 1)
  334. if v:
  335. data = ssl.RAND_bytes(16)
  336. self.assertEqual(len(data), 16)
  337. else:
  338. self.assertRaises(ssl.SSLError, ssl.RAND_bytes, 16)
  339. # negative num is invalid
  340. self.assertRaises(ValueError, ssl.RAND_bytes, -5)
  341. self.assertRaises(ValueError, ssl.RAND_pseudo_bytes, -5)
  342. if hasattr(ssl, 'RAND_egd'):
  343. self.assertRaises(TypeError, ssl.RAND_egd, 1)
  344. self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1)
  345. ssl.RAND_add("this is a random string", 75.0)
  346. ssl.RAND_add(b"this is a random bytes object", 75.0)
  347. ssl.RAND_add(bytearray(b"this is a random bytearray object"), 75.0)
  348. @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork')
  349. def test_random_fork(self):
  350. status = ssl.RAND_status()
  351. if not status:
  352. self.fail("OpenSSL's PRNG has insufficient randomness")
  353. rfd, wfd = os.pipe()
  354. pid = os.fork()
  355. if pid == 0:
  356. try:
  357. os.close(rfd)
  358. child_random = ssl.RAND_pseudo_bytes(16)[0]
  359. self.assertEqual(len(child_random), 16)
  360. os.write(wfd, child_random)
  361. os.close(wfd)
  362. except BaseException:
  363. os._exit(1)
  364. else:
  365. os._exit(0)
  366. else:
  367. os.close(wfd)
  368. self.addCleanup(os.close, rfd)
  369. support.wait_process(pid, exitcode=0)
  370. child_random = os.read(rfd, 16)
  371. self.assertEqual(len(child_random), 16)
  372. parent_random = ssl.RAND_pseudo_bytes(16)[0]
  373. self.assertEqual(len(parent_random), 16)
  374. self.assertNotEqual(child_random, parent_random)
  375. maxDiff = None
  376. def test_parse_cert(self):
  377. # note that this uses an 'unofficial' function in _ssl.c,
  378. # provided solely for this test, to exercise the certificate
  379. # parsing code
  380. self.assertEqual(
  381. ssl._ssl._test_decode_cert(CERTFILE),
  382. CERTFILE_INFO
  383. )
  384. self.assertEqual(
  385. ssl._ssl._test_decode_cert(SIGNED_CERTFILE),
  386. SIGNED_CERTFILE_INFO
  387. )
  388. # Issue #13034: the subjectAltName in some certificates
  389. # (notably projects.developer.nokia.com:443) wasn't parsed
  390. p = ssl._ssl._test_decode_cert(NOKIACERT)
  391. if support.verbose:
  392. sys.stdout.write("\n" + pprint.pformat(p) + "\n")
  393. self.assertEqual(p['subjectAltName'],
  394. (('DNS', 'projects.developer.nokia.com'),
  395. ('DNS', 'projects.forum.nokia.com'))
  396. )
  397. # extra OCSP and AIA fields
  398. self.assertEqual(p['OCSP'], ('http://ocsp.verisign.com',))
  399. self.assertEqual(p['caIssuers'],
  400. ('http://SVRIntl-G3-aia.verisign.com/SVRIntlG3.cer',))
  401. self.assertEqual(p['crlDistributionPoints'],
  402. ('http://SVRIntl-G3-crl.verisign.com/SVRIntlG3.crl',))
  403. def test_parse_cert_CVE_2019_5010(self):
  404. p = ssl._ssl._test_decode_cert(TALOS_INVALID_CRLDP)
  405. if support.verbose:
  406. sys.stdout.write("\n" + pprint.pformat(p) + "\n")
  407. self.assertEqual(
  408. p,
  409. {
  410. 'issuer': (
  411. (('countryName', 'UK'),), (('commonName', 'cody-ca'),)),
  412. 'notAfter': 'Jun 14 18:00:58 2028 GMT',
  413. 'notBefore': 'Jun 18 18:00:58 2018 GMT',
  414. 'serialNumber': '02',
  415. 'subject': ((('countryName', 'UK'),),
  416. (('commonName',
  417. 'codenomicon-vm-2.test.lal.cisco.com'),)),
  418. 'subjectAltName': (
  419. ('DNS', 'codenomicon-vm-2.test.lal.cisco.com'),),
  420. 'version': 3
  421. }
  422. )
  423. def test_parse_cert_CVE_2013_4238(self):
  424. p = ssl._ssl._test_decode_cert(NULLBYTECERT)
  425. if support.verbose:
  426. sys.stdout.write("\n" + pprint.pformat(p) + "\n")
  427. subject = ((('countryName', 'US'),),
  428. (('stateOrProvinceName', 'Oregon'),),
  429. (('localityName', 'Beaverton'),),
  430. (('organizationName', 'Python Software Foundation'),),
  431. (('organizationalUnitName', 'Python Core Development'),),
  432. (('commonName', 'null.python.org\x00example.org'),),
  433. (('emailAddress', 'python-dev@python.org'),))
  434. self.assertEqual(p['subject'], subject)
  435. self.assertEqual(p['issuer'], subject)
  436. if ssl._OPENSSL_API_VERSION >= (0, 9, 8):
  437. san = (('DNS', 'altnull.python.org\x00example.com'),
  438. ('email', 'null@python.org\x00user@example.org'),
  439. ('URI', 'http://null.python.org\x00http://example.org'),
  440. ('IP Address', '192.0.2.1'),
  441. ('IP Address', '2001:DB8:0:0:0:0:0:1'))
  442. else:
  443. # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
  444. san = (('DNS', 'altnull.python.org\x00example.com'),
  445. ('email', 'null@python.org\x00user@example.org'),
  446. ('URI', 'http://null.python.org\x00http://example.org'),
  447. ('IP Address', '192.0.2.1'),
  448. ('IP Address', '<invalid>'))
  449. self.assertEqual(p['subjectAltName'], san)
  450. def test_parse_all_sans(self):
  451. p = ssl._ssl._test_decode_cert(ALLSANFILE)
  452. self.assertEqual(p['subjectAltName'],
  453. (
  454. ('DNS', 'allsans'),
  455. ('othername', '<unsupported>'),
  456. ('othername', '<unsupported>'),
  457. ('email', 'user@example.org'),
  458. ('DNS', 'www.example.org'),
  459. ('DirName',
  460. ((('countryName', 'XY'),),
  461. (('localityName', 'Castle Anthrax'),),
  462. (('organizationName', 'Python Software Foundation'),),
  463. (('commonName', 'dirname example'),))),
  464. ('URI', 'https://www.python.org/'),
  465. ('IP Address', '127.0.0.1'),
  466. ('IP Address', '0:0:0:0:0:0:0:1'),
  467. ('Registered ID', '1.2.3.4.5')
  468. )
  469. )
  470. def test_DER_to_PEM(self):
  471. with open(CAFILE_CACERT, 'r') as f:
  472. pem = f.read()
  473. d1 = ssl.PEM_cert_to_DER_cert(pem)
  474. p2 = ssl.DER_cert_to_PEM_cert(d1)
  475. d2 = ssl.PEM_cert_to_DER_cert(p2)
  476. self.assertEqual(d1, d2)
  477. if not p2.startswith(ssl.PEM_HEADER + '\n'):
  478. self.fail("DER-to-PEM didn't include correct header:\n%r\n" % p2)
  479. if not p2.endswith('\n' + ssl.PEM_FOOTER + '\n'):
  480. self.fail("DER-to-PEM didn't include correct footer:\n%r\n" % p2)
  481. def test_openssl_version(self):
  482. n = ssl.OPENSSL_VERSION_NUMBER
  483. t = ssl.OPENSSL_VERSION_INFO
  484. s = ssl.OPENSSL_VERSION
  485. self.assertIsInstance(n, int)
  486. self.assertIsInstance(t, tuple)
  487. self.assertIsInstance(s, str)
  488. # Some sanity checks follow
  489. # >= 0.9
  490. self.assertGreaterEqual(n, 0x900000)
  491. # < 4.0
  492. self.assertLess(n, 0x40000000)
  493. major, minor, fix, patch, status = t
  494. self.assertGreaterEqual(major, 1)
  495. self.assertLess(major, 4)
  496. self.assertGreaterEqual(minor, 0)
  497. self.assertLess(minor, 256)
  498. self.assertGreaterEqual(fix, 0)
  499. self.assertLess(fix, 256)
  500. self.assertGreaterEqual(patch, 0)
  501. self.assertLessEqual(patch, 63)
  502. self.assertGreaterEqual(status, 0)
  503. self.assertLessEqual(status, 15)
  504. # Version string as returned by {Open,Libre}SSL, the format might change
  505. if IS_LIBRESSL:
  506. self.assertTrue(s.startswith("LibreSSL {:d}".format(major)),
  507. (s, t, hex(n)))
  508. else:
  509. self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
  510. (s, t, hex(n)))
  511. @support.cpython_only
  512. def test_refcycle(self):
  513. # Issue #7943: an SSL object doesn't create reference cycles with
  514. # itself.
  515. s = socket.socket(socket.AF_INET)
  516. ss = test_wrap_socket(s)
  517. wr = weakref.ref(ss)
  518. with warnings_helper.check_warnings(("", ResourceWarning)):
  519. del ss
  520. self.assertEqual(wr(), None)
  521. def test_wrapped_unconnected(self):
  522. # Methods on an unconnected SSLSocket propagate the original
  523. # OSError raise by the underlying socket object.
  524. s = socket.socket(socket.AF_INET)
  525. with test_wrap_socket(s) as ss:
  526. self.assertRaises(OSError, ss.recv, 1)
  527. self.assertRaises(OSError, ss.recv_into, bytearray(b'x'))
  528. self.assertRaises(OSError, ss.recvfrom, 1)
  529. self.assertRaises(OSError, ss.recvfrom_into, bytearray(b'x'), 1)
  530. self.assertRaises(OSError, ss.send, b'x')
  531. self.assertRaises(OSError, ss.sendto, b'x', ('0.0.0.0', 0))
  532. self.assertRaises(NotImplementedError, ss.dup)
  533. self.assertRaises(NotImplementedError, ss.sendmsg,
  534. [b'x'], (), 0, ('0.0.0.0', 0))
  535. self.assertRaises(NotImplementedError, ss.recvmsg, 100)
  536. self.assertRaises(NotImplementedError, ss.recvmsg_into,
  537. [bytearray(100)])
  538. def test_timeout(self):
  539. # Issue #8524: when creating an SSL socket, the timeout of the
  540. # original socket should be retained.
  541. for timeout in (None, 0.0, 5.0):
  542. s = socket.socket(socket.AF_INET)
  543. s.settimeout(timeout)
  544. with test_wrap_socket(s) as ss:
  545. self.assertEqual(timeout, ss.gettimeout())
  546. def test_errors_sslwrap(self):
  547. sock = socket.socket()
  548. self.assertRaisesRegex(ValueError,
  549. "certfile must be specified",
  550. ssl.wrap_socket, sock, keyfile=CERTFILE)
  551. self.assertRaisesRegex(ValueError,
  552. "certfile must be specified for server-side operations",
  553. ssl.wrap_socket, sock, server_side=True)
  554. self.assertRaisesRegex(ValueError,
  555. "certfile must be specified for server-side operations",
  556. ssl.wrap_socket, sock, server_side=True, certfile="")
  557. with ssl.wrap_socket(sock, server_side=True, certfile=CERTFILE) as s:
  558. self.assertRaisesRegex(ValueError, "can't connect in server-side mode",
  559. s.connect, (HOST, 8080))
  560. with self.assertRaises(OSError) as cm:
  561. with socket.socket() as sock:
  562. ssl.wrap_socket(sock, certfile=NONEXISTINGCERT)
  563. self.assertEqual(cm.exception.errno, errno.ENOENT)
  564. with self.assertRaises(OSError) as cm:
  565. with socket.socket() as sock:
  566. ssl.wrap_socket(sock,
  567. certfile=CERTFILE, keyfile=NONEXISTINGCERT)
  568. self.assertEqual(cm.exception.errno, errno.ENOENT)
  569. with self.assertRaises(OSError) as cm:
  570. with socket.socket() as sock:
  571. ssl.wrap_socket(sock,
  572. certfile=NONEXISTINGCERT, keyfile=NONEXISTINGCERT)
  573. self.assertEqual(cm.exception.errno, errno.ENOENT)
  574. def bad_cert_test(self, certfile):
  575. """Check that trying to use the given client certificate fails"""
  576. certfile = os.path.join(os.path.dirname(__file__) or os.curdir,
  577. certfile)
  578. sock = socket.socket()
  579. self.addCleanup(sock.close)
  580. with self.assertRaises(ssl.SSLError):
  581. test_wrap_socket(sock,
  582. certfile=certfile)
  583. def test_empty_cert(self):
  584. """Wrapping with an empty cert file"""
  585. self.bad_cert_test("nullcert.pem")
  586. def test_malformed_cert(self):
  587. """Wrapping with a badly formatted certificate (syntax error)"""
  588. self.bad_cert_test("badcert.pem")
  589. def test_malformed_key(self):
  590. """Wrapping with a badly formatted key (syntax error)"""
  591. self.bad_cert_test("badkey.pem")
  592. def test_match_hostname(self):
  593. def ok(cert, hostname):
  594. ssl.match_hostname(cert, hostname)
  595. def fail(cert, hostname):
  596. self.assertRaises(ssl.CertificateError,
  597. ssl.match_hostname, cert, hostname)
  598. # -- Hostname matching --
  599. cert = {'subject': ((('commonName', 'example.com'),),)}
  600. ok(cert, 'example.com')
  601. ok(cert, 'ExAmple.cOm')
  602. fail(cert, 'www.example.com')
  603. fail(cert, '.example.com')
  604. fail(cert, 'example.org')
  605. fail(cert, 'exampleXcom')
  606. cert = {'subject': ((('commonName', '*.a.com'),),)}
  607. ok(cert, 'foo.a.com')
  608. fail(cert, 'bar.foo.a.com')
  609. fail(cert, 'a.com')
  610. fail(cert, 'Xa.com')
  611. fail(cert, '.a.com')
  612. # only match wildcards when they are the only thing
  613. # in left-most segment
  614. cert = {'subject': ((('commonName', 'f*.com'),),)}
  615. fail(cert, 'foo.com')
  616. fail(cert, 'f.com')
  617. fail(cert, 'bar.com')
  618. fail(cert, 'foo.a.com')
  619. fail(cert, 'bar.foo.com')
  620. # NULL bytes are bad, CVE-2013-4073
  621. cert = {'subject': ((('commonName',
  622. 'null.python.org\x00example.org'),),)}
  623. ok(cert, 'null.python.org\x00example.org') # or raise an error?
  624. fail(cert, 'example.org')
  625. fail(cert, 'null.python.org')
  626. # error cases with wildcards
  627. cert = {'subject': ((('commonName', '*.*.a.com'),),)}
  628. fail(cert, 'bar.foo.a.com')
  629. fail(cert, 'a.com')
  630. fail(cert, 'Xa.com')
  631. fail(cert, '.a.com')
  632. cert = {'subject': ((('commonName', 'a.*.com'),),)}
  633. fail(cert, 'a.foo.com')
  634. fail(cert, 'a..com')
  635. fail(cert, 'a.com')
  636. # wildcard doesn't match IDNA prefix 'xn--'
  637. idna = 'püthon.python.org'.encode("idna").decode("ascii")
  638. cert = {'subject': ((('commonName', idna),),)}
  639. ok(cert, idna)
  640. cert = {'subject': ((('commonName', 'x*.python.org'),),)}
  641. fail(cert, idna)
  642. cert = {'subject': ((('commonName', 'xn--p*.python.org'),),)}
  643. fail(cert, idna)
  644. # wildcard in first fragment and IDNA A-labels in sequent fragments
  645. # are supported.
  646. idna = 'www*.pythön.org'.encode("idna").decode("ascii")
  647. cert = {'subject': ((('commonName', idna),),)}
  648. fail(cert, 'www.pythön.org'.encode("idna").decode("ascii"))
  649. fail(cert, 'www1.pythön.org'.encode("idna").decode("ascii"))
  650. fail(cert, 'ftp.pythön.org'.encode("idna").decode("ascii"))
  651. fail(cert, 'pythön.org'.encode("idna").decode("ascii"))
  652. # Slightly fake real-world example
  653. cert = {'notAfter': 'Jun 26 21:41:46 2011 GMT',
  654. 'subject': ((('commonName', 'linuxfrz.org'),),),
  655. 'subjectAltName': (('DNS', 'linuxfr.org'),
  656. ('DNS', 'linuxfr.com'),
  657. ('othername', '<unsupported>'))}
  658. ok(cert, 'linuxfr.org')
  659. ok(cert, 'linuxfr.com')
  660. # Not a "DNS" entry
  661. fail(cert, '<unsupported>')
  662. # When there is a subjectAltName, commonName isn't used
  663. fail(cert, 'linuxfrz.org')
  664. # A pristine real-world example
  665. cert = {'notAfter': 'Dec 18 23:59:59 2011 GMT',
  666. 'subject': ((('countryName', 'US'),),
  667. (('stateOrProvinceName', 'California'),),
  668. (('localityName', 'Mountain View'),),
  669. (('organizationName', 'Google Inc'),),
  670. (('commonName', 'mail.google.com'),))}
  671. ok(cert, 'mail.google.com')
  672. fail(cert, 'gmail.com')
  673. # Only commonName is considered
  674. fail(cert, 'California')
  675. # -- IPv4 matching --
  676. cert = {'subject': ((('commonName', 'example.com'),),),
  677. 'subjectAltName': (('DNS', 'example.com'),
  678. ('IP Address', '10.11.12.13'),
  679. ('IP Address', '14.15.16.17'),
  680. ('IP Address', '127.0.0.1'))}
  681. ok(cert, '10.11.12.13')
  682. ok(cert, '14.15.16.17')
  683. # socket.inet_ntoa(socket.inet_aton('127.1')) == '127.0.0.1'
  684. fail(cert, '127.1')
  685. fail(cert, '14.15.16.17 ')
  686. fail(cert, '14.15.16.17 extra data')
  687. fail(cert, '14.15.16.18')
  688. fail(cert, 'example.net')
  689. # -- IPv6 matching --
  690. if socket_helper.IPV6_ENABLED:
  691. cert = {'subject': ((('commonName', 'example.com'),),),
  692. 'subjectAltName': (
  693. ('DNS', 'example.com'),
  694. ('IP Address', '2001:0:0:0:0:0:0:CAFE\n'),
  695. ('IP Address', '2003:0:0:0:0:0:0:BABA\n'))}
  696. ok(cert, '2001::cafe')
  697. ok(cert, '2003::baba')
  698. fail(cert, '2003::baba ')
  699. fail(cert, '2003::baba extra data')
  700. fail(cert, '2003::bebe')
  701. fail(cert, 'example.net')
  702. # -- Miscellaneous --
  703. # Neither commonName nor subjectAltName
  704. cert = {'notAfter': 'Dec 18 23:59:59 2011 GMT',
  705. 'subject': ((('countryName', 'US'),),
  706. (('stateOrProvinceName', 'California'),),
  707. (('localityName', 'Mountain View'),),
  708. (('organizationName', 'Google Inc'),))}
  709. fail(cert, 'mail.google.com')
  710. # No DNS entry in subjectAltName but a commonName
  711. cert = {'notAfter': 'Dec 18 23:59:59 2099 GMT',
  712. 'subject': ((('countryName', 'US'),),
  713. (('stateOrProvinceName', 'California'),),
  714. (('localityName', 'Mountain View'),),
  715. (('commonName', 'mail.google.com'),)),
  716. 'subjectAltName': (('othername', 'blabla'), )}
  717. ok(cert, 'mail.google.com')
  718. # No DNS entry subjectAltName and no commonName
  719. cert = {'notAfter': 'Dec 18 23:59:59 2099 GMT',
  720. 'subject': ((('countryName', 'US'),),
  721. (('stateOrProvinceName', 'California'),),
  722. (('localityName', 'Mountain View'),),
  723. (('organizationName', 'Google Inc'),)),
  724. 'subjectAltName': (('othername', 'blabla'),)}
  725. fail(cert, 'google.com')
  726. # Empty cert / no cert
  727. self.assertRaises(ValueError, ssl.match_hostname, None, 'example.com')
  728. self.assertRaises(ValueError, ssl.match_hostname, {}, 'example.com')
  729. # Issue #17980: avoid denials of service by refusing more than one
  730. # wildcard per fragment.
  731. cert = {'subject': ((('commonName', 'a*b.example.com'),),)}
  732. with self.assertRaisesRegex(
  733. ssl.CertificateError,
  734. "partial wildcards in leftmost label are not supported"):
  735. ssl.match_hostname(cert, 'axxb.example.com')
  736. cert = {'subject': ((('commonName', 'www.*.example.com'),),)}
  737. with self.assertRaisesRegex(
  738. ssl.CertificateError,
  739. "wildcard can only be present in the leftmost label"):
  740. ssl.match_hostname(cert, 'www.sub.example.com')
  741. cert = {'subject': ((('commonName', 'a*b*.example.com'),),)}
  742. with self.assertRaisesRegex(
  743. ssl.CertificateError,
  744. "too many wildcards"):
  745. ssl.match_hostname(cert, 'axxbxxc.example.com')
  746. cert = {'subject': ((('commonName', '*'),),)}
  747. with self.assertRaisesRegex(
  748. ssl.CertificateError,
  749. "sole wildcard without additional labels are not support"):
  750. ssl.match_hostname(cert, 'host')
  751. cert = {'subject': ((('commonName', '*.com'),),)}
  752. with self.assertRaisesRegex(
  753. ssl.CertificateError,
  754. r"hostname 'com' doesn't match '\*.com'"):
  755. ssl.match_hostname(cert, 'com')
  756. # extra checks for _inet_paton()
  757. for invalid in ['1', '', '1.2.3', '256.0.0.1', '127.0.0.1/24']:
  758. with self.assertRaises(ValueError):
  759. ssl._inet_paton(invalid)
  760. for ipaddr in ['127.0.0.1', '192.168.0.1']:
  761. self.assertTrue(ssl._inet_paton(ipaddr))
  762. if socket_helper.IPV6_ENABLED:
  763. for ipaddr in ['::1', '2001:db8:85a3::8a2e:370:7334']:
  764. self.assertTrue(ssl._inet_paton(ipaddr))
  765. def test_server_side(self):
  766. # server_hostname doesn't work for server sockets
  767. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  768. with socket.socket() as sock:
  769. self.assertRaises(ValueError, ctx.wrap_socket, sock, True,
  770. server_hostname="some.hostname")
  771. def test_unknown_channel_binding(self):
  772. # should raise ValueError for unknown type
  773. s = socket.create_server(('127.0.0.1', 0))
  774. c = socket.socket(socket.AF_INET)
  775. c.connect(s.getsockname())
  776. with test_wrap_socket(c, do_handshake_on_connect=False) as ss:
  777. with self.assertRaises(ValueError):
  778. ss.get_channel_binding("unknown-type")
  779. s.close()
  780. @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES,
  781. "'tls-unique' channel binding not available")
  782. def test_tls_unique_channel_binding(self):
  783. # unconnected should return None for known type
  784. s = socket.socket(socket.AF_INET)
  785. with test_wrap_socket(s) as ss:
  786. self.assertIsNone(ss.get_channel_binding("tls-unique"))
  787. # the same for server-side
  788. s = socket.socket(socket.AF_INET)
  789. with test_wrap_socket(s, server_side=True, certfile=CERTFILE) as ss:
  790. self.assertIsNone(ss.get_channel_binding("tls-unique"))
  791. def test_dealloc_warn(self):
  792. ss = test_wrap_socket(socket.socket(socket.AF_INET))
  793. r = repr(ss)
  794. with self.assertWarns(ResourceWarning) as cm:
  795. ss = None
  796. support.gc_collect()
  797. self.assertIn(r, str(cm.warning.args[0]))
  798. def test_get_default_verify_paths(self):
  799. paths = ssl.get_default_verify_paths()
  800. self.assertEqual(len(paths), 6)
  801. self.assertIsInstance(paths, ssl.DefaultVerifyPaths)
  802. with os_helper.EnvironmentVarGuard() as env:
  803. env["SSL_CERT_DIR"] = CAPATH
  804. env["SSL_CERT_FILE"] = CERTFILE
  805. paths = ssl.get_default_verify_paths()
  806. self.assertEqual(paths.cafile, CERTFILE)
  807. self.assertEqual(paths.capath, CAPATH)
  808. @unittest.skipUnless(sys.platform == "win32", "Windows specific")
  809. def test_enum_certificates(self):
  810. self.assertTrue(ssl.enum_certificates("CA"))
  811. self.assertTrue(ssl.enum_certificates("ROOT"))
  812. self.assertRaises(TypeError, ssl.enum_certificates)
  813. self.assertRaises(WindowsError, ssl.enum_certificates, "")
  814. trust_oids = set()
  815. for storename in ("CA", "ROOT"):
  816. store = ssl.enum_certificates(storename)
  817. self.assertIsInstance(store, list)
  818. for element in store:
  819. self.assertIsInstance(element, tuple)
  820. self.assertEqual(len(element), 3)
  821. cert, enc, trust = element
  822. self.assertIsInstance(cert, bytes)
  823. self.assertIn(enc, {"x509_asn", "pkcs_7_asn"})
  824. self.assertIsInstance(trust, (frozenset, set, bool))
  825. if isinstance(trust, (frozenset, set)):
  826. trust_oids.update(trust)
  827. serverAuth = "1.3.6.1.5.5.7.3.1"
  828. self.assertIn(serverAuth, trust_oids)
  829. @unittest.skipUnless(sys.platform == "win32", "Windows specific")
  830. def test_enum_crls(self):
  831. self.assertTrue(ssl.enum_crls("CA"))
  832. self.assertRaises(TypeError, ssl.enum_crls)
  833. self.assertRaises(WindowsError, ssl.enum_crls, "")
  834. crls = ssl.enum_crls("CA")
  835. self.assertIsInstance(crls, list)
  836. for element in crls:
  837. self.assertIsInstance(element, tuple)
  838. self.assertEqual(len(element), 2)
  839. self.assertIsInstance(element[0], bytes)
  840. self.assertIn(element[1], {"x509_asn", "pkcs_7_asn"})
  841. def test_asn1object(self):
  842. expected = (129, 'serverAuth', 'TLS Web Server Authentication',
  843. '1.3.6.1.5.5.7.3.1')
  844. val = ssl._ASN1Object('1.3.6.1.5.5.7.3.1')
  845. self.assertEqual(val, expected)
  846. self.assertEqual(val.nid, 129)
  847. self.assertEqual(val.shortname, 'serverAuth')
  848. self.assertEqual(val.longname, 'TLS Web Server Authentication')
  849. self.assertEqual(val.oid, '1.3.6.1.5.5.7.3.1')
  850. self.assertIsInstance(val, ssl._ASN1Object)
  851. self.assertRaises(ValueError, ssl._ASN1Object, 'serverAuth')
  852. val = ssl._ASN1Object.fromnid(129)
  853. self.assertEqual(val, expected)
  854. self.assertIsInstance(val, ssl._ASN1Object)
  855. self.assertRaises(ValueError, ssl._ASN1Object.fromnid, -1)
  856. with self.assertRaisesRegex(ValueError, "unknown NID 100000"):
  857. ssl._ASN1Object.fromnid(100000)
  858. for i in range(1000):
  859. try:
  860. obj = ssl._ASN1Object.fromnid(i)
  861. except ValueError:
  862. pass
  863. else:
  864. self.assertIsInstance(obj.nid, int)
  865. self.assertIsInstance(obj.shortname, str)
  866. self.assertIsInstance(obj.longname, str)
  867. self.assertIsInstance(obj.oid, (str, type(None)))
  868. val = ssl._ASN1Object.fromname('TLS Web Server Authentication')
  869. self.assertEqual(val, expected)
  870. self.assertIsInstance(val, ssl._ASN1Object)
  871. self.assertEqual(ssl._ASN1Object.fromname('serverAuth'), expected)
  872. self.assertEqual(ssl._ASN1Object.fromname('1.3.6.1.5.5.7.3.1'),
  873. expected)
  874. with self.assertRaisesRegex(ValueError, "unknown object 'serverauth'"):
  875. ssl._ASN1Object.fromname('serverauth')
  876. def test_purpose_enum(self):
  877. val = ssl._ASN1Object('1.3.6.1.5.5.7.3.1')
  878. self.assertIsInstance(ssl.Purpose.SERVER_AUTH, ssl._ASN1Object)
  879. self.assertEqual(ssl.Purpose.SERVER_AUTH, val)
  880. self.assertEqual(ssl.Purpose.SERVER_AUTH.nid, 129)
  881. self.assertEqual(ssl.Purpose.SERVER_AUTH.shortname, 'serverAuth')
  882. self.assertEqual(ssl.Purpose.SERVER_AUTH.oid,
  883. '1.3.6.1.5.5.7.3.1')
  884. val = ssl._ASN1Object('1.3.6.1.5.5.7.3.2')
  885. self.assertIsInstance(ssl.Purpose.CLIENT_AUTH, ssl._ASN1Object)
  886. self.assertEqual(ssl.Purpose.CLIENT_AUTH, val)
  887. self.assertEqual(ssl.Purpose.CLIENT_AUTH.nid, 130)
  888. self.assertEqual(ssl.Purpose.CLIENT_AUTH.shortname, 'clientAuth')
  889. self.assertEqual(ssl.Purpose.CLIENT_AUTH.oid,
  890. '1.3.6.1.5.5.7.3.2')
  891. def test_unsupported_dtls(self):
  892. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  893. self.addCleanup(s.close)
  894. with self.assertRaises(NotImplementedError) as cx:
  895. test_wrap_socket(s, cert_reqs=ssl.CERT_NONE)
  896. self.assertEqual(str(cx.exception), "only stream sockets are supported")
  897. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  898. with self.assertRaises(NotImplementedError) as cx:
  899. ctx.wrap_socket(s)
  900. self.assertEqual(str(cx.exception), "only stream sockets are supported")
  901. def cert_time_ok(self, timestring, timestamp):
  902. self.assertEqual(ssl.cert_time_to_seconds(timestring), timestamp)
  903. def cert_time_fail(self, timestring):
  904. with self.assertRaises(ValueError):
  905. ssl.cert_time_to_seconds(timestring)
  906. @unittest.skipUnless(utc_offset(),
  907. 'local time needs to be different from UTC')
  908. def test_cert_time_to_seconds_timezone(self):
  909. # Issue #19940: ssl.cert_time_to_seconds() returns wrong
  910. # results if local timezone is not UTC
  911. self.cert_time_ok("May 9 00:00:00 2007 GMT", 1178668800.0)
  912. self.cert_time_ok("Jan 5 09:34:43 2018 GMT", 1515144883.0)
  913. def test_cert_time_to_seconds(self):
  914. timestring = "Jan 5 09:34:43 2018 GMT"
  915. ts = 1515144883.0
  916. self.cert_time_ok(timestring, ts)
  917. # accept keyword parameter, assert its name
  918. self.assertEqual(ssl.cert_time_to_seconds(cert_time=timestring), ts)
  919. # accept both %e and %d (space or zero generated by strftime)
  920. self.cert_time_ok("Jan 05 09:34:43 2018 GMT", ts)
  921. # case-insensitive
  922. self.cert_time_ok("JaN 5 09:34:43 2018 GmT", ts)
  923. self.cert_time_fail("Jan 5 09:34 2018 GMT") # no seconds
  924. self.cert_time_fail("Jan 5 09:34:43 2018") # no GMT
  925. self.cert_time_fail("Jan 5 09:34:43 2018 UTC") # not GMT timezone
  926. self.cert_time_fail("Jan 35 09:34:43 2018 GMT") # invalid day
  927. self.cert_time_fail("Jon 5 09:34:43 2018 GMT") # invalid month
  928. self.cert_time_fail("Jan 5 24:00:00 2018 GMT") # invalid hour
  929. self.cert_time_fail("Jan 5 09:60:43 2018 GMT") # invalid minute
  930. newyear_ts = 1230768000.0
  931. # leap seconds
  932. self.cert_time_ok("Dec 31 23:59:60 2008 GMT", newyear_ts)
  933. # same timestamp
  934. self.cert_time_ok("Jan 1 00:00:00 2009 GMT", newyear_ts)
  935. self.cert_time_ok("Jan 5 09:34:59 2018 GMT", 1515144899)
  936. # allow 60th second (even if it is not a leap second)
  937. self.cert_time_ok("Jan 5 09:34:60 2018 GMT", 1515144900)
  938. # allow 2nd leap second for compatibility with time.strptime()
  939. self.cert_time_ok("Jan 5 09:34:61 2018 GMT", 1515144901)
  940. self.cert_time_fail("Jan 5 09:34:62 2018 GMT") # invalid seconds
  941. # no special treatment for the special value:
  942. # 99991231235959Z (rfc 5280)
  943. self.cert_time_ok("Dec 31 23:59:59 9999 GMT", 253402300799.0)
  944. @support.run_with_locale('LC_ALL', '')
  945. def test_cert_time_to_seconds_locale(self):
  946. # `cert_time_to_seconds()` should be locale independent
  947. def local_february_name():
  948. return time.strftime('%b', (1, 2, 3, 4, 5, 6, 0, 0, 0))
  949. if local_february_name().lower() == 'feb':
  950. self.skipTest("locale-specific month name needs to be "
  951. "different from C locale")
  952. # locale-independent
  953. self.cert_time_ok("Feb 9 00:00:00 2007 GMT", 1170979200.0)
  954. self.cert_time_fail(local_february_name() + " 9 00:00:00 2007 GMT")
  955. def test_connect_ex_error(self):
  956. server = socket.socket(socket.AF_INET)
  957. self.addCleanup(server.close)
  958. port = socket_helper.bind_port(server) # Reserve port but don't listen
  959. s = test_wrap_socket(socket.socket(socket.AF_INET),
  960. cert_reqs=ssl.CERT_REQUIRED)
  961. self.addCleanup(s.close)
  962. rc = s.connect_ex((HOST, port))
  963. # Issue #19919: Windows machines or VMs hosted on Windows
  964. # machines sometimes return EWOULDBLOCK.
  965. errors = (
  966. errno.ECONNREFUSED, errno.EHOSTUNREACH, errno.ETIMEDOUT,
  967. errno.EWOULDBLOCK,
  968. )
  969. self.assertIn(rc, errors)
  970. class ContextTests(unittest.TestCase):
  971. def test_constructor(self):
  972. for protocol in PROTOCOLS:
  973. ssl.SSLContext(protocol)
  974. ctx = ssl.SSLContext()
  975. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
  976. self.assertRaises(ValueError, ssl.SSLContext, -1)
  977. self.assertRaises(ValueError, ssl.SSLContext, 42)
  978. def test_protocol(self):
  979. for proto in PROTOCOLS:
  980. ctx = ssl.SSLContext(proto)
  981. self.assertEqual(ctx.protocol, proto)
  982. def test_ciphers(self):
  983. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  984. ctx.set_ciphers("ALL")
  985. ctx.set_ciphers("DEFAULT")
  986. with self.assertRaisesRegex(ssl.SSLError, "No cipher can be selected"):
  987. ctx.set_ciphers("^$:,;?*'dorothyx")
  988. @unittest.skipUnless(PY_SSL_DEFAULT_CIPHERS == 1,
  989. "Test applies only to Python default ciphers")
  990. def test_python_ciphers(self):
  991. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  992. ciphers = ctx.get_ciphers()
  993. for suite in ciphers:
  994. name = suite['name']
  995. self.assertNotIn("PSK", name)
  996. self.assertNotIn("SRP", name)
  997. self.assertNotIn("MD5", name)
  998. self.assertNotIn("RC4", name)
  999. self.assertNotIn("3DES", name)
  1000. def test_get_ciphers(self):
  1001. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1002. ctx.set_ciphers('AESGCM')
  1003. names = set(d['name'] for d in ctx.get_ciphers())
  1004. self.assertIn('AES256-GCM-SHA384', names)
  1005. self.assertIn('AES128-GCM-SHA256', names)
  1006. def test_options(self):
  1007. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1008. # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value
  1009. default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
  1010. # SSLContext also enables these by default
  1011. default |= (OP_NO_COMPRESSION | OP_CIPHER_SERVER_PREFERENCE |
  1012. OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE |
  1013. OP_ENABLE_MIDDLEBOX_COMPAT |
  1014. OP_IGNORE_UNEXPECTED_EOF)
  1015. self.assertEqual(default, ctx.options)
  1016. ctx.options |= ssl.OP_NO_TLSv1
  1017. self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options)
  1018. ctx.options = (ctx.options & ~ssl.OP_NO_TLSv1)
  1019. self.assertEqual(default, ctx.options)
  1020. ctx.options = 0
  1021. # Ubuntu has OP_NO_SSLv3 forced on by default
  1022. self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3)
  1023. def test_verify_mode_protocol(self):
  1024. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1025. # Default value
  1026. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1027. ctx.verify_mode = ssl.CERT_OPTIONAL
  1028. self.assertEqual(ctx.verify_mode, ssl.CERT_OPTIONAL)
  1029. ctx.verify_mode = ssl.CERT_REQUIRED
  1030. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1031. ctx.verify_mode = ssl.CERT_NONE
  1032. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1033. with self.assertRaises(TypeError):
  1034. ctx.verify_mode = None
  1035. with self.assertRaises(ValueError):
  1036. ctx.verify_mode = 42
  1037. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1038. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1039. self.assertFalse(ctx.check_hostname)
  1040. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1041. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1042. self.assertTrue(ctx.check_hostname)
  1043. def test_hostname_checks_common_name(self):
  1044. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1045. self.assertTrue(ctx.hostname_checks_common_name)
  1046. if ssl.HAS_NEVER_CHECK_COMMON_NAME:
  1047. ctx.hostname_checks_common_name = True
  1048. self.assertTrue(ctx.hostname_checks_common_name)
  1049. ctx.hostname_checks_common_name = False
  1050. self.assertFalse(ctx.hostname_checks_common_name)
  1051. ctx.hostname_checks_common_name = True
  1052. self.assertTrue(ctx.hostname_checks_common_name)
  1053. else:
  1054. with self.assertRaises(AttributeError):
  1055. ctx.hostname_checks_common_name = True
  1056. @requires_minimum_version
  1057. @unittest.skipIf(IS_LIBRESSL, "see bpo-34001")
  1058. def test_min_max_version(self):
  1059. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1060. # OpenSSL default is MINIMUM_SUPPORTED, however some vendors like
  1061. # Fedora override the setting to TLS 1.0.
  1062. minimum_range = {
  1063. # stock OpenSSL
  1064. ssl.TLSVersion.MINIMUM_SUPPORTED,
  1065. # Fedora 29 uses TLS 1.0 by default
  1066. ssl.TLSVersion.TLSv1,
  1067. # RHEL 8 uses TLS 1.2 by default
  1068. ssl.TLSVersion.TLSv1_2
  1069. }
  1070. maximum_range = {
  1071. # stock OpenSSL
  1072. ssl.TLSVersion.MAXIMUM_SUPPORTED,
  1073. # Fedora 32 uses TLS 1.3 by default
  1074. ssl.TLSVersion.TLSv1_3
  1075. }
  1076. self.assertIn(
  1077. ctx.minimum_version, minimum_range
  1078. )
  1079. self.assertIn(
  1080. ctx.maximum_version, maximum_range
  1081. )
  1082. ctx.minimum_version = ssl.TLSVersion.TLSv1_1
  1083. ctx.maximum_version = ssl.TLSVersion.TLSv1_2
  1084. self.assertEqual(
  1085. ctx.minimum_version, ssl.TLSVersion.TLSv1_1
  1086. )
  1087. self.assertEqual(
  1088. ctx.maximum_version, ssl.TLSVersion.TLSv1_2
  1089. )
  1090. ctx.minimum_version = ssl.TLSVersion.MINIMUM_SUPPORTED
  1091. ctx.maximum_version = ssl.TLSVersion.TLSv1
  1092. self.assertEqual(
  1093. ctx.minimum_version, ssl.TLSVersion.MINIMUM_SUPPORTED
  1094. )
  1095. self.assertEqual(
  1096. ctx.maximum_version, ssl.TLSVersion.TLSv1
  1097. )
  1098. ctx.maximum_version = ssl.TLSVersion.MAXIMUM_SUPPORTED
  1099. self.assertEqual(
  1100. ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED
  1101. )
  1102. ctx.maximum_version = ssl.TLSVersion.MINIMUM_SUPPORTED
  1103. self.assertIn(
  1104. ctx.maximum_version,
  1105. {ssl.TLSVersion.TLSv1, ssl.TLSVersion.SSLv3}
  1106. )
  1107. ctx.minimum_version = ssl.TLSVersion.MAXIMUM_SUPPORTED
  1108. self.assertIn(
  1109. ctx.minimum_version,
  1110. {ssl.TLSVersion.TLSv1_2, ssl.TLSVersion.TLSv1_3}
  1111. )
  1112. with self.assertRaises(ValueError):
  1113. ctx.minimum_version = 42
  1114. ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_1)
  1115. self.assertIn(
  1116. ctx.minimum_version, minimum_range
  1117. )
  1118. self.assertEqual(
  1119. ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED
  1120. )
  1121. with self.assertRaises(ValueError):
  1122. ctx.minimum_version = ssl.TLSVersion.MINIMUM_SUPPORTED
  1123. with self.assertRaises(ValueError):
  1124. ctx.maximum_version = ssl.TLSVersion.TLSv1
  1125. @unittest.skipUnless(
  1126. hasattr(ssl.SSLContext, 'security_level'),
  1127. "requires OpenSSL >= 1.1.0"
  1128. )
  1129. def test_security_level(self):
  1130. ctx = ssl.SSLContext()
  1131. # The default security callback allows for levels between 0-5
  1132. # with OpenSSL defaulting to 1, however some vendors override the
  1133. # default value (e.g. Debian defaults to 2)
  1134. security_level_range = {
  1135. 0,
  1136. 1, # OpenSSL default
  1137. 2, # Debian
  1138. 3,
  1139. 4,
  1140. 5,
  1141. }
  1142. self.assertIn(ctx.security_level, security_level_range)
  1143. def test_verify_flags(self):
  1144. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1145. # default value
  1146. tf = getattr(ssl, "VERIFY_X509_TRUSTED_FIRST", 0)
  1147. self.assertEqual(ctx.verify_flags, ssl.VERIFY_DEFAULT | tf)
  1148. ctx.verify_flags = ssl.VERIFY_CRL_CHECK_LEAF
  1149. self.assertEqual(ctx.verify_flags, ssl.VERIFY_CRL_CHECK_LEAF)
  1150. ctx.verify_flags = ssl.VERIFY_CRL_CHECK_CHAIN
  1151. self.assertEqual(ctx.verify_flags, ssl.VERIFY_CRL_CHECK_CHAIN)
  1152. ctx.verify_flags = ssl.VERIFY_DEFAULT
  1153. self.assertEqual(ctx.verify_flags, ssl.VERIFY_DEFAULT)
  1154. ctx.verify_flags = ssl.VERIFY_ALLOW_PROXY_CERTS
  1155. self.assertEqual(ctx.verify_flags, ssl.VERIFY_ALLOW_PROXY_CERTS)
  1156. # supports any value
  1157. ctx.verify_flags = ssl.VERIFY_CRL_CHECK_LEAF | ssl.VERIFY_X509_STRICT
  1158. self.assertEqual(ctx.verify_flags,
  1159. ssl.VERIFY_CRL_CHECK_LEAF | ssl.VERIFY_X509_STRICT)
  1160. with self.assertRaises(TypeError):
  1161. ctx.verify_flags = None
  1162. def test_load_cert_chain(self):
  1163. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1164. # Combined key and cert in a single file
  1165. ctx.load_cert_chain(CERTFILE, keyfile=None)
  1166. ctx.load_cert_chain(CERTFILE, keyfile=CERTFILE)
  1167. self.assertRaises(TypeError, ctx.load_cert_chain, keyfile=CERTFILE)
  1168. with self.assertRaises(OSError) as cm:
  1169. ctx.load_cert_chain(NONEXISTINGCERT)
  1170. self.assertEqual(cm.exception.errno, errno.ENOENT)
  1171. with self.assertRaisesRegex(ssl.SSLError, "PEM lib"):
  1172. ctx.load_cert_chain(BADCERT)
  1173. with self.assertRaisesRegex(ssl.SSLError, "PEM lib"):
  1174. ctx.load_cert_chain(EMPTYCERT)
  1175. # Separate key and cert
  1176. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1177. ctx.load_cert_chain(ONLYCERT, ONLYKEY)
  1178. ctx.load_cert_chain(certfile=ONLYCERT, keyfile=ONLYKEY)
  1179. ctx.load_cert_chain(certfile=BYTES_ONLYCERT, keyfile=BYTES_ONLYKEY)
  1180. with self.assertRaisesRegex(ssl.SSLError, "PEM lib"):
  1181. ctx.load_cert_chain(ONLYCERT)
  1182. with self.assertRaisesRegex(ssl.SSLError, "PEM lib"):
  1183. ctx.load_cert_chain(ONLYKEY)
  1184. with self.assertRaisesRegex(ssl.SSLError, "PEM lib"):
  1185. ctx.load_cert_chain(certfile=ONLYKEY, keyfile=ONLYCERT)
  1186. # Mismatching key and cert
  1187. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1188. with self.assertRaisesRegex(ssl.SSLError, "key values mismatch"):
  1189. ctx.load_cert_chain(CAFILE_CACERT, ONLYKEY)
  1190. # Password protected key and cert
  1191. ctx.load_cert_chain(CERTFILE_PROTECTED, password=KEY_PASSWORD)
  1192. ctx.load_cert_chain(CERTFILE_PROTECTED, password=KEY_PASSWORD.encode())
  1193. ctx.load_cert_chain(CERTFILE_PROTECTED,
  1194. password=bytearray(KEY_PASSWORD.encode()))
  1195. ctx.load_cert_chain(ONLYCERT, ONLYKEY_PROTECTED, KEY_PASSWORD)
  1196. ctx.load_cert_chain(ONLYCERT, ONLYKEY_PROTECTED, KEY_PASSWORD.encode())
  1197. ctx.load_cert_chain(ONLYCERT, ONLYKEY_PROTECTED,
  1198. bytearray(KEY_PASSWORD.encode()))
  1199. with self.assertRaisesRegex(TypeError, "should be a string"):
  1200. ctx.load_cert_chain(CERTFILE_PROTECTED, password=True)
  1201. with self.assertRaises(ssl.SSLError):
  1202. ctx.load_cert_chain(CERTFILE_PROTECTED, password="badpass")
  1203. with self.assertRaisesRegex(ValueError, "cannot be longer"):
  1204. # openssl has a fixed limit on the password buffer.
  1205. # PEM_BUFSIZE is generally set to 1kb.
  1206. # Return a string larger than this.
  1207. ctx.load_cert_chain(CERTFILE_PROTECTED, password=b'a' * 102400)
  1208. # Password callback
  1209. def getpass_unicode():
  1210. return KEY_PASSWORD
  1211. def getpass_bytes():
  1212. return KEY_PASSWORD.encode()
  1213. def getpass_bytearray():
  1214. return bytearray(KEY_PASSWORD.encode())
  1215. def getpass_badpass():
  1216. return "badpass"
  1217. def getpass_huge():
  1218. return b'a' * (1024 * 1024)
  1219. def getpass_bad_type():
  1220. return 9
  1221. def getpass_exception():
  1222. raise Exception('getpass error')
  1223. class GetPassCallable:
  1224. def __call__(self):
  1225. return KEY_PASSWORD
  1226. def getpass(self):
  1227. return KEY_PASSWORD
  1228. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_unicode)
  1229. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_bytes)
  1230. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_bytearray)
  1231. ctx.load_cert_chain(CERTFILE_PROTECTED, password=GetPassCallable())
  1232. ctx.load_cert_chain(CERTFILE_PROTECTED,
  1233. password=GetPassCallable().getpass)
  1234. with self.assertRaises(ssl.SSLError):
  1235. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_badpass)
  1236. with self.assertRaisesRegex(ValueError, "cannot be longer"):
  1237. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_huge)
  1238. with self.assertRaisesRegex(TypeError, "must return a string"):
  1239. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_bad_type)
  1240. with self.assertRaisesRegex(Exception, "getpass error"):
  1241. ctx.load_cert_chain(CERTFILE_PROTECTED, password=getpass_exception)
  1242. # Make sure the password function isn't called if it isn't needed
  1243. ctx.load_cert_chain(CERTFILE, password=getpass_exception)
  1244. def test_load_verify_locations(self):
  1245. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1246. ctx.load_verify_locations(CERTFILE)
  1247. ctx.load_verify_locations(cafile=CERTFILE, capath=None)
  1248. ctx.load_verify_locations(BYTES_CERTFILE)
  1249. ctx.load_verify_locations(cafile=BYTES_CERTFILE, capath=None)
  1250. self.assertRaises(TypeError, ctx.load_verify_locations)
  1251. self.assertRaises(TypeError, ctx.load_verify_locations, None, None, None)
  1252. with self.assertRaises(OSError) as cm:
  1253. ctx.load_verify_locations(NONEXISTINGCERT)
  1254. self.assertEqual(cm.exception.errno, errno.ENOENT)
  1255. with self.assertRaisesRegex(ssl.SSLError, "PEM lib"):
  1256. ctx.load_verify_locations(BADCERT)
  1257. ctx.load_verify_locations(CERTFILE, CAPATH)
  1258. ctx.load_verify_locations(CERTFILE, capath=BYTES_CAPATH)
  1259. # Issue #10989: crash if the second argument type is invalid
  1260. self.assertRaises(TypeError, ctx.load_verify_locations, None, True)
  1261. def test_load_verify_cadata(self):
  1262. # test cadata
  1263. with open(CAFILE_CACERT) as f:
  1264. cacert_pem = f.read()
  1265. cacert_der = ssl.PEM_cert_to_DER_cert(cacert_pem)
  1266. with open(CAFILE_NEURONIO) as f:
  1267. neuronio_pem = f.read()
  1268. neuronio_der = ssl.PEM_cert_to_DER_cert(neuronio_pem)
  1269. # test PEM
  1270. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1271. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 0)
  1272. ctx.load_verify_locations(cadata=cacert_pem)
  1273. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 1)
  1274. ctx.load_verify_locations(cadata=neuronio_pem)
  1275. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1276. # cert already in hash table
  1277. ctx.load_verify_locations(cadata=neuronio_pem)
  1278. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1279. # combined
  1280. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1281. combined = "\n".join((cacert_pem, neuronio_pem))
  1282. ctx.load_verify_locations(cadata=combined)
  1283. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1284. # with junk around the certs
  1285. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1286. combined = ["head", cacert_pem, "other", neuronio_pem, "again",
  1287. neuronio_pem, "tail"]
  1288. ctx.load_verify_locations(cadata="\n".join(combined))
  1289. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1290. # test DER
  1291. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1292. ctx.load_verify_locations(cadata=cacert_der)
  1293. ctx.load_verify_locations(cadata=neuronio_der)
  1294. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1295. # cert already in hash table
  1296. ctx.load_verify_locations(cadata=cacert_der)
  1297. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1298. # combined
  1299. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1300. combined = b"".join((cacert_der, neuronio_der))
  1301. ctx.load_verify_locations(cadata=combined)
  1302. self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2)
  1303. # error cases
  1304. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1305. self.assertRaises(TypeError, ctx.load_verify_locations, cadata=object)
  1306. with self.assertRaisesRegex(ssl.SSLError, "no start line"):
  1307. ctx.load_verify_locations(cadata="broken")
  1308. with self.assertRaisesRegex(ssl.SSLError, "not enough data"):
  1309. ctx.load_verify_locations(cadata=b"broken")
  1310. @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
  1311. def test_load_dh_params(self):
  1312. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1313. ctx.load_dh_params(DHFILE)
  1314. if os.name != 'nt':
  1315. ctx.load_dh_params(BYTES_DHFILE)
  1316. self.assertRaises(TypeError, ctx.load_dh_params)
  1317. self.assertRaises(TypeError, ctx.load_dh_params, None)
  1318. with self.assertRaises(FileNotFoundError) as cm:
  1319. ctx.load_dh_params(NONEXISTINGCERT)
  1320. self.assertEqual(cm.exception.errno, errno.ENOENT)
  1321. with self.assertRaises(ssl.SSLError) as cm:
  1322. ctx.load_dh_params(CERTFILE)
  1323. def test_session_stats(self):
  1324. for proto in PROTOCOLS:
  1325. ctx = ssl.SSLContext(proto)
  1326. self.assertEqual(ctx.session_stats(), {
  1327. 'number': 0,
  1328. 'connect': 0,
  1329. 'connect_good': 0,
  1330. 'connect_renegotiate': 0,
  1331. 'accept': 0,
  1332. 'accept_good': 0,
  1333. 'accept_renegotiate': 0,
  1334. 'hits': 0,
  1335. 'misses': 0,
  1336. 'timeouts': 0,
  1337. 'cache_full': 0,
  1338. })
  1339. def test_set_default_verify_paths(self):
  1340. # There's not much we can do to test that it acts as expected,
  1341. # so just check it doesn't crash or raise an exception.
  1342. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1343. ctx.set_default_verify_paths()
  1344. @unittest.skipUnless(ssl.HAS_ECDH, "ECDH disabled on this OpenSSL build")
  1345. def test_set_ecdh_curve(self):
  1346. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1347. ctx.set_ecdh_curve("prime256v1")
  1348. ctx.set_ecdh_curve(b"prime256v1")
  1349. self.assertRaises(TypeError, ctx.set_ecdh_curve)
  1350. self.assertRaises(TypeError, ctx.set_ecdh_curve, None)
  1351. self.assertRaises(ValueError, ctx.set_ecdh_curve, "foo")
  1352. self.assertRaises(ValueError, ctx.set_ecdh_curve, b"foo")
  1353. @needs_sni
  1354. def test_sni_callback(self):
  1355. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1356. # set_servername_callback expects a callable, or None
  1357. self.assertRaises(TypeError, ctx.set_servername_callback)
  1358. self.assertRaises(TypeError, ctx.set_servername_callback, 4)
  1359. self.assertRaises(TypeError, ctx.set_servername_callback, "")
  1360. self.assertRaises(TypeError, ctx.set_servername_callback, ctx)
  1361. def dummycallback(sock, servername, ctx):
  1362. pass
  1363. ctx.set_servername_callback(None)
  1364. ctx.set_servername_callback(dummycallback)
  1365. @needs_sni
  1366. def test_sni_callback_refcycle(self):
  1367. # Reference cycles through the servername callback are detected
  1368. # and cleared.
  1369. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1370. def dummycallback(sock, servername, ctx, cycle=ctx):
  1371. pass
  1372. ctx.set_servername_callback(dummycallback)
  1373. wr = weakref.ref(ctx)
  1374. del ctx, dummycallback
  1375. gc.collect()
  1376. self.assertIs(wr(), None)
  1377. def test_cert_store_stats(self):
  1378. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1379. self.assertEqual(ctx.cert_store_stats(),
  1380. {'x509_ca': 0, 'crl': 0, 'x509': 0})
  1381. ctx.load_cert_chain(CERTFILE)
  1382. self.assertEqual(ctx.cert_store_stats(),
  1383. {'x509_ca': 0, 'crl': 0, 'x509': 0})
  1384. ctx.load_verify_locations(CERTFILE)
  1385. self.assertEqual(ctx.cert_store_stats(),
  1386. {'x509_ca': 0, 'crl': 0, 'x509': 1})
  1387. ctx.load_verify_locations(CAFILE_CACERT)
  1388. self.assertEqual(ctx.cert_store_stats(),
  1389. {'x509_ca': 1, 'crl': 0, 'x509': 2})
  1390. def test_get_ca_certs(self):
  1391. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1392. self.assertEqual(ctx.get_ca_certs(), [])
  1393. # CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE
  1394. ctx.load_verify_locations(CERTFILE)
  1395. self.assertEqual(ctx.get_ca_certs(), [])
  1396. # but CAFILE_CACERT is a CA cert
  1397. ctx.load_verify_locations(CAFILE_CACERT)
  1398. self.assertEqual(ctx.get_ca_certs(),
  1399. [{'issuer': ((('organizationName', 'Root CA'),),
  1400. (('organizationalUnitName', 'http://www.cacert.org'),),
  1401. (('commonName', 'CA Cert Signing Authority'),),
  1402. (('emailAddress', 'support@cacert.org'),)),
  1403. 'notAfter': asn1time('Mar 29 12:29:49 2033 GMT'),
  1404. 'notBefore': asn1time('Mar 30 12:29:49 2003 GMT'),
  1405. 'serialNumber': '00',
  1406. 'crlDistributionPoints': ('https://www.cacert.org/revoke.crl',),
  1407. 'subject': ((('organizationName', 'Root CA'),),
  1408. (('organizationalUnitName', 'http://www.cacert.org'),),
  1409. (('commonName', 'CA Cert Signing Authority'),),
  1410. (('emailAddress', 'support@cacert.org'),)),
  1411. 'version': 3}])
  1412. with open(CAFILE_CACERT) as f:
  1413. pem = f.read()
  1414. der = ssl.PEM_cert_to_DER_cert(pem)
  1415. self.assertEqual(ctx.get_ca_certs(True), [der])
  1416. def test_load_default_certs(self):
  1417. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1418. ctx.load_default_certs()
  1419. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1420. ctx.load_default_certs(ssl.Purpose.SERVER_AUTH)
  1421. ctx.load_default_certs()
  1422. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1423. ctx.load_default_certs(ssl.Purpose.CLIENT_AUTH)
  1424. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1425. self.assertRaises(TypeError, ctx.load_default_certs, None)
  1426. self.assertRaises(TypeError, ctx.load_default_certs, 'SERVER_AUTH')
  1427. @unittest.skipIf(sys.platform == "win32", "not-Windows specific")
  1428. @unittest.skipIf(IS_LIBRESSL, "LibreSSL doesn't support env vars")
  1429. def test_load_default_certs_env(self):
  1430. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1431. with os_helper.EnvironmentVarGuard() as env:
  1432. env["SSL_CERT_DIR"] = CAPATH
  1433. env["SSL_CERT_FILE"] = CERTFILE
  1434. ctx.load_default_certs()
  1435. self.assertEqual(ctx.cert_store_stats(), {"crl": 0, "x509": 1, "x509_ca": 0})
  1436. @unittest.skipUnless(sys.platform == "win32", "Windows specific")
  1437. @unittest.skipIf(hasattr(sys, "gettotalrefcount"), "Debug build does not share environment between CRTs")
  1438. def test_load_default_certs_env_windows(self):
  1439. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1440. ctx.load_default_certs()
  1441. stats = ctx.cert_store_stats()
  1442. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1443. with os_helper.EnvironmentVarGuard() as env:
  1444. env["SSL_CERT_DIR"] = CAPATH
  1445. env["SSL_CERT_FILE"] = CERTFILE
  1446. ctx.load_default_certs()
  1447. stats["x509"] += 1
  1448. self.assertEqual(ctx.cert_store_stats(), stats)
  1449. def _assert_context_options(self, ctx):
  1450. self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
  1451. if OP_NO_COMPRESSION != 0:
  1452. self.assertEqual(ctx.options & OP_NO_COMPRESSION,
  1453. OP_NO_COMPRESSION)
  1454. if OP_SINGLE_DH_USE != 0:
  1455. self.assertEqual(ctx.options & OP_SINGLE_DH_USE,
  1456. OP_SINGLE_DH_USE)
  1457. if OP_SINGLE_ECDH_USE != 0:
  1458. self.assertEqual(ctx.options & OP_SINGLE_ECDH_USE,
  1459. OP_SINGLE_ECDH_USE)
  1460. if OP_CIPHER_SERVER_PREFERENCE != 0:
  1461. self.assertEqual(ctx.options & OP_CIPHER_SERVER_PREFERENCE,
  1462. OP_CIPHER_SERVER_PREFERENCE)
  1463. def test_create_default_context(self):
  1464. ctx = ssl.create_default_context()
  1465. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
  1466. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1467. self.assertTrue(ctx.check_hostname)
  1468. self._assert_context_options(ctx)
  1469. with open(SIGNING_CA) as f:
  1470. cadata = f.read()
  1471. ctx = ssl.create_default_context(cafile=SIGNING_CA, capath=CAPATH,
  1472. cadata=cadata)
  1473. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
  1474. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1475. self._assert_context_options(ctx)
  1476. ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
  1477. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
  1478. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1479. self._assert_context_options(ctx)
  1480. def test__create_stdlib_context(self):
  1481. ctx = ssl._create_stdlib_context()
  1482. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
  1483. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1484. self.assertFalse(ctx.check_hostname)
  1485. self._assert_context_options(ctx)
  1486. ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1)
  1487. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1)
  1488. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1489. self._assert_context_options(ctx)
  1490. ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1,
  1491. cert_reqs=ssl.CERT_REQUIRED,
  1492. check_hostname=True)
  1493. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1)
  1494. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1495. self.assertTrue(ctx.check_hostname)
  1496. self._assert_context_options(ctx)
  1497. ctx = ssl._create_stdlib_context(purpose=ssl.Purpose.CLIENT_AUTH)
  1498. self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS)
  1499. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1500. self._assert_context_options(ctx)
  1501. def test_check_hostname(self):
  1502. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1503. self.assertFalse(ctx.check_hostname)
  1504. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1505. # Auto set CERT_REQUIRED
  1506. ctx.check_hostname = True
  1507. self.assertTrue(ctx.check_hostname)
  1508. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1509. ctx.check_hostname = False
  1510. ctx.verify_mode = ssl.CERT_REQUIRED
  1511. self.assertFalse(ctx.check_hostname)
  1512. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1513. # Changing verify_mode does not affect check_hostname
  1514. ctx.check_hostname = False
  1515. ctx.verify_mode = ssl.CERT_NONE
  1516. ctx.check_hostname = False
  1517. self.assertFalse(ctx.check_hostname)
  1518. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1519. # Auto set
  1520. ctx.check_hostname = True
  1521. self.assertTrue(ctx.check_hostname)
  1522. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1523. ctx.check_hostname = False
  1524. ctx.verify_mode = ssl.CERT_OPTIONAL
  1525. ctx.check_hostname = False
  1526. self.assertFalse(ctx.check_hostname)
  1527. self.assertEqual(ctx.verify_mode, ssl.CERT_OPTIONAL)
  1528. # keep CERT_OPTIONAL
  1529. ctx.check_hostname = True
  1530. self.assertTrue(ctx.check_hostname)
  1531. self.assertEqual(ctx.verify_mode, ssl.CERT_OPTIONAL)
  1532. # Cannot set CERT_NONE with check_hostname enabled
  1533. with self.assertRaises(ValueError):
  1534. ctx.verify_mode = ssl.CERT_NONE
  1535. ctx.check_hostname = False
  1536. self.assertFalse(ctx.check_hostname)
  1537. ctx.verify_mode = ssl.CERT_NONE
  1538. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1539. def test_context_client_server(self):
  1540. # PROTOCOL_TLS_CLIENT has sane defaults
  1541. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1542. self.assertTrue(ctx.check_hostname)
  1543. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1544. # PROTOCOL_TLS_SERVER has different but also sane defaults
  1545. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1546. self.assertFalse(ctx.check_hostname)
  1547. self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
  1548. def test_context_custom_class(self):
  1549. class MySSLSocket(ssl.SSLSocket):
  1550. pass
  1551. class MySSLObject(ssl.SSLObject):
  1552. pass
  1553. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1554. ctx.sslsocket_class = MySSLSocket
  1555. ctx.sslobject_class = MySSLObject
  1556. with ctx.wrap_socket(socket.socket(), server_side=True) as sock:
  1557. self.assertIsInstance(sock, MySSLSocket)
  1558. obj = ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO())
  1559. self.assertIsInstance(obj, MySSLObject)
  1560. def test_num_tickest(self):
  1561. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  1562. self.assertEqual(ctx.num_tickets, 2)
  1563. ctx.num_tickets = 1
  1564. self.assertEqual(ctx.num_tickets, 1)
  1565. ctx.num_tickets = 0
  1566. self.assertEqual(ctx.num_tickets, 0)
  1567. with self.assertRaises(ValueError):
  1568. ctx.num_tickets = -1
  1569. with self.assertRaises(TypeError):
  1570. ctx.num_tickets = None
  1571. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1572. self.assertEqual(ctx.num_tickets, 2)
  1573. with self.assertRaises(ValueError):
  1574. ctx.num_tickets = 1
  1575. class SSLErrorTests(unittest.TestCase):
  1576. def test_str(self):
  1577. # The str() of a SSLError doesn't include the errno
  1578. e = ssl.SSLError(1, "foo")
  1579. self.assertEqual(str(e), "foo")
  1580. self.assertEqual(e.errno, 1)
  1581. # Same for a subclass
  1582. e = ssl.SSLZeroReturnError(1, "foo")
  1583. self.assertEqual(str(e), "foo")
  1584. self.assertEqual(e.errno, 1)
  1585. @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
  1586. def test_lib_reason(self):
  1587. # Test the library and reason attributes
  1588. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1589. with self.assertRaises(ssl.SSLError) as cm:
  1590. ctx.load_dh_params(CERTFILE)
  1591. self.assertEqual(cm.exception.library, 'PEM')
  1592. self.assertEqual(cm.exception.reason, 'NO_START_LINE')
  1593. s = str(cm.exception)
  1594. self.assertTrue(s.startswith("[PEM: NO_START_LINE] no start line"), s)
  1595. def test_subclass(self):
  1596. # Check that the appropriate SSLError subclass is raised
  1597. # (this only tests one of them)
  1598. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1599. ctx.check_hostname = False
  1600. ctx.verify_mode = ssl.CERT_NONE
  1601. with socket.create_server(("127.0.0.1", 0)) as s:
  1602. c = socket.create_connection(s.getsockname())
  1603. c.setblocking(False)
  1604. with ctx.wrap_socket(c, False, do_handshake_on_connect=False) as c:
  1605. with self.assertRaises(ssl.SSLWantReadError) as cm:
  1606. c.do_handshake()
  1607. s = str(cm.exception)
  1608. self.assertTrue(s.startswith("The operation did not complete (read)"), s)
  1609. # For compatibility
  1610. self.assertEqual(cm.exception.errno, ssl.SSL_ERROR_WANT_READ)
  1611. def test_bad_server_hostname(self):
  1612. ctx = ssl.create_default_context()
  1613. with self.assertRaises(ValueError):
  1614. ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(),
  1615. server_hostname="")
  1616. with self.assertRaises(ValueError):
  1617. ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(),
  1618. server_hostname=".example.org")
  1619. with self.assertRaises(TypeError):
  1620. ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(),
  1621. server_hostname="example.org\x00evil.com")
  1622. class MemoryBIOTests(unittest.TestCase):
  1623. def test_read_write(self):
  1624. bio = ssl.MemoryBIO()
  1625. bio.write(b'foo')
  1626. self.assertEqual(bio.read(), b'foo')
  1627. self.assertEqual(bio.read(), b'')
  1628. bio.write(b'foo')
  1629. bio.write(b'bar')
  1630. self.assertEqual(bio.read(), b'foobar')
  1631. self.assertEqual(bio.read(), b'')
  1632. bio.write(b'baz')
  1633. self.assertEqual(bio.read(2), b'ba')
  1634. self.assertEqual(bio.read(1), b'z')
  1635. self.assertEqual(bio.read(1), b'')
  1636. def test_eof(self):
  1637. bio = ssl.MemoryBIO()
  1638. self.assertFalse(bio.eof)
  1639. self.assertEqual(bio.read(), b'')
  1640. self.assertFalse(bio.eof)
  1641. bio.write(b'foo')
  1642. self.assertFalse(bio.eof)
  1643. bio.write_eof()
  1644. self.assertFalse(bio.eof)
  1645. self.assertEqual(bio.read(2), b'fo')
  1646. self.assertFalse(bio.eof)
  1647. self.assertEqual(bio.read(1), b'o')
  1648. self.assertTrue(bio.eof)
  1649. self.assertEqual(bio.read(), b'')
  1650. self.assertTrue(bio.eof)
  1651. def test_pending(self):
  1652. bio = ssl.MemoryBIO()
  1653. self.assertEqual(bio.pending, 0)
  1654. bio.write(b'foo')
  1655. self.assertEqual(bio.pending, 3)
  1656. for i in range(3):
  1657. bio.read(1)
  1658. self.assertEqual(bio.pending, 3-i-1)
  1659. for i in range(3):
  1660. bio.write(b'x')
  1661. self.assertEqual(bio.pending, i+1)
  1662. bio.read()
  1663. self.assertEqual(bio.pending, 0)
  1664. def test_buffer_types(self):
  1665. bio = ssl.MemoryBIO()
  1666. bio.write(b'foo')
  1667. self.assertEqual(bio.read(), b'foo')
  1668. bio.write(bytearray(b'bar'))
  1669. self.assertEqual(bio.read(), b'bar')
  1670. bio.write(memoryview(b'baz'))
  1671. self.assertEqual(bio.read(), b'baz')
  1672. def test_error_types(self):
  1673. bio = ssl.MemoryBIO()
  1674. self.assertRaises(TypeError, bio.write, 'foo')
  1675. self.assertRaises(TypeError, bio.write, None)
  1676. self.assertRaises(TypeError, bio.write, True)
  1677. self.assertRaises(TypeError, bio.write, 1)
  1678. class SSLObjectTests(unittest.TestCase):
  1679. def test_private_init(self):
  1680. bio = ssl.MemoryBIO()
  1681. with self.assertRaisesRegex(TypeError, "public constructor"):
  1682. ssl.SSLObject(bio, bio)
  1683. def test_unwrap(self):
  1684. client_ctx, server_ctx, hostname = testing_context()
  1685. c_in = ssl.MemoryBIO()
  1686. c_out = ssl.MemoryBIO()
  1687. s_in = ssl.MemoryBIO()
  1688. s_out = ssl.MemoryBIO()
  1689. client = client_ctx.wrap_bio(c_in, c_out, server_hostname=hostname)
  1690. server = server_ctx.wrap_bio(s_in, s_out, server_side=True)
  1691. # Loop on the handshake for a bit to get it settled
  1692. for _ in range(5):
  1693. try:
  1694. client.do_handshake()
  1695. except ssl.SSLWantReadError:
  1696. pass
  1697. if c_out.pending:
  1698. s_in.write(c_out.read())
  1699. try:
  1700. server.do_handshake()
  1701. except ssl.SSLWantReadError:
  1702. pass
  1703. if s_out.pending:
  1704. c_in.write(s_out.read())
  1705. # Now the handshakes should be complete (don't raise WantReadError)
  1706. client.do_handshake()
  1707. server.do_handshake()
  1708. # Now if we unwrap one side unilaterally, it should send close-notify
  1709. # and raise WantReadError:
  1710. with self.assertRaises(ssl.SSLWantReadError):
  1711. client.unwrap()
  1712. # But server.unwrap() does not raise, because it reads the client's
  1713. # close-notify:
  1714. s_in.write(c_out.read())
  1715. server.unwrap()
  1716. # And now that the client gets the server's close-notify, it doesn't
  1717. # raise either.
  1718. c_in.write(s_out.read())
  1719. client.unwrap()
  1720. class SimpleBackgroundTests(unittest.TestCase):
  1721. """Tests that connect to a simple server running in the background"""
  1722. def setUp(self):
  1723. server = ThreadedEchoServer(SIGNED_CERTFILE)
  1724. self.server_addr = (HOST, server.port)
  1725. server.__enter__()
  1726. self.addCleanup(server.__exit__, None, None, None)
  1727. def test_connect(self):
  1728. with test_wrap_socket(socket.socket(socket.AF_INET),
  1729. cert_reqs=ssl.CERT_NONE) as s:
  1730. s.connect(self.server_addr)
  1731. self.assertEqual({}, s.getpeercert())
  1732. self.assertFalse(s.server_side)
  1733. # this should succeed because we specify the root cert
  1734. with test_wrap_socket(socket.socket(socket.AF_INET),
  1735. cert_reqs=ssl.CERT_REQUIRED,
  1736. ca_certs=SIGNING_CA) as s:
  1737. s.connect(self.server_addr)
  1738. self.assertTrue(s.getpeercert())
  1739. self.assertFalse(s.server_side)
  1740. def test_connect_fail(self):
  1741. # This should fail because we have no verification certs. Connection
  1742. # failure crashes ThreadedEchoServer, so run this in an independent
  1743. # test method.
  1744. s = test_wrap_socket(socket.socket(socket.AF_INET),
  1745. cert_reqs=ssl.CERT_REQUIRED)
  1746. self.addCleanup(s.close)
  1747. self.assertRaisesRegex(ssl.SSLError, "certificate verify failed",
  1748. s.connect, self.server_addr)
  1749. def test_connect_ex(self):
  1750. # Issue #11326: check connect_ex() implementation
  1751. s = test_wrap_socket(socket.socket(socket.AF_INET),
  1752. cert_reqs=ssl.CERT_REQUIRED,
  1753. ca_certs=SIGNING_CA)
  1754. self.addCleanup(s.close)
  1755. self.assertEqual(0, s.connect_ex(self.server_addr))
  1756. self.assertTrue(s.getpeercert())
  1757. def test_non_blocking_connect_ex(self):
  1758. # Issue #11326: non-blocking connect_ex() should allow handshake
  1759. # to proceed after the socket gets ready.
  1760. s = test_wrap_socket(socket.socket(socket.AF_INET),
  1761. cert_reqs=ssl.CERT_REQUIRED,
  1762. ca_certs=SIGNING_CA,
  1763. do_handshake_on_connect=False)
  1764. self.addCleanup(s.close)
  1765. s.setblocking(False)
  1766. rc = s.connect_ex(self.server_addr)
  1767. # EWOULDBLOCK under Windows, EINPROGRESS elsewhere
  1768. self.assertIn(rc, (0, errno.EINPROGRESS, errno.EWOULDBLOCK))
  1769. # Wait for connect to finish
  1770. select.select([], [s], [], 5.0)
  1771. # Non-blocking handshake
  1772. while True:
  1773. try:
  1774. s.do_handshake()
  1775. break
  1776. except ssl.SSLWantReadError:
  1777. select.select([s], [], [], 5.0)
  1778. except ssl.SSLWantWriteError:
  1779. select.select([], [s], [], 5.0)
  1780. # SSL established
  1781. self.assertTrue(s.getpeercert())
  1782. def test_connect_with_context(self):
  1783. # Same as test_connect, but with a separately created context
  1784. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1785. with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
  1786. s.connect(self.server_addr)
  1787. self.assertEqual({}, s.getpeercert())
  1788. # Same with a server hostname
  1789. with ctx.wrap_socket(socket.socket(socket.AF_INET),
  1790. server_hostname="dummy") as s:
  1791. s.connect(self.server_addr)
  1792. ctx.verify_mode = ssl.CERT_REQUIRED
  1793. # This should succeed because we specify the root cert
  1794. ctx.load_verify_locations(SIGNING_CA)
  1795. with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
  1796. s.connect(self.server_addr)
  1797. cert = s.getpeercert()
  1798. self.assertTrue(cert)
  1799. def test_connect_with_context_fail(self):
  1800. # This should fail because we have no verification certs. Connection
  1801. # failure crashes ThreadedEchoServer, so run this in an independent
  1802. # test method.
  1803. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1804. ctx.verify_mode = ssl.CERT_REQUIRED
  1805. s = ctx.wrap_socket(socket.socket(socket.AF_INET))
  1806. self.addCleanup(s.close)
  1807. self.assertRaisesRegex(ssl.SSLError, "certificate verify failed",
  1808. s.connect, self.server_addr)
  1809. def test_connect_capath(self):
  1810. # Verify server certificates using the `capath` argument
  1811. # NOTE: the subject hashing algorithm has been changed between
  1812. # OpenSSL 0.9.8n and 1.0.0, as a result the capath directory must
  1813. # contain both versions of each certificate (same content, different
  1814. # filename) for this test to be portable across OpenSSL releases.
  1815. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1816. ctx.verify_mode = ssl.CERT_REQUIRED
  1817. ctx.load_verify_locations(capath=CAPATH)
  1818. with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
  1819. s.connect(self.server_addr)
  1820. cert = s.getpeercert()
  1821. self.assertTrue(cert)
  1822. # Same with a bytes `capath` argument
  1823. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1824. ctx.verify_mode = ssl.CERT_REQUIRED
  1825. ctx.load_verify_locations(capath=BYTES_CAPATH)
  1826. with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
  1827. s.connect(self.server_addr)
  1828. cert = s.getpeercert()
  1829. self.assertTrue(cert)
  1830. def test_connect_cadata(self):
  1831. with open(SIGNING_CA) as f:
  1832. pem = f.read()
  1833. der = ssl.PEM_cert_to_DER_cert(pem)
  1834. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1835. ctx.verify_mode = ssl.CERT_REQUIRED
  1836. ctx.load_verify_locations(cadata=pem)
  1837. with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
  1838. s.connect(self.server_addr)
  1839. cert = s.getpeercert()
  1840. self.assertTrue(cert)
  1841. # same with DER
  1842. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  1843. ctx.verify_mode = ssl.CERT_REQUIRED
  1844. ctx.load_verify_locations(cadata=der)
  1845. with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
  1846. s.connect(self.server_addr)
  1847. cert = s.getpeercert()
  1848. self.assertTrue(cert)
  1849. @unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows")
  1850. def test_makefile_close(self):
  1851. # Issue #5238: creating a file-like object with makefile() shouldn't
  1852. # delay closing the underlying "real socket" (here tested with its
  1853. # file descriptor, hence skipping the test under Windows).
  1854. ss = test_wrap_socket(socket.socket(socket.AF_INET))
  1855. ss.connect(self.server_addr)
  1856. fd = ss.fileno()
  1857. f = ss.makefile()
  1858. f.close()
  1859. # The fd is still open
  1860. os.read(fd, 0)
  1861. # Closing the SSL socket should close the fd too
  1862. ss.close()
  1863. gc.collect()
  1864. with self.assertRaises(OSError) as e:
  1865. os.read(fd, 0)
  1866. self.assertEqual(e.exception.errno, errno.EBADF)
  1867. def test_non_blocking_handshake(self):
  1868. s = socket.socket(socket.AF_INET)
  1869. s.connect(self.server_addr)
  1870. s.setblocking(False)
  1871. s = test_wrap_socket(s,
  1872. cert_reqs=ssl.CERT_NONE,
  1873. do_handshake_on_connect=False)
  1874. self.addCleanup(s.close)
  1875. count = 0
  1876. while True:
  1877. try:
  1878. count += 1
  1879. s.do_handshake()
  1880. break
  1881. except ssl.SSLWantReadError:
  1882. select.select([s], [], [])
  1883. except ssl.SSLWantWriteError:
  1884. select.select([], [s], [])
  1885. if support.verbose:
  1886. sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count)
  1887. def test_get_server_certificate(self):
  1888. _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  1889. def test_get_server_certificate_fail(self):
  1890. # Connection failure crashes ThreadedEchoServer, so run this in an
  1891. # independent test method
  1892. _test_get_server_certificate_fail(self, *self.server_addr)
  1893. def test_ciphers(self):
  1894. with test_wrap_socket(socket.socket(socket.AF_INET),
  1895. cert_reqs=ssl.CERT_NONE, ciphers="ALL") as s:
  1896. s.connect(self.server_addr)
  1897. with test_wrap_socket(socket.socket(socket.AF_INET),
  1898. cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT") as s:
  1899. s.connect(self.server_addr)
  1900. # Error checking can happen at instantiation or when connecting
  1901. with self.assertRaisesRegex(ssl.SSLError, "No cipher can be selected"):
  1902. with socket.socket(socket.AF_INET) as sock:
  1903. s = test_wrap_socket(sock,
  1904. cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx")
  1905. s.connect(self.server_addr)
  1906. def test_get_ca_certs_capath(self):
  1907. # capath certs are loaded on request
  1908. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1909. ctx.load_verify_locations(capath=CAPATH)
  1910. self.assertEqual(ctx.get_ca_certs(), [])
  1911. with ctx.wrap_socket(socket.socket(socket.AF_INET),
  1912. server_hostname='localhost') as s:
  1913. s.connect(self.server_addr)
  1914. cert = s.getpeercert()
  1915. self.assertTrue(cert)
  1916. self.assertEqual(len(ctx.get_ca_certs()), 1)
  1917. @needs_sni
  1918. def test_context_setget(self):
  1919. # Check that the context of a connected socket can be replaced.
  1920. ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1921. ctx1.load_verify_locations(capath=CAPATH)
  1922. ctx2 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1923. ctx2.load_verify_locations(capath=CAPATH)
  1924. s = socket.socket(socket.AF_INET)
  1925. with ctx1.wrap_socket(s, server_hostname='localhost') as ss:
  1926. ss.connect(self.server_addr)
  1927. self.assertIs(ss.context, ctx1)
  1928. self.assertIs(ss._sslobj.context, ctx1)
  1929. ss.context = ctx2
  1930. self.assertIs(ss.context, ctx2)
  1931. self.assertIs(ss._sslobj.context, ctx2)
  1932. def ssl_io_loop(self, sock, incoming, outgoing, func, *args, **kwargs):
  1933. # A simple IO loop. Call func(*args) depending on the error we get
  1934. # (WANT_READ or WANT_WRITE) move data between the socket and the BIOs.
  1935. timeout = kwargs.get('timeout', support.SHORT_TIMEOUT)
  1936. deadline = time.monotonic() + timeout
  1937. count = 0
  1938. while True:
  1939. if time.monotonic() > deadline:
  1940. self.fail("timeout")
  1941. errno = None
  1942. count += 1
  1943. try:
  1944. ret = func(*args)
  1945. except ssl.SSLError as e:
  1946. if e.errno not in (ssl.SSL_ERROR_WANT_READ,
  1947. ssl.SSL_ERROR_WANT_WRITE):
  1948. raise
  1949. errno = e.errno
  1950. # Get any data from the outgoing BIO irrespective of any error, and
  1951. # send it to the socket.
  1952. buf = outgoing.read()
  1953. sock.sendall(buf)
  1954. # If there's no error, we're done. For WANT_READ, we need to get
  1955. # data from the socket and put it in the incoming BIO.
  1956. if errno is None:
  1957. break
  1958. elif errno == ssl.SSL_ERROR_WANT_READ:
  1959. buf = sock.recv(32768)
  1960. if buf:
  1961. incoming.write(buf)
  1962. else:
  1963. incoming.write_eof()
  1964. if support.verbose:
  1965. sys.stdout.write("Needed %d calls to complete %s().\n"
  1966. % (count, func.__name__))
  1967. return ret
  1968. def test_bio_handshake(self):
  1969. sock = socket.socket(socket.AF_INET)
  1970. self.addCleanup(sock.close)
  1971. sock.connect(self.server_addr)
  1972. incoming = ssl.MemoryBIO()
  1973. outgoing = ssl.MemoryBIO()
  1974. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  1975. self.assertTrue(ctx.check_hostname)
  1976. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  1977. ctx.load_verify_locations(SIGNING_CA)
  1978. sslobj = ctx.wrap_bio(incoming, outgoing, False,
  1979. SIGNED_CERTFILE_HOSTNAME)
  1980. self.assertIs(sslobj._sslobj.owner, sslobj)
  1981. self.assertIsNone(sslobj.cipher())
  1982. self.assertIsNone(sslobj.version())
  1983. self.assertIsNotNone(sslobj.shared_ciphers())
  1984. self.assertRaises(ValueError, sslobj.getpeercert)
  1985. if 'tls-unique' in ssl.CHANNEL_BINDING_TYPES:
  1986. self.assertIsNone(sslobj.get_channel_binding('tls-unique'))
  1987. self.ssl_io_loop(sock, incoming, outgoing, sslobj.do_handshake)
  1988. self.assertTrue(sslobj.cipher())
  1989. self.assertIsNotNone(sslobj.shared_ciphers())
  1990. self.assertIsNotNone(sslobj.version())
  1991. self.assertTrue(sslobj.getpeercert())
  1992. if 'tls-unique' in ssl.CHANNEL_BINDING_TYPES:
  1993. self.assertTrue(sslobj.get_channel_binding('tls-unique'))
  1994. try:
  1995. self.ssl_io_loop(sock, incoming, outgoing, sslobj.unwrap)
  1996. except ssl.SSLSyscallError:
  1997. # If the server shuts down the TCP connection without sending a
  1998. # secure shutdown message, this is reported as SSL_ERROR_SYSCALL
  1999. pass
  2000. self.assertRaises(ssl.SSLError, sslobj.write, b'foo')
  2001. def test_bio_read_write_data(self):
  2002. sock = socket.socket(socket.AF_INET)
  2003. self.addCleanup(sock.close)
  2004. sock.connect(self.server_addr)
  2005. incoming = ssl.MemoryBIO()
  2006. outgoing = ssl.MemoryBIO()
  2007. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
  2008. ctx.verify_mode = ssl.CERT_NONE
  2009. sslobj = ctx.wrap_bio(incoming, outgoing, False)
  2010. self.ssl_io_loop(sock, incoming, outgoing, sslobj.do_handshake)
  2011. req = b'FOO\n'
  2012. self.ssl_io_loop(sock, incoming, outgoing, sslobj.write, req)
  2013. buf = self.ssl_io_loop(sock, incoming, outgoing, sslobj.read, 1024)
  2014. self.assertEqual(buf, b'foo\n')
  2015. self.ssl_io_loop(sock, incoming, outgoing, sslobj.unwrap)
  2016. class NetworkedTests(unittest.TestCase):
  2017. def test_timeout_connect_ex(self):
  2018. # Issue #12065: on a timeout, connect_ex() should return the original
  2019. # errno (mimicking the behaviour of non-SSL sockets).
  2020. with socket_helper.transient_internet(REMOTE_HOST):
  2021. s = test_wrap_socket(socket.socket(socket.AF_INET),
  2022. cert_reqs=ssl.CERT_REQUIRED,
  2023. do_handshake_on_connect=False)
  2024. self.addCleanup(s.close)
  2025. s.settimeout(0.0000001)
  2026. rc = s.connect_ex((REMOTE_HOST, 443))
  2027. if rc == 0:
  2028. self.skipTest("REMOTE_HOST responded too quickly")
  2029. elif rc == errno.ENETUNREACH:
  2030. self.skipTest("Network unreachable.")
  2031. self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
  2032. @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'Needs IPv6')
  2033. def test_get_server_certificate_ipv6(self):
  2034. with socket_helper.transient_internet('ipv6.google.com'):
  2035. _test_get_server_certificate(self, 'ipv6.google.com', 443)
  2036. _test_get_server_certificate_fail(self, 'ipv6.google.com', 443)
  2037. def _test_get_server_certificate(test, host, port, cert=None):
  2038. pem = ssl.get_server_certificate((host, port))
  2039. if not pem:
  2040. test.fail("No server certificate on %s:%s!" % (host, port))
  2041. pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  2042. if not pem:
  2043. test.fail("No server certificate on %s:%s!" % (host, port))
  2044. if support.verbose:
  2045. sys.stdout.write("\nVerified certificate for %s:%s is\n%s\n" % (host, port ,pem))
  2046. def _test_get_server_certificate_fail(test, host, port):
  2047. try:
  2048. pem = ssl.get_server_certificate((host, port), ca_certs=CERTFILE)
  2049. except ssl.SSLError as x:
  2050. #should fail
  2051. if support.verbose:
  2052. sys.stdout.write("%s\n" % x)
  2053. else:
  2054. test.fail("Got server certificate %s for %s:%s!" % (pem, host, port))
  2055. from test.ssl_servers import make_https_server
  2056. class ThreadedEchoServer(threading.Thread):
  2057. class ConnectionHandler(threading.Thread):
  2058. """A mildly complicated class, because we want it to work both
  2059. with and without the SSL wrapper around the socket connection, so
  2060. that we can test the STARTTLS functionality."""
  2061. def __init__(self, server, connsock, addr):
  2062. self.server = server
  2063. self.running = False
  2064. self.sock = connsock
  2065. self.addr = addr
  2066. self.sock.setblocking(True)
  2067. self.sslconn = None
  2068. threading.Thread.__init__(self)
  2069. self.daemon = True
  2070. def wrap_conn(self):
  2071. try:
  2072. self.sslconn = self.server.context.wrap_socket(
  2073. self.sock, server_side=True)
  2074. self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol())
  2075. self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol())
  2076. except (ConnectionResetError, BrokenPipeError, ConnectionAbortedError) as e:
  2077. # We treat ConnectionResetError as though it were an
  2078. # SSLError - OpenSSL on Ubuntu abruptly closes the
  2079. # connection when asked to use an unsupported protocol.
  2080. #
  2081. # BrokenPipeError is raised in TLS 1.3 mode, when OpenSSL
  2082. # tries to send session tickets after handshake.
  2083. # https://github.com/openssl/openssl/issues/6342
  2084. #
  2085. # ConnectionAbortedError is raised in TLS 1.3 mode, when OpenSSL
  2086. # tries to send session tickets after handshake when using WinSock.
  2087. self.server.conn_errors.append(str(e))
  2088. if self.server.chatty:
  2089. handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n")
  2090. self.running = False
  2091. self.close()
  2092. return False
  2093. except (ssl.SSLError, OSError) as e:
  2094. # OSError may occur with wrong protocols, e.g. both
  2095. # sides use PROTOCOL_TLS_SERVER.
  2096. #
  2097. # XXX Various errors can have happened here, for example
  2098. # a mismatching protocol version, an invalid certificate,
  2099. # or a low-level bug. This should be made more discriminating.
  2100. #
  2101. # bpo-31323: Store the exception as string to prevent
  2102. # a reference leak: server -> conn_errors -> exception
  2103. # -> traceback -> self (ConnectionHandler) -> server
  2104. self.server.conn_errors.append(str(e))
  2105. if self.server.chatty:
  2106. handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n")
  2107. self.running = False
  2108. self.server.stop()
  2109. self.close()
  2110. return False
  2111. else:
  2112. self.server.shared_ciphers.append(self.sslconn.shared_ciphers())
  2113. if self.server.context.verify_mode == ssl.CERT_REQUIRED:
  2114. cert = self.sslconn.getpeercert()
  2115. if support.verbose and self.server.chatty:
  2116. sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n")
  2117. cert_binary = self.sslconn.getpeercert(True)
  2118. if support.verbose and self.server.chatty:
  2119. sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n")
  2120. cipher = self.sslconn.cipher()
  2121. if support.verbose and self.server.chatty:
  2122. sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n")
  2123. sys.stdout.write(" server: selected protocol is now "
  2124. + str(self.sslconn.selected_npn_protocol()) + "\n")
  2125. return True
  2126. def read(self):
  2127. if self.sslconn:
  2128. return self.sslconn.read()
  2129. else:
  2130. return self.sock.recv(1024)
  2131. def write(self, bytes):
  2132. if self.sslconn:
  2133. return self.sslconn.write(bytes)
  2134. else:
  2135. return self.sock.send(bytes)
  2136. def close(self):
  2137. if self.sslconn:
  2138. self.sslconn.close()
  2139. else:
  2140. self.sock.close()
  2141. def run(self):
  2142. self.running = True
  2143. if not self.server.starttls_server:
  2144. if not self.wrap_conn():
  2145. return
  2146. while self.running:
  2147. try:
  2148. msg = self.read()
  2149. stripped = msg.strip()
  2150. if not stripped:
  2151. # eof, so quit this handler
  2152. self.running = False
  2153. try:
  2154. self.sock = self.sslconn.unwrap()
  2155. except OSError:
  2156. # Many tests shut the TCP connection down
  2157. # without an SSL shutdown. This causes
  2158. # unwrap() to raise OSError with errno=0!
  2159. pass
  2160. else:
  2161. self.sslconn = None
  2162. self.close()
  2163. elif stripped == b'over':
  2164. if support.verbose and self.server.connectionchatty:
  2165. sys.stdout.write(" server: client closed connection\n")
  2166. self.close()
  2167. return
  2168. elif (self.server.starttls_server and
  2169. stripped == b'STARTTLS'):
  2170. if support.verbose and self.server.connectionchatty:
  2171. sys.stdout.write(" server: read STARTTLS from client, sending OK...\n")
  2172. self.write(b"OK\n")
  2173. if not self.wrap_conn():
  2174. return
  2175. elif (self.server.starttls_server and self.sslconn
  2176. and stripped == b'ENDTLS'):
  2177. if support.verbose and self.server.connectionchatty:
  2178. sys.stdout.write(" server: read ENDTLS from client, sending OK...\n")
  2179. self.write(b"OK\n")
  2180. self.sock = self.sslconn.unwrap()
  2181. self.sslconn = None
  2182. if support.verbose and self.server.connectionchatty:
  2183. sys.stdout.write(" server: connection is now unencrypted...\n")
  2184. elif stripped == b'CB tls-unique':
  2185. if support.verbose and self.server.connectionchatty:
  2186. sys.stdout.write(" server: read CB tls-unique from client, sending our CB data...\n")
  2187. data = self.sslconn.get_channel_binding("tls-unique")
  2188. self.write(repr(data).encode("us-ascii") + b"\n")
  2189. elif stripped == b'PHA':
  2190. if support.verbose and self.server.connectionchatty:
  2191. sys.stdout.write(" server: initiating post handshake auth\n")
  2192. try:
  2193. self.sslconn.verify_client_post_handshake()
  2194. except ssl.SSLError as e:
  2195. self.write(repr(e).encode("us-ascii") + b"\n")
  2196. else:
  2197. self.write(b"OK\n")
  2198. elif stripped == b'HASCERT':
  2199. if self.sslconn.getpeercert() is not None:
  2200. self.write(b'TRUE\n')
  2201. else:
  2202. self.write(b'FALSE\n')
  2203. elif stripped == b'GETCERT':
  2204. cert = self.sslconn.getpeercert()
  2205. self.write(repr(cert).encode("us-ascii") + b"\n")
  2206. else:
  2207. if (support.verbose and
  2208. self.server.connectionchatty):
  2209. ctype = (self.sslconn and "encrypted") or "unencrypted"
  2210. sys.stdout.write(" server: read %r (%s), sending back %r (%s)...\n"
  2211. % (msg, ctype, msg.lower(), ctype))
  2212. self.write(msg.lower())
  2213. except (ConnectionResetError, ConnectionAbortedError):
  2214. # XXX: OpenSSL 1.1.1 sometimes raises ConnectionResetError
  2215. # when connection is not shut down gracefully.
  2216. if self.server.chatty and support.verbose:
  2217. sys.stdout.write(
  2218. " Connection reset by peer: {}\n".format(
  2219. self.addr)
  2220. )
  2221. self.close()
  2222. self.running = False
  2223. except ssl.SSLError as err:
  2224. # On Windows sometimes test_pha_required_nocert receives the
  2225. # PEER_DID_NOT_RETURN_A_CERTIFICATE exception
  2226. # before the 'tlsv13 alert certificate required' exception.
  2227. # If the server is stopped when PEER_DID_NOT_RETURN_A_CERTIFICATE
  2228. # is received test_pha_required_nocert fails with ConnectionResetError
  2229. # because the underlying socket is closed
  2230. if 'PEER_DID_NOT_RETURN_A_CERTIFICATE' == err.reason:
  2231. if self.server.chatty and support.verbose:
  2232. sys.stdout.write(err.args[1])
  2233. # test_pha_required_nocert is expecting this exception
  2234. raise ssl.SSLError('tlsv13 alert certificate required')
  2235. except OSError:
  2236. if self.server.chatty:
  2237. handle_error("Test server failure:\n")
  2238. self.close()
  2239. self.running = False
  2240. # normally, we'd just stop here, but for the test
  2241. # harness, we want to stop the server
  2242. self.server.stop()
  2243. def __init__(self, certificate=None, ssl_version=None,
  2244. certreqs=None, cacerts=None,
  2245. chatty=True, connectionchatty=False, starttls_server=False,
  2246. npn_protocols=None, alpn_protocols=None,
  2247. ciphers=None, context=None):
  2248. if context:
  2249. self.context = context
  2250. else:
  2251. self.context = ssl.SSLContext(ssl_version
  2252. if ssl_version is not None
  2253. else ssl.PROTOCOL_TLS_SERVER)
  2254. self.context.verify_mode = (certreqs if certreqs is not None
  2255. else ssl.CERT_NONE)
  2256. if cacerts:
  2257. self.context.load_verify_locations(cacerts)
  2258. if certificate:
  2259. self.context.load_cert_chain(certificate)
  2260. if npn_protocols:
  2261. self.context.set_npn_protocols(npn_protocols)
  2262. if alpn_protocols:
  2263. self.context.set_alpn_protocols(alpn_protocols)
  2264. if ciphers:
  2265. self.context.set_ciphers(ciphers)
  2266. self.chatty = chatty
  2267. self.connectionchatty = connectionchatty
  2268. self.starttls_server = starttls_server
  2269. self.sock = socket.socket()
  2270. self.port = socket_helper.bind_port(self.sock)
  2271. self.flag = None
  2272. self.active = False
  2273. self.selected_npn_protocols = []
  2274. self.selected_alpn_protocols = []
  2275. self.shared_ciphers = []
  2276. self.conn_errors = []
  2277. threading.Thread.__init__(self)
  2278. self.daemon = True
  2279. def __enter__(self):
  2280. self.start(threading.Event())
  2281. self.flag.wait()
  2282. return self
  2283. def __exit__(self, *args):
  2284. self.stop()
  2285. self.join()
  2286. def start(self, flag=None):
  2287. self.flag = flag
  2288. threading.Thread.start(self)
  2289. def run(self):
  2290. self.sock.settimeout(0.05)
  2291. self.sock.listen()
  2292. self.active = True
  2293. if self.flag:
  2294. # signal an event
  2295. self.flag.set()
  2296. while self.active:
  2297. try:
  2298. newconn, connaddr = self.sock.accept()
  2299. if support.verbose and self.chatty:
  2300. sys.stdout.write(' server: new connection from '
  2301. + repr(connaddr) + '\n')
  2302. handler = self.ConnectionHandler(self, newconn, connaddr)
  2303. handler.start()
  2304. handler.join()
  2305. except TimeoutError:
  2306. pass
  2307. except KeyboardInterrupt:
  2308. self.stop()
  2309. except BaseException as e:
  2310. if support.verbose and self.chatty:
  2311. sys.stdout.write(
  2312. ' connection handling failed: ' + repr(e) + '\n')
  2313. self.sock.close()
  2314. def stop(self):
  2315. self.active = False
  2316. class AsyncoreEchoServer(threading.Thread):
  2317. # this one's based on asyncore.dispatcher
  2318. class EchoServer (asyncore.dispatcher):
  2319. class ConnectionHandler(asyncore.dispatcher_with_send):
  2320. def __init__(self, conn, certfile):
  2321. self.socket = test_wrap_socket(conn, server_side=True,
  2322. certfile=certfile,
  2323. do_handshake_on_connect=False)
  2324. asyncore.dispatcher_with_send.__init__(self, self.socket)
  2325. self._ssl_accepting = True
  2326. self._do_ssl_handshake()
  2327. def readable(self):
  2328. if isinstance(self.socket, ssl.SSLSocket):
  2329. while self.socket.pending() > 0:
  2330. self.handle_read_event()
  2331. return True
  2332. def _do_ssl_handshake(self):
  2333. try:
  2334. self.socket.do_handshake()
  2335. except (ssl.SSLWantReadError, ssl.SSLWantWriteError):
  2336. return
  2337. except ssl.SSLEOFError:
  2338. return self.handle_close()
  2339. except ssl.SSLError:
  2340. raise
  2341. except OSError as err:
  2342. if err.args[0] == errno.ECONNABORTED:
  2343. return self.handle_close()
  2344. else:
  2345. self._ssl_accepting = False
  2346. def handle_read(self):
  2347. if self._ssl_accepting:
  2348. self._do_ssl_handshake()
  2349. else:
  2350. data = self.recv(1024)
  2351. if support.verbose:
  2352. sys.stdout.write(" server: read %s from client\n" % repr(data))
  2353. if not data:
  2354. self.close()
  2355. else:
  2356. self.send(data.lower())
  2357. def handle_close(self):
  2358. self.close()
  2359. if support.verbose:
  2360. sys.stdout.write(" server: closed connection %s\n" % self.socket)
  2361. def handle_error(self):
  2362. raise
  2363. def __init__(self, certfile):
  2364. self.certfile = certfile
  2365. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  2366. self.port = socket_helper.bind_port(sock, '')
  2367. asyncore.dispatcher.__init__(self, sock)
  2368. self.listen(5)
  2369. def handle_accepted(self, sock_obj, addr):
  2370. if support.verbose:
  2371. sys.stdout.write(" server: new connection from %s:%s\n" %addr)
  2372. self.ConnectionHandler(sock_obj, self.certfile)
  2373. def handle_error(self):
  2374. raise
  2375. def __init__(self, certfile):
  2376. self.flag = None
  2377. self.active = False
  2378. self.server = self.EchoServer(certfile)
  2379. self.port = self.server.port
  2380. threading.Thread.__init__(self)
  2381. self.daemon = True
  2382. def __str__(self):
  2383. return "<%s %s>" % (self.__class__.__name__, self.server)
  2384. def __enter__(self):
  2385. self.start(threading.Event())
  2386. self.flag.wait()
  2387. return self
  2388. def __exit__(self, *args):
  2389. if support.verbose:
  2390. sys.stdout.write(" cleanup: stopping server.\n")
  2391. self.stop()
  2392. if support.verbose:
  2393. sys.stdout.write(" cleanup: joining server thread.\n")
  2394. self.join()
  2395. if support.verbose:
  2396. sys.stdout.write(" cleanup: successfully joined.\n")
  2397. # make sure that ConnectionHandler is removed from socket_map
  2398. asyncore.close_all(ignore_all=True)
  2399. def start (self, flag=None):
  2400. self.flag = flag
  2401. threading.Thread.start(self)
  2402. def run(self):
  2403. self.active = True
  2404. if self.flag:
  2405. self.flag.set()
  2406. while self.active:
  2407. try:
  2408. asyncore.loop(1)
  2409. except:
  2410. pass
  2411. def stop(self):
  2412. self.active = False
  2413. self.server.close()
  2414. def server_params_test(client_context, server_context, indata=b"FOO\n",
  2415. chatty=True, connectionchatty=False, sni_name=None,
  2416. session=None):
  2417. """
  2418. Launch a server, connect a client to it and try various reads
  2419. and writes.
  2420. """
  2421. stats = {}
  2422. server = ThreadedEchoServer(context=server_context,
  2423. chatty=chatty,
  2424. connectionchatty=False)
  2425. with server:
  2426. with client_context.wrap_socket(socket.socket(),
  2427. server_hostname=sni_name, session=session) as s:
  2428. s.connect((HOST, server.port))
  2429. for arg in [indata, bytearray(indata), memoryview(indata)]:
  2430. if connectionchatty:
  2431. if support.verbose:
  2432. sys.stdout.write(
  2433. " client: sending %r...\n" % indata)
  2434. s.write(arg)
  2435. outdata = s.read()
  2436. if connectionchatty:
  2437. if support.verbose:
  2438. sys.stdout.write(" client: read %r\n" % outdata)
  2439. if outdata != indata.lower():
  2440. raise AssertionError(
  2441. "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n"
  2442. % (outdata[:20], len(outdata),
  2443. indata[:20].lower(), len(indata)))
  2444. s.write(b"over\n")
  2445. if connectionchatty:
  2446. if support.verbose:
  2447. sys.stdout.write(" client: closing connection.\n")
  2448. stats.update({
  2449. 'compression': s.compression(),
  2450. 'cipher': s.cipher(),
  2451. 'peercert': s.getpeercert(),
  2452. 'client_alpn_protocol': s.selected_alpn_protocol(),
  2453. 'client_npn_protocol': s.selected_npn_protocol(),
  2454. 'version': s.version(),
  2455. 'session_reused': s.session_reused,
  2456. 'session': s.session,
  2457. })
  2458. s.close()
  2459. stats['server_alpn_protocols'] = server.selected_alpn_protocols
  2460. stats['server_npn_protocols'] = server.selected_npn_protocols
  2461. stats['server_shared_ciphers'] = server.shared_ciphers
  2462. return stats
  2463. def try_protocol_combo(server_protocol, client_protocol, expect_success,
  2464. certsreqs=None, server_options=0, client_options=0):
  2465. """
  2466. Try to SSL-connect using *client_protocol* to *server_protocol*.
  2467. If *expect_success* is true, assert that the connection succeeds,
  2468. if it's false, assert that the connection fails.
  2469. Also, if *expect_success* is a string, assert that it is the protocol
  2470. version actually used by the connection.
  2471. """
  2472. if certsreqs is None:
  2473. certsreqs = ssl.CERT_NONE
  2474. certtype = {
  2475. ssl.CERT_NONE: "CERT_NONE",
  2476. ssl.CERT_OPTIONAL: "CERT_OPTIONAL",
  2477. ssl.CERT_REQUIRED: "CERT_REQUIRED",
  2478. }[certsreqs]
  2479. if support.verbose:
  2480. formatstr = (expect_success and " %s->%s %s\n") or " {%s->%s} %s\n"
  2481. sys.stdout.write(formatstr %
  2482. (ssl.get_protocol_name(client_protocol),
  2483. ssl.get_protocol_name(server_protocol),
  2484. certtype))
  2485. client_context = ssl.SSLContext(client_protocol)
  2486. client_context.options |= client_options
  2487. server_context = ssl.SSLContext(server_protocol)
  2488. server_context.options |= server_options
  2489. min_version = PROTOCOL_TO_TLS_VERSION.get(client_protocol, None)
  2490. if (min_version is not None
  2491. # SSLContext.minimum_version is only available on recent OpenSSL
  2492. # (setter added in OpenSSL 1.1.0, getter added in OpenSSL 1.1.1)
  2493. and hasattr(server_context, 'minimum_version')
  2494. and server_protocol == ssl.PROTOCOL_TLS
  2495. and server_context.minimum_version > min_version):
  2496. # If OpenSSL configuration is strict and requires more recent TLS
  2497. # version, we have to change the minimum to test old TLS versions.
  2498. server_context.minimum_version = min_version
  2499. # NOTE: we must enable "ALL" ciphers on the client, otherwise an
  2500. # SSLv23 client will send an SSLv3 hello (rather than SSLv2)
  2501. # starting from OpenSSL 1.0.0 (see issue #8322).
  2502. if client_context.protocol == ssl.PROTOCOL_TLS:
  2503. client_context.set_ciphers("ALL")
  2504. seclevel_workaround(server_context, client_context)
  2505. for ctx in (client_context, server_context):
  2506. ctx.verify_mode = certsreqs
  2507. ctx.load_cert_chain(SIGNED_CERTFILE)
  2508. ctx.load_verify_locations(SIGNING_CA)
  2509. try:
  2510. stats = server_params_test(client_context, server_context,
  2511. chatty=False, connectionchatty=False)
  2512. # Protocol mismatch can result in either an SSLError, or a
  2513. # "Connection reset by peer" error.
  2514. except ssl.SSLError:
  2515. if expect_success:
  2516. raise
  2517. except OSError as e:
  2518. if expect_success or e.errno != errno.ECONNRESET:
  2519. raise
  2520. else:
  2521. if not expect_success:
  2522. raise AssertionError(
  2523. "Client protocol %s succeeded with server protocol %s!"
  2524. % (ssl.get_protocol_name(client_protocol),
  2525. ssl.get_protocol_name(server_protocol)))
  2526. elif (expect_success is not True
  2527. and expect_success != stats['version']):
  2528. raise AssertionError("version mismatch: expected %r, got %r"
  2529. % (expect_success, stats['version']))
  2530. class ThreadedTests(unittest.TestCase):
  2531. def test_echo(self):
  2532. """Basic test of an SSL client connecting to a server"""
  2533. if support.verbose:
  2534. sys.stdout.write("\n")
  2535. for protocol in PROTOCOLS:
  2536. if protocol in {ssl.PROTOCOL_TLS_CLIENT, ssl.PROTOCOL_TLS_SERVER}:
  2537. continue
  2538. if not has_tls_protocol(protocol):
  2539. continue
  2540. with self.subTest(protocol=ssl._PROTOCOL_NAMES[protocol]):
  2541. context = ssl.SSLContext(protocol)
  2542. context.load_cert_chain(CERTFILE)
  2543. seclevel_workaround(context)
  2544. server_params_test(context, context,
  2545. chatty=True, connectionchatty=True)
  2546. client_context, server_context, hostname = testing_context()
  2547. with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_SERVER):
  2548. server_params_test(client_context=client_context,
  2549. server_context=server_context,
  2550. chatty=True, connectionchatty=True,
  2551. sni_name=hostname)
  2552. client_context.check_hostname = False
  2553. with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_CLIENT):
  2554. with self.assertRaises(ssl.SSLError) as e:
  2555. server_params_test(client_context=server_context,
  2556. server_context=client_context,
  2557. chatty=True, connectionchatty=True,
  2558. sni_name=hostname)
  2559. self.assertIn('called a function you should not call',
  2560. str(e.exception))
  2561. with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_SERVER):
  2562. with self.assertRaises(ssl.SSLError) as e:
  2563. server_params_test(client_context=server_context,
  2564. server_context=server_context,
  2565. chatty=True, connectionchatty=True)
  2566. self.assertIn('called a function you should not call',
  2567. str(e.exception))
  2568. with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_CLIENT):
  2569. with self.assertRaises(ssl.SSLError) as e:
  2570. server_params_test(client_context=server_context,
  2571. server_context=client_context,
  2572. chatty=True, connectionchatty=True)
  2573. self.assertIn('called a function you should not call',
  2574. str(e.exception))
  2575. def test_getpeercert(self):
  2576. if support.verbose:
  2577. sys.stdout.write("\n")
  2578. client_context, server_context, hostname = testing_context()
  2579. server = ThreadedEchoServer(context=server_context, chatty=False)
  2580. with server:
  2581. with client_context.wrap_socket(socket.socket(),
  2582. do_handshake_on_connect=False,
  2583. server_hostname=hostname) as s:
  2584. s.connect((HOST, server.port))
  2585. # getpeercert() raise ValueError while the handshake isn't
  2586. # done.
  2587. with self.assertRaises(ValueError):
  2588. s.getpeercert()
  2589. s.do_handshake()
  2590. cert = s.getpeercert()
  2591. self.assertTrue(cert, "Can't get peer certificate.")
  2592. cipher = s.cipher()
  2593. if support.verbose:
  2594. sys.stdout.write(pprint.pformat(cert) + '\n')
  2595. sys.stdout.write("Connection cipher is " + str(cipher) + '.\n')
  2596. if 'subject' not in cert:
  2597. self.fail("No subject field in certificate: %s." %
  2598. pprint.pformat(cert))
  2599. if ((('organizationName', 'Python Software Foundation'),)
  2600. not in cert['subject']):
  2601. self.fail(
  2602. "Missing or invalid 'organizationName' field in certificate subject; "
  2603. "should be 'Python Software Foundation'.")
  2604. self.assertIn('notBefore', cert)
  2605. self.assertIn('notAfter', cert)
  2606. before = ssl.cert_time_to_seconds(cert['notBefore'])
  2607. after = ssl.cert_time_to_seconds(cert['notAfter'])
  2608. self.assertLess(before, after)
  2609. def test_crl_check(self):
  2610. if support.verbose:
  2611. sys.stdout.write("\n")
  2612. client_context, server_context, hostname = testing_context()
  2613. tf = getattr(ssl, "VERIFY_X509_TRUSTED_FIRST", 0)
  2614. self.assertEqual(client_context.verify_flags, ssl.VERIFY_DEFAULT | tf)
  2615. # VERIFY_DEFAULT should pass
  2616. server = ThreadedEchoServer(context=server_context, chatty=True)
  2617. with server:
  2618. with client_context.wrap_socket(socket.socket(),
  2619. server_hostname=hostname) as s:
  2620. s.connect((HOST, server.port))
  2621. cert = s.getpeercert()
  2622. self.assertTrue(cert, "Can't get peer certificate.")
  2623. # VERIFY_CRL_CHECK_LEAF without a loaded CRL file fails
  2624. client_context.verify_flags |= ssl.VERIFY_CRL_CHECK_LEAF
  2625. server = ThreadedEchoServer(context=server_context, chatty=True)
  2626. with server:
  2627. with client_context.wrap_socket(socket.socket(),
  2628. server_hostname=hostname) as s:
  2629. with self.assertRaisesRegex(ssl.SSLError,
  2630. "certificate verify failed"):
  2631. s.connect((HOST, server.port))
  2632. # now load a CRL file. The CRL file is signed by the CA.
  2633. client_context.load_verify_locations(CRLFILE)
  2634. server = ThreadedEchoServer(context=server_context, chatty=True)
  2635. with server:
  2636. with client_context.wrap_socket(socket.socket(),
  2637. server_hostname=hostname) as s:
  2638. s.connect((HOST, server.port))
  2639. cert = s.getpeercert()
  2640. self.assertTrue(cert, "Can't get peer certificate.")
  2641. def test_check_hostname(self):
  2642. if support.verbose:
  2643. sys.stdout.write("\n")
  2644. client_context, server_context, hostname = testing_context()
  2645. # correct hostname should verify
  2646. server = ThreadedEchoServer(context=server_context, chatty=True)
  2647. with server:
  2648. with client_context.wrap_socket(socket.socket(),
  2649. server_hostname=hostname) as s:
  2650. s.connect((HOST, server.port))
  2651. cert = s.getpeercert()
  2652. self.assertTrue(cert, "Can't get peer certificate.")
  2653. # incorrect hostname should raise an exception
  2654. server = ThreadedEchoServer(context=server_context, chatty=True)
  2655. with server:
  2656. with client_context.wrap_socket(socket.socket(),
  2657. server_hostname="invalid") as s:
  2658. with self.assertRaisesRegex(
  2659. ssl.CertificateError,
  2660. "Hostname mismatch, certificate is not valid for 'invalid'."):
  2661. s.connect((HOST, server.port))
  2662. # missing server_hostname arg should cause an exception, too
  2663. server = ThreadedEchoServer(context=server_context, chatty=True)
  2664. with server:
  2665. with socket.socket() as s:
  2666. with self.assertRaisesRegex(ValueError,
  2667. "check_hostname requires server_hostname"):
  2668. client_context.wrap_socket(s)
  2669. @unittest.skipUnless(
  2670. ssl.HAS_NEVER_CHECK_COMMON_NAME, "test requires hostname_checks_common_name"
  2671. )
  2672. def test_hostname_checks_common_name(self):
  2673. client_context, server_context, hostname = testing_context()
  2674. assert client_context.hostname_checks_common_name
  2675. client_context.hostname_checks_common_name = False
  2676. # default cert has a SAN
  2677. server = ThreadedEchoServer(context=server_context, chatty=True)
  2678. with server:
  2679. with client_context.wrap_socket(socket.socket(),
  2680. server_hostname=hostname) as s:
  2681. s.connect((HOST, server.port))
  2682. client_context, server_context, hostname = testing_context(NOSANFILE)
  2683. client_context.hostname_checks_common_name = False
  2684. server = ThreadedEchoServer(context=server_context, chatty=True)
  2685. with server:
  2686. with client_context.wrap_socket(socket.socket(),
  2687. server_hostname=hostname) as s:
  2688. with self.assertRaises(ssl.SSLCertVerificationError):
  2689. s.connect((HOST, server.port))
  2690. def test_ecc_cert(self):
  2691. client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  2692. client_context.load_verify_locations(SIGNING_CA)
  2693. client_context.set_ciphers('ECDHE:ECDSA:!NULL:!aRSA')
  2694. hostname = SIGNED_CERTFILE_ECC_HOSTNAME
  2695. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  2696. # load ECC cert
  2697. server_context.load_cert_chain(SIGNED_CERTFILE_ECC)
  2698. # correct hostname should verify
  2699. server = ThreadedEchoServer(context=server_context, chatty=True)
  2700. with server:
  2701. with client_context.wrap_socket(socket.socket(),
  2702. server_hostname=hostname) as s:
  2703. s.connect((HOST, server.port))
  2704. cert = s.getpeercert()
  2705. self.assertTrue(cert, "Can't get peer certificate.")
  2706. cipher = s.cipher()[0].split('-')
  2707. self.assertTrue(cipher[:2], ('ECDHE', 'ECDSA'))
  2708. def test_dual_rsa_ecc(self):
  2709. client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  2710. client_context.load_verify_locations(SIGNING_CA)
  2711. # TODO: fix TLSv1.3 once SSLContext can restrict signature
  2712. # algorithms.
  2713. client_context.options |= ssl.OP_NO_TLSv1_3
  2714. # only ECDSA certs
  2715. client_context.set_ciphers('ECDHE:ECDSA:!NULL:!aRSA')
  2716. hostname = SIGNED_CERTFILE_ECC_HOSTNAME
  2717. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  2718. # load ECC and RSA key/cert pairs
  2719. server_context.load_cert_chain(SIGNED_CERTFILE_ECC)
  2720. server_context.load_cert_chain(SIGNED_CERTFILE)
  2721. # correct hostname should verify
  2722. server = ThreadedEchoServer(context=server_context, chatty=True)
  2723. with server:
  2724. with client_context.wrap_socket(socket.socket(),
  2725. server_hostname=hostname) as s:
  2726. s.connect((HOST, server.port))
  2727. cert = s.getpeercert()
  2728. self.assertTrue(cert, "Can't get peer certificate.")
  2729. cipher = s.cipher()[0].split('-')
  2730. self.assertTrue(cipher[:2], ('ECDHE', 'ECDSA'))
  2731. def test_check_hostname_idn(self):
  2732. if support.verbose:
  2733. sys.stdout.write("\n")
  2734. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  2735. server_context.load_cert_chain(IDNSANSFILE)
  2736. context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  2737. context.verify_mode = ssl.CERT_REQUIRED
  2738. context.check_hostname = True
  2739. context.load_verify_locations(SIGNING_CA)
  2740. # correct hostname should verify, when specified in several
  2741. # different ways
  2742. idn_hostnames = [
  2743. ('könig.idn.pythontest.net',
  2744. 'xn--knig-5qa.idn.pythontest.net'),
  2745. ('xn--knig-5qa.idn.pythontest.net',
  2746. 'xn--knig-5qa.idn.pythontest.net'),
  2747. (b'xn--knig-5qa.idn.pythontest.net',
  2748. 'xn--knig-5qa.idn.pythontest.net'),
  2749. ('königsgäßchen.idna2003.pythontest.net',
  2750. 'xn--knigsgsschen-lcb0w.idna2003.pythontest.net'),
  2751. ('xn--knigsgsschen-lcb0w.idna2003.pythontest.net',
  2752. 'xn--knigsgsschen-lcb0w.idna2003.pythontest.net'),
  2753. (b'xn--knigsgsschen-lcb0w.idna2003.pythontest.net',
  2754. 'xn--knigsgsschen-lcb0w.idna2003.pythontest.net'),
  2755. # ('königsgäßchen.idna2008.pythontest.net',
  2756. # 'xn--knigsgchen-b4a3dun.idna2008.pythontest.net'),
  2757. ('xn--knigsgchen-b4a3dun.idna2008.pythontest.net',
  2758. 'xn--knigsgchen-b4a3dun.idna2008.pythontest.net'),
  2759. (b'xn--knigsgchen-b4a3dun.idna2008.pythontest.net',
  2760. 'xn--knigsgchen-b4a3dun.idna2008.pythontest.net'),
  2761. ]
  2762. for server_hostname, expected_hostname in idn_hostnames:
  2763. server = ThreadedEchoServer(context=server_context, chatty=True)
  2764. with server:
  2765. with context.wrap_socket(socket.socket(),
  2766. server_hostname=server_hostname) as s:
  2767. self.assertEqual(s.server_hostname, expected_hostname)
  2768. s.connect((HOST, server.port))
  2769. cert = s.getpeercert()
  2770. self.assertEqual(s.server_hostname, expected_hostname)
  2771. self.assertTrue(cert, "Can't get peer certificate.")
  2772. # incorrect hostname should raise an exception
  2773. server = ThreadedEchoServer(context=server_context, chatty=True)
  2774. with server:
  2775. with context.wrap_socket(socket.socket(),
  2776. server_hostname="python.example.org") as s:
  2777. with self.assertRaises(ssl.CertificateError):
  2778. s.connect((HOST, server.port))
  2779. def test_wrong_cert_tls12(self):
  2780. """Connecting when the server rejects the client's certificate
  2781. Launch a server with CERT_REQUIRED, and check that trying to
  2782. connect to it with a wrong client certificate fails.
  2783. """
  2784. client_context, server_context, hostname = testing_context()
  2785. # load client cert that is not signed by trusted CA
  2786. client_context.load_cert_chain(CERTFILE)
  2787. # require TLS client authentication
  2788. server_context.verify_mode = ssl.CERT_REQUIRED
  2789. # TLS 1.3 has different handshake
  2790. client_context.maximum_version = ssl.TLSVersion.TLSv1_2
  2791. server = ThreadedEchoServer(
  2792. context=server_context, chatty=True, connectionchatty=True,
  2793. )
  2794. with server, \
  2795. client_context.wrap_socket(socket.socket(),
  2796. server_hostname=hostname) as s:
  2797. try:
  2798. # Expect either an SSL error about the server rejecting
  2799. # the connection, or a low-level connection reset (which
  2800. # sometimes happens on Windows)
  2801. s.connect((HOST, server.port))
  2802. except ssl.SSLError as e:
  2803. if support.verbose:
  2804. sys.stdout.write("\nSSLError is %r\n" % e)
  2805. except OSError as e:
  2806. if e.errno != errno.ECONNRESET:
  2807. raise
  2808. if support.verbose:
  2809. sys.stdout.write("\nsocket.error is %r\n" % e)
  2810. else:
  2811. self.fail("Use of invalid cert should have failed!")
  2812. @requires_tls_version('TLSv1_3')
  2813. def test_wrong_cert_tls13(self):
  2814. client_context, server_context, hostname = testing_context()
  2815. # load client cert that is not signed by trusted CA
  2816. client_context.load_cert_chain(CERTFILE)
  2817. server_context.verify_mode = ssl.CERT_REQUIRED
  2818. server_context.minimum_version = ssl.TLSVersion.TLSv1_3
  2819. client_context.minimum_version = ssl.TLSVersion.TLSv1_3
  2820. server = ThreadedEchoServer(
  2821. context=server_context, chatty=True, connectionchatty=True,
  2822. )
  2823. with server, \
  2824. client_context.wrap_socket(socket.socket(),
  2825. server_hostname=hostname) as s:
  2826. # TLS 1.3 perform client cert exchange after handshake
  2827. s.connect((HOST, server.port))
  2828. try:
  2829. s.write(b'data')
  2830. s.read(4)
  2831. except ssl.SSLError as e:
  2832. if support.verbose:
  2833. sys.stdout.write("\nSSLError is %r\n" % e)
  2834. except OSError as e:
  2835. if e.errno != errno.ECONNRESET:
  2836. raise
  2837. if support.verbose:
  2838. sys.stdout.write("\nsocket.error is %r\n" % e)
  2839. else:
  2840. self.fail("Use of invalid cert should have failed!")
  2841. def test_rude_shutdown(self):
  2842. """A brutal shutdown of an SSL server should raise an OSError
  2843. in the client when attempting handshake.
  2844. """
  2845. listener_ready = threading.Event()
  2846. listener_gone = threading.Event()
  2847. s = socket.socket()
  2848. port = socket_helper.bind_port(s, HOST)
  2849. # `listener` runs in a thread. It sits in an accept() until
  2850. # the main thread connects. Then it rudely closes the socket,
  2851. # and sets Event `listener_gone` to let the main thread know
  2852. # the socket is gone.
  2853. def listener():
  2854. s.listen()
  2855. listener_ready.set()
  2856. newsock, addr = s.accept()
  2857. newsock.close()
  2858. s.close()
  2859. listener_gone.set()
  2860. def connector():
  2861. listener_ready.wait()
  2862. with socket.socket() as c:
  2863. c.connect((HOST, port))
  2864. listener_gone.wait()
  2865. try:
  2866. ssl_sock = test_wrap_socket(c)
  2867. except OSError:
  2868. pass
  2869. else:
  2870. self.fail('connecting to closed SSL socket should have failed')
  2871. t = threading.Thread(target=listener)
  2872. t.start()
  2873. try:
  2874. connector()
  2875. finally:
  2876. t.join()
  2877. def test_ssl_cert_verify_error(self):
  2878. if support.verbose:
  2879. sys.stdout.write("\n")
  2880. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  2881. server_context.load_cert_chain(SIGNED_CERTFILE)
  2882. context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  2883. server = ThreadedEchoServer(context=server_context, chatty=True)
  2884. with server:
  2885. with context.wrap_socket(socket.socket(),
  2886. server_hostname=SIGNED_CERTFILE_HOSTNAME) as s:
  2887. try:
  2888. s.connect((HOST, server.port))
  2889. except ssl.SSLError as e:
  2890. msg = 'unable to get local issuer certificate'
  2891. self.assertIsInstance(e, ssl.SSLCertVerificationError)
  2892. self.assertEqual(e.verify_code, 20)
  2893. self.assertEqual(e.verify_message, msg)
  2894. self.assertIn(msg, repr(e))
  2895. self.assertIn('certificate verify failed', repr(e))
  2896. @requires_tls_version('SSLv2')
  2897. def test_protocol_sslv2(self):
  2898. """Connecting to an SSLv2 server with various client options"""
  2899. if support.verbose:
  2900. sys.stdout.write("\n")
  2901. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True)
  2902. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL)
  2903. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED)
  2904. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False)
  2905. if has_tls_version('SSLv3'):
  2906. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
  2907. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False)
  2908. # SSLv23 client with specific SSL options
  2909. if no_sslv2_implies_sslv3_hello():
  2910. # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs
  2911. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False,
  2912. client_options=ssl.OP_NO_SSLv2)
  2913. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False,
  2914. client_options=ssl.OP_NO_SSLv3)
  2915. try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False,
  2916. client_options=ssl.OP_NO_TLSv1)
  2917. def test_PROTOCOL_TLS(self):
  2918. """Connecting to an SSLv23 server with various client options"""
  2919. if support.verbose:
  2920. sys.stdout.write("\n")
  2921. if has_tls_version('SSLv2'):
  2922. try:
  2923. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv2, True)
  2924. except OSError as x:
  2925. # this fails on some older versions of OpenSSL (0.9.7l, for instance)
  2926. if support.verbose:
  2927. sys.stdout.write(
  2928. " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n"
  2929. % str(x))
  2930. if has_tls_version('SSLv3'):
  2931. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False)
  2932. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True)
  2933. if has_tls_version('TLSv1'):
  2934. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1')
  2935. if has_tls_version('SSLv3'):
  2936. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False, ssl.CERT_OPTIONAL)
  2937. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True, ssl.CERT_OPTIONAL)
  2938. if has_tls_version('TLSv1'):
  2939. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL)
  2940. if has_tls_version('SSLv3'):
  2941. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False, ssl.CERT_REQUIRED)
  2942. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True, ssl.CERT_REQUIRED)
  2943. if has_tls_version('TLSv1'):
  2944. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED)
  2945. # Server with specific SSL options
  2946. if has_tls_version('SSLv3'):
  2947. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False,
  2948. server_options=ssl.OP_NO_SSLv3)
  2949. # Will choose TLSv1
  2950. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True,
  2951. server_options=ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
  2952. if has_tls_version('TLSv1'):
  2953. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, False,
  2954. server_options=ssl.OP_NO_TLSv1)
  2955. @requires_tls_version('SSLv3')
  2956. def test_protocol_sslv3(self):
  2957. """Connecting to an SSLv3 server with various client options"""
  2958. if support.verbose:
  2959. sys.stdout.write("\n")
  2960. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3')
  2961. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_OPTIONAL)
  2962. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_REQUIRED)
  2963. if has_tls_version('SSLv2'):
  2964. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False)
  2965. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS, False,
  2966. client_options=ssl.OP_NO_SSLv3)
  2967. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False)
  2968. if no_sslv2_implies_sslv3_hello():
  2969. # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs
  2970. try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS,
  2971. False, client_options=ssl.OP_NO_SSLv2)
  2972. @requires_tls_version('TLSv1')
  2973. def test_protocol_tlsv1(self):
  2974. """Connecting to a TLSv1 server with various client options"""
  2975. if support.verbose:
  2976. sys.stdout.write("\n")
  2977. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1')
  2978. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL)
  2979. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED)
  2980. if has_tls_version('SSLv2'):
  2981. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False)
  2982. if has_tls_version('SSLv3'):
  2983. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False)
  2984. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLS, False,
  2985. client_options=ssl.OP_NO_TLSv1)
  2986. @requires_tls_version('TLSv1_1')
  2987. def test_protocol_tlsv1_1(self):
  2988. """Connecting to a TLSv1.1 server with various client options.
  2989. Testing against older TLS versions."""
  2990. if support.verbose:
  2991. sys.stdout.write("\n")
  2992. try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1')
  2993. if has_tls_version('SSLv2'):
  2994. try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv2, False)
  2995. if has_tls_version('SSLv3'):
  2996. try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv3, False)
  2997. try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLS, False,
  2998. client_options=ssl.OP_NO_TLSv1_1)
  2999. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1')
  3000. try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_2, False)
  3001. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_1, False)
  3002. @requires_tls_version('TLSv1_2')
  3003. def test_protocol_tlsv1_2(self):
  3004. """Connecting to a TLSv1.2 server with various client options.
  3005. Testing against older TLS versions."""
  3006. if support.verbose:
  3007. sys.stdout.write("\n")
  3008. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2',
  3009. server_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2,
  3010. client_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2,)
  3011. if has_tls_version('SSLv2'):
  3012. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv2, False)
  3013. if has_tls_version('SSLv3'):
  3014. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv3, False)
  3015. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLS, False,
  3016. client_options=ssl.OP_NO_TLSv1_2)
  3017. try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2')
  3018. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1, False)
  3019. try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_2, False)
  3020. try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_1, False)
  3021. try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_2, False)
  3022. def test_starttls(self):
  3023. """Switching from clear text to encrypted and back again."""
  3024. msgs = (b"msg 1", b"MSG 2", b"STARTTLS", b"MSG 3", b"msg 4", b"ENDTLS", b"msg 5", b"msg 6")
  3025. server = ThreadedEchoServer(CERTFILE,
  3026. starttls_server=True,
  3027. chatty=True,
  3028. connectionchatty=True)
  3029. wrapped = False
  3030. with server:
  3031. s = socket.socket()
  3032. s.setblocking(True)
  3033. s.connect((HOST, server.port))
  3034. if support.verbose:
  3035. sys.stdout.write("\n")
  3036. for indata in msgs:
  3037. if support.verbose:
  3038. sys.stdout.write(
  3039. " client: sending %r...\n" % indata)
  3040. if wrapped:
  3041. conn.write(indata)
  3042. outdata = conn.read()
  3043. else:
  3044. s.send(indata)
  3045. outdata = s.recv(1024)
  3046. msg = outdata.strip().lower()
  3047. if indata == b"STARTTLS" and msg.startswith(b"ok"):
  3048. # STARTTLS ok, switch to secure mode
  3049. if support.verbose:
  3050. sys.stdout.write(
  3051. " client: read %r from server, starting TLS...\n"
  3052. % msg)
  3053. conn = test_wrap_socket(s)
  3054. wrapped = True
  3055. elif indata == b"ENDTLS" and msg.startswith(b"ok"):
  3056. # ENDTLS ok, switch back to clear text
  3057. if support.verbose:
  3058. sys.stdout.write(
  3059. " client: read %r from server, ending TLS...\n"
  3060. % msg)
  3061. s = conn.unwrap()
  3062. wrapped = False
  3063. else:
  3064. if support.verbose:
  3065. sys.stdout.write(
  3066. " client: read %r from server\n" % msg)
  3067. if support.verbose:
  3068. sys.stdout.write(" client: closing connection.\n")
  3069. if wrapped:
  3070. conn.write(b"over\n")
  3071. else:
  3072. s.send(b"over\n")
  3073. if wrapped:
  3074. conn.close()
  3075. else:
  3076. s.close()
  3077. def test_socketserver(self):
  3078. """Using socketserver to create and manage SSL connections."""
  3079. server = make_https_server(self, certfile=SIGNED_CERTFILE)
  3080. # try to connect
  3081. if support.verbose:
  3082. sys.stdout.write('\n')
  3083. with open(CERTFILE, 'rb') as f:
  3084. d1 = f.read()
  3085. d2 = ''
  3086. # now fetch the same data from the HTTPS server
  3087. url = 'https://localhost:%d/%s' % (
  3088. server.port, os.path.split(CERTFILE)[1])
  3089. context = ssl.create_default_context(cafile=SIGNING_CA)
  3090. f = urllib.request.urlopen(url, context=context)
  3091. try:
  3092. dlen = f.info().get("content-length")
  3093. if dlen and (int(dlen) > 0):
  3094. d2 = f.read(int(dlen))
  3095. if support.verbose:
  3096. sys.stdout.write(
  3097. " client: read %d bytes from remote server '%s'\n"
  3098. % (len(d2), server))
  3099. finally:
  3100. f.close()
  3101. self.assertEqual(d1, d2)
  3102. def test_asyncore_server(self):
  3103. """Check the example asyncore integration."""
  3104. if support.verbose:
  3105. sys.stdout.write("\n")
  3106. indata = b"FOO\n"
  3107. server = AsyncoreEchoServer(CERTFILE)
  3108. with server:
  3109. s = test_wrap_socket(socket.socket())
  3110. s.connect(('127.0.0.1', server.port))
  3111. if support.verbose:
  3112. sys.stdout.write(
  3113. " client: sending %r...\n" % indata)
  3114. s.write(indata)
  3115. outdata = s.read()
  3116. if support.verbose:
  3117. sys.stdout.write(" client: read %r\n" % outdata)
  3118. if outdata != indata.lower():
  3119. self.fail(
  3120. "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n"
  3121. % (outdata[:20], len(outdata),
  3122. indata[:20].lower(), len(indata)))
  3123. s.write(b"over\n")
  3124. if support.verbose:
  3125. sys.stdout.write(" client: closing connection.\n")
  3126. s.close()
  3127. if support.verbose:
  3128. sys.stdout.write(" client: connection closed.\n")
  3129. def test_recv_send(self):
  3130. """Test recv(), send() and friends."""
  3131. if support.verbose:
  3132. sys.stdout.write("\n")
  3133. server = ThreadedEchoServer(CERTFILE,
  3134. certreqs=ssl.CERT_NONE,
  3135. ssl_version=ssl.PROTOCOL_TLS_SERVER,
  3136. cacerts=CERTFILE,
  3137. chatty=True,
  3138. connectionchatty=False)
  3139. with server:
  3140. s = test_wrap_socket(socket.socket(),
  3141. server_side=False,
  3142. certfile=CERTFILE,
  3143. ca_certs=CERTFILE,
  3144. cert_reqs=ssl.CERT_NONE,
  3145. ssl_version=ssl.PROTOCOL_TLS_CLIENT)
  3146. s.connect((HOST, server.port))
  3147. # helper methods for standardising recv* method signatures
  3148. def _recv_into():
  3149. b = bytearray(b"\0"*100)
  3150. count = s.recv_into(b)
  3151. return b[:count]
  3152. def _recvfrom_into():
  3153. b = bytearray(b"\0"*100)
  3154. count, addr = s.recvfrom_into(b)
  3155. return b[:count]
  3156. # (name, method, expect success?, *args, return value func)
  3157. send_methods = [
  3158. ('send', s.send, True, [], len),
  3159. ('sendto', s.sendto, False, ["some.address"], len),
  3160. ('sendall', s.sendall, True, [], lambda x: None),
  3161. ]
  3162. # (name, method, whether to expect success, *args)
  3163. recv_methods = [
  3164. ('recv', s.recv, True, []),
  3165. ('recvfrom', s.recvfrom, False, ["some.address"]),
  3166. ('recv_into', _recv_into, True, []),
  3167. ('recvfrom_into', _recvfrom_into, False, []),
  3168. ]
  3169. data_prefix = "PREFIX_"
  3170. for (meth_name, send_meth, expect_success, args,
  3171. ret_val_meth) in send_methods:
  3172. indata = (data_prefix + meth_name).encode('ascii')
  3173. try:
  3174. ret = send_meth(indata, *args)
  3175. msg = "sending with {}".format(meth_name)
  3176. self.assertEqual(ret, ret_val_meth(indata), msg=msg)
  3177. outdata = s.read()
  3178. if outdata != indata.lower():
  3179. self.fail(
  3180. "While sending with <<{name:s}>> bad data "
  3181. "<<{outdata:r}>> ({nout:d}) received; "
  3182. "expected <<{indata:r}>> ({nin:d})\n".format(
  3183. name=meth_name, outdata=outdata[:20],
  3184. nout=len(outdata),
  3185. indata=indata[:20], nin=len(indata)
  3186. )
  3187. )
  3188. except ValueError as e:
  3189. if expect_success:
  3190. self.fail(
  3191. "Failed to send with method <<{name:s}>>; "
  3192. "expected to succeed.\n".format(name=meth_name)
  3193. )
  3194. if not str(e).startswith(meth_name):
  3195. self.fail(
  3196. "Method <<{name:s}>> failed with unexpected "
  3197. "exception message: {exp:s}\n".format(
  3198. name=meth_name, exp=e
  3199. )
  3200. )
  3201. for meth_name, recv_meth, expect_success, args in recv_methods:
  3202. indata = (data_prefix + meth_name).encode('ascii')
  3203. try:
  3204. s.send(indata)
  3205. outdata = recv_meth(*args)
  3206. if outdata != indata.lower():
  3207. self.fail(
  3208. "While receiving with <<{name:s}>> bad data "
  3209. "<<{outdata:r}>> ({nout:d}) received; "
  3210. "expected <<{indata:r}>> ({nin:d})\n".format(
  3211. name=meth_name, outdata=outdata[:20],
  3212. nout=len(outdata),
  3213. indata=indata[:20], nin=len(indata)
  3214. )
  3215. )
  3216. except ValueError as e:
  3217. if expect_success:
  3218. self.fail(
  3219. "Failed to receive with method <<{name:s}>>; "
  3220. "expected to succeed.\n".format(name=meth_name)
  3221. )
  3222. if not str(e).startswith(meth_name):
  3223. self.fail(
  3224. "Method <<{name:s}>> failed with unexpected "
  3225. "exception message: {exp:s}\n".format(
  3226. name=meth_name, exp=e
  3227. )
  3228. )
  3229. # consume data
  3230. s.read()
  3231. # read(-1, buffer) is supported, even though read(-1) is not
  3232. data = b"data"
  3233. s.send(data)
  3234. buffer = bytearray(len(data))
  3235. self.assertEqual(s.read(-1, buffer), len(data))
  3236. self.assertEqual(buffer, data)
  3237. # sendall accepts bytes-like objects
  3238. if ctypes is not None:
  3239. ubyte = ctypes.c_ubyte * len(data)
  3240. byteslike = ubyte.from_buffer_copy(data)
  3241. s.sendall(byteslike)
  3242. self.assertEqual(s.read(), data)
  3243. # Make sure sendmsg et al are disallowed to avoid
  3244. # inadvertent disclosure of data and/or corruption
  3245. # of the encrypted data stream
  3246. self.assertRaises(NotImplementedError, s.dup)
  3247. self.assertRaises(NotImplementedError, s.sendmsg, [b"data"])
  3248. self.assertRaises(NotImplementedError, s.recvmsg, 100)
  3249. self.assertRaises(NotImplementedError,
  3250. s.recvmsg_into, [bytearray(100)])
  3251. s.write(b"over\n")
  3252. self.assertRaises(ValueError, s.recv, -1)
  3253. self.assertRaises(ValueError, s.read, -1)
  3254. s.close()
  3255. def test_recv_zero(self):
  3256. server = ThreadedEchoServer(CERTFILE)
  3257. server.__enter__()
  3258. self.addCleanup(server.__exit__, None, None)
  3259. s = socket.create_connection((HOST, server.port))
  3260. self.addCleanup(s.close)
  3261. s = test_wrap_socket(s, suppress_ragged_eofs=False)
  3262. self.addCleanup(s.close)
  3263. # recv/read(0) should return no data
  3264. s.send(b"data")
  3265. self.assertEqual(s.recv(0), b"")
  3266. self.assertEqual(s.read(0), b"")
  3267. self.assertEqual(s.read(), b"data")
  3268. # Should not block if the other end sends no data
  3269. s.setblocking(False)
  3270. self.assertEqual(s.recv(0), b"")
  3271. self.assertEqual(s.recv_into(bytearray()), 0)
  3272. def test_nonblocking_send(self):
  3273. server = ThreadedEchoServer(CERTFILE,
  3274. certreqs=ssl.CERT_NONE,
  3275. ssl_version=ssl.PROTOCOL_TLS_SERVER,
  3276. cacerts=CERTFILE,
  3277. chatty=True,
  3278. connectionchatty=False)
  3279. with server:
  3280. s = test_wrap_socket(socket.socket(),
  3281. server_side=False,
  3282. certfile=CERTFILE,
  3283. ca_certs=CERTFILE,
  3284. cert_reqs=ssl.CERT_NONE,
  3285. ssl_version=ssl.PROTOCOL_TLS_CLIENT)
  3286. s.connect((HOST, server.port))
  3287. s.setblocking(False)
  3288. # If we keep sending data, at some point the buffers
  3289. # will be full and the call will block
  3290. buf = bytearray(8192)
  3291. def fill_buffer():
  3292. while True:
  3293. s.send(buf)
  3294. self.assertRaises((ssl.SSLWantWriteError,
  3295. ssl.SSLWantReadError), fill_buffer)
  3296. # Now read all the output and discard it
  3297. s.setblocking(True)
  3298. s.close()
  3299. def test_handshake_timeout(self):
  3300. # Issue #5103: SSL handshake must respect the socket timeout
  3301. server = socket.socket(socket.AF_INET)
  3302. host = "127.0.0.1"
  3303. port = socket_helper.bind_port(server)
  3304. started = threading.Event()
  3305. finish = False
  3306. def serve():
  3307. server.listen()
  3308. started.set()
  3309. conns = []
  3310. while not finish:
  3311. r, w, e = select.select([server], [], [], 0.1)
  3312. if server in r:
  3313. # Let the socket hang around rather than having
  3314. # it closed by garbage collection.
  3315. conns.append(server.accept()[0])
  3316. for sock in conns:
  3317. sock.close()
  3318. t = threading.Thread(target=serve)
  3319. t.start()
  3320. started.wait()
  3321. try:
  3322. try:
  3323. c = socket.socket(socket.AF_INET)
  3324. c.settimeout(0.2)
  3325. c.connect((host, port))
  3326. # Will attempt handshake and time out
  3327. self.assertRaisesRegex(TimeoutError, "timed out",
  3328. test_wrap_socket, c)
  3329. finally:
  3330. c.close()
  3331. try:
  3332. c = socket.socket(socket.AF_INET)
  3333. c = test_wrap_socket(c)
  3334. c.settimeout(0.2)
  3335. # Will attempt handshake and time out
  3336. self.assertRaisesRegex(TimeoutError, "timed out",
  3337. c.connect, (host, port))
  3338. finally:
  3339. c.close()
  3340. finally:
  3341. finish = True
  3342. t.join()
  3343. server.close()
  3344. def test_server_accept(self):
  3345. # Issue #16357: accept() on a SSLSocket created through
  3346. # SSLContext.wrap_socket().
  3347. context = ssl.SSLContext(ssl.PROTOCOL_TLS)
  3348. context.verify_mode = ssl.CERT_REQUIRED
  3349. context.load_verify_locations(SIGNING_CA)
  3350. context.load_cert_chain(SIGNED_CERTFILE)
  3351. server = socket.socket(socket.AF_INET)
  3352. host = "127.0.0.1"
  3353. port = socket_helper.bind_port(server)
  3354. server = context.wrap_socket(server, server_side=True)
  3355. self.assertTrue(server.server_side)
  3356. evt = threading.Event()
  3357. remote = None
  3358. peer = None
  3359. def serve():
  3360. nonlocal remote, peer
  3361. server.listen()
  3362. # Block on the accept and wait on the connection to close.
  3363. evt.set()
  3364. remote, peer = server.accept()
  3365. remote.send(remote.recv(4))
  3366. t = threading.Thread(target=serve)
  3367. t.start()
  3368. # Client wait until server setup and perform a connect.
  3369. evt.wait()
  3370. client = context.wrap_socket(socket.socket())
  3371. client.connect((host, port))
  3372. client.send(b'data')
  3373. client.recv()
  3374. client_addr = client.getsockname()
  3375. client.close()
  3376. t.join()
  3377. remote.close()
  3378. server.close()
  3379. # Sanity checks.
  3380. self.assertIsInstance(remote, ssl.SSLSocket)
  3381. self.assertEqual(peer, client_addr)
  3382. def test_getpeercert_enotconn(self):
  3383. context = ssl.SSLContext(ssl.PROTOCOL_TLS)
  3384. with context.wrap_socket(socket.socket()) as sock:
  3385. with self.assertRaises(OSError) as cm:
  3386. sock.getpeercert()
  3387. self.assertEqual(cm.exception.errno, errno.ENOTCONN)
  3388. def test_do_handshake_enotconn(self):
  3389. context = ssl.SSLContext(ssl.PROTOCOL_TLS)
  3390. with context.wrap_socket(socket.socket()) as sock:
  3391. with self.assertRaises(OSError) as cm:
  3392. sock.do_handshake()
  3393. self.assertEqual(cm.exception.errno, errno.ENOTCONN)
  3394. def test_no_shared_ciphers(self):
  3395. client_context, server_context, hostname = testing_context()
  3396. # OpenSSL enables all TLS 1.3 ciphers, enforce TLS 1.2 for test
  3397. client_context.options |= ssl.OP_NO_TLSv1_3
  3398. # Force different suites on client and server
  3399. client_context.set_ciphers("AES128")
  3400. server_context.set_ciphers("AES256")
  3401. with ThreadedEchoServer(context=server_context) as server:
  3402. with client_context.wrap_socket(socket.socket(),
  3403. server_hostname=hostname) as s:
  3404. with self.assertRaises(OSError):
  3405. s.connect((HOST, server.port))
  3406. self.assertIn("no shared cipher", server.conn_errors[0])
  3407. def test_version_basic(self):
  3408. """
  3409. Basic tests for SSLSocket.version().
  3410. More tests are done in the test_protocol_*() methods.
  3411. """
  3412. context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  3413. context.check_hostname = False
  3414. context.verify_mode = ssl.CERT_NONE
  3415. with ThreadedEchoServer(CERTFILE,
  3416. ssl_version=ssl.PROTOCOL_TLS_SERVER,
  3417. chatty=False) as server:
  3418. with context.wrap_socket(socket.socket()) as s:
  3419. self.assertIs(s.version(), None)
  3420. self.assertIs(s._sslobj, None)
  3421. s.connect((HOST, server.port))
  3422. self.assertEqual(s.version(), 'TLSv1.3')
  3423. self.assertIs(s._sslobj, None)
  3424. self.assertIs(s.version(), None)
  3425. @requires_tls_version('TLSv1_3')
  3426. def test_tls1_3(self):
  3427. context = ssl.SSLContext(ssl.PROTOCOL_TLS)
  3428. context.load_cert_chain(CERTFILE)
  3429. context.options |= (
  3430. ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2
  3431. )
  3432. with ThreadedEchoServer(context=context) as server:
  3433. with context.wrap_socket(socket.socket()) as s:
  3434. s.connect((HOST, server.port))
  3435. self.assertIn(s.cipher()[0], {
  3436. 'TLS_AES_256_GCM_SHA384',
  3437. 'TLS_CHACHA20_POLY1305_SHA256',
  3438. 'TLS_AES_128_GCM_SHA256',
  3439. })
  3440. self.assertEqual(s.version(), 'TLSv1.3')
  3441. @requires_minimum_version
  3442. @requires_tls_version('TLSv1_2')
  3443. def test_min_max_version_tlsv1_2(self):
  3444. client_context, server_context, hostname = testing_context()
  3445. # client TLSv1.0 to 1.2
  3446. client_context.minimum_version = ssl.TLSVersion.TLSv1
  3447. client_context.maximum_version = ssl.TLSVersion.TLSv1_2
  3448. # server only TLSv1.2
  3449. server_context.minimum_version = ssl.TLSVersion.TLSv1_2
  3450. server_context.maximum_version = ssl.TLSVersion.TLSv1_2
  3451. with ThreadedEchoServer(context=server_context) as server:
  3452. with client_context.wrap_socket(socket.socket(),
  3453. server_hostname=hostname) as s:
  3454. s.connect((HOST, server.port))
  3455. self.assertEqual(s.version(), 'TLSv1.2')
  3456. @requires_minimum_version
  3457. @requires_tls_version('TLSv1_1')
  3458. def test_min_max_version_tlsv1_1(self):
  3459. client_context, server_context, hostname = testing_context()
  3460. # client 1.0 to 1.2, server 1.0 to 1.1
  3461. client_context.minimum_version = ssl.TLSVersion.TLSv1
  3462. client_context.maximum_version = ssl.TLSVersion.TLSv1_2
  3463. server_context.minimum_version = ssl.TLSVersion.TLSv1
  3464. server_context.maximum_version = ssl.TLSVersion.TLSv1_1
  3465. seclevel_workaround(client_context, server_context)
  3466. with ThreadedEchoServer(context=server_context) as server:
  3467. with client_context.wrap_socket(socket.socket(),
  3468. server_hostname=hostname) as s:
  3469. s.connect((HOST, server.port))
  3470. self.assertEqual(s.version(), 'TLSv1.1')
  3471. @requires_minimum_version
  3472. @requires_tls_version('TLSv1_2')
  3473. @requires_tls_version('TLSv1')
  3474. def test_min_max_version_mismatch(self):
  3475. client_context, server_context, hostname = testing_context()
  3476. # client 1.0, server 1.2 (mismatch)
  3477. server_context.maximum_version = ssl.TLSVersion.TLSv1_2
  3478. server_context.minimum_version = ssl.TLSVersion.TLSv1_2
  3479. client_context.maximum_version = ssl.TLSVersion.TLSv1
  3480. client_context.minimum_version = ssl.TLSVersion.TLSv1
  3481. seclevel_workaround(client_context, server_context)
  3482. with ThreadedEchoServer(context=server_context) as server:
  3483. with client_context.wrap_socket(socket.socket(),
  3484. server_hostname=hostname) as s:
  3485. with self.assertRaises(ssl.SSLError) as e:
  3486. s.connect((HOST, server.port))
  3487. self.assertIn("alert", str(e.exception))
  3488. @requires_minimum_version
  3489. @requires_tls_version('SSLv3')
  3490. def test_min_max_version_sslv3(self):
  3491. client_context, server_context, hostname = testing_context()
  3492. server_context.minimum_version = ssl.TLSVersion.SSLv3
  3493. client_context.minimum_version = ssl.TLSVersion.SSLv3
  3494. client_context.maximum_version = ssl.TLSVersion.SSLv3
  3495. seclevel_workaround(client_context, server_context)
  3496. with ThreadedEchoServer(context=server_context) as server:
  3497. with client_context.wrap_socket(socket.socket(),
  3498. server_hostname=hostname) as s:
  3499. s.connect((HOST, server.port))
  3500. self.assertEqual(s.version(), 'SSLv3')
  3501. @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL")
  3502. def test_default_ecdh_curve(self):
  3503. # Issue #21015: elliptic curve-based Diffie Hellman key exchange
  3504. # should be enabled by default on SSL contexts.
  3505. context = ssl.SSLContext(ssl.PROTOCOL_TLS)
  3506. context.load_cert_chain(CERTFILE)
  3507. # TLSv1.3 defaults to PFS key agreement and no longer has KEA in
  3508. # cipher name.
  3509. context.options |= ssl.OP_NO_TLSv1_3
  3510. # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled
  3511. # explicitly using the 'ECCdraft' cipher alias. Otherwise,
  3512. # our default cipher list should prefer ECDH-based ciphers
  3513. # automatically.
  3514. with ThreadedEchoServer(context=context) as server:
  3515. with context.wrap_socket(socket.socket()) as s:
  3516. s.connect((HOST, server.port))
  3517. self.assertIn("ECDH", s.cipher()[0])
  3518. @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES,
  3519. "'tls-unique' channel binding not available")
  3520. def test_tls_unique_channel_binding(self):
  3521. """Test tls-unique channel binding."""
  3522. if support.verbose:
  3523. sys.stdout.write("\n")
  3524. client_context, server_context, hostname = testing_context()
  3525. server = ThreadedEchoServer(context=server_context,
  3526. chatty=True,
  3527. connectionchatty=False)
  3528. with server:
  3529. with client_context.wrap_socket(
  3530. socket.socket(),
  3531. server_hostname=hostname) as s:
  3532. s.connect((HOST, server.port))
  3533. # get the data
  3534. cb_data = s.get_channel_binding("tls-unique")
  3535. if support.verbose:
  3536. sys.stdout.write(
  3537. " got channel binding data: {0!r}\n".format(cb_data))
  3538. # check if it is sane
  3539. self.assertIsNotNone(cb_data)
  3540. if s.version() == 'TLSv1.3':
  3541. self.assertEqual(len(cb_data), 48)
  3542. else:
  3543. self.assertEqual(len(cb_data), 12) # True for TLSv1
  3544. # and compare with the peers version
  3545. s.write(b"CB tls-unique\n")
  3546. peer_data_repr = s.read().strip()
  3547. self.assertEqual(peer_data_repr,
  3548. repr(cb_data).encode("us-ascii"))
  3549. # now, again
  3550. with client_context.wrap_socket(
  3551. socket.socket(),
  3552. server_hostname=hostname) as s:
  3553. s.connect((HOST, server.port))
  3554. new_cb_data = s.get_channel_binding("tls-unique")
  3555. if support.verbose:
  3556. sys.stdout.write(
  3557. "got another channel binding data: {0!r}\n".format(
  3558. new_cb_data)
  3559. )
  3560. # is it really unique
  3561. self.assertNotEqual(cb_data, new_cb_data)
  3562. self.assertIsNotNone(cb_data)
  3563. if s.version() == 'TLSv1.3':
  3564. self.assertEqual(len(cb_data), 48)
  3565. else:
  3566. self.assertEqual(len(cb_data), 12) # True for TLSv1
  3567. s.write(b"CB tls-unique\n")
  3568. peer_data_repr = s.read().strip()
  3569. self.assertEqual(peer_data_repr,
  3570. repr(new_cb_data).encode("us-ascii"))
  3571. def test_compression(self):
  3572. client_context, server_context, hostname = testing_context()
  3573. stats = server_params_test(client_context, server_context,
  3574. chatty=True, connectionchatty=True,
  3575. sni_name=hostname)
  3576. if support.verbose:
  3577. sys.stdout.write(" got compression: {!r}\n".format(stats['compression']))
  3578. self.assertIn(stats['compression'], { None, 'ZLIB', 'RLE' })
  3579. @unittest.skipUnless(hasattr(ssl, 'OP_NO_COMPRESSION'),
  3580. "ssl.OP_NO_COMPRESSION needed for this test")
  3581. def test_compression_disabled(self):
  3582. client_context, server_context, hostname = testing_context()
  3583. client_context.options |= ssl.OP_NO_COMPRESSION
  3584. server_context.options |= ssl.OP_NO_COMPRESSION
  3585. stats = server_params_test(client_context, server_context,
  3586. chatty=True, connectionchatty=True,
  3587. sni_name=hostname)
  3588. self.assertIs(stats['compression'], None)
  3589. @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
  3590. def test_dh_params(self):
  3591. # Check we can get a connection with ephemeral Diffie-Hellman
  3592. client_context, server_context, hostname = testing_context()
  3593. # test scenario needs TLS <= 1.2
  3594. client_context.options |= ssl.OP_NO_TLSv1_3
  3595. server_context.load_dh_params(DHFILE)
  3596. server_context.set_ciphers("kEDH")
  3597. server_context.options |= ssl.OP_NO_TLSv1_3
  3598. stats = server_params_test(client_context, server_context,
  3599. chatty=True, connectionchatty=True,
  3600. sni_name=hostname)
  3601. cipher = stats["cipher"][0]
  3602. parts = cipher.split("-")
  3603. if "ADH" not in parts and "EDH" not in parts and "DHE" not in parts:
  3604. self.fail("Non-DH cipher: " + cipher[0])
  3605. @unittest.skipUnless(HAVE_SECP_CURVES, "needs secp384r1 curve support")
  3606. @unittest.skipIf(IS_OPENSSL_1_1_1, "TODO: Test doesn't work on 1.1.1")
  3607. def test_ecdh_curve(self):
  3608. # server secp384r1, client auto
  3609. client_context, server_context, hostname = testing_context()
  3610. server_context.set_ecdh_curve("secp384r1")
  3611. server_context.set_ciphers("ECDHE:!eNULL:!aNULL")
  3612. server_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
  3613. stats = server_params_test(client_context, server_context,
  3614. chatty=True, connectionchatty=True,
  3615. sni_name=hostname)
  3616. # server auto, client secp384r1
  3617. client_context, server_context, hostname = testing_context()
  3618. client_context.set_ecdh_curve("secp384r1")
  3619. server_context.set_ciphers("ECDHE:!eNULL:!aNULL")
  3620. server_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
  3621. stats = server_params_test(client_context, server_context,
  3622. chatty=True, connectionchatty=True,
  3623. sni_name=hostname)
  3624. # server / client curve mismatch
  3625. client_context, server_context, hostname = testing_context()
  3626. client_context.set_ecdh_curve("prime256v1")
  3627. server_context.set_ecdh_curve("secp384r1")
  3628. server_context.set_ciphers("ECDHE:!eNULL:!aNULL")
  3629. server_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1
  3630. try:
  3631. server_params_test(client_context, server_context,
  3632. chatty=True, connectionchatty=True,
  3633. sni_name=hostname)
  3634. except ssl.SSLError:
  3635. self.fail("mismatch curve did not fail")
  3636. def test_selected_alpn_protocol(self):
  3637. # selected_alpn_protocol() is None unless ALPN is used.
  3638. client_context, server_context, hostname = testing_context()
  3639. stats = server_params_test(client_context, server_context,
  3640. chatty=True, connectionchatty=True,
  3641. sni_name=hostname)
  3642. self.assertIs(stats['client_alpn_protocol'], None)
  3643. def test_selected_alpn_protocol_if_server_uses_alpn(self):
  3644. # selected_alpn_protocol() is None unless ALPN is used by the client.
  3645. client_context, server_context, hostname = testing_context()
  3646. server_context.set_alpn_protocols(['foo', 'bar'])
  3647. stats = server_params_test(client_context, server_context,
  3648. chatty=True, connectionchatty=True,
  3649. sni_name=hostname)
  3650. self.assertIs(stats['client_alpn_protocol'], None)
  3651. def test_alpn_protocols(self):
  3652. server_protocols = ['foo', 'bar', 'milkshake']
  3653. protocol_tests = [
  3654. (['foo', 'bar'], 'foo'),
  3655. (['bar', 'foo'], 'foo'),
  3656. (['milkshake'], 'milkshake'),
  3657. (['http/3.0', 'http/4.0'], None)
  3658. ]
  3659. for client_protocols, expected in protocol_tests:
  3660. client_context, server_context, hostname = testing_context()
  3661. server_context.set_alpn_protocols(server_protocols)
  3662. client_context.set_alpn_protocols(client_protocols)
  3663. try:
  3664. stats = server_params_test(client_context,
  3665. server_context,
  3666. chatty=True,
  3667. connectionchatty=True,
  3668. sni_name=hostname)
  3669. except ssl.SSLError as e:
  3670. stats = e
  3671. msg = "failed trying %s (s) and %s (c).\n" \
  3672. "was expecting %s, but got %%s from the %%s" \
  3673. % (str(server_protocols), str(client_protocols),
  3674. str(expected))
  3675. client_result = stats['client_alpn_protocol']
  3676. self.assertEqual(client_result, expected,
  3677. msg % (client_result, "client"))
  3678. server_result = stats['server_alpn_protocols'][-1] \
  3679. if len(stats['server_alpn_protocols']) else 'nothing'
  3680. self.assertEqual(server_result, expected,
  3681. msg % (server_result, "server"))
  3682. def test_selected_npn_protocol(self):
  3683. # selected_npn_protocol() is None unless NPN is used
  3684. client_context, server_context, hostname = testing_context()
  3685. stats = server_params_test(client_context, server_context,
  3686. chatty=True, connectionchatty=True,
  3687. sni_name=hostname)
  3688. self.assertIs(stats['client_npn_protocol'], None)
  3689. def test_npn_protocols(self):
  3690. assert not ssl.HAS_NPN
  3691. def sni_contexts(self):
  3692. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  3693. server_context.load_cert_chain(SIGNED_CERTFILE)
  3694. other_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  3695. other_context.load_cert_chain(SIGNED_CERTFILE2)
  3696. client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  3697. client_context.load_verify_locations(SIGNING_CA)
  3698. return server_context, other_context, client_context
  3699. def check_common_name(self, stats, name):
  3700. cert = stats['peercert']
  3701. self.assertIn((('commonName', name),), cert['subject'])
  3702. @needs_sni
  3703. def test_sni_callback(self):
  3704. calls = []
  3705. server_context, other_context, client_context = self.sni_contexts()
  3706. client_context.check_hostname = False
  3707. def servername_cb(ssl_sock, server_name, initial_context):
  3708. calls.append((server_name, initial_context))
  3709. if server_name is not None:
  3710. ssl_sock.context = other_context
  3711. server_context.set_servername_callback(servername_cb)
  3712. stats = server_params_test(client_context, server_context,
  3713. chatty=True,
  3714. sni_name='supermessage')
  3715. # The hostname was fetched properly, and the certificate was
  3716. # changed for the connection.
  3717. self.assertEqual(calls, [("supermessage", server_context)])
  3718. # CERTFILE4 was selected
  3719. self.check_common_name(stats, 'fakehostname')
  3720. calls = []
  3721. # The callback is called with server_name=None
  3722. stats = server_params_test(client_context, server_context,
  3723. chatty=True,
  3724. sni_name=None)
  3725. self.assertEqual(calls, [(None, server_context)])
  3726. self.check_common_name(stats, SIGNED_CERTFILE_HOSTNAME)
  3727. # Check disabling the callback
  3728. calls = []
  3729. server_context.set_servername_callback(None)
  3730. stats = server_params_test(client_context, server_context,
  3731. chatty=True,
  3732. sni_name='notfunny')
  3733. # Certificate didn't change
  3734. self.check_common_name(stats, SIGNED_CERTFILE_HOSTNAME)
  3735. self.assertEqual(calls, [])
  3736. @needs_sni
  3737. def test_sni_callback_alert(self):
  3738. # Returning a TLS alert is reflected to the connecting client
  3739. server_context, other_context, client_context = self.sni_contexts()
  3740. def cb_returning_alert(ssl_sock, server_name, initial_context):
  3741. return ssl.ALERT_DESCRIPTION_ACCESS_DENIED
  3742. server_context.set_servername_callback(cb_returning_alert)
  3743. with self.assertRaises(ssl.SSLError) as cm:
  3744. stats = server_params_test(client_context, server_context,
  3745. chatty=False,
  3746. sni_name='supermessage')
  3747. self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_ACCESS_DENIED')
  3748. @needs_sni
  3749. def test_sni_callback_raising(self):
  3750. # Raising fails the connection with a TLS handshake failure alert.
  3751. server_context, other_context, client_context = self.sni_contexts()
  3752. def cb_raising(ssl_sock, server_name, initial_context):
  3753. 1/0
  3754. server_context.set_servername_callback(cb_raising)
  3755. with support.catch_unraisable_exception() as catch:
  3756. with self.assertRaises(ssl.SSLError) as cm:
  3757. stats = server_params_test(client_context, server_context,
  3758. chatty=False,
  3759. sni_name='supermessage')
  3760. self.assertEqual(cm.exception.reason,
  3761. 'SSLV3_ALERT_HANDSHAKE_FAILURE')
  3762. self.assertEqual(catch.unraisable.exc_type, ZeroDivisionError)
  3763. @needs_sni
  3764. def test_sni_callback_wrong_return_type(self):
  3765. # Returning the wrong return type terminates the TLS connection
  3766. # with an internal error alert.
  3767. server_context, other_context, client_context = self.sni_contexts()
  3768. def cb_wrong_return_type(ssl_sock, server_name, initial_context):
  3769. return "foo"
  3770. server_context.set_servername_callback(cb_wrong_return_type)
  3771. with support.catch_unraisable_exception() as catch:
  3772. with self.assertRaises(ssl.SSLError) as cm:
  3773. stats = server_params_test(client_context, server_context,
  3774. chatty=False,
  3775. sni_name='supermessage')
  3776. self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_INTERNAL_ERROR')
  3777. self.assertEqual(catch.unraisable.exc_type, TypeError)
  3778. def test_shared_ciphers(self):
  3779. client_context, server_context, hostname = testing_context()
  3780. client_context.set_ciphers("AES128:AES256")
  3781. server_context.set_ciphers("AES256")
  3782. expected_algs = [
  3783. "AES256", "AES-256",
  3784. # TLS 1.3 ciphers are always enabled
  3785. "TLS_CHACHA20", "TLS_AES",
  3786. ]
  3787. stats = server_params_test(client_context, server_context,
  3788. sni_name=hostname)
  3789. ciphers = stats['server_shared_ciphers'][0]
  3790. self.assertGreater(len(ciphers), 0)
  3791. for name, tls_version, bits in ciphers:
  3792. if not any(alg in name for alg in expected_algs):
  3793. self.fail(name)
  3794. def test_read_write_after_close_raises_valuerror(self):
  3795. client_context, server_context, hostname = testing_context()
  3796. server = ThreadedEchoServer(context=server_context, chatty=False)
  3797. with server:
  3798. s = client_context.wrap_socket(socket.socket(),
  3799. server_hostname=hostname)
  3800. s.connect((HOST, server.port))
  3801. s.close()
  3802. self.assertRaises(ValueError, s.read, 1024)
  3803. self.assertRaises(ValueError, s.write, b'hello')
  3804. def test_sendfile(self):
  3805. TEST_DATA = b"x" * 512
  3806. with open(os_helper.TESTFN, 'wb') as f:
  3807. f.write(TEST_DATA)
  3808. self.addCleanup(os_helper.unlink, os_helper.TESTFN)
  3809. context = ssl.SSLContext(ssl.PROTOCOL_TLS)
  3810. context.verify_mode = ssl.CERT_REQUIRED
  3811. context.load_verify_locations(SIGNING_CA)
  3812. context.load_cert_chain(SIGNED_CERTFILE)
  3813. server = ThreadedEchoServer(context=context, chatty=False)
  3814. with server:
  3815. with context.wrap_socket(socket.socket()) as s:
  3816. s.connect((HOST, server.port))
  3817. with open(os_helper.TESTFN, 'rb') as file:
  3818. s.sendfile(file)
  3819. self.assertEqual(s.recv(1024), TEST_DATA)
  3820. def test_session(self):
  3821. client_context, server_context, hostname = testing_context()
  3822. # TODO: sessions aren't compatible with TLSv1.3 yet
  3823. client_context.options |= ssl.OP_NO_TLSv1_3
  3824. # first connection without session
  3825. stats = server_params_test(client_context, server_context,
  3826. sni_name=hostname)
  3827. session = stats['session']
  3828. self.assertTrue(session.id)
  3829. self.assertGreater(session.time, 0)
  3830. self.assertGreater(session.timeout, 0)
  3831. self.assertTrue(session.has_ticket)
  3832. self.assertGreater(session.ticket_lifetime_hint, 0)
  3833. self.assertFalse(stats['session_reused'])
  3834. sess_stat = server_context.session_stats()
  3835. self.assertEqual(sess_stat['accept'], 1)
  3836. self.assertEqual(sess_stat['hits'], 0)
  3837. # reuse session
  3838. stats = server_params_test(client_context, server_context,
  3839. session=session, sni_name=hostname)
  3840. sess_stat = server_context.session_stats()
  3841. self.assertEqual(sess_stat['accept'], 2)
  3842. self.assertEqual(sess_stat['hits'], 1)
  3843. self.assertTrue(stats['session_reused'])
  3844. session2 = stats['session']
  3845. self.assertEqual(session2.id, session.id)
  3846. self.assertEqual(session2, session)
  3847. self.assertIsNot(session2, session)
  3848. self.assertGreaterEqual(session2.time, session.time)
  3849. self.assertGreaterEqual(session2.timeout, session.timeout)
  3850. # another one without session
  3851. stats = server_params_test(client_context, server_context,
  3852. sni_name=hostname)
  3853. self.assertFalse(stats['session_reused'])
  3854. session3 = stats['session']
  3855. self.assertNotEqual(session3.id, session.id)
  3856. self.assertNotEqual(session3, session)
  3857. sess_stat = server_context.session_stats()
  3858. self.assertEqual(sess_stat['accept'], 3)
  3859. self.assertEqual(sess_stat['hits'], 1)
  3860. # reuse session again
  3861. stats = server_params_test(client_context, server_context,
  3862. session=session, sni_name=hostname)
  3863. self.assertTrue(stats['session_reused'])
  3864. session4 = stats['session']
  3865. self.assertEqual(session4.id, session.id)
  3866. self.assertEqual(session4, session)
  3867. self.assertGreaterEqual(session4.time, session.time)
  3868. self.assertGreaterEqual(session4.timeout, session.timeout)
  3869. sess_stat = server_context.session_stats()
  3870. self.assertEqual(sess_stat['accept'], 4)
  3871. self.assertEqual(sess_stat['hits'], 2)
  3872. def test_session_handling(self):
  3873. client_context, server_context, hostname = testing_context()
  3874. client_context2, _, _ = testing_context()
  3875. # TODO: session reuse does not work with TLSv1.3
  3876. client_context.options |= ssl.OP_NO_TLSv1_3
  3877. client_context2.options |= ssl.OP_NO_TLSv1_3
  3878. server = ThreadedEchoServer(context=server_context, chatty=False)
  3879. with server:
  3880. with client_context.wrap_socket(socket.socket(),
  3881. server_hostname=hostname) as s:
  3882. # session is None before handshake
  3883. self.assertEqual(s.session, None)
  3884. self.assertEqual(s.session_reused, None)
  3885. s.connect((HOST, server.port))
  3886. session = s.session
  3887. self.assertTrue(session)
  3888. with self.assertRaises(TypeError) as e:
  3889. s.session = object
  3890. self.assertEqual(str(e.exception), 'Value is not a SSLSession.')
  3891. with client_context.wrap_socket(socket.socket(),
  3892. server_hostname=hostname) as s:
  3893. s.connect((HOST, server.port))
  3894. # cannot set session after handshake
  3895. with self.assertRaises(ValueError) as e:
  3896. s.session = session
  3897. self.assertEqual(str(e.exception),
  3898. 'Cannot set session after handshake.')
  3899. with client_context.wrap_socket(socket.socket(),
  3900. server_hostname=hostname) as s:
  3901. # can set session before handshake and before the
  3902. # connection was established
  3903. s.session = session
  3904. s.connect((HOST, server.port))
  3905. self.assertEqual(s.session.id, session.id)
  3906. self.assertEqual(s.session, session)
  3907. self.assertEqual(s.session_reused, True)
  3908. with client_context2.wrap_socket(socket.socket(),
  3909. server_hostname=hostname) as s:
  3910. # cannot re-use session with a different SSLContext
  3911. with self.assertRaises(ValueError) as e:
  3912. s.session = session
  3913. s.connect((HOST, server.port))
  3914. self.assertEqual(str(e.exception),
  3915. 'Session refers to a different SSLContext.')
  3916. @unittest.skipUnless(has_tls_version('TLSv1_3'), "Test needs TLS 1.3")
  3917. class TestPostHandshakeAuth(unittest.TestCase):
  3918. def test_pha_setter(self):
  3919. protocols = [
  3920. ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_SERVER, ssl.PROTOCOL_TLS_CLIENT
  3921. ]
  3922. for protocol in protocols:
  3923. ctx = ssl.SSLContext(protocol)
  3924. self.assertEqual(ctx.post_handshake_auth, False)
  3925. ctx.post_handshake_auth = True
  3926. self.assertEqual(ctx.post_handshake_auth, True)
  3927. ctx.verify_mode = ssl.CERT_REQUIRED
  3928. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  3929. self.assertEqual(ctx.post_handshake_auth, True)
  3930. ctx.post_handshake_auth = False
  3931. self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
  3932. self.assertEqual(ctx.post_handshake_auth, False)
  3933. ctx.verify_mode = ssl.CERT_OPTIONAL
  3934. ctx.post_handshake_auth = True
  3935. self.assertEqual(ctx.verify_mode, ssl.CERT_OPTIONAL)
  3936. self.assertEqual(ctx.post_handshake_auth, True)
  3937. def test_pha_required(self):
  3938. client_context, server_context, hostname = testing_context()
  3939. server_context.post_handshake_auth = True
  3940. server_context.verify_mode = ssl.CERT_REQUIRED
  3941. client_context.post_handshake_auth = True
  3942. client_context.load_cert_chain(SIGNED_CERTFILE)
  3943. server = ThreadedEchoServer(context=server_context, chatty=False)
  3944. with server:
  3945. with client_context.wrap_socket(socket.socket(),
  3946. server_hostname=hostname) as s:
  3947. s.connect((HOST, server.port))
  3948. s.write(b'HASCERT')
  3949. self.assertEqual(s.recv(1024), b'FALSE\n')
  3950. s.write(b'PHA')
  3951. self.assertEqual(s.recv(1024), b'OK\n')
  3952. s.write(b'HASCERT')
  3953. self.assertEqual(s.recv(1024), b'TRUE\n')
  3954. # PHA method just returns true when cert is already available
  3955. s.write(b'PHA')
  3956. self.assertEqual(s.recv(1024), b'OK\n')
  3957. s.write(b'GETCERT')
  3958. cert_text = s.recv(4096).decode('us-ascii')
  3959. self.assertIn('Python Software Foundation CA', cert_text)
  3960. def test_pha_required_nocert(self):
  3961. client_context, server_context, hostname = testing_context()
  3962. server_context.post_handshake_auth = True
  3963. server_context.verify_mode = ssl.CERT_REQUIRED
  3964. client_context.post_handshake_auth = True
  3965. # Ignore expected SSLError in ConnectionHandler of ThreadedEchoServer
  3966. # (it is only raised sometimes on Windows)
  3967. with threading_helper.catch_threading_exception() as cm:
  3968. server = ThreadedEchoServer(context=server_context, chatty=False)
  3969. with server:
  3970. with client_context.wrap_socket(socket.socket(),
  3971. server_hostname=hostname) as s:
  3972. s.connect((HOST, server.port))
  3973. s.write(b'PHA')
  3974. # receive CertificateRequest
  3975. self.assertEqual(s.recv(1024), b'OK\n')
  3976. # send empty Certificate + Finish
  3977. s.write(b'HASCERT')
  3978. # receive alert
  3979. with self.assertRaisesRegex(
  3980. ssl.SSLError,
  3981. 'tlsv13 alert certificate required'):
  3982. s.recv(1024)
  3983. def test_pha_optional(self):
  3984. if support.verbose:
  3985. sys.stdout.write("\n")
  3986. client_context, server_context, hostname = testing_context()
  3987. server_context.post_handshake_auth = True
  3988. server_context.verify_mode = ssl.CERT_REQUIRED
  3989. client_context.post_handshake_auth = True
  3990. client_context.load_cert_chain(SIGNED_CERTFILE)
  3991. # check CERT_OPTIONAL
  3992. server_context.verify_mode = ssl.CERT_OPTIONAL
  3993. server = ThreadedEchoServer(context=server_context, chatty=False)
  3994. with server:
  3995. with client_context.wrap_socket(socket.socket(),
  3996. server_hostname=hostname) as s:
  3997. s.connect((HOST, server.port))
  3998. s.write(b'HASCERT')
  3999. self.assertEqual(s.recv(1024), b'FALSE\n')
  4000. s.write(b'PHA')
  4001. self.assertEqual(s.recv(1024), b'OK\n')
  4002. s.write(b'HASCERT')
  4003. self.assertEqual(s.recv(1024), b'TRUE\n')
  4004. def test_pha_optional_nocert(self):
  4005. if support.verbose:
  4006. sys.stdout.write("\n")
  4007. client_context, server_context, hostname = testing_context()
  4008. server_context.post_handshake_auth = True
  4009. server_context.verify_mode = ssl.CERT_OPTIONAL
  4010. client_context.post_handshake_auth = True
  4011. server = ThreadedEchoServer(context=server_context, chatty=False)
  4012. with server:
  4013. with client_context.wrap_socket(socket.socket(),
  4014. server_hostname=hostname) as s:
  4015. s.connect((HOST, server.port))
  4016. s.write(b'HASCERT')
  4017. self.assertEqual(s.recv(1024), b'FALSE\n')
  4018. s.write(b'PHA')
  4019. self.assertEqual(s.recv(1024), b'OK\n')
  4020. # optional doesn't fail when client does not have a cert
  4021. s.write(b'HASCERT')
  4022. self.assertEqual(s.recv(1024), b'FALSE\n')
  4023. def test_pha_no_pha_client(self):
  4024. client_context, server_context, hostname = testing_context()
  4025. server_context.post_handshake_auth = True
  4026. server_context.verify_mode = ssl.CERT_REQUIRED
  4027. client_context.load_cert_chain(SIGNED_CERTFILE)
  4028. server = ThreadedEchoServer(context=server_context, chatty=False)
  4029. with server:
  4030. with client_context.wrap_socket(socket.socket(),
  4031. server_hostname=hostname) as s:
  4032. s.connect((HOST, server.port))
  4033. with self.assertRaisesRegex(ssl.SSLError, 'not server'):
  4034. s.verify_client_post_handshake()
  4035. s.write(b'PHA')
  4036. self.assertIn(b'extension not received', s.recv(1024))
  4037. def test_pha_no_pha_server(self):
  4038. # server doesn't have PHA enabled, cert is requested in handshake
  4039. client_context, server_context, hostname = testing_context()
  4040. server_context.verify_mode = ssl.CERT_REQUIRED
  4041. client_context.post_handshake_auth = True
  4042. client_context.load_cert_chain(SIGNED_CERTFILE)
  4043. server = ThreadedEchoServer(context=server_context, chatty=False)
  4044. with server:
  4045. with client_context.wrap_socket(socket.socket(),
  4046. server_hostname=hostname) as s:
  4047. s.connect((HOST, server.port))
  4048. s.write(b'HASCERT')
  4049. self.assertEqual(s.recv(1024), b'TRUE\n')
  4050. # PHA doesn't fail if there is already a cert
  4051. s.write(b'PHA')
  4052. self.assertEqual(s.recv(1024), b'OK\n')
  4053. s.write(b'HASCERT')
  4054. self.assertEqual(s.recv(1024), b'TRUE\n')
  4055. def test_pha_not_tls13(self):
  4056. # TLS 1.2
  4057. client_context, server_context, hostname = testing_context()
  4058. server_context.verify_mode = ssl.CERT_REQUIRED
  4059. client_context.maximum_version = ssl.TLSVersion.TLSv1_2
  4060. client_context.post_handshake_auth = True
  4061. client_context.load_cert_chain(SIGNED_CERTFILE)
  4062. server = ThreadedEchoServer(context=server_context, chatty=False)
  4063. with server:
  4064. with client_context.wrap_socket(socket.socket(),
  4065. server_hostname=hostname) as s:
  4066. s.connect((HOST, server.port))
  4067. # PHA fails for TLS != 1.3
  4068. s.write(b'PHA')
  4069. self.assertIn(b'WRONG_SSL_VERSION', s.recv(1024))
  4070. def test_bpo37428_pha_cert_none(self):
  4071. # verify that post_handshake_auth does not implicitly enable cert
  4072. # validation.
  4073. hostname = SIGNED_CERTFILE_HOSTNAME
  4074. client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  4075. client_context.post_handshake_auth = True
  4076. client_context.load_cert_chain(SIGNED_CERTFILE)
  4077. # no cert validation and CA on client side
  4078. client_context.check_hostname = False
  4079. client_context.verify_mode = ssl.CERT_NONE
  4080. server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
  4081. server_context.load_cert_chain(SIGNED_CERTFILE)
  4082. server_context.load_verify_locations(SIGNING_CA)
  4083. server_context.post_handshake_auth = True
  4084. server_context.verify_mode = ssl.CERT_REQUIRED
  4085. server = ThreadedEchoServer(context=server_context, chatty=False)
  4086. with server:
  4087. with client_context.wrap_socket(socket.socket(),
  4088. server_hostname=hostname) as s:
  4089. s.connect((HOST, server.port))
  4090. s.write(b'HASCERT')
  4091. self.assertEqual(s.recv(1024), b'FALSE\n')
  4092. s.write(b'PHA')
  4093. self.assertEqual(s.recv(1024), b'OK\n')
  4094. s.write(b'HASCERT')
  4095. self.assertEqual(s.recv(1024), b'TRUE\n')
  4096. # server cert has not been validated
  4097. self.assertEqual(s.getpeercert(), {})
  4098. HAS_KEYLOG = hasattr(ssl.SSLContext, 'keylog_filename')
  4099. requires_keylog = unittest.skipUnless(
  4100. HAS_KEYLOG, 'test requires OpenSSL 1.1.1 with keylog callback')
  4101. class TestSSLDebug(unittest.TestCase):
  4102. def keylog_lines(self, fname=os_helper.TESTFN):
  4103. with open(fname) as f:
  4104. return len(list(f))
  4105. @requires_keylog
  4106. @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
  4107. def test_keylog_defaults(self):
  4108. self.addCleanup(os_helper.unlink, os_helper.TESTFN)
  4109. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  4110. self.assertEqual(ctx.keylog_filename, None)
  4111. self.assertFalse(os.path.isfile(os_helper.TESTFN))
  4112. ctx.keylog_filename = os_helper.TESTFN
  4113. self.assertEqual(ctx.keylog_filename, os_helper.TESTFN)
  4114. self.assertTrue(os.path.isfile(os_helper.TESTFN))
  4115. self.assertEqual(self.keylog_lines(), 1)
  4116. ctx.keylog_filename = None
  4117. self.assertEqual(ctx.keylog_filename, None)
  4118. with self.assertRaises((IsADirectoryError, PermissionError)):
  4119. # Windows raises PermissionError
  4120. ctx.keylog_filename = os.path.dirname(
  4121. os.path.abspath(os_helper.TESTFN))
  4122. with self.assertRaises(TypeError):
  4123. ctx.keylog_filename = 1
  4124. @requires_keylog
  4125. @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
  4126. def test_keylog_filename(self):
  4127. self.addCleanup(os_helper.unlink, os_helper.TESTFN)
  4128. client_context, server_context, hostname = testing_context()
  4129. client_context.keylog_filename = os_helper.TESTFN
  4130. server = ThreadedEchoServer(context=server_context, chatty=False)
  4131. with server:
  4132. with client_context.wrap_socket(socket.socket(),
  4133. server_hostname=hostname) as s:
  4134. s.connect((HOST, server.port))
  4135. # header, 5 lines for TLS 1.3
  4136. self.assertEqual(self.keylog_lines(), 6)
  4137. client_context.keylog_filename = None
  4138. server_context.keylog_filename = os_helper.TESTFN
  4139. server = ThreadedEchoServer(context=server_context, chatty=False)
  4140. with server:
  4141. with client_context.wrap_socket(socket.socket(),
  4142. server_hostname=hostname) as s:
  4143. s.connect((HOST, server.port))
  4144. self.assertGreaterEqual(self.keylog_lines(), 11)
  4145. client_context.keylog_filename = os_helper.TESTFN
  4146. server_context.keylog_filename = os_helper.TESTFN
  4147. server = ThreadedEchoServer(context=server_context, chatty=False)
  4148. with server:
  4149. with client_context.wrap_socket(socket.socket(),
  4150. server_hostname=hostname) as s:
  4151. s.connect((HOST, server.port))
  4152. self.assertGreaterEqual(self.keylog_lines(), 21)
  4153. client_context.keylog_filename = None
  4154. server_context.keylog_filename = None
  4155. @requires_keylog
  4156. @unittest.skipIf(sys.flags.ignore_environment,
  4157. "test is not compatible with ignore_environment")
  4158. @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
  4159. def test_keylog_env(self):
  4160. self.addCleanup(os_helper.unlink, os_helper.TESTFN)
  4161. with unittest.mock.patch.dict(os.environ):
  4162. os.environ['SSLKEYLOGFILE'] = os_helper.TESTFN
  4163. self.assertEqual(os.environ['SSLKEYLOGFILE'], os_helper.TESTFN)
  4164. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  4165. self.assertEqual(ctx.keylog_filename, None)
  4166. ctx = ssl.create_default_context()
  4167. self.assertEqual(ctx.keylog_filename, os_helper.TESTFN)
  4168. ctx = ssl._create_stdlib_context()
  4169. self.assertEqual(ctx.keylog_filename, os_helper.TESTFN)
  4170. def test_msg_callback(self):
  4171. client_context, server_context, hostname = testing_context()
  4172. def msg_cb(conn, direction, version, content_type, msg_type, data):
  4173. pass
  4174. self.assertIs(client_context._msg_callback, None)
  4175. client_context._msg_callback = msg_cb
  4176. self.assertIs(client_context._msg_callback, msg_cb)
  4177. with self.assertRaises(TypeError):
  4178. client_context._msg_callback = object()
  4179. def test_msg_callback_tls12(self):
  4180. client_context, server_context, hostname = testing_context()
  4181. client_context.options |= ssl.OP_NO_TLSv1_3
  4182. msg = []
  4183. def msg_cb(conn, direction, version, content_type, msg_type, data):
  4184. self.assertIsInstance(conn, ssl.SSLSocket)
  4185. self.assertIsInstance(data, bytes)
  4186. self.assertIn(direction, {'read', 'write'})
  4187. msg.append((direction, version, content_type, msg_type))
  4188. client_context._msg_callback = msg_cb
  4189. server = ThreadedEchoServer(context=server_context, chatty=False)
  4190. with server:
  4191. with client_context.wrap_socket(socket.socket(),
  4192. server_hostname=hostname) as s:
  4193. s.connect((HOST, server.port))
  4194. self.assertIn(
  4195. ("read", TLSVersion.TLSv1_2, _TLSContentType.HANDSHAKE,
  4196. _TLSMessageType.SERVER_KEY_EXCHANGE),
  4197. msg
  4198. )
  4199. self.assertIn(
  4200. ("write", TLSVersion.TLSv1_2, _TLSContentType.CHANGE_CIPHER_SPEC,
  4201. _TLSMessageType.CHANGE_CIPHER_SPEC),
  4202. msg
  4203. )
  4204. def test_msg_callback_deadlock_bpo43577(self):
  4205. client_context, server_context, hostname = testing_context()
  4206. server_context2 = testing_context()[1]
  4207. def msg_cb(conn, direction, version, content_type, msg_type, data):
  4208. pass
  4209. def sni_cb(sock, servername, ctx):
  4210. sock.context = server_context2
  4211. server_context._msg_callback = msg_cb
  4212. server_context.sni_callback = sni_cb
  4213. server = ThreadedEchoServer(context=server_context, chatty=False)
  4214. with server:
  4215. with client_context.wrap_socket(socket.socket(),
  4216. server_hostname=hostname) as s:
  4217. s.connect((HOST, server.port))
  4218. with client_context.wrap_socket(socket.socket(),
  4219. server_hostname=hostname) as s:
  4220. s.connect((HOST, server.port))
  4221. def test_main(verbose=False):
  4222. if support.verbose:
  4223. plats = {
  4224. 'Mac': platform.mac_ver,
  4225. 'Windows': platform.win32_ver,
  4226. }
  4227. for name, func in plats.items():
  4228. plat = func()
  4229. if plat and plat[0]:
  4230. plat = '%s %r' % (name, plat)
  4231. break
  4232. else:
  4233. plat = repr(platform.platform())
  4234. print("test_ssl: testing with %r %r" %
  4235. (ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO))
  4236. print(" under %s" % plat)
  4237. print(" HAS_SNI = %r" % ssl.HAS_SNI)
  4238. print(" OP_ALL = 0x%8x" % ssl.OP_ALL)
  4239. try:
  4240. print(" OP_NO_TLSv1_1 = 0x%8x" % ssl.OP_NO_TLSv1_1)
  4241. except AttributeError:
  4242. pass
  4243. for filename in [
  4244. CERTFILE, BYTES_CERTFILE,
  4245. ONLYCERT, ONLYKEY, BYTES_ONLYCERT, BYTES_ONLYKEY,
  4246. SIGNED_CERTFILE, SIGNED_CERTFILE2, SIGNING_CA,
  4247. BADCERT, BADKEY, EMPTYCERT]:
  4248. if not os.path.exists(filename):
  4249. raise support.TestFailed("Can't read certificate file %r" % filename)
  4250. tests = [
  4251. ContextTests, BasicSocketTests, SSLErrorTests, MemoryBIOTests,
  4252. SSLObjectTests, SimpleBackgroundTests, ThreadedTests,
  4253. TestPostHandshakeAuth, TestSSLDebug
  4254. ]
  4255. if support.is_resource_enabled('network'):
  4256. tests.append(NetworkedTests)
  4257. thread_info = threading_helper.threading_setup()
  4258. try:
  4259. support.run_unittest(*tests)
  4260. finally:
  4261. threading_helper.threading_cleanup(*thread_info)
  4262. if __name__ == "__main__":
  4263. test_main()