summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593)Eric Snow2017-09-155-63/+128
| | | | | The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls. We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.
* bpo-31338 (#3374)Barry Warsaw2017-09-158-27/+15
| | | | | | | * Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros.
* bpo-28411: Isolate PyInterpreterState.modules (#3575)Eric Snow2017-09-145-47/+84
| | | | | A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason. Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts.
* bpo-30860: Fix a refleak. (#3567)Eric Snow2017-09-144-27/+31
| | | | | Resolves bpo-31420. (This was accidentally reverted when in #3565.)
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-149-238/+111
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an ↵Oren Milman2017-09-131-1/+1
| | | | exception with a bad __module__ attribute. (#3539)
* bpo-30860: Fix a refleak. (#3506)Eric Snow2017-09-124-27/+31
| | | | | | | | | | | | | | * Drop warnoptions from PyInterpreterState. * Drop xoptions from PyInterpreterState. * Don't set warnoptions and _xoptions again. * Decref after adding to sys.__dict__. * Drop an unused macro. * Check sys.xoptions *before* we delete it.
* bpo-31416: Fix assertion failures in case of a bad warnings.filters or ↵Oren Milman2017-09-111-3/+16
| | | | | warnings.defaultaction. (#3496) Patch by Oren Milman.
* bpo-31373: remove overly strict float range checks (#3486)Benjamin Peterson2017-09-111-4/+0
| | | | | This undoes a853a8ba7850381d49b284295dd6f0dc491dbe44 except for the pytime.c parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be rounded into finite floats. Tests were added to very this behavior.
* bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is ↵Oren Milman2017-09-111-1/+7
| | | | not a dictionary. (#3485)
* bpo-26669: Fix nan arg value error in pytime.c (#3085)Han Lee2017-09-081-0/+14
| | | | | | | | | | * Fix #26669 * Modify NaN check function and error message * Fix pytime.c when arg is nan * fix whitespace
* delete dead locale initialization code for windows (#3461)Benjamin Peterson2017-09-081-5/+1
|
* bpo-31393: Fix the use of PyUnicode_READY(). (#3451)Serhiy Storchaka2017-09-081-7/+10
|
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-0817-426/+416
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31344: Per-frame control of trace events (GH-3417)Nick Coghlan2017-09-082-9/+17
| | | | | | | | | f_trace_lines: enable/disable line trace events f_trace_opcodes: enable/disable opcode trace events These are intended primarily for testing of the interpreter itself, as they make it much easier to emulate signals arriving at unfortunate times.
* bpo-31373: fix undefined floating-point demotions (#3396)Benjamin Peterson2017-09-072-16/+21
|
* remove current_filename optimization from marshal (#3423) (closes bpo-31384)Benjamin Peterson2017-09-071-19/+0
|
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-078-216/+3
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-30465: Fix lineno and col_offset in fstring AST nodes (#1800)Łukasz Langa2017-09-071-5/+67
| | | For f-string ast nodes, fix the line and columns so that tools such as flake8 can identify them correctly.
* Revert "pytime: include winsock2, so we can have a complete timeval type ↵Antoine Pitrou2017-09-061-1/+0
| | | | | (#3377)" (#3383) This reverts commit 833860615bedfd2484ac0623d6f01ff0578ba09f, as it broke Windows builds.
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-0610-418/+452
| | | Windows buildbots started failing due to include-related errors.
* pytime: include winsock2, so we can have a complete timeval type (#3377)Benjamin Peterson2017-09-061-0/+1
|
* correct initialization code (#3376)Benjamin Peterson2017-09-062-3/+2
| | | Explicitly initialize struct members rather than relying on compiler extensions.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-0610-452/+419
| | | | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-048-84/+207
| | | sys.modules is the one true source.
* bpo-31286, bpo-30024: Fixed stack usage in absolute imports with (#3217)Serhiy Storchaka2017-08-291-10/+16
| | | binding a submodule to a name.
* bpo-31095: fix potential crash during GC (GH-2974)INADA Naoki2017-08-241-0/+2
|
* bpo-31229: Fixed wrong error messages when too many keyword arguments are ↵Oren Milman2017-08-231-2/+8
| | | | received. (#3180)
* bpo-31236: Improved some error messages of min() and max().Oren Milman2017-08-211-2/+3
|
* bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. ↵Stefan Krah2017-08-219-14/+27
| | | | (#3157)
* bpo-31070: Fix a race condition in importlib _get_module_lock(). (#3033)Serhiy Storchaka2017-08-091-1473/+1478
|
* Fix a shadow-compatible-local warning (#2180)Yuan Chao Chou2017-08-041-165/+165
| | | | Change the shadowing naming, 'value' (Python-ast.c:4652), to 'val' to prevent the variables from being misused.
* bpo-31071: Avoid masking original TypeError in call with * unpacking (#2957)Serhiy Storchaka2017-08-031-29/+34
| | | when other arguments are passed.
* Spelling fixes (#2902)Ville Skyttä2017-08-031-1/+1
|
* bpo-31091: Remove dead code in PyErr_GivenExceptionMatches(). (#2963)scoder2017-07-311-13/+1
| | | According to the comment, there was previously a call to PyObject_IsSubclass() involved which could fail, but since it was replaced with a call to PyType_IsSubtype(), it can no longer fail.
* bpo-30640: Fix undefined behavior in _PyFunction_FastCallDict() and ↵Zackery Spytz2017-07-311-1/+2
| | | | | PyEval_EvalCodeEx() (#2919) k + 1 was calculated with k = NULL.
* bpo-9566: Fix a warning in Python/getargs.c (#2890)Segev Finer2017-07-261-1/+1
|
* Fix a small typo in a comment (#2863)Stéphane Wirtel2017-07-251-1/+1
|
* bpo-30891: Fix again importlib _find_and_load() (#2665)Victor Stinner2017-07-211-351/+352
| | | | | | | | | Use sys.modules.get() in the "with _ModuleLockManager(name):" block to protect the dictionary key with the module lock and use an atomic get to prevent race condition. Remove also _bootstrap._POPULATE since it was unused (_bootstrap_external now has its own _POPULATE object), add a new _SENTINEL object instead.
* bpo-30876: Relative import from unloaded package now reimports the package ↵Serhiy Storchaka2017-07-122-380/+365
| | | | | | | | | (#2639) instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError.
* bpo-30891: Fix importlib _find_and_load() race condition (#2646)Victor Stinner2017-07-102-1539/+1526
| | | | | | * Rewrite importlib _get_module_lock(): it is now responsible to hold the imp lock directly. * _find_and_load() now holds the module lock to check if name is in sys.modules to prevent a race condition
* Remove _PyArg_NoStackKeywords(). (#2641)Serhiy Storchaka2017-07-101-18/+0
|
* bpo-30814: Fixed a race condition when import a submodule from a package. ↵Serhiy Storchaka2017-07-062-323/+306
| | | | (#2580)
* bpo-30854: Fix compile error when --without-threads (#2581)Masayuki Yamamoto2017-07-051-1/+1
| | | | | | * bpo-30854: Fix compile error when --without-threads * bpo-30854: fix news
* bpo-29464: Rename METH_FASTCALL to METH_FASTCALL|METH_KEYWORDS and make (#1955)Serhiy Storchaka2017-07-035-101/+27
| | | | | the bare METH_FASTCALL be used for functions with positional-only parameters.
* bpo-30832: Remove own implementation for thread-local storage (#2537)Masayuki Yamamoto2017-07-033-220/+8
| | | | | | | | | | | | | | | | * bpo-30832: Remove own implementation for thread-local storage CPython has provided the own implementation for thread-local storage (TLS) on Python/thread.c, it's used in the case which a platform has not supplied native TLS. However, currently all supported platforms (NT and pthreads) have provided native TLS and defined the Py_HAVE_NATIVE_TLS macro with unconditional in any case. * bpo-30832: replace NT with Windows * bpo-30832: change to directive chain * bpo-30832: remove comemnt which making no sense
* bpo-30647: Check nl_langinfo(CODESET) in locale coercion (GH-2374)Nick Coghlan2017-06-291-8/+11
| | | | | | | | | | | | | - On some versions of FreeBSD, setting the "UTF-8" locale succeeds, but a subsequent "nl_langinfo(CODESET)" fails - adding a check for this in the coercion logic means that coercion will happen on systems where this check succeeds, and will be skipped otherwise - that way CPython should automatically adapt to changes in platform behaviour, rather than needing a new release to enable coercion at build time - this also allows UTF-8 to be re-enabled as a coercion target, restoring the locale coercion behaviour on Mac OS X
* bpo-29585: Fix sysconfig.get_config_var("PYTHONFRAMEWORK") (GH-2483)INADA Naoki2017-06-291-1/+1
| | | | | | | | | | | `PYTHONFRAMEWORK` is defined in `Makefile` and it shoulnd't be used in `pyconfig.h`. `sysconfig.py --generate-posix-vars` reads config vars from Makefile and `pyconfig.h`. Conflicting variables should be avoided. Especially, string config variables in Makefile are unquoted, but in `pyconfig.h` are keep quoted. So it should be private (starts with underscore).
* bpo-30703: Improve signal delivery (#2415)Antoine Pitrou2017-06-281-21/+54
| | | | | | | | | | | | | | | | | | | | * 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
* bpo-29585: optimize site.py startup time (GH-136)INADA Naoki2017-06-281-0/+1
| | | | Avoid importing `sysconfig` from `site` by copying minimum code. Python startup is 5% faster on Linux and 30% faster on macOS