| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
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.
|
|
|
|
|
| |
Resolves bpo-31420.
(This was accidentally reverted when in #3565.)
|
|
|
| |
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.
|
|
|
|
| |
exception with a bad __module__ attribute. (#3539)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
warnings.defaultaction. (#3496)
Patch by Oren Milman.
|
|
|
|
|
| |
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.
|
|
|
|
| |
not a dictionary. (#3485)
|
|
|
|
|
|
|
|
|
|
| |
* Fix #26669
* Modify NaN check function and error message
* Fix pytime.c when arg is nan
* fix whitespace
|
| |
|
| |
|
|
|
|
|
|
|
| |
* 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).
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
|
|
|
| |
For f-string ast nodes, fix the line and columns so that tools such as flake8 can identify them correctly.
|
|
|
|
|
| |
(#3377)" (#3383)
This reverts commit 833860615bedfd2484ac0623d6f01ff0578ba09f, as it broke Windows builds.
|
|
|
| |
Windows buildbots started failing due to include-related errors.
|
| |
|
|
|
| |
Explicitly initialize struct members rather than relying on compiler extensions.
|
|
|
|
|
|
|
|
|
| |
* 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).
|
|
|
| |
sys.modules is the one true source.
|
|
|
| |
binding a submodule to a name.
|
| |
|
|
|
|
| |
received. (#3180)
|
| |
|
|
|
|
| |
(#3157)
|
| |
|
|
|
|
| |
Change the shadowing naming, 'value' (Python-ast.c:4652), to 'val'
to prevent the variables from being misused.
|
|
|
| |
when other arguments are passed.
|
| |
|
|
|
| |
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.
|
|
|
|
|
| |
PyEval_EvalCodeEx() (#2919)
k + 1 was calculated with k = NULL.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
(#2639)
instead of failing with SystemError.
Relative import from non-package now fails with ImportError rather than
SystemError.
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
| |
(#2580)
|
|
|
|
|
|
| |
* bpo-30854: Fix compile error when --without-threads
* bpo-30854: fix news
|
|
|
|
|
| |
the bare METH_FASTCALL be used for functions with positional-only
parameters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
| |
`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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
Avoid importing `sysconfig` from `site` by copying minimum code.
Python startup is 5% faster on Linux and 30% faster on macOS
|
|
|
|
|
|
|
| |
Based on patch by Victor Stinner.
Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to lock
This is especially important if PyThread_acquire_lock() is called reentrantly
(for example from a signal handler).
* Update 2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst
* Avoid core logic when taking the mutex failed
|