summaryrefslogtreecommitdiff
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-33041: Fixed jumping if the function contains an "async for" loop. (GH-6154)Serhiy Storchaka2018-03-231-27/+17
|
* [3.7] bpo-33021: Release the GIL during fstat() calls (GH-6019) (GH-6159)Miss Islington (bot)2018-03-201-1/+6
| | | | | | | | | | | | | | | | fstat may block for long time if the file descriptor is on a non-responsive NFS server, hanging all threads. Most fstat() calls are handled by _Py_fstat(), releasing the GIL internally, but but _Py_fstat_noraise() does not release the GIL, and most calls release the GIL explicitly around it. This patch fixes last 2 calls to _Py_fstat_no_raise(), avoiding hangs when calling: - mmap.mmap() - os.urandom() - random.seed() (cherry picked from commit 4484f9dca9149da135bbae035f10a50d20d1cbbb) Co-authored-by: Nir Soffer <nirsof@gmail.com>
* bpo-32836: Remove obsolete code from symtable pass (GH-5680)Miss Islington (bot)2018-03-101-25/+0
| | | | | | | | | | When comprehensions switched to using a nested scope, the old code for generating a temporary name to hold the accumulation target became redundant, but was never actually removed. Patch by Nitish Chandra. (cherry picked from commit 3a087beddd9f0955eb9080a6fd1499ff89ca74bf) Co-authored-by: Nitish Chandra <nitishchandrachinta@gmail.com>
* [3.7] bpo-33041: Add missed error checks when compile "async for" (GH-6053) ↵Serhiy Storchaka2018-03-101-13/+7
| | | | | | | | (GH-6060) and remove redundant code. (cherry picked from commit 67ee07795bcd84b679c000780212d4d81a1490a3) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Add two missing error checks in hamt.c (GH-5851)Miss Islington (bot)2018-03-071-1/+7
| | | | | (cherry picked from commit 3c7ac7ea2098c672e50402d1d1b5ee9f14586437) Co-authored-by: Xiang Zhang <angwerzx@126.com>
* bpo-33005: Fix _PyGILState_Reinit() (GH-6001)Miss Islington (bot)2018-03-061-4/+23
| | | | | | | | | | | Fix a crash on fork when using a custom memory allocator (ex: using PYTHONMALLOC env var). _PyGILState_Reinit() and _PyInterpreterState_Enable() now use the default RAW memory allocator to allocate a new interpreters mutex on fork. (cherry picked from commit 5d92647102fac9e116b98ab8bbc632eeed501c34) Co-authored-by: Victor Stinner <victor.stinner@gmail.com>
* bpo-32838: Fix Python versions in the table of magic numbers. (GH-5658)Miss Islington (bot)2018-02-231-117/+117
| | | | | (cherry picked from commit 4af8fd561433826ac897c55e41a087a5c5dbacf3) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-32604: Swap threads only if the interpreter is different. (gh-5783)Miss Islington (bot)2018-02-201-6/+14
| | | | | | The CPython runtime assumes that there is a one-to-one relationship (for a given interpreter) between PyThreadState and OS threads. Sending and receiving on a channel in the same interpreter was causing crashes because of this (specifically due to a check in PyThreadState_Swap()). The solution is to not switch threads if the interpreter is the same. (cherry picked from commit f53d9f2778a87bdd48eb9030f782a4ebf9e7622f) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* bpo-32869: Fix incorrect dst buffer size for MultiByteToWideChar (GH-5739)Miss Islington (bot)2018-02-181-1/+2
| | | | | | | This function expects the destination buffer size to be given in wide characters, not bytes. (cherry picked from commit b3b4a9d3001f1fc7df8efcccdce081de54fa5eab) Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
* bpo-32604: Clean up created subinterpreters before runtime finalization. ↵Miss Islington (bot)2018-02-161-1/+57
| | | | | | | (gh-5710) (cherry picked from commit 4c6955e2b0ccf88c705f8d1fac685a8e65f9699e) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* Fix some warnings produced by different compilers. (GH-5593) (GH-5600)Miss Islington (bot)2018-02-093-5/+5
| | | | | (cherry picked from commit bfe4fd5f2e96e72eecb5b8a0c7df0ac1689f3b7e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-32777: Fix _Py_set_inheritable async-safety in subprocess (GH-5560) ↵Miss Islington (bot)2018-02-051-3/+16
| | | | | | | | | | | | (GH-5562) Fix a rare but potential pre-exec child process deadlock in subprocess on POSIX systems when marking file descriptors inheritable on exec in the child process. This bug appears to have been introduced in 3.4 with the inheritable file descriptors support. This also changes Python/fileutils.c `set_inheritable` to use the "slow" two `fcntl` syscall path instead of the "fast" single `ioctl` syscall path when asked to be async signal safe (by way of being asked not to raise exceptions). `ioctl` is not a POSIX async-signal-safe approved function. ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html (cherry picked from commit c1e46e94de38a92f98736af9a42d89c3975a9919) Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
* [3.7] bpo-32746: Fix multiple typos (GH-5144) (GH-5520)Miss Islington (bot)2018-02-031-2/+2
| | | | | | Fix typos found by codespell in docs, docstrings, and comments. (cherry picked from commit c3d9508ff22ece9a96892b628dd5813e2fb0cd80) Co-authored-by: Leo Arias <leo.arias@canonical.com>
* bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (GH-5507)Miss Islington (bot)2018-02-021-0/+1
| | | | | (cherry picked from commit 4e9da0d163731caa79811c723c703ee416c31826) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5503)Barry Warsaw2018-02-022-1425/+1425
| | | | | | | | | | * Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages. * Make sure ``__spec__.origin` matches ``__file__`` for namespace packages. https://bugs.python.org/issue32303 https://bugs.python.org/issue32305 (cherry picked from commit bbbcf8693b876daae4469765aa62f8924f39a7d2) Co-authored-by: Barry Warsaw <barry@python.org>
* bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5488)Miss Islington (bot)2018-02-011-3/+3
| | | | | | | | Clarify that the level argument is used to determine whether to perform absolute or relative imports: 0 is absolute, while a positive number is the number of parent directories to search relative to the current module. (cherry picked from commit 461d225b195eec5269f317323b41115516144c41) Co-authored-by: oldk <oldk1331@users.noreply.github.com>
* bpo-32436: Fix compiler warning (GH-5483) (GH-5486)Miss Islington (bot)2018-02-011-0/+2
| | | | | (cherry picked from commit 55e0839f2672e029c2b96514028c77c31ffbe41f) Co-authored-by: Yury Selivanov <yury@magic.io>
* Fix typo in hamt.c comments (GH-5478) (#5484)Miss Islington (bot)2018-02-011-1/+1
| | | | | (cherry picked from commit 01a0cb891694cf73b86f799c48d8c78de1b8f74c) Co-authored-by: Dmitry Alimov <dvalimov@gmail.com>
* [3.7] bpo-32711: Fix warnings for Python/ast_unparse.c (GH-5426) (#5475)Miss Islington (bot)2018-02-011-3/+7
| | | | | | * bpo-32711: Fix warnings for Python/ast_unparse.c (cherry picked from commit 83ab995871ffd504ac229bdbf5b9e9ffc1032815) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
* bpo-32604: Expose the subinterpreters C-API in a "private" stdlib module. ↵Eric Snow2018-01-291-1/+274
| | | | | (gh-1748) The module is primarily intended for internal use in the test suite. Building the module under Windows will come in a follow-up PR.
* bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181)Mark Shannon2018-01-294-174/+123
|
* rename _imp initialization function to follow conventions (#5432)Benjamin Peterson2018-01-292-3/+2
| | | When the C imp module became _imp in 6f44d66bc491bad5b8d897a68da68e009e27829d, the initialization function should have been renamed from PyInit_imp to PyInit__imp.
* bpo-32707: Fix warnings in hamt.c (#5430)Yury Selivanov2018-01-291-3/+5
|
* bpo-20891: Py_Initialize() now creates the GIL (#4700)Victor Stinner2018-01-292-12/+17
| | | | The GIL is no longer created "on demand" to fix a race condition when PyGILState_Ensure() is called in a non-Python thread.
* bpo-32688: Make why the line is commented out clear (GH-5405)Xiang Zhang2018-01-291-1/+1
|
* bpo-32436: Use PyThreadState_GET() in all hot paths (GH-5363)Yury Selivanov2018-01-271-3/+6
|
* bpo-32436: Make PyContextVar_Get a little bit faster (#5350)Yury Selivanov2018-01-261-1/+2
| | | | Since context.c is compiled with Py_BUILD_CORE, using a macro will result in a slightly more optimal code.
* bpo-32670: Enforce PEP 479. (#5327)Yury Selivanov2018-01-261-1/+1
|
* bpo-32591: fix abort in _PyErr_WarnUnawaitedCoroutine during shutdown (#5337)Nathaniel J. Smith2018-01-261-0/+7
| | | | | | | | | | | | | | | | | | When an unawaited coroutine is collected very late in shutdown -- like, during the final GC at the end of PyImport_Cleanup -- then it was triggering an interpreter abort, because we'd try to look up the "warnings" module and not only was it missing (we were prepared for that), but the entire module system was missing (which we were not prepared for). I've tried to fix this at the source, by making the utility function get_warnings_attr robust against this in general. Note that it already has the convention that it can return NULL without setting an error, which is how it signals that the attribute it was asked to fetch is missing, and that all callers already check for NULL returns. There's a similar check for being late in shutdown at the top of warn_explicit, which might be unnecessary after this fix, but I'm not sure so I'm going to leave it.
* String annotations [PEP 563] (#4390)Guido van Rossum2018-01-263-2/+1189
| | | | | | | | * Document `from __future__ import annotations` * Provide plumbing and tests for `from __future__ import annotations` * Implement unparsing the AST back to string form This is required for PEP 563 and as such only implements a part of the unparsing process that covers expressions.
* bpo-32436: Fix a refleak; var GC tracking; a GCC warning (#5326)Yury Selivanov2018-01-252-4/+6
| | | | | The refleak in question wasn't really important, as context vars are usually created at the toplevel and live as long as the interpreter lives, so the context var name isn't ever GCed anyways.
* Fix 3rd level node's binary representation in HAMT algorithm description (#5319)Dmitry Alimov2018-01-251-1/+1
|
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-255-1069/+1204
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-32436: Don't use native popcount() (also fixes bpo-32641) (#5292)Yury Selivanov2018-01-232-15/+13
|
* bpo-32436: Fix potential NULL dereference (#5286)Yury Selivanov2018-01-231-0/+4
|
* bpo-32436: Remove a redundant assert (#5275)Yury Selivanov2018-01-231-1/+0
|
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-225-0/+4363
|
* bpo-29240: PyUnicode_DecodeLocale() uses UTF-8 on Android (#5272)Victor Stinner2018-01-221-0/+10
| | | | | | | | PyUnicode_DecodeLocaleAndSize(), PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale() now use always use the UTF-8 encoding on Android, instead of the current locale encoding. On Android API 19, mbstowcs() and wcstombs() are broken and cannot be used.
* bpo-32593: Drop FreeBSD 9 and older support (#5232)Victor Stinner2018-01-221-10/+0
| | | Drop support of FreeBSD 9 and older.
* bpo-32591: Fix PyExc_WarnFormat call (follow-up commit) (#5263)Yury Selivanov2018-01-211-5/+4
| | | | | The previous version was correct in terms of behaviour, but checking the return value of PyErr_WarnFormat allows to avoid calling PyErr_Occurred and silences the coverity alarm.
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-215-0/+185
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
* bpo-9566: Fix size_t=>int downcast warnings (#5230)Victor Stinner2018-01-183-7/+7
| | | | * Use wider types (int => Py_ssize_t) to avoid integer overflows. * Fix gc.get_freeze_count(): use Py_ssize_t type rather than int, since gc_list_size() returns a Py_ssize_t.
* Fix typo in thread_nt.h code comment (GH-5211)hui shang2018-01-171-1/+1
| | | | The comment for PyThread_allocate_lock says "It has too be implemented ...". There was an extra "o" in ".. to be implemented.."
* bpo-32544: Speed up hasattr() and getattr() (GH-5173)INADA Naoki2018-01-161-10/+11
| | | | | AttributeError was raised always when attribute is not found. This commit skip raising AttributeError when `tp_getattro` is `PyObject_GenericGetAttr`. It makes hasattr() and getattr() about 4x faster when attribute is not found.
* Implement the get_resource_reader() API for file system imports (#5168)Barry Warsaw2018-01-151-1248/+1307
|
* bpo-31900: Fix localeconv() encoding for LC_NUMERIC (#4174)Victor Stinner2018-01-152-11/+81
| | | | | | | | * Add _Py_GetLocaleconvNumeric() function: decode decimal_point and thousands_sep fields of localeconv() from the LC_NUMERIC encoding, rather than decoding from the LC_CTYPE encoding. * Modify locale.localeconv() and "n" formatter of str.format() (for int, float and complex to use _Py_GetLocaleconvNumeric() internally.
* bpo-29240: Fix locale encodings in UTF-8 Mode (#5170)Victor Stinner2018-01-152-141/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | Modify locale.localeconv(), time.tzname, os.strerror() and other functions to ignore the UTF-8 Mode: always use the current locale encoding. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx(). On decoding or encoding error, they return the position of the error and an error message which are used to raise Unicode errors in PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale(). * Replace _Py_DecodeCurrentLocale() with _Py_DecodeLocaleEx(). * PyUnicode_DecodeLocale() now uses _Py_DecodeLocaleEx() for all cases, especially for the strict error handler. * Add _Py_DecodeUTF8Ex(): return more information on decoding error and supports the strict error handler. * Rename _Py_EncodeUTF8_surrogateescape() to _Py_EncodeUTF8Ex(). * Replace _Py_EncodeCurrentLocale() with _Py_EncodeLocaleEx(). * Ignore the UTF-8 mode to encode/decode localeconv(), strerror() and time zone name. * Remove PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and PyUnicode_EncodeLocale() now ignore the UTF-8 mode: always use the "current" locale. * Remove _PyUnicode_DecodeCurrentLocale(), _PyUnicode_DecodeCurrentLocaleAndSize() and _PyUnicode_EncodeCurrentLocale().
* bpo-31113: Get rid of recursion in the compiler for normal control flow. (#3015)Serhiy Storchaka2018-01-111-78/+104
|
* bpo-29240: readline now ignores the UTF-8 Mode (#5145)Victor Stinner2018-01-101-28/+52
| | | | | | | | | | | | Add new fuctions ignoring the UTF-8 mode: * _Py_DecodeCurrentLocale() * _Py_EncodeCurrentLocale() * _PyUnicode_DecodeCurrentLocaleAndSize() * _PyUnicode_EncodeCurrentLocale() Modify the readline module to use these functions. Re-enable test_readline.test_nonascii().
* bpo-24340: Fix estimation of the code stack size. (#5076)Serhiy Storchaka2018-01-093-1152/+1205
|