diff -r 754c630c98a3 -r ff1274594739 Doc/library/argparse.rst --- a/Doc/library/argparse.rst Tue Jan 20 14:11:38 2015 -0600 +++ b/Doc/library/argparse.rst Mon Jan 19 22:03:19 2015 +0000 @@ -1521,15 +1521,12 @@ * parser_class - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. ArgumentParser) - * action_ - the basic type of action to be taken when this argument is - encountered at the command line - - * dest_ - name of the attribute under which sub-command name will be + * dest - name of the attribute under which sub-command name will be stored; by default None and no value is stored - * help_ - help for sub-parser group in help output, by default None + * help - help for sub-parser group in help output, by default None - * metavar_ - string presenting available sub-commands in help; by default it + * metavar - string presenting available sub-commands in help; by default it is None and presents sub-commands in form {cmd1, cmd2, ..} Some example usage:: diff -r 754c630c98a3 -r ff1274594739 Doc/library/http.client.rst --- a/Doc/library/http.client.rst Tue Jan 20 14:11:38 2015 -0600 +++ b/Doc/library/http.client.rst Mon Jan 19 22:03:19 2015 +0000 @@ -180,15 +180,221 @@ The default port for the HTTPS protocol (always ``443``). +and also the following constants for integer status codes: + ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| Constant | Value | Definition | ++==========================================+=========+=======================================================================+ +| :const:`CONTINUE` | ``100`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.1.1 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`SWITCHING_PROTOCOLS` | ``101`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.1.2 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`PROCESSING` | ``102`` | WEBDAV, `RFC 2518, Section 10.1 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`OK` | ``200`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.1 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`CREATED` | ``201`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.2 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`ACCEPTED` | ``202`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.3 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NON_AUTHORITATIVE_INFORMATION` | ``203`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.4 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NO_CONTENT` | ``204`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.5 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`RESET_CONTENT` | ``205`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.6 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`PARTIAL_CONTENT` | ``206`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.2.7 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`MULTI_STATUS` | ``207`` | WEBDAV `RFC 2518, Section 10.2 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`IM_USED` | ``226`` | Delta encoding in HTTP, | +| | | :rfc:`3229`, Section 10.4.1 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`MULTIPLE_CHOICES` | ``300`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.1 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`MOVED_PERMANENTLY` | ``301`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.2 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`FOUND` | ``302`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.3 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`SEE_OTHER` | ``303`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.4 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NOT_MODIFIED` | ``304`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.5 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`USE_PROXY` | ``305`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.6 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`TEMPORARY_REDIRECT` | ``307`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.3.8 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`BAD_REQUEST` | ``400`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.1 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`UNAUTHORIZED` | ``401`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.2 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`PAYMENT_REQUIRED` | ``402`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.3 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`FORBIDDEN` | ``403`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.4 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NOT_FOUND` | ``404`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.5 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`METHOD_NOT_ALLOWED` | ``405`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.6 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NOT_ACCEPTABLE` | ``406`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.7 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`PROXY_AUTHENTICATION_REQUIRED` | ``407`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.8 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`REQUEST_TIMEOUT` | ``408`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.9 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`CONFLICT` | ``409`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.10 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`GONE` | ``410`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.11 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`LENGTH_REQUIRED` | ``411`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.12 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`PRECONDITION_FAILED` | ``412`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.13 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`REQUEST_ENTITY_TOO_LARGE` | ``413`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.14 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`REQUEST_URI_TOO_LONG` | ``414`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.15 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`UNSUPPORTED_MEDIA_TYPE` | ``415`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.16 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`REQUESTED_RANGE_NOT_SATISFIABLE` | ``416`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.17 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`EXPECTATION_FAILED` | ``417`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.4.18 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`UNPROCESSABLE_ENTITY` | ``422`` | WEBDAV, `RFC 2518, Section 10.3 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`LOCKED` | ``423`` | WEBDAV `RFC 2518, Section 10.4 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`FAILED_DEPENDENCY` | ``424`` | WEBDAV, `RFC 2518, Section 10.5 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`UPGRADE_REQUIRED` | ``426`` | HTTP Upgrade to TLS, | +| | | :rfc:`2817`, Section 6 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`PRECONDITION_REQUIRED` | ``428`` | Additional HTTP Status Codes, | +| | | :rfc:`6585`, Section 3 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`TOO_MANY_REQUESTS` | ``429`` | Additional HTTP Status Codes, | +| | | :rfc:`6585`, Section 4 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`REQUEST_HEADER_FIELDS_TOO_LARGE` | ``431`` | Additional HTTP Status Codes, | +| | | :rfc:`6585`, Section 5 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`INTERNAL_SERVER_ERROR` | ``500`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.5.1 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NOT_IMPLEMENTED` | ``501`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.5.2 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`BAD_GATEWAY` | ``502`` | HTTP/1.1 `RFC 2616, Section | +| | | 10.5.3 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`SERVICE_UNAVAILABLE` | ``503`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.5.4 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`GATEWAY_TIMEOUT` | ``504`` | HTTP/1.1 `RFC 2616, Section | +| | | 10.5.5 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`HTTP_VERSION_NOT_SUPPORTED` | ``505`` | HTTP/1.1, `RFC 2616, Section | +| | | 10.5.6 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`INSUFFICIENT_STORAGE` | ``507`` | WEBDAV, `RFC 2518, Section 10.6 | +| | | `_ | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NOT_EXTENDED` | ``510`` | An HTTP Extension Framework, | +| | | :rfc:`2774`, Section 7 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ +| :const:`NETWORK_AUTHENTICATION_REQUIRED` | ``511`` | Additional HTTP Status Codes, | +| | | :rfc:`6585`, Section 6 | ++------------------------------------------+---------+-----------------------------------------------------------------------+ + +.. versionchanged:: 3.3 + Added codes ``428``, ``429``, ``431`` and ``511`` from :rfc:`6585`. + + .. data:: responses This dictionary maps the HTTP 1.1 status codes to the W3C names. Example: ``http.client.responses[http.client.NOT_FOUND]`` is ``'Not Found'``. -See :ref:`http-status-codes` for a list of HTTP status codes that are -available in this module as constants. - .. _httpconnection-objects: diff -r 754c630c98a3 -r ff1274594739 Doc/library/http.rst --- a/Doc/library/http.rst Tue Jan 20 14:11:38 2015 -0600 +++ b/Doc/library/http.rst Mon Jan 19 22:03:19 2015 +0000 @@ -10,7 +10,7 @@ **Source code:** :source:`Lib/http/__init__.py` -:mod:`http` is a package that collects several modules for working with the +:mod:`http` is a also package that collects several modules for working with the HyperText Transfer Protocol: * :mod:`http.client` is a low-level HTTP protocol client; for high-level URL @@ -45,78 +45,85 @@ >>> list(HTTPStatus) [, , ...] -.. _http-status-codes: + The supported HTTP status codes are: -HTTP status codes ------------------ - -Supported, -`IANA-registered `_ -status codes available in :class:`http.HTTPStatus` are: - -======= =================================== ================================================================== -Code Enum Name Details -======= =================================== ================================================================== -``100`` ``CONTINUE`` HTTP/1.1 :rfc:`7231`, Section 6.2.1 -``101`` ``SWITCHING_PROTOCOLS`` HTTP/1.1 :rfc:`7231`, Section 6.2.2 -``102`` ``PROCESSING`` WebDAV :rfc:`2518`, Section 10.1 -``200`` ``OK`` HTTP/1.1 :rfc:`7231`, Section 6.3.1 -``201`` ``CREATED`` HTTP/1.1 :rfc:`7231`, Section 6.3.2 -``202`` ``ACCEPTED`` HTTP/1.1 :rfc:`7231`, Section 6.3.3 -``203`` ``NON_AUTHORITATIVE_INFORMATION`` HTTP/1.1 :rfc:`7231`, Section 6.3.4 -``204`` ``NO_CONTENT`` HTTP/1.1 :rfc:`7231`, Section 6.3.5 -``205`` ``RESET_CONTENT`` HTTP/1.1 :rfc:`7231`, Section 6.3.6 -``206`` ``PARTIAL_CONTENT`` HTTP/1.1 :rfc:`7233`, Section 4.1 -``207`` ``MULTI_STATUS`` WebDAV :rfc:`4918`, Section 11.1 -``208`` ``ALREADY_REPORTED`` WebDAV Binding Extensions :rfc:`5842`, Section 7.1 (Experimental) -``226`` ``IM_USED`` Delta Encoding in HTTP :rfc:`3229`, Section 10.4.1 -``300`` ``MULTIPLE_CHOICES`` HTTP/1.1 :rfc:`7231`, Section 6.4.1 -``301`` ``MOVED_PERMANENTLY`` HTTP/1.1 :rfc:`7231`, Section 6.4.2 -``302`` ``FOUND`` HTTP/1.1 :rfc:`7231`, Section 6.4.3 -``303`` ``SEE_OTHER`` HTTP/1.1 :rfc:`7231`, Section 6.4.4 -``304`` ``NOT_MODIFIED`` HTTP/1.1 :rfc:`7232`, Section 4.1 -``305`` ``USE_PROXY`` HTTP/1.1 :rfc:`7231`, Section 6.4.5 -``307`` ``TEMPORARY_REDIRECT`` HTTP/1.1 :rfc:`7231`, Section 6.4.7 -``308`` ``PERMANENT_REDIRECT`` Permanent Redirect :rfc:`7238`, Section 3 (Experimental) -``400`` ``BAD_REQUEST`` HTTP/1.1 :rfc:`7231`, Section 6.5.1 -``401`` ``UNAUTHORIZED`` HTTP/1.1 Authentication :rfc:`7235`, Section 3.1 -``402`` ``PAYMENT_REQUIRED`` HTTP/1.1 :rfc:`7231`, Section 6.5.2 -``403`` ``FORBIDDEN`` HTTP/1.1 :rfc:`7231`, Section 6.5.3 -``404`` ``NOT_FOUND`` HTTP/1.1 :rfc:`7231`, Section 6.5.4 -``405`` ``METHOD_NOT_ALLOWED`` HTTP/1.1 :rfc:`7231`, Section 6.5.5 -``406`` ``NOT_ACCEPTABLE`` HTTP/1.1 :rfc:`7231`, Section 6.5.6 -``407`` ``PROXY_AUTHENTICATION_REQUIRED`` HTTP/1.1 Authentication :rfc:`7235`, Section 3.2 -``408`` ``REQUEST_TIMEOUT`` HTTP/1.1 :rfc:`7231`, Section 6.5.7 -``409`` ``CONFLICT`` HTTP/1.1 :rfc:`7231`, Section 6.5.8 -``410`` ``GONE`` HTTP/1.1 :rfc:`7231`, Section 6.5.9 -``411`` ``LENGTH_REQUIRED`` HTTP/1.1 :rfc:`7231`, Section 6.5.10 -``412`` ``PRECONDITION_FAILED`` HTTP/1.1 :rfc:`7232`, Section 4.2 -``413`` ``REQUEST_ENTITY_TOO_LARGE`` HTTP/1.1 :rfc:`7231`, Section 6.5.11 -``414`` ``REQUEST_URI_TOO_LONG`` HTTP/1.1 :rfc:`7231`, Section 6.5.12 -``415`` ``UNSUPPORTED_MEDIA_TYPE`` HTTP/1.1 :rfc:`7231`, Section 6.5.13 -``416`` ``REQUEST_RANGE_NOT_SATISFIABLE`` HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4 -``417`` ``EXPECTATION_FAILED`` HTTP/1.1 :rfc:`7231`, Section 6.5.14 -``422`` ``UNPROCESSABLE_ENTITY`` WebDAV :rfc:`4918`, Section 11.2 -``423`` ``LOCKED`` WebDAV :rfc:`4918`, Section 11.3 -``424`` ``FAILED_DEPENDENCY`` WebDAV :rfc:`4918`, Section 11.4 -``426`` ``UPGRADE_REQUIRED`` HTTP/1.1 :rfc:`7231`, Section 6.5.15 -``428`` ``PRECONDITION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585` -``429`` ``TOO_MANY_REQUESTS`` Additional HTTP Status Codes :rfc:`6585` -``431`` ``REQUEST_HEADER_FIELDS_TOO_LARGE`` Additional HTTP Status Codes :rfc:`6585` -``500`` ``INTERNAL_SERVER_ERROR`` HTTP/1.1 :rfc:`7231`, Section 6.6.1 -``501`` ``NOT_IMPLEMENTED`` HTTP/1.1 :rfc:`7231`, Section 6.6.2 -``502`` ``BAD_GATEWAY`` HTTP/1.1 :rfc:`7231`, Section 6.6.3 -``503`` ``SERVICE_UNAVAILABLE`` HTTP/1.1 :rfc:`7231`, Section 6.6.4 -``504`` ``GATEWAY_TIMEOUT`` HTTP/1.1 :rfc:`7231`, Section 6.6.5 -``505`` ``HTTP_VERSION_NOT_SUPPORTED`` HTTP/1.1 :rfc:`7231`, Section 6.6.6 -``506`` ``VARIANT_ALSO_NEGOTIATES`` Transparent Content Negotiation in HTTP :rfc:`2295`, Section 8.1 (Experimental) -``507`` ``INSUFFICIENT_STORAGE`` WebDAV :rfc:`4918`, Section 11.5 -``508`` ``LOOP_DETECTED`` WebDAV Binding Extensions :rfc:`5842`, Section 7.2 (Experimental) -``510`` ``NOT_EXTENDED`` An HTTP Extension Framework :rfc:`2774`, Section 7 (Experimental) -``511`` ``NETWORK_AUTHENTICATION_REQUIRED`` Additional HTTP Status Codes :rfc:`6585`, Section 6 -======= =================================== ================================================================== - -In order to preserve backwards compatibility, enum values are also present -in the :mod:`http.client` module in the form of constants. The enum name is -equal to the constant name (i.e. ``http.HTTPStatus.OK`` is also available as -``http.client.OK``). + === ============================== + 100 Continue + 101 Switching Protocols + 102 Processing + 200 OK + 201 Created + 202 Accepted + 203 Non-Authoritative Information + 204 No Content + 205 Reset Content + 206 Partial Content + 207 Multi-Status + 208 Already Reported + 226 IM Used + 300 Multiple Choices + 301 Moved Permanently + 302 Found + 303 See Other + 304 Not Modified + 305 Use Proxy + 306 Switch Proxy + 307 Temporary Redirect + 308 Permanent Redirect + 400 Bad Request + 401 Unauthorized + 402 Payment Required + 403 Forbidden + 404 Not Found + 405 Method Not Allowed + 406 Not Acceptable + 407 Proxy Authentication Required + 408 Request Timeout + 409 Conflict + 410 Gone + 411 Length Required + 412 Precondition Failed + 413 Request Entity Too Large + 414 Request URI Too Long + 415 Unsupported Media Type + 416 Request Range Not Satisfiable + 417 Expectation Failed + 418 I'm a teapot + 419 Authentication Timeout + 420 Method Failure *(Spring framework)* + 422 Unprocessable Entity + 423 Locked + 424 Failed Dependency + 426 Upgrade Required + 428 Precondition Required + 429 Too Many Requests + 431 Request Header Field Too Large + 440 Login Timeout *(Microsoft)* + 444 No Response *(Nginx)* + 449 Retry With *(Microsoft)* + 450 Blocked By Windows Parental Controls *(Microsoft)* + 494 Request Header Too Large *(Nginx)* + 495 Cert Error *(Nginx)* + 496 No Cert *(Nginx)* + 497 HTTP To HTTPS *(Nginx)* + 499 Client Closed Request *(Nginx)* + 500 Internal Server Error + 501 Not Implemented + 502 Bad Gateway + 503 Service Unavailable + 504 Gateway Timeout + 505 HTTP Version Not Supported + 506 Variant Also Negotiates + 507 Insufficient Storage + 508 Loop Detected + 509 Bandwidth Limit Exceeded + 510 Not Extended + 511 Network Authentication Required + 520 Origin Error *(CloudFlare)* + 521 Web Server Is Down *(CloudFlare)* + 522 Connection Timed Out *(CloudFlare)* + 523 Proxy Declined Request *(CloudFlare)* + 524 A Timeout Occurred *(CloudFlare)* + 598 Network Read Timeout Error + 599 Network Connect Timeout Error + === ============================== diff -r 754c630c98a3 -r ff1274594739 Doc/library/json.rst --- a/Doc/library/json.rst Tue Jan 20 14:11:38 2015 -0600 +++ b/Doc/library/json.rst Mon Jan 19 22:03:19 2015 +0000 @@ -514,7 +514,7 @@ that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 surrogates), but it does note that they may cause interoperability problems. By default, this module accepts and outputs (when present in the original -:class:`str`) code points for such sequences. +:class:`str`) codepoints for such sequences. Infinite and NaN Number Values diff -r 754c630c98a3 -r ff1274594739 Include/setobject.h --- a/Include/setobject.h Tue Jan 20 14:11:38 2015 -0600 +++ b/Include/setobject.h Mon Jan 19 22:03:19 2015 +0000 @@ -14,7 +14,9 @@ 2. Active: key != NULL and key != dummy 3. Dummy: key == dummy -The hash field of Unused or Dummy slots have no meaning. +Note: .pop() abuses the hash field of an Unused or Dummy slot to +hold a search finger. The hash field of Unused or Dummy slots has +no meaning otherwise. */ #define PySet_MINSIZE 8 @@ -57,7 +59,6 @@ Py_hash_t hash; /* Only used by frozenset objects */ setentry smalltable[PySet_MINSIZE]; - Py_ssize_t finger; /* Search finger for pop() */ PyObject *weakreflist; /* List of weak references */ } PySetObject; diff -r 754c630c98a3 -r ff1274594739 Lib/_pyio.py --- a/Lib/_pyio.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/_pyio.py Mon Jan 19 22:03:19 2015 +0000 @@ -1006,10 +1006,7 @@ current_size = 0 while True: # Read until EOF or until read() would block. - try: - chunk = self.raw.read() - except InterruptedError: - continue + chunk = self.raw.read() if chunk in empty_values: nodata_val = chunk break @@ -1028,10 +1025,7 @@ chunks = [buf[pos:]] wanted = max(self.buffer_size, n) while avail < n: - try: - chunk = self.raw.read(wanted) - except InterruptedError: - continue + chunk = self.raw.read(wanted) if chunk in empty_values: nodata_val = chunk break @@ -1060,12 +1054,7 @@ have = len(self._read_buf) - self._read_pos if have < want or have <= 0: to_read = self.buffer_size - have - while True: - try: - current = self.raw.read(to_read) - except InterruptedError: - continue - break + current = self.raw.read(to_read) if current: self._read_buf = self._read_buf[self._read_pos:] + current self._read_pos = 0 @@ -1214,8 +1203,6 @@ while self._write_buf: try: n = self.raw.write(self._write_buf) - except InterruptedError: - continue except BlockingIOError: raise RuntimeError("self.raw should implement RawIOBase: it " "should not raise BlockingIOError") diff -r 754c630c98a3 -r ff1274594739 Lib/codecs.py --- a/Lib/codecs.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/codecs.py Mon Jan 19 22:03:19 2015 +0000 @@ -124,7 +124,7 @@ Python will use the official U+FFFD REPLACEMENT CHARACTER for the builtin Unicode codecs on decoding and '?' on encoding. - 'surrogateescape' - replace with private code points U+DCnn. + 'surrogateescape' - replace with private codepoints U+DCnn. 'xmlcharrefreplace' - Replace with the appropriate XML character reference (only for encoding). 'backslashreplace' - Replace with backslashed escape sequences diff -r 754c630c98a3 -r ff1274594739 Lib/distutils/spawn.py --- a/Lib/distutils/spawn.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/distutils/spawn.py Mon Jan 19 22:03:19 2015 +0000 @@ -137,9 +137,6 @@ try: pid, status = os.waitpid(pid, 0) except OSError as exc: - import errno - if exc.errno == errno.EINTR: - continue if not DEBUG: cmd = executable raise DistutilsExecError( diff -r 754c630c98a3 -r ff1274594739 Lib/email/message.py --- a/Lib/email/message.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/email/message.py Mon Jan 19 22:03:19 2015 +0000 @@ -273,7 +273,7 @@ bpayload = payload.encode('ascii') except UnicodeError: # This won't happen for RFC compliant messages (messages - # containing only ASCII code points in the unicode input). + # containing only ASCII codepoints in the unicode input). # If it does happen, turn the string into bytes in a way # guaranteed not to fail. bpayload = payload.encode('raw-unicode-escape') diff -r 754c630c98a3 -r ff1274594739 Lib/html/entities.py --- a/Lib/html/entities.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/html/entities.py Mon Jan 19 22:03:19 2015 +0000 @@ -3,7 +3,7 @@ __all__ = ['html5', 'name2codepoint', 'codepoint2name', 'entitydefs'] -# maps the HTML entity name to the Unicode code point +# maps the HTML entity name to the Unicode codepoint name2codepoint = { 'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1 'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1 @@ -2495,7 +2495,7 @@ 'zwnj;': '\u200c', } -# maps the Unicode code point to the HTML entity name +# maps the Unicode codepoint to the HTML entity name codepoint2name = {} # maps the HTML entity name to the character diff -r 754c630c98a3 -r ff1274594739 Lib/http/__init__.py --- a/Lib/http/__init__.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/http/__init__.py Mon Jan 19 22:03:19 2015 +0000 @@ -13,8 +13,16 @@ * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518 * RFC 5842: Binding Extensions to WebDAV * RFC 7238: Permanent Redirect + * RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0) * RFC 2295: Transparent Content Negotiation in HTTP * RFC 2774: An HTTP Extension Framework + + Non-standard vendor codes include: + + * Spring framework: 420 + * Nginx: 444, 494, 495, 496, 497, 499 + * Microsoft: 440, 449, 450 + * Cloudflare: 520, 521, 522, 523, 524, 598, 599 """ def __new__(cls, value, phrase, description=''): obj = int.__new__(cls, value) @@ -55,6 +63,7 @@ 'Document has not changed since given time') USE_PROXY = (305, 'Use Proxy', 'You must use proxy specified in Location to access this resource') + SWITCH_PROXY = 306, 'Switch Proxy' TEMPORARY_REDIRECT = (307, 'Temporary Redirect', 'Object moved temporarily -- see URI list') PERMANENT_REDIRECT = (308, 'Permanent Redirect', @@ -98,6 +107,9 @@ 'Cannot satisfy request range') EXPECTATION_FAILED = (417, 'Expectation Failed', 'Expect condition could not be satisfied') + IM_A_TEAPOT = 418, 'I\'m a teapot' + AUTHENTICATION_TIMEOUT = 419, 'Authentication Timeout' + METHOD_FAILURE = 420, 'Method Failure' # Spring framework UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity' LOCKED = 423, 'Locked' FAILED_DEPENDENCY = 424, 'Failed Dependency' @@ -111,6 +123,16 @@ 'Request Header Field Too Large', 'The server is unwilling to process the request because its header ' 'fields are too large') + LOGIN_TIMEOUT = 440, 'Login Timeout' # microsoft + NO_RESPONSE = 444, 'No Response' # nginx + RETRY_WITH = 449, 'Retry With' # microsoft + BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = (450, + 'Blocked By Windows Parental Controls') # microsoft + REQUEST_HEADER_TOO_LARGE = 494, 'Request Header Too Large' # nginx + CERT_ERROR = 495, 'Cert Error' # nginx + NO_CERT = 496, 'No Cert' # nginx + HTTP_TO_HTTPS = 497, 'HTTP To HTTPS' # nginx + CLIENT_CLOSED_REQUEST = 499, 'Client Closed Request' # nginx # server errors INTERNAL_SERVER_ERROR = (500, 'Internal Server Error', @@ -128,7 +150,15 @@ VARIANT_ALSO_NEGOTIATES = 506, 'Variant Also Negotiates' INSUFFICIENT_STORAGE = 507, 'Insufficient Storage' LOOP_DETECTED = 508, 'Loop Detected' + BANDWIDTH_LIMIT_EXCEEDED = 509, 'Bandwidth Limit Exceeded' NOT_EXTENDED = 510, 'Not Extended' NETWORK_AUTHENTICATION_REQUIRED = (511, 'Network Authentication Required', 'The client needs to authenticate to gain network access') + ORIGIN_ERROR = 520, 'Origin Error' # cloudflare + WEB_SERVER_IS_DOWN = 521, 'Web Server Is Down' # cloudflare + CONNECTON_TIMED_OUT = 522, 'Connection Timed Out' # cloudflare + PROXY_DECLINED_REQUEST = 523, 'Proxy Declined Request' # cloudflare + A_TIMEOUT_OCCURRED = 524, 'A Timeout Occurred', '' # cloudflare + NETWORK_READ_TIMEOUT_ERROR = 598, 'Network Read Timeout Error' + NETWORK_CONNECT_TIMEOUT_ERROR = 599, 'Network Connect Timeout Error' diff -r 754c630c98a3 -r ff1274594739 Lib/ipaddress.py --- a/Lib/ipaddress.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/ipaddress.py Mon Jan 19 22:03:19 2015 +0000 @@ -164,23 +164,22 @@ def _find_address_range(addresses): - """Find a sequence of sorted deduplicated IPv#Address. + """Find a sequence of IPv#Address. Args: addresses: a list of IPv#Address objects. - Yields: + Returns: A tuple containing the first and last IP addresses in the sequence. """ - it = iter(addresses) - first = last = next(it) - for ip in it: - if ip._ip != last._ip + 1: - yield first, last - first = ip - last = ip - yield first, last + first = last = addresses[0] + for ip in addresses[1:]: + if ip._ip == last._ip + 1: + last = ip + else: + break + return (first, last) def _count_righthand_zero_bits(number, bits): @@ -321,6 +320,7 @@ TypeError: If passed a list of mixed version objects. """ + i = 0 addrs = [] ips = [] nets = [] @@ -349,10 +349,10 @@ # sort and dedup ips = sorted(set(ips)) - # find consecutive address ranges in the sorted sequence and summarize them - if ips: - for first, last in _find_address_range(ips): - addrs.extend(summarize_address_range(first, last)) + while i < len(ips): + (first, last) = _find_address_range(ips[i:]) + i = ips.index(last) + 1 + addrs.extend(summarize_address_range(first, last)) return _collapse_addresses_internal(addrs + nets) @@ -563,9 +563,6 @@ except ValueError: cls._report_invalid_netmask(ip_str) - def __reduce__(self): - return self.__class__, (str(self),) - class _BaseAddress(_IPAddressBase): @@ -575,6 +572,11 @@ used by single IP addresses. """ + def __init__(self, address): + if (not isinstance(address, bytes) + and '/' in str(address)): + raise AddressValueError("Unexpected '/' in %r" % address) + def __int__(self): return self._ip @@ -620,9 +622,6 @@ def _get_address_key(self): return (self._version, self) - def __reduce__(self): - return self.__class__, (self._ip,) - class _BaseNetwork(_IPAddressBase): @@ -1292,6 +1291,7 @@ AddressValueError: If ipaddress isn't a valid IPv4 address. """ + _BaseAddress.__init__(self, address) _BaseV4.__init__(self, address) # Efficient constructor from integer. @@ -1309,8 +1309,6 @@ # Assume input argument to be string or any object representation # which converts into a formatted IP string. addr_str = str(address) - if '/' in addr_str: - raise AddressValueError("Unexpected '/' in %r" % address) self._ip = self._ip_int_from_string(addr_str) @property @@ -1444,8 +1442,6 @@ def __hash__(self): return self._ip ^ self._prefixlen ^ int(self.network.network_address) - __reduce__ = _IPAddressBase.__reduce__ - @property def ip(self): return IPv4Address(self._ip) @@ -1920,6 +1916,7 @@ AddressValueError: If address isn't a valid IPv6 address. """ + _BaseAddress.__init__(self, address) _BaseV6.__init__(self, address) # Efficient constructor from integer. @@ -1937,8 +1934,6 @@ # Assume input argument to be string or any object representation # which converts into a formatted IP string. addr_str = str(address) - if '/' in addr_str: - raise AddressValueError("Unexpected '/' in %r" % address) self._ip = self._ip_int_from_string(addr_str) @property @@ -2135,8 +2130,6 @@ def __hash__(self): return self._ip ^ self._prefixlen ^ int(self.network.network_address) - __reduce__ = _IPAddressBase.__reduce__ - @property def ip(self): return IPv6Address(self._ip) diff -r 754c630c98a3 -r ff1274594739 Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/multiprocessing/connection.py Mon Jan 19 22:03:19 2015 +0000 @@ -365,10 +365,7 @@ def _send(self, buf, write=_write): remaining = len(buf) while True: - try: - n = write(self._handle, buf) - except InterruptedError: - continue + n = write(self._handle, buf) remaining -= n if remaining == 0: break @@ -379,10 +376,7 @@ handle = self._handle remaining = size while remaining > 0: - try: - chunk = read(handle, remaining) - except InterruptedError: - continue + chunk = read(handle, remaining) n = len(chunk) if n == 0: if remaining == size: @@ -595,13 +589,7 @@ self._unlink = None def accept(self): - while True: - try: - s, self._last_accepted = self._socket.accept() - except InterruptedError: - pass - else: - break + s, self._last_accepted = self._socket.accept() s.setblocking(True) return Connection(s.detach()) diff -r 754c630c98a3 -r ff1274594739 Lib/multiprocessing/forkserver.py --- a/Lib/multiprocessing/forkserver.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/multiprocessing/forkserver.py Mon Jan 19 22:03:19 2015 +0000 @@ -188,8 +188,6 @@ finally: os._exit(code) - except InterruptedError: - pass except OSError as e: if e.errno != errno.ECONNABORTED: raise @@ -230,13 +228,7 @@ data = b'' length = UNSIGNED_STRUCT.size while len(data) < length: - while True: - try: - s = os.read(fd, length - len(data)) - except InterruptedError: - pass - else: - break + s = os.read(fd, length - len(data)) if not s: raise EOFError('unexpected EOF') data += s @@ -245,13 +237,7 @@ def write_unsigned(fd, n): msg = UNSIGNED_STRUCT.pack(n) while msg: - while True: - try: - nbytes = os.write(fd, msg) - except InterruptedError: - pass - else: - break + nbytes = os.write(fd, msg) if nbytes == 0: raise RuntimeError('should not get here') msg = msg[nbytes:] diff -r 754c630c98a3 -r ff1274594739 Lib/multiprocessing/popen_fork.py --- a/Lib/multiprocessing/popen_fork.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/multiprocessing/popen_fork.py Mon Jan 19 22:03:19 2015 +0000 @@ -1,7 +1,6 @@ import os import sys import signal -import errno from . import util @@ -29,8 +28,6 @@ try: pid, sts = os.waitpid(self.pid, flag) except OSError as e: - if e.errno == errno.EINTR: - continue # Child process not yet created. See #1731717 # e.errno == errno.ECHILD == 10 return None diff -r 754c630c98a3 -r ff1274594739 Lib/socket.py --- a/Lib/socket.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/socket.py Mon Jan 19 22:03:19 2015 +0000 @@ -572,8 +572,6 @@ except timeout: self._timeout_occurred = True raise - except InterruptedError: - continue except error as e: if e.args[0] in _blocking_errnos: return None diff -r 754c630c98a3 -r ff1274594739 Lib/socketserver.py --- a/Lib/socketserver.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/socketserver.py Mon Jan 19 22:03:19 2015 +0000 @@ -553,8 +553,6 @@ try: pid, _ = os.waitpid(-1, 0) self.active_children.discard(pid) - except InterruptedError: - pass except ChildProcessError: # we don't have any children, we're done self.active_children.clear() diff -r 754c630c98a3 -r ff1274594739 Lib/subprocess.py --- a/Lib/subprocess.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/subprocess.py Mon Jan 19 22:03:19 2015 +0000 @@ -489,14 +489,6 @@ DEVNULL = -3 -def _eintr_retry_call(func, *args): - while True: - try: - return func(*args) - except InterruptedError: - continue - - # XXX This function is only used by multiprocessing and the test suite, # but it's here so that it can be imported when Python is compiled without # threads. @@ -963,10 +955,10 @@ if self.stdin: self._stdin_write(input) elif self.stdout: - stdout = _eintr_retry_call(self.stdout.read) + stdout = self.stdout.read() self.stdout.close() elif self.stderr: - stderr = _eintr_retry_call(self.stderr.read) + stderr = self.stderr.read() self.stderr.close() self.wait() else: @@ -1410,7 +1402,7 @@ # exception (limited in size) errpipe_data = bytearray() while True: - part = _eintr_retry_call(os.read, errpipe_read, 50000) + part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break @@ -1420,7 +1412,7 @@ if errpipe_data: try: - _eintr_retry_call(os.waitpid, self.pid, 0) + os.waitpid(self.pid, 0) except ChildProcessError: pass try: @@ -1505,7 +1497,7 @@ def _try_wait(self, wait_flags): """All callers to this function MUST hold self._waitpid_lock.""" try: - (pid, sts) = _eintr_retry_call(os.waitpid, self.pid, wait_flags) + (pid, sts) = os.waitpid(self.pid, wait_flags) except ChildProcessError: # This happens if SIGCLD is set to be ignored or waiting # for child processes has otherwise been disabled for our diff -r 754c630c98a3 -r ff1274594739 Lib/test/eintrdata/eintr_tester.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/test/eintrdata/eintr_tester.py Mon Jan 19 22:03:19 2015 +0000 @@ -0,0 +1,234 @@ +""" +This test suite exercises some system calls subject to interruption with EINTR, +to check that it is actually handled transparently. +It is intended to be run by the main test suite within a child process, to +ensure there is no background thread running (so that signals are delivered to +the correct thread). +Signals are generated in-process using setitimer(ITIMER_REAL), which allows +sub-second periodicity (contrarily to signal()). +""" + +import faulthandler +import io +import os +import signal +import socket +import time +import unittest + +from test import support + + +@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") +class EINTRBaseTest(unittest.TestCase): + """ Base class for EINTR tests. """ + + # delay for initial singal delivery + signal_delay = 0.1 + # signal delivery periodicity + signal_period = 0.2 + # default sleep time for tests - should obviously have: + # sleep_time > signal_period + sleep_time = 0.5 + + @classmethod + def setUpClass(cls): + faulthandler.dump_traceback_later(60, exit=True) + cls.orig_handler = signal.signal(signal.SIGALRM, lambda *args: None) + signal.setitimer(signal.ITIMER_REAL, cls.signal_delay, + cls.signal_period) + + @classmethod + def tearDownClass(cls): + signal.setitimer(signal.ITIMER_REAL, cls.signal_delay, 0) + signal.signal(signal.SIGALRM, cls.orig_handler) + + @classmethod + def _sleep(cls): + # default sleep time + time.sleep(cls.sleep_time) + + +@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") +class OSEINTRTest(EINTRBaseTest): + """ EINTR tests for the os module. """ + + def _test_wait_multiple(self, wait_func): + for _ in range(3): + pid = os.fork() + if pid == 0: + self._sleep() + os._exit(0) + wait_func() + + def test_wait(self): + self._test_wait_multiple(os.wait) + + @unittest.skipUnless(hasattr(os, 'wait3'), 'requires wait3()') + def test_wait3(self): + self._test_wait_multiple(lambda: os.wait3(0)) + + def _test_wait_single(self, wait_func): + pid = os.fork() + if pid == 0: + self._sleep() + os._exit(0) + else: + wait_func(pid) + + def test_waitpid(self): + self._test_wait_single(lambda pid: os.waitpid(pid, 0)) + + @unittest.skipUnless(hasattr(os, 'wait4'), 'requires wait4()') + def test_wait4(self): + self._test_wait_single(lambda pid: os.wait4(pid, 0)) + + def test_read(self): + rd, wr = os.pipe() + self.addCleanup(os.close, rd) + # wr closed explicitly by parent + + # the payload below are smaller than PIPE_BUF, hence the writes will be + # atomic + datas = [b"hello", b"world", b"spam"] + + pid = os.fork() + if pid == 0: + os.close(rd) + for data in datas: + # let the parent block on read() + self._sleep() + os.write(wr, data) + os._exit(0) + else: + self.addCleanup(os.waitpid, pid, 0) + os.close(wr) + for data in datas: + self.assertEqual(data, os.read(rd, len(data))) + + def test_write(self): + rd, wr = os.pipe() + self.addCleanup(os.close, wr) + # rd closed explicitly by parent + + # we must write enough data for the write() to block + data = b"xyz" * support.PIPE_MAX_SIZE + + pid = os.fork() + if pid == 0: + os.close(wr) + read_data = io.BytesIO() + # let the parent block on write() + self._sleep() + while len(read_data.getvalue()) < len(data): + chunk = os.read(rd, 2 * len(data)) + read_data.write(chunk) + self.assertEqual(read_data.getvalue(), data) + os._exit(0) + else: + os.close(rd) + written = 0 + while written < len(data): + written += os.write(wr, memoryview(data)[written:]) + self.assertEqual(0, os.waitpid(pid, 0)[1]) + + +@unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") +class SocketEINTRTest(EINTRBaseTest): + """ EINTR tests for the socket module. """ + + @unittest.skipUnless(hasattr(socket, 'socketpair'), 'needs socketpair()') + def _test_recv(self, recv_func): + rd, wr = socket.socketpair() + self.addCleanup(rd.close) + # wr closed explicitly by parent + + # single-byte payload guard us against partial recv + datas = [b"x", b"y", b"z"] + + pid = os.fork() + if pid == 0: + rd.close() + for data in datas: + # let the parent block on recv() + self._sleep() + wr.sendall(data) + os._exit(0) + else: + self.addCleanup(os.waitpid, pid, 0) + wr.close() + for data in datas: + self.assertEqual(data, recv_func(rd, len(data))) + + def test_recv(self): + self._test_recv(socket.socket.recv) + + @unittest.skipUnless(hasattr(socket.socket, 'recvmsg'), 'needs recvmsg()') + def test_recvmsg(self): + self._test_recv(lambda sock, data: sock.recvmsg(data)[0]) + + def _test_send(self, send_func): + rd, wr = socket.socketpair() + self.addCleanup(wr.close) + # rd closed explicitly by parent + + # we must write enough data for the write() to block + data = b"xyz" * support.SOCK_MAX_SIZE + + pid = os.fork() + if pid == 0: + wr.close() + read_data = io.BytesIO() + # let the parent block on send() + self._sleep() + while len(read_data.getvalue()) < len(data): + chunk = rd.recv(2 * len(data)) + read_data.write(chunk) + self.assertEqual(read_data.getvalue(), data) + os._exit(0) + else: + rd.close() + written = 0 + while written < len(data): + sent = send_func(wr, memoryview(data)[written:]) + # sendall() returns None + written += len(data) if sent is None else sent + self.assertEqual(0, os.waitpid(pid, 0)[1]) + + def test_send(self): + self._test_send(socket.socket.send) + + def test_sendall(self): + self._test_send(socket.socket.sendall) + + @unittest.skipUnless(hasattr(socket.socket, 'sendmsg'), 'needs sendmsg()') + def test_sendmsg(self): + self._test_send(lambda sock, data: sock.sendmsg([data])) + + def test_accept(self): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.addCleanup(sock.close) + + sock.bind((support.HOST, 0)) + _, port = sock.getsockname() + sock.listen() + + pid = os.fork() + if pid == 0: + # let parent block on accept() + self._sleep() + with socket.create_connection((support.HOST, port)): + self._sleep() + os._exit(0) + else: + self.addCleanup(os.waitpid, pid, 0) + client_sock, _ = sock.accept() + client_sock.close() + + +def test_main(): + support.run_unittest(OSEINTRTest, SocketEINTRTest) + + +if __name__ == "__main__": + test_main() diff -r 754c630c98a3 -r ff1274594739 Lib/test/multibytecodec_support.py --- a/Lib/test/multibytecodec_support.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/multibytecodec_support.py Mon Jan 19 22:03:19 2015 +0000 @@ -21,7 +21,7 @@ roundtriptest = 1 # set if roundtrip is possible with unicode has_iso10646 = 0 # set if this encoding contains whole iso10646 map xmlcharnametest = None # string to test xmlcharrefreplace - unmappedunicode = '\udeee' # a unicode code point that is not mapped. + unmappedunicode = '\udeee' # a unicode codepoint that is not mapped. def setUp(self): if self.codec is None: diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_binascii.py --- a/Lib/test/test_binascii.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_binascii.py Mon Jan 19 22:03:19 2015 +0000 @@ -162,9 +162,7 @@ self.assertRaises(binascii.Error, binascii.a2b_hex, t[:-1]) self.assertRaises(binascii.Error, binascii.a2b_hex, t[:-1] + b'q') - # Confirm that b2a_hex == hexlify and a2b_hex == unhexlify - self.assertEqual(binascii.hexlify(self.type2test(s)), t) - self.assertEqual(binascii.unhexlify(self.type2test(t)), u) + self.assertEqual(binascii.hexlify(b'a'), b'61') def test_qp(self): # A test for SF bug 534347 (segfaults without the proper fix) diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_eintr.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/test/test_eintr.py Mon Jan 19 22:03:19 2015 +0000 @@ -0,0 +1,20 @@ +import os +import signal +import unittest + +from test import script_helper, support + + +@unittest.skipUnless(os.name == "posix", "only supported on Unix") +class EINTRTests(unittest.TestCase): + + @unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") + def test_all(self): + # Run the tester in a sub-process, to make sure there is only one + # thread (for reliable signal delivery). + tester = support.findfile("eintr_tester.py", subdir="eintrdata") + script_helper.assert_python_ok(tester) + + +if __name__ == "__main__": + unittest.main() diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_html.py --- a/Lib/test/test_html.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_html.py Mon Jan 19 22:03:19 2015 +0000 @@ -48,10 +48,10 @@ check(s % num, char) for end in [' ', 'X']: check((s+end) % num, char+end) - # check invalid code points + # check invalid codepoints for cp in [0xD800, 0xDB00, 0xDC00, 0xDFFF, 0x110000]: check_num(cp, '\uFFFD') - # check more invalid code points + # check more invalid codepoints for cp in [0x1, 0xb, 0xe, 0x7f, 0xfffe, 0xffff, 0x10fffe, 0x10ffff]: check_num(cp, '') # check invalid numbers diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_ipaddress.py --- a/Lib/test/test_ipaddress.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_ipaddress.py Mon Jan 19 22:03:19 2015 +0000 @@ -8,7 +8,6 @@ import re import contextlib import operator -import pickle import ipaddress @@ -83,13 +82,6 @@ self.assertRaises(TypeError, hex, self.factory(1)) self.assertRaises(TypeError, bytes, self.factory(1)) - def pickle_test(self, addr): - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.subTest(proto=proto): - x = self.factory(addr) - y = pickle.loads(pickle.dumps(x, proto)) - self.assertEqual(y, x) - class CommonTestMixin_v4(CommonTestMixin): @@ -255,9 +247,6 @@ assertBadOctet("257.0.0.0", 257) assertBadOctet("192.168.0.999", 999) - def test_pickle(self): - self.pickle_test('192.0.2.1') - class AddressTestCase_v6(BaseTestCase, CommonTestMixin_v6): factory = ipaddress.IPv6Address @@ -390,9 +379,6 @@ assertBadPart("02001:db8::", "02001") assertBadPart('2001:888888::1', "888888") - def test_pickle(self): - self.pickle_test('2001:db8::') - class NetmaskTestMixin_v4(CommonTestMixin_v4): """Input validation on interfaces and networks is very similar""" @@ -456,11 +442,6 @@ assertBadNetmask("1.1.1.1", "pudding") assertBadNetmask("1.1.1.1", "::") - def test_pickle(self): - self.pickle_test('192.0.2.0/27') - self.pickle_test('192.0.2.0/31') # IPV4LENGTH - 1 - self.pickle_test('192.0.2.0') # IPV4LENGTH - class InterfaceTestCase_v4(BaseTestCase, NetmaskTestMixin_v4): factory = ipaddress.IPv4Interface @@ -519,11 +500,6 @@ assertBadNetmask("::1", "pudding") assertBadNetmask("::", "::") - def test_pickle(self): - self.pickle_test('2001:db8::1000/124') - self.pickle_test('2001:db8::1000/127') # IPV6LENGTH - 1 - self.pickle_test('2001:db8::1000') # IPV6LENGTH - class InterfaceTestCase_v6(BaseTestCase, NetmaskTestMixin_v6): factory = ipaddress.IPv6Interface @@ -790,18 +766,20 @@ 2 ** ipaddress.IPV6LENGTH) def testInternals(self): - ip1 = ipaddress.IPv4Address('10.10.10.10') - ip2 = ipaddress.IPv4Address('10.10.10.11') - ip3 = ipaddress.IPv4Address('10.10.10.12') - self.assertEqual(list(ipaddress._find_address_range([ip1])), - [(ip1, ip1)]) - self.assertEqual(list(ipaddress._find_address_range([ip1, ip3])), - [(ip1, ip1), (ip3, ip3)]) - self.assertEqual(list(ipaddress._find_address_range([ip1, ip2, ip3])), - [(ip1, ip3)]) + first, last = ipaddress._find_address_range([ + ipaddress.IPv4Address('10.10.10.10'), + ipaddress.IPv4Address('10.10.10.12')]) + self.assertEqual(first, last) self.assertEqual(128, ipaddress._count_righthand_zero_bits(0, 128)) self.assertEqual("IPv4Network('1.2.3.0/24')", repr(self.ipv4_network)) + def testMissingAddressVersion(self): + class Broken(ipaddress._BaseAddress): + pass + broken = Broken('127.0.0.1') + with self.assertRaisesRegex(NotImplementedError, "Broken.*version"): + broken.version + def testMissingNetworkVersion(self): class Broken(ipaddress._BaseNetwork): pass diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_multibytecodec.py --- a/Lib/test/test_multibytecodec.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_multibytecodec.py Mon Jan 19 22:03:19 2015 +0000 @@ -80,7 +80,7 @@ self.assertEqual(encoder.reset(), None) def test_stateful(self): - # jisx0213 encoder is stateful for a few code points. eg) + # jisx0213 encoder is stateful for a few codepoints. eg) # U+00E6 => A9DC # U+00E6 U+0300 => ABC4 # U+0300 => ABDC diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_signal.py --- a/Lib/test/test_signal.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_signal.py Mon Jan 19 22:03:19 2015 +0000 @@ -587,7 +587,7 @@ r, w = os.pipe() def handler(signum, frame): - pass + 1 / 0 signal.signal(signal.SIGALRM, handler) if interrupt is not None: @@ -604,9 +604,8 @@ try: # blocking call: read from a pipe without data os.read(r, 1) - except OSError as err: - if err.errno != errno.EINTR: - raise + except ZeroDivisionError: + pass else: sys.exit(2) sys.exit(3) diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_socket.py --- a/Lib/test/test_socket.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_socket.py Mon Jan 19 22:03:19 2015 +0000 @@ -3590,7 +3590,7 @@ def setUp(self): super().setUp() orig_alrm_handler = signal.signal(signal.SIGALRM, - lambda signum, frame: None) + lambda signum, frame: 1 / 0) self.addCleanup(signal.signal, signal.SIGALRM, orig_alrm_handler) self.addCleanup(self.setAlarm, 0) @@ -3627,13 +3627,11 @@ self.serv.settimeout(self.timeout) def checkInterruptedRecv(self, func, *args, **kwargs): - # Check that func(*args, **kwargs) raises OSError with an + # Check that func(*args, **kwargs) raises # errno of EINTR when interrupted by a signal. self.setAlarm(self.alarm_time) - with self.assertRaises(OSError) as cm: + with self.assertRaises(ZeroDivisionError) as cm: func(*args, **kwargs) - self.assertNotIsInstance(cm.exception, socket.timeout) - self.assertEqual(cm.exception.errno, errno.EINTR) def testInterruptedRecvTimeout(self): self.checkInterruptedRecv(self.serv.recv, 1024) @@ -3689,12 +3687,10 @@ # Check that func(*args, **kwargs), run in a loop, raises # OSError with an errno of EINTR when interrupted by a # signal. - with self.assertRaises(OSError) as cm: + with self.assertRaises(ZeroDivisionError) as cm: while True: self.setAlarm(self.alarm_time) func(*args, **kwargs) - self.assertNotIsInstance(cm.exception, socket.timeout) - self.assertEqual(cm.exception.errno, errno.EINTR) # Issue #12958: The following tests have problems on OS X prior to 10.7 @support.requires_mac_ver(10, 7) @@ -4062,117 +4058,6 @@ pass -class FileObjectInterruptedTestCase(unittest.TestCase): - """Test that the file object correctly handles EINTR internally.""" - - class MockSocket(object): - def __init__(self, recv_funcs=()): - # A generator that returns callables that we'll call for each - # call to recv(). - self._recv_step = iter(recv_funcs) - - def recv_into(self, buffer): - data = next(self._recv_step)() - assert len(buffer) >= len(data) - buffer[:len(data)] = data - return len(data) - - def _decref_socketios(self): - pass - - def _textiowrap_for_test(self, buffering=-1): - raw = socket.SocketIO(self, "r") - if buffering < 0: - buffering = io.DEFAULT_BUFFER_SIZE - if buffering == 0: - return raw - buffer = io.BufferedReader(raw, buffering) - text = io.TextIOWrapper(buffer, None, None) - text.mode = "rb" - return text - - @staticmethod - def _raise_eintr(): - raise OSError(errno.EINTR, "interrupted") - - def _textiowrap_mock_socket(self, mock, buffering=-1): - raw = socket.SocketIO(mock, "r") - if buffering < 0: - buffering = io.DEFAULT_BUFFER_SIZE - if buffering == 0: - return raw - buffer = io.BufferedReader(raw, buffering) - text = io.TextIOWrapper(buffer, None, None) - text.mode = "rb" - return text - - def _test_readline(self, size=-1, buffering=-1): - mock_sock = self.MockSocket(recv_funcs=[ - lambda : b"This is the first line\nAnd the sec", - self._raise_eintr, - lambda : b"ond line is here\n", - lambda : b"", - lambda : b"", # XXX(gps): io library does an extra EOF read - ]) - fo = mock_sock._textiowrap_for_test(buffering=buffering) - self.assertEqual(fo.readline(size), "This is the first line\n") - self.assertEqual(fo.readline(size), "And the second line is here\n") - - def _test_read(self, size=-1, buffering=-1): - mock_sock = self.MockSocket(recv_funcs=[ - lambda : b"This is the first line\nAnd the sec", - self._raise_eintr, - lambda : b"ond line is here\n", - lambda : b"", - lambda : b"", # XXX(gps): io library does an extra EOF read - ]) - expecting = (b"This is the first line\n" - b"And the second line is here\n") - fo = mock_sock._textiowrap_for_test(buffering=buffering) - if buffering == 0: - data = b'' - else: - data = '' - expecting = expecting.decode('utf-8') - while len(data) != len(expecting): - part = fo.read(size) - if not part: - break - data += part - self.assertEqual(data, expecting) - - def test_default(self): - self._test_readline() - self._test_readline(size=100) - self._test_read() - self._test_read(size=100) - - def test_with_1k_buffer(self): - self._test_readline(buffering=1024) - self._test_readline(size=100, buffering=1024) - self._test_read(buffering=1024) - self._test_read(size=100, buffering=1024) - - def _test_readline_no_buffer(self, size=-1): - mock_sock = self.MockSocket(recv_funcs=[ - lambda : b"a", - lambda : b"\n", - lambda : b"B", - self._raise_eintr, - lambda : b"b", - lambda : b"", - ]) - fo = mock_sock._textiowrap_for_test(buffering=0) - self.assertEqual(fo.readline(size), b"a\n") - self.assertEqual(fo.readline(size), b"Bb") - - def test_no_buffer(self): - self._test_readline_no_buffer() - self._test_readline_no_buffer(size=4) - self._test_read(buffering=0) - self._test_read(size=100, buffering=0) - - class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase): """Repeat the tests from FileObjectClassTestCase with bufsize==0. @@ -5388,7 +5273,6 @@ tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, - FileObjectInterruptedTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase, diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_stringprep.py --- a/Lib/test/test_stringprep.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_stringprep.py Mon Jan 19 22:03:19 2015 +0000 @@ -1,5 +1,5 @@ # To fully test this module, we would need a copy of the stringprep tables. -# Since we don't have them, this test checks only a few code points. +# Since we don't have them, this test checks only a few codepoints. import unittest from test import support diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_subprocess.py Mon Jan 19 22:03:19 2015 +0000 @@ -2421,25 +2421,6 @@ ProcessTestCase.tearDown(self) -class HelperFunctionTests(unittest.TestCase): - @unittest.skipIf(mswindows, "errno and EINTR make no sense on windows") - def test_eintr_retry_call(self): - record_calls = [] - def fake_os_func(*args): - record_calls.append(args) - if len(record_calls) == 2: - raise OSError(errno.EINTR, "fake interrupted system call") - return tuple(reversed(args)) - - self.assertEqual((999, 256), - subprocess._eintr_retry_call(fake_os_func, 256, 999)) - self.assertEqual([(256, 999)], record_calls) - # This time there will be an EINTR so it will loop once. - self.assertEqual((666,), - subprocess._eintr_retry_call(fake_os_func, 666)) - self.assertEqual([(256, 999), (666,), (666,)], record_calls) - - @unittest.skipUnless(mswindows, "Windows-specific tests") class CommandsWithSpaces (BaseTestCase): @@ -2528,7 +2509,6 @@ Win32ProcessTestCase, CommandTests, ProcessTestCaseNoPoll, - HelperFunctionTests, CommandsWithSpaces, ContextManagerTests, ) diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_sys.py --- a/Lib/test/test_sys.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_sys.py Mon Jan 19 22:03:19 2015 +0000 @@ -994,7 +994,7 @@ # frozenset PySet_MINSIZE = 8 samples = [[], range(10), range(50)] - s = size('3n2P' + PySet_MINSIZE*'nP' + '2nP') + s = size('3n2P' + PySet_MINSIZE*'nP' + 'nP') for sample in samples: minused = len(sample) if minused == 0: tmp = 1 diff -r 754c630c98a3 -r ff1274594739 Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Lib/test/test_unicode.py Mon Jan 19 22:03:19 2015 +0000 @@ -1470,9 +1470,9 @@ def test_utf8_decode_invalid_sequences(self): # continuation bytes in a sequence of 2, 3, or 4 bytes continuation_bytes = [bytes([x]) for x in range(0x80, 0xC0)] - # start bytes of a 2-byte sequence equivalent to code points < 0x7F + # start bytes of a 2-byte sequence equivalent to codepoints < 0x7F invalid_2B_seq_start_bytes = [bytes([x]) for x in range(0xC0, 0xC2)] - # start bytes of a 4-byte sequence equivalent to code points > 0x10FFFF + # start bytes of a 4-byte sequence equivalent to codepoints > 0x10FFFF invalid_4B_seq_start_bytes = [bytes([x]) for x in range(0xF5, 0xF8)] invalid_start_bytes = ( continuation_bytes + invalid_2B_seq_start_bytes + diff -r 754c630c98a3 -r ff1274594739 Misc/NEWS --- a/Misc/NEWS Tue Jan 20 14:11:38 2015 -0600 +++ b/Misc/NEWS Mon Jan 19 22:03:19 2015 +0000 @@ -203,14 +203,6 @@ Library ------- -- Issue #23133: Pickling of ipaddress objects now produces more compact and - portable representation. - -- Issue #23248: Update ssl error codes from latest OpenSSL git master. - -- Issue #23266: Much faster implementation of ipaddress.collapse_addresses() - when there are many non-consecutive addresses. - - Issue #23098: 64-bit dev_t is now supported in the os module. - Issue #21817: When an exception is raised in a task submitted to a diff -r 754c630c98a3 -r ff1274594739 Modules/_io/fileio.c --- a/Modules/_io/fileio.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/_io/fileio.c Mon Jan 19 22:03:19 2015 +0000 @@ -550,7 +550,7 @@ { Py_buffer pbuf; Py_ssize_t n, len; - int err; + int err, async_err = 0; if (self->fd < 0) return err_closed(); @@ -562,16 +562,19 @@ if (_PyVerify_fd(self->fd)) { len = pbuf.len; - Py_BEGIN_ALLOW_THREADS - errno = 0; + do { + Py_BEGIN_ALLOW_THREADS + errno = 0; #ifdef MS_WINDOWS - if (len > INT_MAX) - len = INT_MAX; - n = read(self->fd, pbuf.buf, (int)len); + if (len > INT_MAX) + len = INT_MAX; + n = read(self->fd, pbuf.buf, (int)len); #else - n = read(self->fd, pbuf.buf, len); + n = read(self->fd, pbuf.buf, len); #endif - Py_END_ALLOW_THREADS + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); } else n = -1; err = errno; @@ -580,7 +583,8 @@ if (err == EAGAIN) Py_RETURN_NONE; errno = err; - PyErr_SetFromErrno(PyExc_IOError); + if (!async_err) + PyErr_SetFromErrno(PyExc_IOError); return NULL; } @@ -627,6 +631,7 @@ Py_ssize_t bytes_read = 0; Py_ssize_t n; size_t bufsize; + int async_err = 0; if (self->fd < 0) return err_closed(); @@ -673,27 +678,23 @@ return NULL; } } - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = bufsize - bytes_read; + do { + Py_BEGIN_ALLOW_THREADS + errno = 0; + n = bufsize - bytes_read; #ifdef MS_WINDOWS - if (n > INT_MAX) - n = INT_MAX; - n = read(self->fd, PyBytes_AS_STRING(result) + bytes_read, (int)n); + if (n > INT_MAX) + n = INT_MAX; + n = read(self->fd, PyBytes_AS_STRING(result) + bytes_read, (int)n); #else - n = read(self->fd, PyBytes_AS_STRING(result) + bytes_read, n); + n = read(self->fd, PyBytes_AS_STRING(result) + bytes_read, n); #endif - Py_END_ALLOW_THREADS + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); if (n == 0) break; if (n < 0) { - if (errno == EINTR) { - if (PyErr_CheckSignals()) { - Py_DECREF(result); - return NULL; - } - continue; - } if (errno == EAGAIN) { if (bytes_read > 0) break; @@ -701,7 +702,8 @@ Py_RETURN_NONE; } Py_DECREF(result); - PyErr_SetFromErrno(PyExc_IOError); + if (!async_err) + PyErr_SetFromErrno(PyExc_IOError); return NULL; } bytes_read += n; @@ -723,6 +725,7 @@ char *ptr; Py_ssize_t n; Py_ssize_t size = -1; + int async_err = 0; PyObject *bytes; if (self->fd < 0) @@ -747,14 +750,17 @@ ptr = PyBytes_AS_STRING(bytes); if (_PyVerify_fd(self->fd)) { - Py_BEGIN_ALLOW_THREADS - errno = 0; + do { + Py_BEGIN_ALLOW_THREADS + errno = 0; #ifdef MS_WINDOWS - n = read(self->fd, ptr, (int)size); + n = read(self->fd, ptr, (int)size); #else - n = read(self->fd, ptr, size); + n = read(self->fd, ptr, size); #endif - Py_END_ALLOW_THREADS + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); } else n = -1; @@ -764,7 +770,8 @@ if (err == EAGAIN) Py_RETURN_NONE; errno = err; - PyErr_SetFromErrno(PyExc_IOError); + if (!async_err) + PyErr_SetFromErrno(PyExc_IOError); return NULL; } @@ -783,7 +790,7 @@ { Py_buffer pbuf; Py_ssize_t n, len; - int err; + int err, async_err = 0; if (self->fd < 0) return err_closed(); @@ -794,24 +801,26 @@ return NULL; if (_PyVerify_fd(self->fd)) { - Py_BEGIN_ALLOW_THREADS - errno = 0; - len = pbuf.len; + do { + Py_BEGIN_ALLOW_THREADS + errno = 0; + len = pbuf.len; #ifdef MS_WINDOWS - if (len > 32767 && isatty(self->fd)) { - /* Issue #11395: the Windows console returns an error (12: not - enough space error) on writing into stdout if stdout mode is - binary and the length is greater than 66,000 bytes (or less, - depending on heap usage). */ - len = 32767; - } - else if (len > INT_MAX) - len = INT_MAX; - n = write(self->fd, pbuf.buf, (int)len); + if (len > 32767 && isatty(self->fd)) { + /* Issue #11395: the Windows console returns an error (12: not + enough space error) on writing into stdout if stdout mode is + binary and the length is greater than 66,000 bytes (or less, + depending on heap usage). */ + len = 32767; + } else if (len > INT_MAX) + len = INT_MAX; + n = write(self->fd, pbuf.buf, (int)len); #else - n = write(self->fd, pbuf.buf, len); + n = write(self->fd, pbuf.buf, len); #endif - Py_END_ALLOW_THREADS + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); } else n = -1; err = errno; @@ -822,7 +831,8 @@ if (err == EAGAIN) Py_RETURN_NONE; errno = err; - PyErr_SetFromErrno(PyExc_IOError); + if (!async_err) + PyErr_SetFromErrno(PyExc_IOError); return NULL; } diff -r 754c630c98a3 -r ff1274594739 Modules/_ssl_data.h --- a/Modules/_ssl_data.h Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/_ssl_data.h Mon Jan 19 22:03:19 2015 +0000 @@ -1,5 +1,5 @@ /* File generated by Tools/ssl/make_ssl_data.py */ -/* Generated on 2015-01-17T20:33:43.377453 */ +/* Generated on 2012-05-16T23:56:40.981382 */ static struct py_ssl_library_code library_codes[] = { {"PEM", ERR_LIB_PEM}, @@ -179,11 +179,6 @@ #else {"BAD_CHECKSUM", ERR_LIB_SSL, 104}, #endif - #ifdef SSL_R_BAD_DATA - {"BAD_DATA", ERR_LIB_SSL, SSL_R_BAD_DATA}, - #else - {"BAD_DATA", ERR_LIB_SSL, 390}, - #endif #ifdef SSL_R_BAD_DATA_RETURNED_BY_CALLBACK {"BAD_DATA_RETURNED_BY_CALLBACK", ERR_LIB_SSL, SSL_R_BAD_DATA_RETURNED_BY_CALLBACK}, #else @@ -314,46 +309,6 @@ #else {"BAD_SIGNATURE", ERR_LIB_SSL, 123}, #endif - #ifdef SSL_R_BAD_SRP_A_LENGTH - {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_A_LENGTH}, - #else - {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, 347}, - #endif - #ifdef SSL_R_BAD_SRP_B_LENGTH - {"BAD_SRP_B_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_B_LENGTH}, - #else - {"BAD_SRP_B_LENGTH", ERR_LIB_SSL, 348}, - #endif - #ifdef SSL_R_BAD_SRP_G_LENGTH - {"BAD_SRP_G_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_G_LENGTH}, - #else - {"BAD_SRP_G_LENGTH", ERR_LIB_SSL, 349}, - #endif - #ifdef SSL_R_BAD_SRP_N_LENGTH - {"BAD_SRP_N_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_N_LENGTH}, - #else - {"BAD_SRP_N_LENGTH", ERR_LIB_SSL, 350}, - #endif - #ifdef SSL_R_BAD_SRP_PARAMETERS - {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, SSL_R_BAD_SRP_PARAMETERS}, - #else - {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, 371}, - #endif - #ifdef SSL_R_BAD_SRP_S_LENGTH - {"BAD_SRP_S_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_S_LENGTH}, - #else - {"BAD_SRP_S_LENGTH", ERR_LIB_SSL, 351}, - #endif - #ifdef SSL_R_BAD_SRTP_MKI_VALUE - {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, SSL_R_BAD_SRTP_MKI_VALUE}, - #else - {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, 352}, - #endif - #ifdef SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST - {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST}, - #else - {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, 353}, - #endif #ifdef SSL_R_BAD_SSL_FILETYPE {"BAD_SSL_FILETYPE", ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE}, #else @@ -369,11 +324,6 @@ #else {"BAD_STATE", ERR_LIB_SSL, 126}, #endif - #ifdef SSL_R_BAD_VALUE - {"BAD_VALUE", ERR_LIB_SSL, SSL_R_BAD_VALUE}, - #else - {"BAD_VALUE", ERR_LIB_SSL, 384}, - #endif #ifdef SSL_R_BAD_WRITE_RETRY {"BAD_WRITE_RETRY", ERR_LIB_SSL, SSL_R_BAD_WRITE_RETRY}, #else @@ -404,16 +354,6 @@ #else {"CA_DN_TOO_LONG", ERR_LIB_SSL, 132}, #endif - #ifdef SSL_R_CA_KEY_TOO_SMALL - {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_CA_KEY_TOO_SMALL}, - #else - {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, 397}, - #endif - #ifdef SSL_R_CA_MD_TOO_WEAK - {"CA_MD_TOO_WEAK", ERR_LIB_SSL, SSL_R_CA_MD_TOO_WEAK}, - #else - {"CA_MD_TOO_WEAK", ERR_LIB_SSL, 398}, - #endif #ifdef SSL_R_CCS_RECEIVED_EARLY {"CCS_RECEIVED_EARLY", ERR_LIB_SSL, SSL_R_CCS_RECEIVED_EARLY}, #else @@ -424,11 +364,6 @@ #else {"CERTIFICATE_VERIFY_FAILED", ERR_LIB_SSL, 134}, #endif - #ifdef SSL_R_CERT_CB_ERROR - {"CERT_CB_ERROR", ERR_LIB_SSL, SSL_R_CERT_CB_ERROR}, - #else - {"CERT_CB_ERROR", ERR_LIB_SSL, 377}, - #endif #ifdef SSL_R_CERT_LENGTH_MISMATCH {"CERT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CERT_LENGTH_MISMATCH}, #else @@ -519,11 +454,6 @@ #else {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", ERR_LIB_SSL, 281}, #endif - #ifdef SSL_R_DH_KEY_TOO_SMALL - {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_DH_KEY_TOO_SMALL}, - #else - {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, 394}, - #endif #ifdef SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG}, #else @@ -564,26 +494,11 @@ #else {"ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE", ERR_LIB_SSL, 323}, #endif - #ifdef SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE - {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE}, - #else - {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, 374}, - #endif #ifdef SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER {"ECGROUP_TOO_LARGE_FOR_CIPHER", ERR_LIB_SSL, SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER}, #else {"ECGROUP_TOO_LARGE_FOR_CIPHER", ERR_LIB_SSL, 310}, #endif - #ifdef SSL_R_EE_KEY_TOO_SMALL - {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_EE_KEY_TOO_SMALL}, - #else - {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, 399}, - #endif - #ifdef SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST - {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST}, - #else - {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, 354}, - #endif #ifdef SSL_R_ENCRYPTED_LENGTH_TOO_LONG {"ENCRYPTED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_ENCRYPTED_LENGTH_TOO_LONG}, #else @@ -614,16 +529,6 @@ #else {"GOT_A_FIN_BEFORE_A_CCS", ERR_LIB_SSL, 154}, #endif - #ifdef SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS - {"GOT_NEXT_PROTO_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS}, - #else - {"GOT_NEXT_PROTO_BEFORE_A_CCS", ERR_LIB_SSL, 355}, - #endif - #ifdef SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION - {"GOT_NEXT_PROTO_WITHOUT_EXTENSION", ERR_LIB_SSL, SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION}, - #else - {"GOT_NEXT_PROTO_WITHOUT_EXTENSION", ERR_LIB_SSL, 356}, - #endif #ifdef SSL_R_HTTPS_PROXY_REQUEST {"HTTPS_PROXY_REQUEST", ERR_LIB_SSL, SSL_R_HTTPS_PROXY_REQUEST}, #else @@ -639,16 +544,6 @@ #else {"ILLEGAL_PADDING", ERR_LIB_SSL, 283}, #endif - #ifdef SSL_R_ILLEGAL_SUITEB_DIGEST - {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, SSL_R_ILLEGAL_SUITEB_DIGEST}, - #else - {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, 380}, - #endif - #ifdef SSL_R_INAPPROPRIATE_FALLBACK - {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_INAPPROPRIATE_FALLBACK}, - #else - {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, 373}, - #endif #ifdef SSL_R_INCONSISTENT_COMPRESSION {"INCONSISTENT_COMPRESSION", ERR_LIB_SSL, SSL_R_INCONSISTENT_COMPRESSION}, #else @@ -669,26 +564,11 @@ #else {"INVALID_COMPRESSION_ALGORITHM", ERR_LIB_SSL, 341}, #endif - #ifdef SSL_R_INVALID_NULL_CMD_NAME - {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, SSL_R_INVALID_NULL_CMD_NAME}, - #else - {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, 385}, - #endif #ifdef SSL_R_INVALID_PURPOSE {"INVALID_PURPOSE", ERR_LIB_SSL, SSL_R_INVALID_PURPOSE}, #else {"INVALID_PURPOSE", ERR_LIB_SSL, 278}, #endif - #ifdef SSL_R_INVALID_SERVERINFO_DATA - {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, SSL_R_INVALID_SERVERINFO_DATA}, - #else - {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, 388}, - #endif - #ifdef SSL_R_INVALID_SRP_USERNAME - {"INVALID_SRP_USERNAME", ERR_LIB_SSL, SSL_R_INVALID_SRP_USERNAME}, - #else - {"INVALID_SRP_USERNAME", ERR_LIB_SSL, 357}, - #endif #ifdef SSL_R_INVALID_STATUS_RESPONSE {"INVALID_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_INVALID_STATUS_RESPONSE}, #else @@ -809,16 +689,6 @@ #else {"MISSING_DSA_SIGNING_CERT", ERR_LIB_SSL, 165}, #endif - #ifdef SSL_R_MISSING_ECDH_CERT - {"MISSING_ECDH_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDH_CERT}, - #else - {"MISSING_ECDH_CERT", ERR_LIB_SSL, 382}, - #endif - #ifdef SSL_R_MISSING_ECDSA_SIGNING_CERT - {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDSA_SIGNING_CERT}, - #else - {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, 381}, - #endif #ifdef SSL_R_MISSING_EXPORT_TMP_DH_KEY {"MISSING_EXPORT_TMP_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_EXPORT_TMP_DH_KEY}, #else @@ -844,11 +714,6 @@ #else {"MISSING_RSA_SIGNING_CERT", ERR_LIB_SSL, 170}, #endif - #ifdef SSL_R_MISSING_SRP_PARAM - {"MISSING_SRP_PARAM", ERR_LIB_SSL, SSL_R_MISSING_SRP_PARAM}, - #else - {"MISSING_SRP_PARAM", ERR_LIB_SSL, 358}, - #endif #ifdef SSL_R_MISSING_TMP_DH_KEY {"MISSING_TMP_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_DH_KEY}, #else @@ -874,11 +739,6 @@ #else {"MISSING_VERIFY_MESSAGE", ERR_LIB_SSL, 174}, #endif - #ifdef SSL_R_MULTIPLE_SGC_RESTARTS - {"MULTIPLE_SGC_RESTARTS", ERR_LIB_SSL, SSL_R_MULTIPLE_SGC_RESTARTS}, - #else - {"MULTIPLE_SGC_RESTARTS", ERR_LIB_SSL, 346}, - #endif #ifdef SSL_R_NON_SSLV2_INITIAL_PACKET {"NON_SSLV2_INITIAL_PACKET", ERR_LIB_SSL, SSL_R_NON_SSLV2_INITIAL_PACKET}, #else @@ -959,11 +819,6 @@ #else {"NO_METHOD_SPECIFIED", ERR_LIB_SSL, 188}, #endif - #ifdef SSL_R_NO_PEM_EXTENSIONS - {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, SSL_R_NO_PEM_EXTENSIONS}, - #else - {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, 389}, - #endif #ifdef SSL_R_NO_PRIVATEKEY {"NO_PRIVATEKEY", ERR_LIB_SSL, SSL_R_NO_PRIVATEKEY}, #else @@ -999,16 +854,6 @@ #else {"NO_SHARED_CIPHER", ERR_LIB_SSL, 193}, #endif - #ifdef SSL_R_NO_SHARED_SIGATURE_ALGORITHMS - {"NO_SHARED_SIGATURE_ALGORITHMS", ERR_LIB_SSL, SSL_R_NO_SHARED_SIGATURE_ALGORITHMS}, - #else - {"NO_SHARED_SIGATURE_ALGORITHMS", ERR_LIB_SSL, 376}, - #endif - #ifdef SSL_R_NO_SRTP_PROFILES - {"NO_SRTP_PROFILES", ERR_LIB_SSL, SSL_R_NO_SRTP_PROFILES}, - #else - {"NO_SRTP_PROFILES", ERR_LIB_SSL, 359}, - #endif #ifdef SSL_R_NO_VERIFY_CALLBACK {"NO_VERIFY_CALLBACK", ERR_LIB_SSL, SSL_R_NO_VERIFY_CALLBACK}, #else @@ -1034,16 +879,6 @@ #else {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", ERR_LIB_SSL, 344}, #endif - #ifdef SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE - {"ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE}, - #else - {"ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, 387}, - #endif - #ifdef SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE - {"ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE}, - #else - {"ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, 379}, - #endif #ifdef SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE {"ONLY_TLS_ALLOWED_IN_FIPS_MODE", ERR_LIB_SSL, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE}, #else @@ -1099,16 +934,6 @@ #else {"PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE", ERR_LIB_SSL, 204}, #endif - #ifdef SSL_R_PEM_NAME_BAD_PREFIX - {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, SSL_R_PEM_NAME_BAD_PREFIX}, - #else - {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, 391}, - #endif - #ifdef SSL_R_PEM_NAME_TOO_SHORT - {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, SSL_R_PEM_NAME_TOO_SHORT}, - #else - {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, 392}, - #endif #ifdef SSL_R_PRE_MAC_LENGTH_TOO_LONG {"PRE_MAC_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_PRE_MAC_LENGTH_TOO_LONG}, #else @@ -1244,36 +1069,11 @@ #else {"SHORT_READ", ERR_LIB_SSL, 219}, #endif - #ifdef SSL_R_SIGNATURE_ALGORITHMS_ERROR - {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, SSL_R_SIGNATURE_ALGORITHMS_ERROR}, - #else - {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, 360}, - #endif #ifdef SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE}, #else {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, 220}, #endif - #ifdef SSL_R_SRP_A_CALC - {"SRP_A_CALC", ERR_LIB_SSL, SSL_R_SRP_A_CALC}, - #else - {"SRP_A_CALC", ERR_LIB_SSL, 361}, - #endif - #ifdef SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES - {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES}, - #else - {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, 362}, - #endif - #ifdef SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG - {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG}, - #else - {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, 363}, - #endif - #ifdef SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE - {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE}, - #else - {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, 364}, - #endif #ifdef SSL_R_SSL23_DOING_SESSION_ID_REUSE {"SSL23_DOING_SESSION_ID_REUSE", ERR_LIB_SSL, SSL_R_SSL23_DOING_SESSION_ID_REUSE}, #else @@ -1379,11 +1179,6 @@ #else {"SSL_LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, 230}, #endif - #ifdef SSL_R_SSL_NEGATIVE_LENGTH - {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, SSL_R_SSL_NEGATIVE_LENGTH}, - #else - {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, 372}, - #endif #ifdef SSL_R_SSL_SESSION_ID_CALLBACK_FAILED {"SSL_SESSION_ID_CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CALLBACK_FAILED}, #else @@ -1434,11 +1229,6 @@ #else {"TLSV1_ALERT_EXPORT_RESTRICTION", ERR_LIB_SSL, 1060}, #endif - #ifdef SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK - {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK}, - #else - {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, 1086}, - #endif #ifdef SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY {"TLSV1_ALERT_INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY}, #else @@ -1504,21 +1294,6 @@ #else {"TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER", ERR_LIB_SSL, 232}, #endif - #ifdef SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT - {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT}, - #else - {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", ERR_LIB_SSL, 365}, - #endif - #ifdef SSL_R_TLS_HEARTBEAT_PENDING - {"TLS_HEARTBEAT_PENDING", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PENDING}, - #else - {"TLS_HEARTBEAT_PENDING", ERR_LIB_SSL, 366}, - #endif - #ifdef SSL_R_TLS_ILLEGAL_EXPORTER_LABEL - {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL}, - #else - {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, 367}, - #endif #ifdef SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST {"TLS_INVALID_ECPOINTFORMAT_LIST", ERR_LIB_SSL, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST}, #else @@ -1624,16 +1399,6 @@ #else {"UNKNOWN_CIPHER_TYPE", ERR_LIB_SSL, 249}, #endif - #ifdef SSL_R_UNKNOWN_CMD_NAME - {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, SSL_R_UNKNOWN_CMD_NAME}, - #else - {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, 386}, - #endif - #ifdef SSL_R_UNKNOWN_DIGEST - {"UNKNOWN_DIGEST", ERR_LIB_SSL, SSL_R_UNKNOWN_DIGEST}, - #else - {"UNKNOWN_DIGEST", ERR_LIB_SSL, 368}, - #endif #ifdef SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE {"UNKNOWN_KEY_EXCHANGE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE}, #else @@ -1704,36 +1469,16 @@ #else {"UNSUPPORTED_STATUS_TYPE", ERR_LIB_SSL, 329}, #endif - #ifdef SSL_R_USE_SRTP_NOT_NEGOTIATED - {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, SSL_R_USE_SRTP_NOT_NEGOTIATED}, - #else - {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, 369}, - #endif - #ifdef SSL_R_VERSION_TOO_LOW - {"VERSION_TOO_LOW", ERR_LIB_SSL, SSL_R_VERSION_TOO_LOW}, - #else - {"VERSION_TOO_LOW", ERR_LIB_SSL, 396}, - #endif #ifdef SSL_R_WRITE_BIO_NOT_SET {"WRITE_BIO_NOT_SET", ERR_LIB_SSL, SSL_R_WRITE_BIO_NOT_SET}, #else {"WRITE_BIO_NOT_SET", ERR_LIB_SSL, 260}, #endif - #ifdef SSL_R_WRONG_CERTIFICATE_TYPE - {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_CERTIFICATE_TYPE}, - #else - {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, 383}, - #endif #ifdef SSL_R_WRONG_CIPHER_RETURNED {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_WRONG_CIPHER_RETURNED}, #else {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, 261}, #endif - #ifdef SSL_R_WRONG_CURVE - {"WRONG_CURVE", ERR_LIB_SSL, SSL_R_WRONG_CURVE}, - #else - {"WRONG_CURVE", ERR_LIB_SSL, 378}, - #endif #ifdef SSL_R_WRONG_MESSAGE_TYPE {"WRONG_MESSAGE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_MESSAGE_TYPE}, #else @@ -1754,11 +1499,6 @@ #else {"WRONG_SIGNATURE_SIZE", ERR_LIB_SSL, 265}, #endif - #ifdef SSL_R_WRONG_SIGNATURE_TYPE - {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_TYPE}, - #else - {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, 370}, - #endif #ifdef SSL_R_WRONG_SSL_VERSION {"WRONG_SSL_VERSION", ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION}, #else @@ -1779,11 +1519,6 @@ #else {"X509_VERIFICATION_SETUP_PROBLEMS", ERR_LIB_SSL, 269}, #endif - #ifdef X509_R_AKID_MISMATCH - {"AKID_MISMATCH", ERR_LIB_X509, X509_R_AKID_MISMATCH}, - #else - {"AKID_MISMATCH", ERR_LIB_X509, 110}, - #endif #ifdef X509_R_BAD_X509_FILETYPE {"BAD_X509_FILETYPE", ERR_LIB_X509, X509_R_BAD_X509_FILETYPE}, #else @@ -1804,26 +1539,11 @@ #else {"CERT_ALREADY_IN_HASH_TABLE", ERR_LIB_X509, 101}, #endif - #ifdef X509_R_CRL_ALREADY_DELTA - {"CRL_ALREADY_DELTA", ERR_LIB_X509, X509_R_CRL_ALREADY_DELTA}, - #else - {"CRL_ALREADY_DELTA", ERR_LIB_X509, 127}, - #endif - #ifdef X509_R_CRL_VERIFY_FAILURE - {"CRL_VERIFY_FAILURE", ERR_LIB_X509, X509_R_CRL_VERIFY_FAILURE}, - #else - {"CRL_VERIFY_FAILURE", ERR_LIB_X509, 131}, - #endif #ifdef X509_R_ERR_ASN1_LIB {"ERR_ASN1_LIB", ERR_LIB_X509, X509_R_ERR_ASN1_LIB}, #else {"ERR_ASN1_LIB", ERR_LIB_X509, 102}, #endif - #ifdef X509_R_IDP_MISMATCH - {"IDP_MISMATCH", ERR_LIB_X509, X509_R_IDP_MISMATCH}, - #else - {"IDP_MISMATCH", ERR_LIB_X509, 128}, - #endif #ifdef X509_R_INVALID_DIRECTORY {"INVALID_DIRECTORY", ERR_LIB_X509, X509_R_INVALID_DIRECTORY}, #else @@ -1839,11 +1559,6 @@ #else {"INVALID_TRUST", ERR_LIB_X509, 123}, #endif - #ifdef X509_R_ISSUER_MISMATCH - {"ISSUER_MISMATCH", ERR_LIB_X509, X509_R_ISSUER_MISMATCH}, - #else - {"ISSUER_MISMATCH", ERR_LIB_X509, 129}, - #endif #ifdef X509_R_KEY_TYPE_MISMATCH {"KEY_TYPE_MISMATCH", ERR_LIB_X509, X509_R_KEY_TYPE_MISMATCH}, #else @@ -1869,21 +1584,11 @@ #else {"METHOD_NOT_SUPPORTED", ERR_LIB_X509, 124}, #endif - #ifdef X509_R_NEWER_CRL_NOT_NEWER - {"NEWER_CRL_NOT_NEWER", ERR_LIB_X509, X509_R_NEWER_CRL_NOT_NEWER}, - #else - {"NEWER_CRL_NOT_NEWER", ERR_LIB_X509, 132}, - #endif #ifdef X509_R_NO_CERT_SET_FOR_US_TO_VERIFY {"NO_CERT_SET_FOR_US_TO_VERIFY", ERR_LIB_X509, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY}, #else {"NO_CERT_SET_FOR_US_TO_VERIFY", ERR_LIB_X509, 105}, #endif - #ifdef X509_R_NO_CRL_NUMBER - {"NO_CRL_NUMBER", ERR_LIB_X509, X509_R_NO_CRL_NUMBER}, - #else - {"NO_CRL_NUMBER", ERR_LIB_X509, 130}, - #endif #ifdef X509_R_PUBLIC_KEY_DECODE_ERROR {"PUBLIC_KEY_DECODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_DECODE_ERROR}, #else diff -r 754c630c98a3 -r ff1274594739 Modules/binascii.c --- a/Modules/binascii.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/binascii.c Mon Jan 19 22:03:19 2015 +0000 @@ -1147,20 +1147,6 @@ return retval; } -/*[clinic input] -binascii.hexlify = binascii.b2a_hex - -Hexadecimal representation of binary data. - -The return value is a bytes object. -[clinic start generated code]*/ - -static PyObject * -binascii_hexlify_impl(PyModuleDef *module, Py_buffer *data) -/*[clinic end generated code: output=6098440091fb61dc input=2e3afae7f083f061]*/ -{ - return binascii_b2a_hex_impl(module, data); -} static int to_int(int c) @@ -1235,21 +1221,6 @@ return NULL; } -/*[clinic input] -binascii.unhexlify = binascii.a2b_hex - -Binary data of hexadecimal representation. - -hexstr must contain an even number of hex digits (upper or lower case). -[clinic start generated code]*/ - -static PyObject * -binascii_unhexlify_impl(PyModuleDef *module, Py_buffer *hexstr) -/*[clinic end generated code: output=17cec7544499803e input=dd8c012725f462da]*/ -{ - return binascii_a2b_hex_impl(module, hexstr); -} - static int table_hex[128] = { -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, @@ -1564,8 +1535,10 @@ BINASCII_B2A_HQX_METHODDEF BINASCII_A2B_HEX_METHODDEF BINASCII_B2A_HEX_METHODDEF - BINASCII_HEXLIFY_METHODDEF - BINASCII_UNHEXLIFY_METHODDEF + {"unhexlify", (PyCFunction)binascii_a2b_hex, METH_VARARGS, + binascii_a2b_hex__doc__}, + {"hexlify", (PyCFunction)binascii_b2a_hex, METH_VARARGS, + binascii_b2a_hex__doc__}, BINASCII_RLECODE_HQX_METHODDEF BINASCII_RLEDECODE_HQX_METHODDEF BINASCII_CRC_HQX_METHODDEF diff -r 754c630c98a3 -r ff1274594739 Modules/cjkcodecs/_codecs_cn.c --- a/Modules/cjkcodecs/_codecs_cn.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/cjkcodecs/_codecs_cn.c Mon Jan 19 22:03:19 2015 +0000 @@ -15,7 +15,7 @@ #undef hz #endif -/* GBK and GB2312 map differently in few code points that are listed below: +/* GBK and GB2312 map differently in few codepoints that are listed below: * * gb2312 gbk * A1A4 U+30FB KATAKANA MIDDLE DOT U+00B7 MIDDLE DOT diff -r 754c630c98a3 -r ff1274594739 Modules/cjkcodecs/_codecs_hk.c --- a/Modules/cjkcodecs/_codecs_hk.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/cjkcodecs/_codecs_hk.c Mon Jan 19 22:03:19 2015 +0000 @@ -171,7 +171,7 @@ default: return 1; } - NEXT_IN(2); /* all decoded code points are pairs, above. */ + NEXT_IN(2); /* all decoded codepoints are pairs, above. */ } return 0; diff -r 754c630c98a3 -r ff1274594739 Modules/cjkcodecs/_codecs_kr.c --- a/Modules/cjkcodecs/_codecs_kr.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/cjkcodecs/_codecs_kr.c Mon Jan 19 22:03:19 2015 +0000 @@ -69,7 +69,7 @@ OUTBYTE1(EUCKR_JAMO_FIRSTBYTE); OUTBYTE2(EUCKR_JAMO_FILLER); - /* All code points in CP949 extension are in unicode + /* All codepoints in CP949 extension are in unicode * Hangul Syllable area. */ assert(0xac00 <= c && c <= 0xd7a3); c -= 0xac00; diff -r 754c630c98a3 -r ff1274594739 Modules/cjkcodecs/cjkcodecs.h --- a/Modules/cjkcodecs/cjkcodecs.h Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/cjkcodecs/cjkcodecs.h Mon Jan 19 22:03:19 2015 +0000 @@ -12,10 +12,10 @@ #include "multibytecodec.h" -/* a unicode "undefined" code point */ +/* a unicode "undefined" codepoint */ #define UNIINV 0xFFFE -/* internal-use DBCS code points which aren't used by any charsets */ +/* internal-use DBCS codepoints which aren't used by any charsets */ #define NOCHAR 0xFFFF #define MULTIC 0xFFFE #define DBCINV 0xFFFD diff -r 754c630c98a3 -r ff1274594739 Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/clinic/binascii.c.h Mon Jan 19 22:03:19 2015 +0000 @@ -367,40 +367,6 @@ return return_value; } -PyDoc_STRVAR(binascii_hexlify__doc__, -"hexlify($module, data, /)\n" -"--\n" -"\n" -"Hexadecimal representation of binary data.\n" -"\n" -"The return value is a bytes object."); - -#define BINASCII_HEXLIFY_METHODDEF \ - {"hexlify", (PyCFunction)binascii_hexlify, METH_VARARGS, binascii_hexlify__doc__}, - -static PyObject * -binascii_hexlify_impl(PyModuleDef *module, Py_buffer *data); - -static PyObject * -binascii_hexlify(PyModuleDef *module, PyObject *args) -{ - PyObject *return_value = NULL; - Py_buffer data = {NULL, NULL}; - - if (!PyArg_ParseTuple(args, - "y*:hexlify", - &data)) - goto exit; - return_value = binascii_hexlify_impl(module, &data); - -exit: - /* Cleanup for data */ - if (data.obj) - PyBuffer_Release(&data); - - return return_value; -} - PyDoc_STRVAR(binascii_a2b_hex__doc__, "a2b_hex($module, hexstr, /)\n" "--\n" @@ -436,40 +402,6 @@ return return_value; } -PyDoc_STRVAR(binascii_unhexlify__doc__, -"unhexlify($module, hexstr, /)\n" -"--\n" -"\n" -"Binary data of hexadecimal representation.\n" -"\n" -"hexstr must contain an even number of hex digits (upper or lower case)."); - -#define BINASCII_UNHEXLIFY_METHODDEF \ - {"unhexlify", (PyCFunction)binascii_unhexlify, METH_VARARGS, binascii_unhexlify__doc__}, - -static PyObject * -binascii_unhexlify_impl(PyModuleDef *module, Py_buffer *hexstr); - -static PyObject * -binascii_unhexlify(PyModuleDef *module, PyObject *args) -{ - PyObject *return_value = NULL; - Py_buffer hexstr = {NULL, NULL}; - - if (!PyArg_ParseTuple(args, - "O&:unhexlify", - ascii_buffer_converter, &hexstr)) - goto exit; - return_value = binascii_unhexlify_impl(module, &hexstr); - -exit: - /* Cleanup for hexstr */ - if (hexstr.obj) - PyBuffer_Release(&hexstr); - - return return_value; -} - PyDoc_STRVAR(binascii_a2b_qp__doc__, "a2b_qp($module, /, data, header=False)\n" "--\n" @@ -543,4 +475,4 @@ return return_value; } -/*[clinic end generated code: output=771126f8f53e84e7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=53cd6b379c745220 input=a9049054013a1b77]*/ diff -r 754c630c98a3 -r ff1274594739 Modules/posixmodule.c --- a/Modules/posixmodule.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/posixmodule.c Mon Jan 19 22:03:19 2015 +0000 @@ -1361,13 +1361,16 @@ posix_fildes_fd(int fd, int (*func)(int)) { int res; - Py_BEGIN_ALLOW_THREADS - res = (*func)(fd); - Py_END_ALLOW_THREADS - if (res < 0) - return posix_error(); - Py_INCREF(Py_None); - return Py_None; + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + res = (*func)(fd); + Py_END_ALLOW_THREADS + } while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res != 0) + return (!async_err) ? posix_error() : NULL; + Py_RETURN_NONE; } @@ -3479,11 +3482,16 @@ /*[clinic end generated code: output=3c19fbfd724a8e0f input=8ab11975ca01ee5b]*/ { int res; - Py_BEGIN_ALLOW_THREADS - res = fchmod(fd, mode); - Py_END_ALLOW_THREADS - if (res < 0) - return posix_error(); + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + res = fchmod(fd, mode); + Py_END_ALLOW_THREADS + } while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res != 0) + return (!async_err) ? posix_error() : NULL; + Py_RETURN_NONE; } #endif /* HAVE_FCHMOD */ @@ -4104,11 +4112,16 @@ /*[clinic end generated code: output=687781cb7d8974d6 input=3af544ba1b13a0d7]*/ { int res; - Py_BEGIN_ALLOW_THREADS - res = fchown(fd, uid, gid); - Py_END_ALLOW_THREADS - if (res < 0) - return posix_error(); + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + res = fchown(fd, uid, gid); + Py_END_ALLOW_THREADS + } while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res != 0) + return (!async_err) ? posix_error() : NULL; + Py_RETURN_NONE; } #endif /* HAVE_FCHOWN */ @@ -9665,15 +9678,21 @@ os_wait4_impl(PyModuleDef *module, pid_t pid, int options) /*[clinic end generated code: output=20dfb05289d37dc6 input=d11deed0750600ba]*/ { + pid_t res; struct rusage ru; + int async_err = 0; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; - Py_BEGIN_ALLOW_THREADS - pid = wait4(pid, &status, options, &ru); - Py_END_ALLOW_THREADS - - return wait_helper(pid, WAIT_STATUS_INT(status), &ru); + do { + Py_BEGIN_ALLOW_THREADS + res = wait4(pid, &status, options, &ru); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res < 0) + return (!async_err) ? posix_error() : NULL; + + return wait_helper(res, WAIT_STATUS_INT(status), &ru); } #endif /* HAVE_WAIT4 */ @@ -9744,14 +9763,17 @@ { PyObject *result; int res; + int async_err = 0; siginfo_t si; si.si_pid = 0; - Py_BEGIN_ALLOW_THREADS - res = waitid(idtype, id, &si, options); - Py_END_ALLOW_THREADS - if (res == -1) - return posix_error(); + do { + Py_BEGIN_ALLOW_THREADS + res = waitid(idtype, id, &si, options); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res < 0) + return (!async_err) ? posix_error() : NULL; if (si.si_pid == 0) Py_RETURN_NONE; @@ -9828,16 +9850,20 @@ os_waitpid_impl(PyModuleDef *module, pid_t pid, int options) /*[clinic end generated code: output=095a6b00af70b7ac input=0bf1666b8758fda3]*/ { + pid_t res; + int async_err = 0; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; - Py_BEGIN_ALLOW_THREADS - pid = waitpid(pid, &status, options); - Py_END_ALLOW_THREADS - if (pid == -1) - return posix_error(); - - return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); + do { + Py_BEGIN_ALLOW_THREADS + res = waitpid(pid, &status, options); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res < 0) + return (!async_err) ? posix_error() : NULL; + + return Py_BuildValue("Ni", PyLong_FromPid(res), WAIT_STATUS_INT(status)); } #elif defined(HAVE_CWAIT) /* MS C has a variant of waitpid() that's usable for most purposes. */ @@ -9894,15 +9920,19 @@ /*[clinic end generated code: output=c20b95b15ad44a3a input=444c8f51cca5b862]*/ { int status; - - Py_BEGIN_ALLOW_THREADS - pid = _cwait(&status, pid, options); - Py_END_ALLOW_THREADS - if (pid == -1) - return posix_error(); + Py_intptr_t res; + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + res = _cwait(&status, pid, options); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (res != 0) + return (!async_err) ? posix_error() : NULL; /* shift the status left a byte so this is more like the POSIX waitpid */ - return Py_BuildValue(_Py_PARSE_INTPTR "i", pid, status << 8); + return Py_BuildValue(_Py_PARSE_INTPTR "i", res, status << 8); } #endif @@ -9943,14 +9973,17 @@ /*[clinic end generated code: output=2a83a9d164e7e6a8 input=03b0182d4a4700ce]*/ { pid_t pid; + int async_err = 0; WAIT_TYPE status; WAIT_STATUS_INT(status) = 0; - Py_BEGIN_ALLOW_THREADS - pid = wait(&status); - Py_END_ALLOW_THREADS - if (pid == -1) - return posix_error(); + do { + Py_BEGIN_ALLOW_THREADS + pid = wait(&status); + Py_END_ALLOW_THREADS + } while (pid < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (pid < 0) + return (!async_err) ? posix_error() : NULL; return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); } @@ -11080,6 +11113,7 @@ /*[clinic end generated code: output=531e482dd11a99a0 input=76e96f511be0352f]*/ { int res; + int async_err = 0; #if defined(HAVE_DUP3) && \ !(defined(HAVE_FCNTL_H) && defined(F_DUP2FD_CLOEXEC)) /* dup3() is available on Linux 2.6.27+ and glibc 2.9 */ @@ -11103,38 +11137,46 @@ } #elif defined(HAVE_FCNTL_H) && defined(F_DUP2FD_CLOEXEC) - Py_BEGIN_ALLOW_THREADS - if (!inheritable) - res = fcntl(fd, F_DUP2FD_CLOEXEC, fd2); - else - res = dup2(fd, fd2); - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS + if (!inheritable) + res = fcntl(fd, F_DUP2FD_CLOEXEC, fd2); + else + res = dup2(fd, fd2); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (res < 0) - return posix_error(); + return (!async_err) ? posix_error() : NULL; #else #ifdef HAVE_DUP3 if (!inheritable && dup3_works != 0) { - Py_BEGIN_ALLOW_THREADS - res = dup3(fd, fd2, O_CLOEXEC); - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS + res = dup3(fd, fd2, O_CLOEXEC); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); if (res < 0) { if (dup3_works == -1) dup3_works = (errno != ENOSYS); if (dup3_works) - return posix_error(); + return (!async_err) ? posix_error() : NULL; } } if (inheritable || dup3_works == 0) { #endif - Py_BEGIN_ALLOW_THREADS - res = dup2(fd, fd2); - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS + res = dup2(fd, fd2); + Py_END_ALLOW_THREADS + } while (res < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); if (res < 0) - return posix_error(); + return (!async_err) ? posix_error() : NULL; if (!inheritable && _Py_set_inheritable(fd2, 0, NULL) < 0) { close(fd2); @@ -11355,6 +11397,7 @@ /*[clinic end generated code: output=1f3bc27260a24968 input=1df2eaa27c0bf1d3]*/ { Py_ssize_t n; + int async_err = 0; PyObject *buffer; if (length < 0) { @@ -11375,13 +11418,16 @@ buffer = PyBytes_FromStringAndSize((char *)NULL, length); if (buffer == NULL) return NULL; - Py_BEGIN_ALLOW_THREADS - n = read(fd, PyBytes_AS_STRING(buffer), READ_CAST length); - Py_END_ALLOW_THREADS + + do { + Py_BEGIN_ALLOW_THREADS + n = read(fd, PyBytes_AS_STRING(buffer), READ_CAST length); + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (n < 0) { Py_DECREF(buffer); - return posix_error(); + return (!async_err) ? posix_error() : NULL; } if (n != length) @@ -11515,6 +11561,7 @@ { int cnt; Py_ssize_t n; + int async_err = 0; struct iovec *iov; Py_buffer *buf; @@ -11529,13 +11576,16 @@ if (iov_setup(&iov, &buf, buffers, cnt, PyBUF_WRITABLE) < 0) return -1; - Py_BEGIN_ALLOW_THREADS - n = readv(fd, iov, cnt); - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS + n = readv(fd, iov, cnt); + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); iov_cleanup(iov, buf, cnt); if (n < 0) { - posix_error(); + if (!async_err) + posix_error(); return -1; } @@ -11598,6 +11648,7 @@ /*[clinic end generated code: output=7b62bf6c06e20ae8 input=084948dcbaa35d4c]*/ { Py_ssize_t n; + int async_err = 0; PyObject *buffer; if (length < 0) { @@ -11611,12 +11662,16 @@ Py_DECREF(buffer); return posix_error(); } - Py_BEGIN_ALLOW_THREADS - n = pread(fd, PyBytes_AS_STRING(buffer), length, offset); - Py_END_ALLOW_THREADS + + do { + Py_BEGIN_ALLOW_THREADS + n = pread(fd, PyBytes_AS_STRING(buffer), length, offset); + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (n < 0) { Py_DECREF(buffer); - return posix_error(); + return (!async_err) ? posix_error() : NULL; } if (n != length) _PyBytes_Resize(&buffer, n); @@ -11677,6 +11732,7 @@ /*[clinic end generated code: output=aeb96acfdd4d5112 input=3207e28963234f3c]*/ { Py_ssize_t size; + int async_err = 0; Py_ssize_t len = data->len; if (!_PyVerify_fd(fd)) { @@ -11684,17 +11740,21 @@ return -1; } - Py_BEGIN_ALLOW_THREADS -#ifdef MS_WINDOWS - if (len > INT_MAX) - len = INT_MAX; - size = write(fd, data->buf, (int)len); -#else - size = write(fd, data->buf, len); -#endif - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS +#ifdef MS_WINDOWS + if (len > INT_MAX) + len = INT_MAX; + size = write(fd, data->buf, (int)len); +#else + size = write(fd, data->buf, len); +#endif + Py_END_ALLOW_THREADS + } while (size < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (size < 0) { - posix_error(); + if (!async_err) + posix_error(); return -1; } return size; @@ -11713,6 +11773,7 @@ { int in, out; Py_ssize_t ret; + int async_err = 0; off_t offset; #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__) @@ -11775,13 +11836,15 @@ } } - Py_BEGIN_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS #ifdef __APPLE__ - ret = sendfile(in, out, offset, &sbytes, &sf, flags); -#else - ret = sendfile(in, out, offset, len, &sf, &sbytes, flags); -#endif - Py_END_ALLOW_THREADS + ret = sendfile(in, out, offset, &sbytes, &sf, flags); +#else + ret = sendfile(in, out, offset, len, &sf, &sbytes, flags); +#endif + Py_END_ALLOW_THREADS + } while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (sf.headers != NULL) iov_cleanup(sf.headers, hbuf, sf.hdr_cnt); @@ -11800,7 +11863,7 @@ return posix_error(); } } - return posix_error(); + return (!async_err) ? posix_error() : NULL; } goto done; @@ -11821,21 +11884,26 @@ return NULL; #ifdef linux if (offobj == Py_None) { + do { + Py_BEGIN_ALLOW_THREADS + ret = sendfile(out, in, NULL, count); + Py_END_ALLOW_THREADS + } while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + if (ret < 0) + return (!async_err) ? posix_error() : NULL; + return Py_BuildValue("n", ret); + } +#endif + if (!Py_off_t_converter(offobj, &offset)) + return NULL; + + do { Py_BEGIN_ALLOW_THREADS - ret = sendfile(out, in, NULL, count); + ret = sendfile(out, in, &offset, count); Py_END_ALLOW_THREADS - if (ret < 0) - return posix_error(); - return Py_BuildValue("n", ret); - } -#endif - if (!Py_off_t_converter(offobj, &offset)) - return NULL; - Py_BEGIN_ALLOW_THREADS - ret = sendfile(out, in, &offset, count); - Py_END_ALLOW_THREADS + } while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (ret < 0) - return posix_error(); + return (!async_err) ? posix_error() : NULL; return Py_BuildValue("n", ret); #endif } @@ -11891,15 +11959,18 @@ { STRUCT_STAT st; int res; - - Py_BEGIN_ALLOW_THREADS - res = FSTAT(fd, &st); - Py_END_ALLOW_THREADS + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + res = FSTAT(fd, &st); + Py_END_ALLOW_THREADS + } while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (res != 0) { #ifdef MS_WINDOWS return PyErr_SetFromWindowsErr(0); #else - return posix_error(); + return (!async_err) ? posix_error() : NULL; #endif } @@ -12185,6 +12256,7 @@ { int cnt; Py_ssize_t result; + int async_err = 0; struct iovec *iov; Py_buffer *buf; @@ -12199,12 +12271,14 @@ return -1; } - Py_BEGIN_ALLOW_THREADS - result = writev(fd, iov, cnt); - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS + result = writev(fd, iov, cnt); + Py_END_ALLOW_THREADS + } while (result < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); iov_cleanup(iov, buf, cnt); - if (result < 0) + if (result < 0 && !async_err) posix_error(); return result; @@ -12275,17 +12349,20 @@ /*[clinic end generated code: output=ec9cc5b2238e96a7 input=19903f1b3dd26377]*/ { Py_ssize_t size; + int async_err = 0; if (!_PyVerify_fd(fd)) { posix_error(); return -1; } - Py_BEGIN_ALLOW_THREADS - size = pwrite(fd, buffer->buf, (size_t)buffer->len, offset); - Py_END_ALLOW_THREADS - - if (size < 0) + do { + Py_BEGIN_ALLOW_THREADS + size = pwrite(fd, buffer->buf, (size_t)buffer->len, offset); + Py_END_ALLOW_THREADS + } while (size < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); + + if (size < 0 && !async_err) posix_error(); return size; } @@ -12353,18 +12430,21 @@ /*[clinic end generated code: output=b3321927546893d0 input=73032e98a36e0e19]*/ { int result; - - Py_BEGIN_ALLOW_THREADS + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS #ifdef HAVE_MKFIFOAT - if (dir_fd != DEFAULT_DIR_FD) - result = mkfifoat(dir_fd, path->narrow, mode); - else -#endif - result = mkfifo(path->narrow, mode); - Py_END_ALLOW_THREADS - - if (result < 0) - return posix_error(); + if (dir_fd != DEFAULT_DIR_FD) + result = mkfifoat(dir_fd, path->narrow, mode); + else +#endif + result = mkfifo(path->narrow, mode); + Py_END_ALLOW_THREADS + } while (result != 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); + if (result != 0) + return (!async_err) ? posix_error() : NULL; Py_RETURN_NONE; } @@ -12448,18 +12528,21 @@ /*[clinic end generated code: output=f71d54eaf9bb6f1a input=ee44531551a4d83b]*/ { int result; - - Py_BEGIN_ALLOW_THREADS + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS #ifdef HAVE_MKNODAT - if (dir_fd != DEFAULT_DIR_FD) - result = mknodat(dir_fd, path->narrow, mode, device); - else -#endif - result = mknod(path->narrow, mode, device); - Py_END_ALLOW_THREADS - - if (result < 0) - return posix_error(); + if (dir_fd != DEFAULT_DIR_FD) + result = mknodat(dir_fd, path->narrow, mode, device); + else +#endif + result = mknod(path->narrow, mode, device); + Py_END_ALLOW_THREADS + } while (result != 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); + if (result != 0) + return (!async_err) ? posix_error() : NULL; Py_RETURN_NONE; } @@ -12662,12 +12745,16 @@ /*[clinic end generated code: output=62326766cb9b76bf input=63b43641e52818f2]*/ { int result; - - Py_BEGIN_ALLOW_THREADS - result = ftruncate(fd, length); - Py_END_ALLOW_THREADS - if (result < 0) - return posix_error(); + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + result = ftruncate(fd, length); + Py_END_ALLOW_THREADS + } while (result != 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); + if (result != 0) + return (!async_err) ? posix_error() : NULL; Py_RETURN_NONE; } #endif /* HAVE_FTRUNCATE */ @@ -12805,14 +12892,16 @@ /*[clinic end generated code: output=0cd702d2065c79db input=d7a2ef0ab2ca52fb]*/ { int result; - - Py_BEGIN_ALLOW_THREADS - result = posix_fallocate(fd, offset, length); - Py_END_ALLOW_THREADS - if (result != 0) { - errno = result; - return posix_error(); - } + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + result = posix_fallocate(fd, offset, length); + Py_END_ALLOW_THREADS + } while (result != 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); + if (result != 0) + return (!async_err) ? posix_error() : NULL; Py_RETURN_NONE; } #endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG */ @@ -12883,14 +12972,16 @@ /*[clinic end generated code: output=dad93f32c04dd4f7 input=0fbe554edc2f04b5]*/ { int result; - - Py_BEGIN_ALLOW_THREADS - result = posix_fadvise(fd, offset, length, advice); - Py_END_ALLOW_THREADS - if (result != 0) { - errno = result; - return posix_error(); - } + int async_err = 0; + + do { + Py_BEGIN_ALLOW_THREADS + result = posix_fadvise(fd, offset, length, advice); + Py_END_ALLOW_THREADS + } while (result != 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); + if (result != 0) + return (!async_err) ? posix_error() : NULL; Py_RETURN_NONE; } #endif /* HAVE_POSIX_FADVISE && !POSIX_FADVISE_AIX_BUG */ @@ -13745,13 +13836,17 @@ /*[clinic end generated code: output=0e32bf07f946ec0d input=d8122243ac50975e]*/ { int result; + int async_err = 0; struct statvfs st; - Py_BEGIN_ALLOW_THREADS - result = fstatvfs(fd, &st); - Py_END_ALLOW_THREADS + do { + Py_BEGIN_ALLOW_THREADS + result = fstatvfs(fd, &st); + Py_END_ALLOW_THREADS + } while (result != 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); if (result != 0) - return posix_error(); + return (!async_err) ? posix_error() : NULL; return _pystatvfs_fromstructstatvfs(st); } diff -r 754c630c98a3 -r ff1274594739 Modules/socketmodule.c --- a/Modules/socketmodule.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/socketmodule.c Mon Jan 19 22:03:19 2015 +0000 @@ -2037,6 +2037,7 @@ PyObject *addr = NULL; PyObject *res = NULL; int timeout; + int async_err = 0; #if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) /* accept4() is available on Linux 2.6.28+ and glibc 2.10 */ static int accept4_works = -1; @@ -2050,27 +2051,27 @@ return select_error(); BEGIN_SELECT_LOOP(s) - - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 0, interval); - if (!timeout) { + do { + Py_BEGIN_ALLOW_THREADS + timeout = internal_select_ex(s, 0, interval); + if (!timeout) { #if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) - if (accept4_works != 0) { - newfd = accept4(s->sock_fd, SAS2SA(&addrbuf), &addrlen, - SOCK_CLOEXEC); - if (newfd == INVALID_SOCKET && accept4_works == -1) { - /* On Linux older than 2.6.28, accept4() fails with ENOSYS */ - accept4_works = (errno != ENOSYS); + if (accept4_works != 0) { + newfd = accept4(s->sock_fd, SAS2SA(&addrbuf), &addrlen, + SOCK_CLOEXEC); + if (newfd == INVALID_SOCKET && accept4_works == -1) { + /* On Linux older than 2.6.28, accept4() fails with ENOSYS */ + accept4_works = (errno != ENOSYS); + } } + if (accept4_works == 0) + newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); +#else + newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); +#endif } - if (accept4_works == 0) - newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); -#else - newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); -#endif - } - Py_END_ALLOW_THREADS - + Py_END_ALLOW_THREADS + } while (newfd < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (timeout == 1) { PyErr_SetString(socket_timeout, "timed out"); return NULL; @@ -2078,7 +2079,7 @@ END_SELECT_LOOP(s) if (newfd == INVALID_SOCKET) - return s->errorhandler(); + return (!async_err) ? s->errorhandler() : NULL; #ifdef MS_WINDOWS if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) { @@ -2513,10 +2514,8 @@ /* Signals are not errors (though they may raise exceptions). Adapted from PyErr_SetFromErrnoWithFilenameObject(). */ -#ifdef EINTR if (res == EINTR && PyErr_CheckSignals()) return NULL; -#endif return PyLong_FromLong((long) res); } @@ -2650,6 +2649,7 @@ { Py_ssize_t outlen = -1; int timeout; + int async_err = 0; if (!IS_SELECTABLE(s)) { select_error(); @@ -2661,18 +2661,20 @@ } BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 0, interval); - if (!timeout) { + do { + Py_BEGIN_ALLOW_THREADS + timeout = internal_select_ex(s, 0, interval); + if (!timeout) { #ifdef MS_WINDOWS - if (len > INT_MAX) - len = INT_MAX; - outlen = recv(s->sock_fd, cbuf, (int)len, flags); + if (len > INT_MAX) + len = INT_MAX; + outlen = recv(s->sock_fd, cbuf, (int)len, flags); #else - outlen = recv(s->sock_fd, cbuf, len, flags); -#endif - } - Py_END_ALLOW_THREADS + outlen = recv(s->sock_fd, cbuf, len, flags); +#endif + } + Py_END_ALLOW_THREADS + } while (outlen < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (timeout == 1) { PyErr_SetString(socket_timeout, "timed out"); @@ -2682,7 +2684,8 @@ if (outlen < 0) { /* Note: the call to errorhandler() ALWAYS indirectly returned NULL, so ignore its return value */ - s->errorhandler(); + if (!async_err) + s->errorhandler(); return -1; } return outlen; @@ -2819,6 +2822,7 @@ int timeout; Py_ssize_t n = -1; socklen_t addrlen; + int async_err = 0; *addr = NULL; @@ -2831,21 +2835,23 @@ } BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - memset(&addrbuf, 0, addrlen); - timeout = internal_select_ex(s, 0, interval); - if (!timeout) { + do { + Py_BEGIN_ALLOW_THREADS + memset(&addrbuf, 0, addrlen); + timeout = internal_select_ex(s, 0, interval); + if (!timeout) { #ifdef MS_WINDOWS - if (len > INT_MAX) - len = INT_MAX; - n = recvfrom(s->sock_fd, cbuf, (int)len, flags, - (void *) &addrbuf, &addrlen); + if (len > INT_MAX) + len = INT_MAX; + n = recvfrom(s->sock_fd, cbuf, (int)len, flags, + (void *) &addrbuf, &addrlen); #else - n = recvfrom(s->sock_fd, cbuf, len, flags, - SAS2SA(&addrbuf), &addrlen); -#endif - } - Py_END_ALLOW_THREADS + n = recvfrom(s->sock_fd, cbuf, len, flags, + SAS2SA(&addrbuf), &addrlen); +#endif + } + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (timeout == 1) { PyErr_SetString(socket_timeout, "timed out"); @@ -2853,7 +2859,8 @@ } END_SELECT_LOOP(s) if (n < 0) { - s->errorhandler(); + if (!async_err) + s->errorhandler(); return -1; } @@ -2993,6 +3000,7 @@ { ssize_t bytes_received = -1; int timeout; + int async_err = 0; sock_addr_t addrbuf; socklen_t addrbuflen; struct msghdr msg = {0}; @@ -3028,25 +3036,29 @@ } BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS; - msg.msg_name = SAS2SA(&addrbuf); - msg.msg_namelen = addrbuflen; - msg.msg_iov = iov; - msg.msg_iovlen = iovlen; - msg.msg_control = controlbuf; - msg.msg_controllen = controllen; - timeout = internal_select_ex(s, 0, interval); - if (!timeout) - bytes_received = recvmsg(s->sock_fd, &msg, flags); - Py_END_ALLOW_THREADS; - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - goto finally; - } + do { + Py_BEGIN_ALLOW_THREADS; + msg.msg_name = SAS2SA(&addrbuf); + msg.msg_namelen = addrbuflen; + msg.msg_iov = iov; + msg.msg_iovlen = iovlen; + msg.msg_control = controlbuf; + msg.msg_controllen = controllen; + timeout = internal_select_ex(s, 0, interval); + if (!timeout) + bytes_received = recvmsg(s->sock_fd, &msg, flags); + Py_END_ALLOW_THREADS; + if (timeout == 1) { + PyErr_SetString(socket_timeout, "timed out"); + goto finally; + } + } while (bytes_received < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); END_SELECT_LOOP(s) if (bytes_received < 0) { - s->errorhandler(); + if (!async_err) + s->errorhandler(); goto finally; } @@ -3305,6 +3317,7 @@ { char *buf; Py_ssize_t len, n = -1; + int async_err = 0; int flags = 0, timeout; Py_buffer pbuf; @@ -3319,18 +3332,20 @@ len = pbuf.len; BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 1, interval); - if (!timeout) { + do { + Py_BEGIN_ALLOW_THREADS + timeout = internal_select_ex(s, 1, interval); + if (!timeout) { #ifdef MS_WINDOWS - if (len > INT_MAX) - len = INT_MAX; - n = send(s->sock_fd, buf, (int)len, flags); + if (len > INT_MAX) + len = INT_MAX; + n = send(s->sock_fd, buf, (int)len, flags); #else - n = send(s->sock_fd, buf, len, flags); -#endif - } - Py_END_ALLOW_THREADS + n = send(s->sock_fd, buf, len, flags); +#endif + } + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (timeout == 1) { PyBuffer_Release(&pbuf); PyErr_SetString(socket_timeout, "timed out"); @@ -3340,7 +3355,7 @@ PyBuffer_Release(&pbuf); if (n < 0) - return s->errorhandler(); + return (!async_err) ? s->errorhandler() : NULL; return PyLong_FromSsize_t(n); } @@ -3359,7 +3374,8 @@ { char *buf; Py_ssize_t len, n = -1; - int flags = 0, timeout, saved_errno; + int async_err = 0; + int flags = 0, timeout; Py_buffer pbuf; if (!PyArg_ParseTuple(args, "y*|i:sendall", &pbuf, &flags)) @@ -3391,29 +3407,16 @@ PyErr_SetString(socket_timeout, "timed out"); return NULL; } - /* PyErr_CheckSignals() might change errno */ - saved_errno = errno; - /* We must run our signal handlers before looping again. - send() can return a successful partial write when it is - interrupted, so we can't restrict ourselves to EINTR. */ - if (PyErr_CheckSignals()) { - PyBuffer_Release(&pbuf); - return NULL; + if (n >= 0) { + buf += n; + len -= n; } - if (n < 0) { - /* If interrupted, try again */ - if (saved_errno == EINTR) - continue; - else - break; - } - buf += n; - len -= n; - } while (len > 0); + } while (len > 0 && (n >= 0 || errno == EINTR) && + !(async_err = PyErr_CheckSignals())); PyBuffer_Release(&pbuf); - if (n < 0) - return s->errorhandler(); + if (n < 0 || async_err) + return (!async_err) ? s->errorhandler() : NULL; Py_INCREF(Py_None); return Py_None; @@ -3439,6 +3442,7 @@ Py_ssize_t len, arglen; sock_addr_t addrbuf; int addrlen, n = -1, flags, timeout; + int async_err = 0; flags = 0; arglen = PyTuple_Size(args); @@ -3473,20 +3477,22 @@ } BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 1, interval); - if (!timeout) { + do { + Py_BEGIN_ALLOW_THREADS + timeout = internal_select_ex(s, 1, interval); + if (!timeout) { #ifdef MS_WINDOWS - if (len > INT_MAX) - len = INT_MAX; - n = sendto(s->sock_fd, buf, (int)len, flags, - SAS2SA(&addrbuf), addrlen); + if (len > INT_MAX) + len = INT_MAX; + n = sendto(s->sock_fd, buf, (int)len, flags, + SAS2SA(&addrbuf), addrlen); #else - n = sendto(s->sock_fd, buf, len, flags, - SAS2SA(&addrbuf), addrlen); -#endif - } - Py_END_ALLOW_THREADS + n = sendto(s->sock_fd, buf, len, flags, + SAS2SA(&addrbuf), addrlen); +#endif + } + Py_END_ALLOW_THREADS + } while (n < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); if (timeout == 1) { PyBuffer_Release(&pbuf); @@ -3496,7 +3502,7 @@ END_SELECT_LOOP(s) PyBuffer_Release(&pbuf); if (n < 0) - return s->errorhandler(); + return (!async_err) ? s->errorhandler() : NULL; return PyLong_FromSsize_t(n); } @@ -3528,6 +3534,7 @@ void *controlbuf = NULL; size_t controllen, controllen_last; ssize_t bytes_sent = -1; + int async_err = 0; int addrlen, timeout, flags = 0; PyObject *data_arg, *cmsg_arg = NULL, *addr_arg = NULL, *data_fast = NULL, *cmsg_fast = NULL, *retval = NULL; @@ -3685,19 +3692,23 @@ } BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS; - timeout = internal_select_ex(s, 1, interval); - if (!timeout) - bytes_sent = sendmsg(s->sock_fd, &msg, flags); - Py_END_ALLOW_THREADS; - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - goto finally; - } + do { + Py_BEGIN_ALLOW_THREADS; + timeout = internal_select_ex(s, 1, interval); + if (!timeout) + bytes_sent = sendmsg(s->sock_fd, &msg, flags); + Py_END_ALLOW_THREADS; + if (timeout == 1) { + PyErr_SetString(socket_timeout, "timed out"); + goto finally; + } + } while (bytes_sent < 0 && errno == EINTR && + !(async_err = PyErr_CheckSignals())); END_SELECT_LOOP(s) if (bytes_sent < 0) { - s->errorhandler(); + if (!async_err) + s->errorhandler(); goto finally; } retval = PyLong_FromSsize_t(bytes_sent); diff -r 754c630c98a3 -r ff1274594739 Modules/unicodedata.c --- a/Modules/unicodedata.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Modules/unicodedata.c Mon Jan 19 22:03:19 2015 +0000 @@ -976,7 +976,7 @@ (0x2B740 <= code && code <= 0x2B81D); /* CJK Ideograph Extension D */ } -/* macros used to determine if the given code point is in the PUA range that +/* macros used to determine if the given codepoint is in the PUA range that * we are using to store aliases and named sequences */ #define IS_ALIAS(cp) ((cp >= aliases_start) && (cp < aliases_end)) #define IS_NAMED_SEQ(cp) ((cp >= named_sequences_start) && \ @@ -986,7 +986,7 @@ _getucname(PyObject *self, Py_UCS4 code, char* buffer, int buflen, int with_alias_and_seq) { - /* Find the name associated with the given code point. + /* Find the name associated with the given codepoint. * If with_alias_and_seq is 1, check for names in the Private Use Area 15 * that we are using for aliases and named sequences. */ int offset; @@ -997,7 +997,7 @@ if (code >= 0x110000) return 0; - /* XXX should we just skip all the code points in the PUAs here? */ + /* XXX should we just skip all the codepoints in the PUAs here? */ if (!with_alias_and_seq && (IS_ALIAS(code) || IS_NAMED_SEQ(code))) return 0; @@ -1125,8 +1125,8 @@ /* check if named sequences are allowed */ if (!with_named_seq && IS_NAMED_SEQ(cp)) return 0; - /* if the code point is in the PUA range that we use for aliases, - * convert it to obtain the right code point */ + /* if the codepoint is in the PUA range that we use for aliases, + * convert it to obtain the right codepoint */ if (IS_ALIAS(cp)) *code = name_aliases[cp-aliases_start]; else @@ -1138,9 +1138,9 @@ _getcode(PyObject* self, const char* name, int namelen, Py_UCS4* code, int with_named_seq) { - /* Return the code point associated with the given name. + /* Return the codepoint associated with the given name. * Named aliases are resolved too (unless self != NULL (i.e. we are using - * 3.2.0)). If with_named_seq is 1, returns the PUA code point that we are + * 3.2.0)). If with_named_seq is 1, returns the PUA codepoint that we are * using for the named sequence, and the caller must then convert it. */ unsigned int h, v; unsigned int mask = code_size-1; diff -r 754c630c98a3 -r ff1274594739 Objects/setobject.c --- a/Objects/setobject.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Objects/setobject.c Mon Jan 19 22:03:19 2015 +0000 @@ -4,7 +4,7 @@ Written and maintained by Raymond D. Hettinger Derived from Lib/sets.py and Objects/dictobject.c. - Copyright (c) 2003-2015 Python Software Foundation. + Copyright (c) 2003-2014 Python Software Foundation. All rights reserved. The basic lookup function used by all operations. @@ -658,8 +658,7 @@ static PyObject * set_pop(PySetObject *so) { - /* Make sure the search finger is in bounds */ - Py_ssize_t i = so->finger & so->mask; + Py_ssize_t i = 0; setentry *entry; PyObject *key; @@ -669,15 +668,32 @@ return NULL; } - while ((entry = &so->table[i])->key == NULL || entry->key==dummy) { - i++; - if (i > so->mask) - i = 0; + /* Set entry to "the first" unused or dummy set entry. We abuse + * the hash field of slot 0 to hold a search finger: + * If slot 0 has a value, use slot 0. + * Else slot 0 is being used to hold a search finger, + * and we use its hash value as the first index to look. + */ + entry = &so->table[0]; + if (entry->key == NULL || entry->key == dummy) { + i = entry->hash; + /* The hash field may be a real hash value, or it may be a + * legit search finger, or it may be a once-legit search + * finger that's out of bounds now because it wrapped around + * or the table shrunk -- simply make sure it's in bounds now. + */ + if (i > so->mask || i < 1) + i = 1; /* skip slot 0 */ + while ((entry = &so->table[i])->key == NULL || entry->key==dummy) { + i++; + if (i > so->mask) + i = 1; + } } key = entry->key; entry->key = dummy; so->used--; - so->finger = i + 1; /* next place to start */ + so->table[0].hash = i + 1; /* next place to start */ return key; } @@ -996,7 +1012,6 @@ so->table = so->smalltable; so->lookup = set_lookkey_unicode; so->hash = -1; - so->finger = 0; so->weakreflist = NULL; if (iterable != NULL) { diff -r 754c630c98a3 -r ff1274594739 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Objects/unicodeobject.c Mon Jan 19 22:03:19 2015 +0000 @@ -5013,7 +5013,7 @@ } if (Py_UNICODE_IS_SURROGATE(ch)) { - errmsg = "code point in surrogate code point range(0xd800, 0xe000)"; + errmsg = "codepoint in surrogate code point range(0xd800, 0xe000)"; startinpos = ((const char *)q) - starts; endinpos = startinpos + 4; } @@ -5032,7 +5032,7 @@ q += 4; continue; } - errmsg = "code point not in range(0x110000)"; + errmsg = "codepoint not in range(0x110000)"; startinpos = ((const char *)q) - starts; endinpos = startinpos + 4; } diff -r 754c630c98a3 -r ff1274594739 Python/sysmodule.c --- a/Python/sysmodule.c Tue Jan 20 14:11:38 2015 -0600 +++ b/Python/sysmodule.c Mon Jan 19 22:03:19 2015 +0000 @@ -1379,7 +1379,7 @@ implementation -- Python implementation information.\n\ int_info -- a struct sequence with information about the int implementation.\n\ maxsize -- the largest supported length of containers.\n\ -maxunicode -- the value of the largest Unicode code point\n\ +maxunicode -- the value of the largest Unicode codepoint\n\ platform -- platform identifier\n\ prefix -- prefix used to find the Python library\n\ thread_info -- a struct sequence with information about the thread implementation.\n\ diff -r 754c630c98a3 -r ff1274594739 Tools/ssl/make_ssl_data.py --- a/Tools/ssl/make_ssl_data.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Tools/ssl/make_ssl_data.py Mon Jan 19 22:03:19 2015 +0000 @@ -5,7 +5,8 @@ `library` and `reason` mnemnonics to a more recent OpenSSL version. It takes two arguments: -- the path to the OpenSSL source tree (e.g. git checkout) +- the path to the OpenSSL include files' directory + (e.g. openssl-1.0.1-beta3/include/openssl/) - the path to the C file to be generated (probably Modules/_ssl_data.h) """ @@ -14,10 +15,9 @@ import os import re import sys -import _ssl -def parse_error_codes(h_file, prefix, libcode): +def parse_error_codes(h_file, prefix): pat = re.compile(r"#define\W+(%s([\w]+))\W+(\d+)\b" % re.escape(prefix)) codes = [] with open(h_file, "r", encoding="latin1") as f: @@ -26,8 +26,7 @@ if match: code, name, num = match.groups() num = int(num) - # e.g. ("SSL_R_BAD_DATA", ("ERR_LIB_SSL", "BAD_DATA", 390)) - codes.append((code, (libcode, name, num))) + codes.append((code, name, num)) return codes if __name__ == "__main__": @@ -35,32 +34,12 @@ outfile = sys.argv[2] use_stdout = outfile == '-' f = sys.stdout if use_stdout else open(outfile, "w") - error_libraries = { - # mnemonic -> (library code, error prefix, header file) - 'PEM': ('ERR_LIB_PEM', 'PEM_R_', 'crypto/pem/pem.h'), - 'SSL': ('ERR_LIB_SSL', 'SSL_R_', 'ssl/ssl.h'), - 'X509': ('ERR_LIB_X509', 'X509_R_', 'crypto/x509/x509.h'), - } - - # Read codes from libraries - new_codes = [] - for libcode, prefix, h_file in sorted(error_libraries.values()): - new_codes += parse_error_codes(os.path.join(openssl_inc, h_file), - prefix, libcode) - new_code_nums = set((libcode, num) - for (code, (libcode, name, num)) in new_codes) - - # Merge with existing codes (in case some old codes disappeared). - codes = {} - for errname, (libnum, errnum) in _ssl.err_names_to_codes.items(): - lib = error_libraries[_ssl.lib_codes_to_names[libnum]] - libcode = lib[0] # e.g. ERR_LIB_PEM - errcode = lib[1] + errname # e.g. SSL_R_BAD_SSL_SESSION_ID_LENGTH - # Only keep it if the numeric codes weren't reused - if (libcode, errnum) not in new_code_nums: - codes[errcode] = libcode, errname, errnum - codes.update(dict(new_codes)) - + error_libraries = ( + # (library code, mnemonic, error prefix, header file) + ('ERR_LIB_PEM', 'PEM', 'PEM_R_', 'pem.h'), + ('ERR_LIB_SSL', 'SSL', 'SSL_R_', 'ssl.h'), + ('ERR_LIB_X509', 'X509', 'X509_R_', 'x509.h'), + ) def w(l): f.write(l + "\n") w("/* File generated by Tools/ssl/make_ssl_data.py */") @@ -68,19 +47,21 @@ w("") w("static struct py_ssl_library_code library_codes[] = {") - for mnemo, (libcode, _, _) in sorted(error_libraries.items()): + for libcode, mnemo, _, _ in error_libraries: w(' {"%s", %s},' % (mnemo, libcode)) w(' { NULL }') w('};') w("") w("static struct py_ssl_error_code error_codes[] = {") - for errcode, (libcode, name, num) in sorted(codes.items()): - w(' #ifdef %s' % (errcode)) - w(' {"%s", %s, %s},' % (name, libcode, errcode)) - w(' #else') - w(' {"%s", %s, %d},' % (name, libcode, num)) - w(' #endif') + for libcode, _, prefix, h_file in error_libraries: + codes = parse_error_codes(os.path.join(openssl_inc, h_file), prefix) + for code, name, num in sorted(codes): + w(' #ifdef %s' % (code)) + w(' {"%s", %s, %s},' % (name, libcode, code)) + w(' #else') + w(' {"%s", %s, %d},' % (name, libcode, num)) + w(' #endif') w(' { NULL }') w('};') if not use_stdout: diff -r 754c630c98a3 -r ff1274594739 Tools/unicode/gencodec.py --- a/Tools/unicode/gencodec.py Tue Jan 20 14:11:38 2015 -0600 +++ b/Tools/unicode/gencodec.py Mon Jan 19 22:03:19 2015 +0000 @@ -34,7 +34,7 @@ # Standard undefined Unicode code point UNI_UNDEFINED = chr(0xFFFE) -# Placeholder for a missing code point +# Placeholder for a missing codepoint MISSING_CODE = -1 mapRE = re.compile('((?:0x[0-9a-fA-F]+\+?)+)'