summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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 "_").
* bpo-12458: Fix line numbers for multiline expressions. (GH-8774)Serhiy Storchaka2018-09-173-3699/+3724
|
* closes bpo-34673: Tweaks to make ceval more editable. (GH-9289)Benjamin Peterson2018-09-171-136/+136
| | | | | Two major changes: - Move case statements out of the TARGET macro. - Move PREDICT macro invocations after the case label.
* bpo-34651: Only allow the main interpreter to fork. (gh-9279)Eric Snow2018-09-141-0/+38
| | | | | When os.fork() is called (on platforms that support it) all threads but the current one are destroyed in the child process. Consequently we must ensure that all but the associated interpreter are likewise destroyed. The main interpreter is critical for runtime operation, so we must ensure that fork only happens in the main interpreter. https://bugs.python.org/issue34651
* bpo-34653: Removed unused function PyParser_SimpleParseStringFilename. (GH-9260)Eric V. Smith2018-09-131-6/+0
| | | | | | This function was not in any .h file and was not used by Python, so removing it is safe. https://bugs.python.org/issue34653
* closes bpo-34641: Further restrict the LHS of keyword argument function call ↵Benjamin Peterson2018-09-131-14/+41
| | | | syntax. (GH-9212)
* closes bpo-34646: Remove PyAPI_* macros from declarations. (GH-9218)Benjamin Peterson2018-09-127-24/+26
|
* bpo-34637: Make the *start* argument for *sum()* visible as a keyword ↵Raymond Hettinger2018-09-122-8/+9
| | | | argument. (GH-9208)
* Make sure the line comes from the same node as the col offset. (GH-9189)Benjamin Peterson2018-09-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to 90fc8980bbcc5c7dcced3627fe172b0bfd193a3b. <!-- Thanks for your contribution! Please read this comment in its entirety. It's quite important. # Pull Request title It should be in the following format: ``` bpo-NNNN: Summary of the changes made ``` Where: bpo-NNNN refers to the issue number in the https://bugs.python.org. Most PRs will require an issue number. Trivial changes, like fixing a typo, do not need an issue. # Backport Pull Request title If this is a backport PR (PR made against branches other than `master`), please ensure that the PR title is in the following format: ``` [X.Y] <title from the original PR> (GH-NNNN) ``` Where: [X.Y] is the branch name, e.g. [3.6]. GH-NNNN refers to the PR number from `master`. -->
* Initialize a variable to make the compiler happy. (GH-9153)Benjamin Peterson2018-09-111-1/+1
| | | | | | | | | | | GCC complains: Python/pylifecycle.c: In function ‘_Py_InitializeFromConfig’: Python/pylifecycle.c:900:13: warning: ‘interp’ may be used uninitialized in this function [-Wmaybe-uninitialized] err = _Py_InitializeMainInterpreter(interp, &main_config); ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This seems spurious since &interp is passed to _Py_InitializeCore. Anyway, we can easily initialize to quiet the warning.
* closes bpo-31902: Fix the col_offset attribute for ast.Async* nodes to point ↵guoci2018-09-111-18/+21
| | | | | | to the "async" keyword. (GH-4175) Previously, col_offset points to the keyword after "async".
* bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)Benjamin Peterson2018-09-101-14/+16
| | | | | | | | The recursive frame pruning code always undercounted the number of elided frames by one. That is, in the "[Previous line repeated N more times]" message, N would always be one too few. Near the recursive pruning cutoff, one frame could be silently dropped. That situation is demonstrated in the OP of the bug report. The fix is to start the identical frame counter at 1.
* _Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044)Victor Stinner2018-09-031-1/+13
| | | | bpo-34544: If _Py_CoerceLegacyLocale() fails to coerce the C locale, restore the LC_CTYPE locale to the its previous value.