summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* [3.6] bpo-30936: Fix a reference leak in json when fail to sort keys. ↵Serhiy Storchaka2017-07-161-1/+3
| | | | | (GH-2712). (#2727) (cherry picked from commit 49f6449ef4b81537c19b82329caaf60596c516c2)
* [3.6] bpo-30879: os.listdir() and os.scandir() now emit bytes names when ↵Serhiy Storchaka2017-07-111-3/+5
| | | | | | (GH-2634) (#2656) called with bytes-like argument.. (cherry picked from commit 1180e5a51871fa53ca6892e83fd2e69dc2600447)
* bpo-30892: Fix _elementtree module initialization (#2647) (#2649)Victor Stinner2017-07-101-0/+5
| | | | | Handle getattr(copy, 'deepcopy') error in _elementtree module initialization. (cherry picked from commit b136f11f3a51f9282ae992bac68f170ca5563b55)
* [3.6] bpo-29854: Fix segfault in call_readline() (GH-728)Nir Soffer2017-07-081-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.
* bpo-30797, bpo-30694: Avoid _GNU_SOURCE redefined warning in xmlparse.c (#2615)Ned Deily2017-07-071-1/+1
|
* [3.6] bpo-30828: Fix out of bounds write in ↵Yury Selivanov2017-07-051-3/+10
| | | | | `asyncio.CFuture.remove_done_callback() (GH-2569) (#2590) (cherry picked from commit 833a3b0d3707200daeaccdd218e8f18a190284aa)
* bpo-30319: socket.close() now ignores ECONNRESET (#2565) (#2566)Victor Stinner2017-07-041-1/+3
| | | | | socket.close() was modified in Python 3.6 to raise OSError on failure: see bpo-26685. (cherry picked from commit 67e1478dba6efe60b8e1890192014b8b06dd6bd9)
* [3.6] bpo-30703: Improve signal delivery (GH-2415) (#2527)Antoine Pitrou2017-07-011-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [3.6] bpo-30703: Improve signal delivery (GH-2415) * Improve signal delivery Avoid using Py_AddPendingCall from signal handler, to avoid calling signal-unsafe functions. * Remove unused function * Improve comments * Add stress test * Adapt for --without-threads * Add second stress test * Add NEWS blurb * Address comments @haypo. (cherry picked from commit c08177a1ccad2ed0d50898c2731b518c631aed14) * bpo-30796: Fix failures in signal delivery stress test (#2488) * bpo-30796: Fix failures in signal delivery stress test setitimer() can have a poor minimum resolution on some machines, this would make the test reach its deadline (and a stray signal could then kill a subsequent test). * Make sure to clear the itimer after the test
* [3.6] bpo-30807: signal.setitimer() may disable the timer by mistake ↵Antoine Pitrou2017-06-301-0/+4
| | | | | | | | (GH-2493) (#2497) * bpo-30807: signal.setitimer() may disable the timer by mistake * Add NEWS blurb (cherry picked from commit 729780a810bbcb12b245a1b652302a601fc9f6fd)
* _winconsoleio: Fix memory leak (#2485)Victor Stinner2017-06-291-3/+3
| | | | Fix memory leak when _winconsoleio tries to open a non-console file: free the name buffer.
* bpo-30602: Fix refleak in os.spawnv() (#2212) (#2486)Victor Stinner2017-06-291-1/+1
| | | | | | When os.spawnv() fails while handling arguments, free correctly argvlist: pass lastarg+1 rather than lastarg to free_string_array() to also free the first item. (cherry picked from commit 8acb4cf2b3436652568d7a70228b166316181466)
* [3.6] bpo-13617: Reject embedded null characters in wchar* strings. ↵Serhiy Storchaka2017-06-289-11/+35
| | | | | | | | | | (GH-2302) (#2462) Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.. (cherry picked from commit f7eae0adfcd4c50034281b2c69f461b43b68db84)
* [3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). ↵Serhiy Storchaka2017-06-278-17/+10
| | | | | | | (GH-2285) (#2443) Raise a ValueError if the second argument is NULL and the wchar_t\* string contains null characters.. (cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a)
* [3.6] bpo-30769: Fix reference leak introduced in 77703942c59 (GH-2416) (#2425)Emily Morehouse2017-06-271-0/+4
| | | | | | | | New error condition paths were introduced, which did not decrement `key2` and `val2` objects. Therefore, decrement references before jumping to the error label. Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com> (cherry picked from commit a7874c73c0c729bbec2fd4b077bd0eec276cfff4)
* [3.6] bpo-30746: Prohibited the '=' character in environment variable names ↵Serhiy Storchaka2017-06-251-4/+28
| | | | | | | (GH-2382) (#2391) in `os.putenv()` and `os.spawn*()`.. (cherry picked from commit 77703942c5997dff00c48f10df1b29b11645624c)
* [3.6] bpo-30745: Fix compiler warnings introduced in bpo-30730. (GH-2376) ↵Serhiy Storchaka2017-06-241-2/+1
| | | | | (#2378) (cherry picked from commit 0ee32c1)
* [3.6] bpo-30730: Prevent environment variables injection in subprocess on ↵Serhiy Storchaka2017-06-231-5/+21
| | | | | | Windows. (GH-2325) (#2360) Prevent passing other invalid environment variables and command arguments.. (cherry picked from commit d174d24a5d37d1516b885dc7c82f71ecd5930700)
* bpo-30602: Fix lastarg in os.spawnve() (#2287) (#2357)Victor Stinner2017-06-231-1/+1
| | | | | Fix a regression introduced by myself in the commit 526b22657cb18fe79118c2ea68511aca09430c2c. (cherry picked from commit c8d6ab2e25ff212702d387e516e258b1d8c52910)
* bpo-30694: Upgrade Modules/expat/ to libexpat 2.2.1 (#2300) (#2313)Victor Stinner2017-06-218-158/+878
| | | | New file: Modules/expat/siphash.h. (cherry picked from commit 5ff7132313eb651107b179d20218dfe5d4e47f13)
* [3.6] bpo-30650: Fixed a syntax error: missed right parentheses (GH-2154) ↵Serhiy Storchaka2017-06-151-1/+1
| | | | | (#2215) (cherry picked from commit 0d32218)
* bpo-29591: Upgrade Modules/expat to libexpat 2.2 (#2164) (#2200)Victor Stinner2017-06-1413-476/+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)
* [3.6] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) ↵Serhiy Storchaka2017-06-121-1/+1
| | | | | | (#2121) The traceback no longer displayed for SystemExit raised in a callback registered by atexit.. (cherry picked from commit 3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4)
* bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. ↵Yury Selivanov2017-06-111-1/+17
| | | | (#2109)
* [3.6] bpo-27425: Be more explicit in .gitattributes (GH-840) (GH-2083)Zachary Ware2017-06-101-111/+111
| | | Also updates checked-in line endings on some files
* [3.6] Regenerate Argument Clinic code for bpo-19180. (GH-2073). (#2077)Serhiy Storchaka2017-06-102-2/+2
| | | | (cherry picked from commit 5f31d5cf6efa8c304d352e34f9f2a1ed0074298e)
* bpo-30038: fix race condition in signal delivery + wakeup fd (#1082) (#2075)Victor Stinner2017-06-101-7/+26
| | | | | | | | | | | | | | | | | | | | Before, it was possible to get the following sequence of events (especially on Windows, where the C-level signal handler for SIGINT is run in a separate thread): - SIGINT arrives - trip_signal is called - trip_signal writes to the wakeup fd - the main thread wakes up from select()-or-equivalent - the main thread checks for pending signals, but doesn't see any - the main thread drains the wakeup fd - the main thread goes back to sleep - trip_signal sets is_tripped=1 and calls Py_AddPendingCall to notify the main thread the it should run the Python-level signal handler - the main thread doesn't notice because it's asleep This has been causing repeated failures in the Trio test suite: https://github.com/python-trio/trio/issues/119 (cherry picked from commit 4ae01496971624c75080431806ed1c08e00f22c7)
* [3.6] bpo-30039: Don't run signal handlers while resuming a yield from stack ↵Yury Selivanov2017-06-091-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-1081) (#1640) If we have a chain of generators/coroutines that are 'yield from'ing each other, then resuming the stack works like: - call send() on the outermost generator - this enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode - which calls send() on the next generator - which enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode - ...etc. However, every time we enter _PyEval_EvalFrameDefault, the first thing we do is to check for pending signals, and if there are any then we run the signal handler. And if it raises an exception, then we immediately propagate that exception *instead* of starting to execute bytecode. This means that e.g. a SIGINT at the wrong moment can "break the chain" – it can be raised in the middle of our yield from chain, with the bottom part of the stack abandoned for the garbage collector. The fix is pretty simple: there's already a special case in _PyEval_EvalFrameEx where it skips running signal handlers if the next opcode is SETUP_FINALLY. (I don't see how this accomplishes anything useful, but that's another story.) If we extend this check to also skip running signal handlers when the next opcode is YIELD_FROM, then that closes the hole – now the exception can only be raised at the innermost stack frame. This shouldn't have any performance implications, because the opcode check happens inside the "slow path" after we've already determined that there's a pending signal or something similar for us to process; the vast majority of the time this isn't true and the new check doesn't run at all.. (cherry picked from commit ab4413a7e9bda95b6fcd517073e2a51dafaa1624)
* bpo-30524: Write unit tests for FASTCALL (#2022) (#2030)Victor Stinner2017-06-091-0/+101
| | | | | | | | Test C functions: * _PyObject_FastCall() * _PyObject_FastCallDict() * _PyObject_FastCallKeywords() (cherry picked from commit 3b5cf85edc188345668f987c824a2acb338a7816)
* [3.6] bpo-19180: Updated references for RFC 1750, RFC 3280 & RFC 4366Nick Coghlan2017-06-092-2/+2
| | | | | | * RFC 1750 has been been obsoleted by RFC 4086. * RFC 3280 has been obsoleted by RFC 5280. * RFC 4366 has been obsoleted by RFC 6066. (cherry picked from commit 63c2c8ac17750ba2be2cfc4e339cae1f4edee54f)
* bpo-30601: Fix a refleak in WindowsConsoleIO (#2003) (#2008)Victor Stinner2017-06-081-3/+2
| | | | | | Fix a reference leak in _io._WindowsConsoleIO: PyUnicode_FSDecoder() always initialize decodedname when it succeed and it doesn't clear input decodedname object. (cherry picked from commit 29adc13bd797d9c9e7fcb893a7c49ce7f7ad388c)
* [3.6] bpo-30594: Fixed refcounting in newPySSLSocket (GH-1992) (#1994)Nathaniel J. Smith2017-06-081-2/+1
| | | | If pass a server_hostname= that fails IDNA decoding to SSLContext.wrap_socket or SSLContext.wrap_bio, then the SSLContext object had a spurious Py_DECREF called on it, eventually leading to segfaults. (cherry picked from commit 65ece7ca2366308fa91a39a8dfa255e6bdce3cca)
* [3.6] bpo-30557: faulthandler now correctly filters and displays exception ↵Steve Dower2017-06-061-4/+4
| | | | | | | | | | | | | | | | | … (#1960) * bpo-30557: faulthandler now correctly filters and displays exception codes on Windows (#1924) * bpo-30557: faulthandler now correctly filters and displays exception codes on Windows * Adds test for non-fatal exceptions. * Adds bpo number to comment. * bpo-30557: Fix test_faulthandler (#1969) On Windows 8, 8.1 and 10 at least, the exit code is the exception code (no bit is cleared).
* bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when ↵Steve Dower2017-06-021-1/+1
| | | | | | | WriteConsoleW fails (#1912) (#1925) * bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails * bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails
* [3.6] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1287)Mariatta2017-05-271-1/+4
| | | (cherry picked from commit 9616a82e7802241a4b74cf7ae38d43c37bf66e48)
* bpo-30003: Fix handling escape characters in HZ codec (#1556) (#1719)Xiang Zhang2017-05-221-13/+12
|
* tmtotuple(): use time_t for gmtoff (#1276) (#1635)Victor Stinner2017-05-171-3/+3
| | | | | | | | timegm() return type is time_t, not int. Use time_t to prevent the following compiler warning on Windows: timemodule.c: warning C4244: '=': conversion from 'time_t' to 'int', possible loss of data (cherry picked from commit 0d659e5614cad512a1940125135b443b3eecb5d7)
* bpo-30242: resolve some undefined behaviours in struct (#1418) (#1586)Xiang Zhang2017-05-151-5/+9
|
* bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546)INADA Naoki2017-05-111-0/+12
| | | | | | | | | | | | | | when there are no more `await` or `yield (from)` before return in coroutine, cancel was ignored. example: async def coro(): asyncio.Task.current_task().cancel() return 42 ... res = await coro() # should raise CancelledError (cherry picked from commit 991adca012f5e106c2d4040ce619c696ba6f9c46)
* bpo-29990: Fix range checking in GB18030 decoder (#1495) (#1507)Xiang Zhang2017-05-091-1/+3
| | | When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
* [3.6] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1469)Serhiy Storchaka2017-05-051-66/+20
| | | | | | 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)
* [3.6] bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. ↵Serhiy Storchaka2017-05-041-2/+2
| | | | | (GH-1316). (#1441) (cherry picked from commit 5f161fd86dd5bb936a1a2a13391b13b7e59ec201)
* Backport bpo-30205 to 3.6 (#1403)Antoine Pitrou2017-05-021-3/+3
|
* bpo-30125: Fix faulthandler.disable() on Windows (#1243)Victor Stinner2017-04-211-2/+11
| | | | On Windows, faulthandler.disable() now removes the exception handler installed by faulthandler.enable().
* [3.6] bpo-30065: Fixed arguments validation in _posixsubprocess.fork_exec(). ↵Serhiy Storchaka2017-04-191-20/+23
| | | | | (GH-1110) (#1186) (cherry picked from commit 66bffd1)
* [3.6] bpo-30070: Fixed leaks and crashes in errors handling in the parser ↵Serhiy Storchaka2017-04-191-52/+79
| | | | | module. (GH-1131). (#1184) (cherry picked from commit a79f4c219531c05fc8f670c1e4bbf12c081935d3)
* bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() ↵Serhiy Storchaka2017-04-194-28/+65
| | | | | | | (#1096) (#1180) raised an error. (cherry picked from commit bf623ae8843dc30b28c574bec8d29fc14be59d86)
* bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is ↵Xiang Zhang2017-04-151-8/+17
| | | | present (#1130) (#1150)
* [3.6] bpo-29738: Fix memory leak in _get_crl_dp (GH-526) (GH-1142)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)
* convert from long long to PyLong loselessly (#1106) (#1121)Benjamin Peterson2017-04-131-1/+1
|
* Expand the PySlice_GetIndicesEx macro. (#1023) (#1044)Serhiy Storchaka2017-04-085-25/+24
| | | (cherry picked from commit b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8)