summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter ↵Serhiy Storchaka2018-02-226-4053/+4132
| | | | | | | | | to compiler. (GH-5006) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
* bpo-32838: Fix Python versions in the table of magic numbers. (#5658)Serhiy Storchaka2018-02-221-117/+117
|
* bpo-32604: Swap threads only if the interpreter is different. (gh-5778)Eric Snow2018-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.
* bpo-32869: Fix incorrect dst buffer size for MultiByteToWideChar (#5739)Alexey Izbyshev2018-02-181-1/+2
| | | | This function expects the destination buffer size to be given in wide characters, not bytes.
* bpo-32604: Clean up created subinterpreters before runtime finalization. ↵Eric Snow2018-02-171-1/+57
| | | | | | (gh-5709)
* Fix some warnings produced by different compilers. (#5593)Serhiy Storchaka2018-02-093-5/+5
|
* bpo-32777: Fix _Py_set_inheritable async-safety in subprocess (GH-5560)Alexey Izbyshev2018-02-061-3/+16
| | | | | | | 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
* bpo-10544: Disallow "yield" in comprehensions and generator expressions. ↵Serhiy Storchaka2018-02-041-24/+7
| | | | (GH-4564)
* bpo-32746: Fix multiple typos (GH-5144)Leo Arias2018-02-041-2/+2
| | | Fix typos found by codespell in docs, docstrings, and comments.
* bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (#5507)Eric Snow2018-02-031-0/+1
|
* bpo-32303 - Consistency fixes for namespace loaders (#5481)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
* bpo-32747: Remove trailing spaces in docstrings. (GH-5491)oldk2018-02-021-3/+3
|
* bpo-32674: Improve the docstring for __import__ (GH-5339)oldk2018-02-021-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.
* bpo-32436: Fix compiler warning (#5483)Yury Selivanov2018-02-021-0/+2
|
* Fix typo in hamt.c comments (#5478)Dmitry Alimov2018-02-021-1/+1
|
* bpo-32711: Fix warnings for Python/ast_unparse.c (#5426)Stéphane Wirtel2018-02-011-3/+7
| | | * bpo-32711: Fix warnings for Python/ast_unparse.c
* bpo-32604: Expose the subinterpreters C-API in a "private" stdlib module. ↵Eric Snow2018-01-301-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-304-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-242-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-235-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-221-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
|
* bpo-31975 (PEP 565): Show DeprecationWarning in __main__ (GH-4458)Nick Coghlan2018-01-081-7/+33
| | | | | | | | | | | | | - primary change is to add a new default filter entry for 'default::DeprecationWarning:__main__' - secondary change is an internal one to cope with plain strings in the warning module's internal filter list (this avoids the need to create a compiled regex object early on during interpreter startup) - assorted documentation updates, including many more examples of configuring the warnings settings - additional tests to ensure that both the pure Python and the C accelerated warnings modules have the expected default configuration
* bpo-30579: Allow TracebackType creation and tb_next mutation from Python ↵Nathaniel J. Smith2018-01-072-26/+158
| | | | | | | | | | | | | | | | | (GH-4793) Third party projects may wish to hide their own internal machinery in order to present more comprehensible tracebacks to end users (e.g. Jinja2 and Trio both do this). Previously such projects have had to rely on ctypes to do so: https://github.com/pallets/jinja/blob/fe3dadacdf4cf411d0a5b6bbd4d5234697a28af2/jinja2/debug.py#L345 https://github.com/python-trio/trio/blob/1e86b1aee8c0c759f6f239ae53a05d0d3963c629/trio/_core/_multierror.py#L296 This provides a Python level API for creating and modifying real Traceback objects, allowing tracebacks to be edited at runtime. Patch by Nathaniel Smith.
* bpo-29137: Remove fpectl module (#4789)Nathaniel J. Smith2018-01-061-14/+6
| | | | | This module has never been enabled by default, never worked correctly on x86-64, and caused ABI problems that caused C extension compatibility. See bpo-29137 for details/discussion.