summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* consistently use Py_TYPE, Py_REFCNT, and correct initializer macros (#3563)Benjamin Peterson2017-09-1410-35/+27
| | | This no-op change makes 2.7 more consistent with 3.x to ease comparison and backports.
* [2.7] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3446)Christian Heimes2017-09-081-0/+13
| | | | | | | | | | | | | | | | * bpo-29136: Add TLS 1.3 support TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3 cipher suites don't overlap with cipher suites from TLS 1.2 and earlier. Since Python sets its own set of permitted ciphers, TLS 1.3 handshake will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common AES-GCM and ChaCha20 suites. Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3 now. Signed-off-by: Christian Heimes <christian@python.org>. (cherry picked from commit cb5b68abdeb1b1d56c581d5b4d647018703d61e3)
* [2.7] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3433)Christian Heimes2017-09-071-2/+1
| | | | Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 17c9ac9)
* Merge branch 'release-2.7.14' into 2.7Benjamin Peterson2017-09-0619-58/+581
|\
| * bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315)Victor Stinner2017-09-0619-58/+581
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix copying of partial characters for UTF-8 input (libexpat bug 115): https://github.com/libexpat/libexpat/issues/115 (cherry picked from commit 759e30ec47048cb9835c62aaeac48748c8151390) The standard header stdbool.h is not available with old Visual Studio compilers Cherry-picked from libexpat b4b89c2ab0cc5325a41360c25ef9d2ccbe617e5c. expat: Add artificial scopes in xmltok.c utf8_toUtf8() to fix c89 compilation. Cherry-picked from libexpat commit e0b290eb3d8f4c4b45137a7d7f4f8db812145bd2
* | bpo-31339: Rewrite time.asctime() and time.ctime() (#3293)Victor Stinner2017-09-051-18/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-31339: Rewrite time.asctime() and time.ctime() Backport and adapt the _asctime() function from the master branch to not depend on the implementation of asctime() and ctime() from the external C library. This change fixes a bug when Python is run using the musl C library. * bound checks for time.asctime() * bound checks for time.strftime()
* | [2.7] bpo-30502: Fix handling of long oids in ssl. (GH-2909). (#3322)Christian Heimes2017-09-051-41/+48
| | | | | | (cherry picked from commit e503ca52889bf66ac502702569e726caa7970299)
* | [2.7] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3343)Christian Heimes2017-09-052-2/+9
| | | | | | | | | | | | | | | | | | The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0. The function detects CPU features and enables optimizations on some CPU architectures such as POWER8. Patch is based on research from Gustavo Serra Scalet. Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit c941e62)
* | [2.7] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3345)Christian Heimes2017-09-051-0/+5
| | | | | | | | | | | | | | Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray plans to remove the functions from sys/types.h. Signed-off-by: Christian Heimes <christian@python.org>. (cherry picked from commit 75b961869a1184895c9d5bf41a57f3c985622662)
* | [2.7] bpo-30622: Change NPN detection: (GH-2079) (#3316)Christian Heimes2017-09-041-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change NPN detection: Version breakdown, support disabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will be defined -> True/False Version breakdown support enabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True * Refine NPN guard: - If NPN is disabled, but ALPN is available we need our callback - Make clinic's ssl behave the same way This created a working ssl module for me, with NPN disabled and ALPN enabled for OpenSSL 1.1.0f. Concerns to address: The initial commit for NPN support into OpenSSL [1], had the OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG guard. The question is if that ever made it into a release. This would need an ugly hack, something like: GH-if defined(OPENSSL_NO_NEXTPROTONEG) && \ !defined(OPENSSL_NPN_NEGOTIATED) GH- define OPENSSL_NPN_UNSUPPORTED 0 GH- define OPENSSL_NPN_NEGOTIATED 1 GH- define OPENSSL_NPN_NO_OVERLAP 2 GH-endif [1] https://github.com/openssl/openssl/commit/68b33cc5c7. (cherry picked from commit b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8)
* | bpo-31095: Fix potential crash during GC (GH-3197)INADA Naoki2017-09-045-2/+12
| | | | | | (cherry picked from commit a6296d34a478b4f697ea9db798146195075d496c)
* | [2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int ↵Pauli Virtanen2017-09-021-2/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-31) (#3242) [2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) Ctypes currently produces wrong pep3118 type codes for several types. E.g. memoryview(ctypes.c_long()).format gives "<l" on 64-bit platforms, but it should be "<q" instead for sizeof(c_long) == 8 The problem is that the '<>' endian specification in the struct syntax also turns on the "standard size" mode, which makes type characters have a platform-independent meaning, which does not match with the codes used internally in ctypes. The struct module format syntax also does not allow specifying native-size non-native-endian items. This commit adds a converter function that maps the internal ctypes codes to appropriate struct module standard-size codes in the pep3118 format strings. The tests are modified to check for this.. (cherry picked from commit 07f1658aa09f6798793c473c72b2951b7fefe220)
* | [2.7] bpo-31243: Fixed PyArg_ParseTuple failure checks. (GH-3171) (#3235)Oren Milman2017-08-292-10/+19
| |
* | [2.7] bpo-28261: Prevent raising SystemError where PyArg_ParseTuple is used ↵Oren Milman2017-08-261-2/+12
|/ | | | to parse non-args. (#3213)
* bpo-30947: Update libexpat from 2.2.1 to 2.2.3 (#3106) (#3145)Victor Stinner2017-08-187-102/+709
| | | | | | | | | | | | | | | | | | * bpo-30947: Update libexpat from 2.2.1 to 2.2.3 * Add NEWS entry * Add new loadlibrary.c * expat_external.h: restore include "pyexpatns.h" * PCbuild: add expat/loadlibrary.c * Define XML_POOR_ENTROPY to compile expat Python 2.7 backport: add expat/loadlibrary.c to PC/VS9.0/ project files (_elementtree and pyexpat). (cherry picked from commit 93d0cb58b4da2a88c56f472c6c19491cc7a390df)
* bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3071)Victor Stinner2017-08-111-0/+22
| | | | | | | | | | | | | | The current test_child_terminated_in_stopped_state() function test creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and then crash (SIGSEGV). The problem is that calling os.waitpid() in the parent process is not enough to close the process: the child process remains alive and so the unit test leaks a child process in a strange state. Closing the child process requires non-trivial code, maybe platform specific. Remove the functional test and replaces it with an unit test which mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to test the WIFSTOPPED() path. (cherry picked from commit 7b7c6dcfff6a35333988a3c74c895ed19dff2e09)
* [2.7] bpo-30797: Avoid _GNU_SOURCE redefined warning in xmlparse.c (GH-2670) ↵Segev Finer2017-07-111-1/+1
| | | | | | | | | | (#2672) * [2.7] Avoid _GNU_SOURCE redefined warning in xmlparse.c (GH-2670) (cherry picked from commit f52325598e7a9683787d76a42009fc16790a0089) * [2.7] Avoid _GNU_SOURCE redefined warning in xmlparse.c (GH-2670). (cherry picked from commit f52325598e7a9683787d76a42009fc16790a0089)
* [2.7] bpo-29854: Fix segfault in call_readline() (GH-728)Nir Soffer2017-07-101-4/+6
| | | | | | | | | | | | | | | If history-length is set in .inputrc, and the history file is double the history size (or more), history_get(N) returns NULL, and python segfaults. Fix that by checking for NULL return value. It seems that the root cause is incorrect handling of bigger history in readline, but Python should not segfault even if readline returns unexpected value. This issue affects only GNU readline. When using libedit emulation system history size option does not work. This is a backport of the actual fix from master without the test, since the test depends on new run_pty() helper which is not available in 2.7.
* [2.7] bpo-30807: signal.setitimer() may disable the timer by mistake ↵Antoine Pitrou2017-06-301-0/+4
| | | | | | | | (GH-2493) (#2499) * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb. (cherry picked from commit 729780a810bbcb12b245a1b652302a601fc9f6fd)
* bpo-30764: Windows support.SuppressCrashReport (#2423)Victor Stinner2017-06-271-0/+51
| | | | | | * Add Windows support to test.support.SuppressCrashReport: call SetErrorMode() and CrtSetReportMode(). * _testcapi: add CrtSetReportMode() and CrtSetReportFile() functions and CRT_xxx and CRTDBG_xxx constants needed by SuppressCrashReport.
* [2.7] bpo-30746: Prohibited the '=' character in environment variable names ↵Serhiy Storchaka2017-06-251-0/+19
| | | | | | | (GH-2382) (#2393) in `os.putenv()` and `os.spawn*()`.. (cherry picked from commit 77703942c5997dff00c48f10df1b29b11645624c)
* [2.7] bpo-30730: Prevent environment variables injection in subprocess on ↵Serhiy Storchaka2017-06-241-0/+6
| | | | | | Windows. (GH-2325) (#2372) Prevent passing other invalid environment variables and command arguments.. (cherry picked from commit d174d24a5d37d1516b885dc7c82f71ecd5930700)
* [2.7] bpo-30694: Upgrade Modules/expat/ to libexpat 2.2.1 (#2300) (#2312)Victor Stinner2017-06-218-158/+889
| | | | | | | | | | | * bpo-30694: Upgrade Modules/expat/ to libexpat 2.2.1 (#2300) New file: Modules/expat/siphash.h. (cherry picked from commit 5ff7132313eb651107b179d20218dfe5d4e47f13) * siphash.h: Address lack of stdint.h for Visual Studio 2003-2008 (cherry picked from libexpat commit c74d380b8f0b5215153d840d2af9455d9c53b960)
* bpo-29591: Upgrade Modules/expat to libexpat 2.2 (#2164) (#2202)Victor Stinner2017-06-1513-477/+523
| | | | | | | | | | | | | | | | | | | | | | * bpo-29591: Upgrade Modules/expat to libexpat 2.2 * bpo-29591: Restore Python changes on expat * bpo-29591: Remove expat config of unsupported platforms Remove the configuration (Modules/expat/*config.h) of unsupported platforms: * Amiga * MacOS Classic on PPC32 * Open Watcom * bpo-29591: Remove useless XML_HAS_SET_HASH_SALT The XML_HAS_SET_HASH_SALT define of Modules/expat/expat.h became useless since our local expat copy was upgrade to expat 2.1 (it's now expat 2.2.0). (cherry picked from commit 23ec4b57e1359f9c539b8defc317542173ae087e)
* _tkinter: Fix refleak in getint() (#2153)Victor Stinner2017-06-131-2/+6
| | | | PyNumber_Int() creates a new reference: need to decrement result reference counter.
* bpo-30615: Fix the leak reference in Modules/_elementtree.c (#2129)Stéphane Wirtel2017-06-121-1/+3
|
* [2.7] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) ↵Serhiy Storchaka2017-06-121-0/+346
| | | | | | (#2123) The traceback no longer displayed for SystemExit raised in a callback registered by atexit.. (cherry picked from commit 3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4)
* bpo-30614: testInitNonExistentFile() of test_bz2 leaks references (#2033)Stéphane Wirtel2017-06-101-25/+39
| | | | | | | | | | | | | | | | | | | | | * bpo-30614: testInitNonExistentFile() of test_bz2 leaks references Extract the code of BZ2File_dealloc and create a new BZ2File_clear() function. Call BZ2File_clear() in BZ2File_dealloc(). Define BZ2File_clear() as tp_clear. Move the lock initialization before the "self->file = PyObject_CallFunction" in BZ2File_init() and check the lock is not created twice. Call BZ2File_clear() in BZ2File_init() after the init of the lock Co-Authored-By: Victor Stinner <victor.stinner@gmail.com> * Create bz2module.c Fix after the review of Victor Stinner
* [2.7] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1289)Mariatta2017-05-271-1/+4
| | | (cherry picked from commit 9616a82e7802241a4b74cf7ae38d43c37bf66e48)
* bpo-30003: Fix handling escape characters in HZ codec (#1720) (#1556)Xiang Zhang2017-05-221-13/+14
|
* [2.7] bpo-30363: Backport warnings in the re module. (#1577)Serhiy Storchaka2017-05-181-0/+14
| | | | | | Running Python with the -3 option now warns about regular expression syntax that is invalid or has different semantic in Python 3 or will change the behavior in future Python versions.
* bpo-30365: Backport warnings and fix bugs in ElementTree. (#1581)Serhiy Storchaka2017-05-171-7/+36
| | | | | | | | | | | | | | | | | | Running Python with the -3 option now emits deprecation warnings for getchildren() and getiterator() methods of the Element class in the xml.etree.cElementTree module and when pass the html argument to xml.etree.ElementTree.XMLParser(). Fixed a deprecation warning about the doctype() method of the xml.etree.ElementTree.XMLParser class. Now it is emitted only when define the doctype() method in the subclass of XMLParser. Fixed a bug in the test_bug_200708_close test method. An EchoTarget instance was incorrectly passed to XMLParser() as the html argument and silently ignored. Tests no longer failed when use the -m option for running only selected test methods. Checking warnings now is more specific, warnings are expected only when use deprecated features.
* bpo-30242: resolve some undefined behaviours in struct (#1418) (#1588)Xiang Zhang2017-05-151-5/+9
|
* bpo-11681: Document the `-b` and `-bb` options (GH-1562)Zachary Ware2017-05-131-0/+2
|
* [2.7] bpo-30283: Backport test_regrtest from master to 2.7 (#1513)Victor Stinner2017-05-091-0/+20
| | | | | | | | | | * bpo-30283: regrtest: add --testdir option * bpo-30283: Backport _testcapi.raise_signal() Function used by test_regrtest to simulate an interrupted unit test. * bpo-30283: Backport test_regrtest from master
* bpo-29990: Fix range checking in GB18030 decoder (#1509)Xiang Zhang2017-05-091-1/+3
|
* [2.7] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1471)Serhiy Storchaka2017-05-051-65/+18
| | | | | | It was possible to get a core dump by using uninitialized _json objects. Now __new__ methods create initialized objects. __init__ methods are removed.. (cherry picked from commit 76a3e51a403bc84ed536921866c86dd7d07aaa7e)
* bpo-30257: _bsddb: Fix newDBObject() (#1428)Victor Stinner2017-05-031-2/+4
| | | | | | Don't set cursorSetReturnsNone to DEFAULT_CURSOR_SET_RETURNS_NONE anymore if self->myenvobj is set. Fix a GCC warning on the strange indentation.
* bpo-27593: Get SCM build info from git instead of hg (#1327)Victor Stinner2017-05-021-41/+23
| | | | | | | | | | | Based on commit 5c4b0d063aba0a68c325073f5f312a2c9f40d178 by Ned Deily, which is based on original patches by Brett Cannon and Steve Dower. Remove also the private _Py_svnversion() function and SVNVERSION variable. Note: Py_SubversionRevision() and Py_SubversionShortBranch() are unchanged, they are part of the public API.
* [2.7] [3.5] bpo-30070: Fixed leaks and crashes in errors handling in the ↵Serhiy Storchaka2017-04-191-32/+73
| | | | | | parser module. (GH-1131). (GH-1185) (#1189) (cherry picked from commit a79f4c219531c05fc8f670c1e4bbf12c081935d3). (cherry picked from commit 952a05e4e2cf082b74a1676a2804f1f43a9b7702)
* [2.7] bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() ↵Serhiy Storchaka2017-04-193-5/+16
| | | | | | | | | (GH-1096) (GH-1180) (#1183) raised an error. (cherry picked from commit bf623ae8843dc30b28c574bec8d29fc14be59d86) (cherry picked from commit 680fea4)
* bpo-30074: Fix compile warnings of _PySlice_Unpack and convert missed (#1154)Serhiy Storchaka2017-04-154-10/+9
| | | | PySlice_GetIndicesEx in _ctypes.c.
* bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is ↵Xiang Zhang2017-04-151-12/+21
| | | | | | present (#1152)
* [2.7] bpo-29738: Fix memory leak in _get_crl_dp (GH-526) (GH-1144)Mariatta2017-04-151-7/+1
| | | | | | | | | * Remove conditional on free of `dps`, since `dps` is now allocated for all versions of OpenSSL * Remove call to `x509_check_ca` since it was only used to cache the `crldp` field of the certificate CRL_DIST_POINTS_free is available in all supported versions of OpenSSL (recent 0.9.8+) and LibreSSL. (cherry picked from commit 2849cc34a8db93d448a62d69c462402347b50dcb)
* bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046)Serhiy Storchaka2017-04-084-19/+18
| | | | (cherry picked from commit b879fe8)
* bpo-27863: Fixed multiple crashes in ElementTree. (#765) (#903) (#963)Serhiy Storchaka2017-04-021-41/+51
| | | | | (cherry picked from commit 576def096ec7b64814e038f03290031f172886c3) (cherry picked from commit a6b4e1902250d6f28ca6d083ce1c8d7e9b91974b)
* bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#913)T. Wouters2017-03-301-24/+28
| | | | | | Fix the use of recursion in itertools.chain.from_iterable. Using recursion is unnecessary, and can easily cause stack overflows, especially when building in low optimization modes or with Py_DEBUG enabled. (cherry picked from commit 5466d4af5fe76ec0a5fbc8a05675287d9e8e9d14)
* bpo-29876: fix DECREF for NULL value in subelement() (GH-760)Xiang Zhang2017-03-221-1/+2
|
* bpo-29874: fix INCREF for possible NULL values in select_select() (GH-758)Xiang Zhang2017-03-221-4/+4
|
* bpo-29873: fix INCREF for possible NULL value in element_getattr() (GH-757)Xiang Zhang2017-03-221-1/+1
|