summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35233: Rewrite test_embed.InitConfigTests (GH-10524)Victor Stinner2018-11-131-0/+75
| | | | | | | | | | | | * Fix _PyCoreConfig_SetGlobalConfig(): set also Py_FrozenFlag * Fix _PyCoreConfig_AsDict(): export also xoptions * Add _Py_GetGlobalVariablesAsDict() and _testcapi.get_global_config() * test.pythoninfo: dump also global configuration variables * _testembed now serializes global, core and main configurations using JSON to reuse _Py_GetGlobalVariablesAsDict(), _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict(), rather than duplicating code. * test_embed.InitConfigTests now test much more configuration variables
* bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)Gregory P. Smith2018-11-132-3/+3
| | | | Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER. Project based C Preprocessor namespacing at its finest. :P
* bpo-35214: Initial clang MemorySanitizer support (GH-10479)Gregory P. Smith2018-11-122-1/+12
| | | | | | | | | | Adds configure flags for msan and ubsan builds to make it easier to enable. These also encode the detail that address sanitizer and memory sanitizer should disable pymalloc. Define MEMORY_SANITIZER when appropriate at build time and adds workarounds to existing code to mark things as initialized where the sanitizer is otherwise unable to determine that. This lets our build succeed under the memory sanitizer. not all tests pass without sanitizer failures yet but we're in pretty good shape after this.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-1219-30/+30
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35177: Add dependencies between header files (GH-10361)Victor Stinner2018-11-117-19/+2
| | | | | | | | | | | | | | * ast.h now includes Python-ast.h and node.h * parsetok.h now includes node.h and grammar.h * symtable.h now includes Python-ast.h * Modify asdl_c.py to enhance Python-ast.h: * Add #ifndef/#define Py_PYTHON_AST_H to be able to include the header twice * Add "extern { ... }" for C++ * Undefine "Yield" macro conflicting with winbase.h * Remove "#undef Yield" from C files, it's now done in Python-ast.h * Remove now useless includes in C files
* bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)Victor Stinner2018-11-092-4/+4
| | | | | | | * _PyTuple_ITEMS() gives access to the tuple->ob_item field and cast the first argument to PyTupleObject*. This internal macro is only usable if Py_BUILD_CORE is defined. * Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob). * Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1].
* bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418)Gregory P. Smith2018-11-091-10/+12
| | | | | | | | | | | | Fix an off by one error in the peephole optimizer when checking for unreachable code beyond a return. Do a bounds check within find_op so it can return before going past the end as a safety measure. https://github.com/python/cpython/commit/7db3c488335168993689ddae5914a28e16188447#diff-a33329ae6ae0bb295d742f0caf93c137 introduced this off by one error while fixing another one nearby. This bug was shipped in all Python 3.6 and 3.7 releases. The included unittest won't fail unless you do a clang msan build.
* bpo-34726: Fix handling of hash-based pycs in zipimport. (GH-10327)Elvis Pranskevichus2018-11-071-1018/+1055
| | | | | | | | Current support for hash-based bytecode files in `zipimport` is rather sparse, which leads to test failures when the test suite is ran with the ``SOURCE_DATE_EPOCH`` environment variable set. This teaches zipimport to handle hash-based pycs properly.
* bpo-35081: Add pycore_fileutils.h (GH-10371)Victor Stinner2018-11-063-0/+3
| | | | Move Py_BUILD_CORE code from Include/fileutils.h to a new Include/internal/pycore_fileutils.h file.
* bpo-35081: Add _PyCoreConfig_AsDict() (GH-10362)Victor Stinner2018-11-061-0/+152
| | | | | | | | | | | | _testcapimodule.c must not include pycore_pathconfig.h, since it's an internal header files. Changes: * Add _PyCoreConfig_AsDict() function to coreconfig.c. * Remove pycore_pathconfig.h include from _testcapimodule.h. * pycore_pathconfig.h now requires Py_BUILD_CORE to be defined. * _testcapimodule.c compilation now fails if it's built with Py_BUILD_CORE defined.
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↵Serhiy Storchaka2018-11-051-1/+1
| | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.
* Simplify sys.breakpointhook implementation (#9519)Anthony Sottile2018-11-011-9/+1
|
* bpo-35081: And pycore_lifecycle.h and pycore_pathconfig.h (GH-10273)Victor Stinner2018-11-015-16/+10
| | | | | | | | | | * And pycore_lifecycle.h and pycore_pathconfig.h headers to Include/internal/ * Move Py_BUILD_CORE specific code from coreconfig.h and pylifecycle.h to pycore_pathconfig.h and pycore_lifecycle.h * Move _Py_wstrlist_XXX() definitions and _PyPathConfig code from pycore_state.h to pycore_pathconfig.h * Move "Init" and "Fini" function definitions from pylifecycle.c to pycore_lifecycle.h.
* bpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)Victor Stinner2018-11-0110-65/+65
| | | | | | | | | | | | | | | | | | | | | | | | | If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access _PyRuntime which comes from the internal pycore_state.h header. Public headers must not require internal headers. Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from Include/pystate.h to Include/internal/pycore_state.h, and rename PyThreadState_GET() to _PyThreadState_GET() there. The PyThreadState_GET() macro of pystate.h is now redefined when pycore_state.h is included, to use the fast _PyThreadState_GET(). Changes: * Add _PyThreadState_GET() macro * Replace "PyThreadState_GET()->interp" with _PyInterpreterState_GET_UNSAFE() * Replace PyThreadState_GET() with _PyThreadState_GET() in internal C files (compiled with Py_BUILD_CORE defined), but keep PyThreadState_GET() in the public header files. * _testcapimodule.c: replace PyThreadState_GET() with PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE defined. * pycore_state.h now requires Py_BUILD_CORE to be defined.
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-3122-34/+34
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-26558: Fix Py_FatalError() with GIL released (GH-10267)Victor Stinner2018-10-311-10/+25
| | | | | Don't call _Py_FatalError_PrintExc() nor flush_std_files() if the current thread doesn't hold the GIL, or if the current thread has no Python state thread.
* bpo-35081: Move Py_BUILD_CORE code to internal/mem.h (GH-10249)Victor Stinner2018-10-316-0/+6
| | | | | * Add #include "internal/mem.h" to C files using _PyMem_SetDefaultAllocator(). * Include/internal/mem.h now requires Py_BUILD_CORE to be defined.
* bpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239)Victor Stinner2018-10-301-0/+1
| | | Add pyatomic.h to the VS project (it wasn't referenced).
* bpo-35081: Cleanup pystate.c and pystate.h (GH-10240)Victor Stinner2018-10-302-25/+21
| | | | | | | | | | | | * Remove _PyThreadState_Current * Replace GET_TSTATE() with PyThreadState_GET() * Replace GET_INTERP_STATE() with _PyInterpreterState_GET_UNSAFE() * Replace direct access to _PyThreadState_Current with PyThreadState_GET() * Replace _PyThreadState_Current with _PyRuntime.gilstate.tstate_current * Rename SET_TSTATE() to _PyThreadState_SET(), name more consistent with _PyThreadState_GET() * Update outdated comments
* bpo-32030: Make _PySys_AddXOptionWithError() private (GH-10236)Victor Stinner2018-10-301-3/+8
| | | | | | | | Make _PySys_AddXOptionWithError() and _PySys_AddWarnOptionWithError() functions private again. They are no longer needed to initialize Python: _PySys_EndInit() is now responsible to add these options instead. Moreover, PySys_AddWarnOptionUnicode() now clears the exception on failure if possible.
* bpo-34523: Fix config_init_fs_encoding() for ASCII (GH-10232)Victor Stinner2018-10-301-20/+22
| | | | | | | * bpo-34523, bpo-34403: Fix config_init_fs_encoding(): it now uses ASCII if _Py_GetForceASCII() is true. * Fix a regression of commit b2457efc78b74a1d6d1b77d11a939e886b8a4e2c. * Fix also a memory leak: get_locale_encoding() already allocates memory, no need to duplicate the string.
* bpo-33237: Improve AttributeError message for partially initialized module. ↵Serhiy Storchaka2018-10-301-21/+9
| | | | (GH-6398)
* bpo-34876: Change the lineno of the AST for decorated function and class. ↵Serhiy Storchaka2018-10-304-2489/+2496
| | | | | | | (GH-9731) It was overridden by the lineno of the first decorator. Now it is the lineno of 'def' or 'class'.
* bpo-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)Serhiy Storchaka2018-10-292-1789/+1750
| | | | | | Modules imported last are now cleared first at interpreter shutdown. A newly imported module is moved to the end of sys.modules, behind modules on which it depends.
* bpo-35064 prefix smelly symbols that appear with COUNT_ALLOCS with _Py_ ↵Pablo Galindo2018-10-282-4/+4
| | | | | | | (GH-10152) Configuring python with ./configure --with-pydebug CFLAGS="-D COUNT_ALLOCS -O0" makes "make smelly" fail as some symbols were being exported without the "Py_" or "_Py" prefixes.
* bpo-35024: Remove redundant and possibly incorrect verbose message after ↵Quentin Agren2018-10-261-1345/+1343
| | | | | | | | | writing '.pyc' (GH-9998) Since `SourceFileLoader.set_data()` catches exceptions raised by `_write_atomic()` and logs an informative message consequently, always logging successful outcome in 'SourceLoader.get_code()' seems redundant. https://bugs.python.org/issue35024
* importlib: Fix typo in SourceLoader.path_stats docstring (GH-10052)Quentin2018-10-251-1497/+1496
|
* bpo-35029: Replace the SyntaxWarning exception with a SyntaxError. (GH-9999)Serhiy Storchaka2018-10-211-11/+31
| | | | If SyntaxWarning was raised as an exception, it will be replaced with a SyntaxError for better error reporting.
* Fix typos in comments (GH-9905)Quan Tian2018-10-192-3/+3
|
* bpo-32912: Replace a DeprecationWarning with a SyntaxWarning (GH-9652)Serhiy Storchaka2018-10-191-3/+3
| | | | for invalid escape sequences in string and bytes literals.
* bpo-24658: Fix read/write greater than 2 GiB on macOS (GH-1705)Stéphane Wirtel2018-10-171-19/+5
| | | On macOS, fix reading from and writing into a file with a size larger than 2 GiB.
* bpo-34939: Allow annotated global names in module namespace (GH-9844)Pablo Galindo2018-10-141-0/+1
| | | | | | | Allow annotated global names in the module namespace after the symbol is declared as global. Previously, only symbols annotated before they are declared as global (i.e. inside a function) were allowed. This change allows symbols to be declared as global before the annotation happens in the global scope.
* Fix an incorrect check in compiler_try_except(). (GH-9810)Zackery Spytz2018-10-121-1/+2
|
* Fix a possible decref of a borrowed reference in symtable.c. (GH-9786)Zackery Spytz2018-10-111-2/+4
|
* closes bpo-34868: Improve error message with '_' is combined with an invalid ↵Benjamin Peterson2018-10-021-8/+9
| | | | type specifier. (GH-9666)
* bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645)Serhiy Storchaka2018-09-301-4/+7
| | | | | | | | | | * Compiling a string annotation containing a lambda with keyword-only argument without default value caused a crash. * Remove the final "*" (it is incorrect syntax) in the representation of lambda without *args and keyword-only arguments when compile from AST. * Improve the representation of lambda without arguments.
* bpo-31370: Remove references to threadless builds (#8805)Zackery Spytz2018-09-291-5/+1
| | | Support for threadless builds was removed in a6a4dc81.
* bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)Serhiy Storchaka2018-09-276-493/+55
|
* bpo-5950: Support reading zips with comments in zipimport (#9548)Zackery Spytz2018-09-251-1006/+1034
| | | * bpo-5950: Support reading zips with comments in zipimport
* bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)Ammar Askar2018-09-244-11/+11
| | | | | | Also point to start of tokens in parsing errors. Fixes bpo-34683
* bpo-32117: Allow tuple unpacking in return and yield statements (gh-4509)David Cuthbert2018-09-221-3/+3
| | | | | Iterable unpacking is now allowed without parentheses in yield and return statements, e.g. ``yield 1, 2, 3, *rest``. Thanks to David Cuthbert for the change and jChapman for added tests.
* bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473)Yury Selivanov2018-09-211-23/+62
|
* Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" ↵Victor Stinner2018-09-192-90/+41
| | | | | | | | | | | | | | | | (GH-9430) * Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" This reverts commit dbdee0073cf0b88fe541980ace1f650900f455cc. * Revert "bpo-34589: C locale coercion off by default (GH-9073)" This reverts commit 7a0791b6992d420dc52536257f2f093851ed7215. * Revert "bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)" This reverts commit 188ebfa475a6f6aa2d0ea14ca8e1fbe7865b6d27.
* bpo-34125: Enable profiling of method_descriptor in all cases (GH-8416)jdemeyer2018-09-191-3/+27
| | | | | | `list.append([], None)` was profiled but `list.append([], None, **{})` was not profiled. Enable profiling for later case. https://bugs.python.org/issue34125
* bpo-25711: Move _ZipImportResourceReader from importlib to zipimport. (GH-9406)Serhiy Storchaka2018-09-191-866/+986
|
* bpo-25711: Rewrite zipimport in pure Python. (GH-6809)Serhiy Storchaka2018-09-185-1352/+2265
|
* bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610)Serhiy Storchaka2018-09-181-0/+6
| | | | Add C API function PyCompile_OpcodeStackEffectWithJump().
* bpo-34589: Add -X coerce_c_locale command line option (GH-9378)Victor Stinner2018-09-181-35/+79
| | | | Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538).
* bpo-34589: C locale coercion off by default (GH-9073)Victor Stinner2018-09-171-1/+6
| | | | | | | | | Py_Initialize() and Py_Main() cannot enable the C locale coercion (PEP 538) anymore: it is always disabled. It can now only be enabled by the Python program ("python3). test_embed: get_filesystem_encoding() doesn't have to set PYTHONUTF8 nor PYTHONCOERCECLOCALE, these variables are already set in the parent.
* bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)Victor Stinner2018-09-172-14/+14
| | | | | | | | _PyCoreConfig: * Rename coerce_c_locale to _coerce_c_locale * Rename coerce_c_locale_warn to _coerce_c_locale_warn These fields are now private (name prefixed by "_").