summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* bpo-34408: Prevent a null pointer dereference and resource leakage in ↵Pablo Galindo2018-08-311-6/+10
| | | | | | | `PyInterpreterState_New()` (GH-8767) * A pointer in `PyInterpreterState_New()` could have been `NULL` when being dereferenced. * Memory was leaked in `PyInterpreterState_New()` when taking some error-handling code path.
* bpo-34523: Use _PyCoreConfig instead of globals (GH-9005)Victor Stinner2018-08-293-28/+34
| | | | | Use the core configuration of the interpreter, rather than using global configuration variables. For example, replace Py_QuietFlag with core_config->quiet.
* bpo-34523: Py_FileSystemDefaultEncoding NULL by default (GH-9003)Victor Stinner2018-08-291-18/+6
| | | | | | | | * Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors default value is now NULL: initfsencoding() set them during Python initialization. * Document how Python chooses the filesystem encoding and error handler. * Add an assertion to _PyCoreConfig_Read().
* bpo-34485: Emit C locale coercion warning later (GH-9002)Victor Stinner2018-08-291-8/+7
| | | | PYTHONCOERCELOCALE=warn warning is now emitted later and written into sys.stderr, rather than being written into the C stderr stream.
* bpo-34523: Support surrogatepass in locale codecs (GH-8995)Victor Stinner2018-08-291-25/+87
| | | | | | | | | | | | | | | | | | | | Add support for the "surrogatepass" error handler in PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault() for the UTF-8 encoding. Changes: * _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the surrogatepass error handler (_Py_ERROR_SURROGATEPASS). * _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use the _Py_error_handler enum instead of "int surrogateescape" to pass the error handler. These functions now return -3 if the error handler is unknown. * Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() in test_codecs. * Rename get_error_handler() to _Py_GetErrorHandler() and expose it as a private function. * _freeze_importlib doesn't need config.filesystem_errors="strict" workaround anymore.
* bpo-34523: Py_DecodeLocale() use UTF-8 on Windows (GH-8998)Victor Stinner2018-08-291-4/+12
| | | | | | | Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding on Windows if Py_LegacyWindowsFSEncodingFlag is zero. pymain_read_conf() now sets Py_LegacyWindowsFSEncodingFlag in its loop, but restore its value at exit.
* bpo-34523: Fix config_init_fs_encoding() (GH-8991)Victor Stinner2018-08-291-1/+1
| | | | Call config_init_fs_encoding() if filesystem_errors is not NULL but filesystem_encoding is NULL.
* bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)Victor Stinner2018-08-293-71/+196
| | | | | | | | | | | | | | | | | | | | | | | _PyCoreConfig_Read() is now responsible to choose the filesystem encoding and error handler. Using Py_Main(), the encoding is now chosen even before calling Py_Initialize(). _PyCoreConfig.filesystem_encoding is now the reference, instead of Py_FileSystemDefaultEncoding, for the Python filesystem encoding. Changes: * Add filesystem_encoding and filesystem_errors to _PyCoreConfig * _PyCoreConfig_Read() now reads the locale encoding for the file system encoding. * PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize() now use the interpreter configuration rather than Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors global configuration variables. * Add _Py_SetFileSystemEncoding() and _Py_ClearFileSystemEncoding() private functions to only modify Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors in coreconfig.c. * _Py_CoerceLegacyLocale() now takes an int rather than _PyCoreConfig for the warning.
* bpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881)Victor Stinner2018-08-292-132/+209
| | | | * Add stdio_encoding and stdio_errors fields to _PyCoreConfig. * Add unit tests on stdio_encoding and stdio_errors.
* bpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)Victor Stinner2018-08-291-4/+6
| | | | | | | | | | | | | | On Windows, the LC_CTYPE is now set to the user preferred locale at startup: _Py_SetLocaleFromEnv(LC_CTYPE) is now called during the Python initialization. Previously, the LC_CTYPE locale was "C" at startup, but changed when calling setlocale(LC_CTYPE, "") or setlocale(LC_ALL, ""). pymain_read_conf() now also calls _Py_SetLocaleFromEnv(LC_CTYPE) to behave as _Py_InitializeCore(). Moreover, it doesn't save/restore the LC_ALL anymore. On Windows, standard streams like sys.stdout now always use surrogateescape error handler by default (ignore the locale).
* bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986)Victor Stinner2018-08-291-9/+22
| | | | | | | Standard streams like sys.stdout now use the "surrogateescape" error handler, instead of "strict", on the POSIX locale (when the C locale is not coerced and the UTF-8 Mode is disabled). Add tests on sys.stdout.errors with LC_ALL=POSIX.
* bpo-34485: Add _Py_ClearStandardStreamEncoding() (GH-8982)Victor Stinner2018-08-282-96/+104
| | | | | | | | | | * Move Py_SetStandardStreamEncoding() from pylifecycle.c to coreconfig.c * Add _Py_ClearStandardStreamEncoding() private function. * pymain_free() now calls _Py_ClearStandardStreamEncoding(). * Add assertions add the end of _PyCoreConfig_Read() * _PyCoreConfig_Copy(): rename COPY_STR_ATTR() macro to COPY_WSTR_ATTR(). * Fix get_stdio_errors() indentation.
* bpo-34485: Fix _Py_InitializeCore() for C locale coercion (GH-8979)Victor Stinner2018-08-282-12/+16
| | | | | | | | * _Py_InitializeCore() now sets the LC_CTYPE locale to the user preferred locale before checking if the C locale should be coerced or not in _PyCoreConfig_Read(). * Fix pymain_read_conf(): remember if the C locale has been coerced when the configuration should be read again if the encoding has changed.
* bpo-34485: Enhance init_sys_streams() (GH-8978)Victor Stinner2018-08-281-23/+63
| | | | | | | | | | | | | | | Python now gets the locale encoding with C code to initialize the encoding of standard streams like sys.stdout. Moreover, the encoding is now initialized to the Python codec name to get a normalized encoding name and to ensure that the codec is loaded. The change avoids importing _bootlocale and _locale modules at startup by default. When the PYTHONIOENCODING environment variable only contains an encoding, the error handler is now is now set explicitly to "strict". Rename also get_default_standard_stream_error_handler() to get_stdio_errors(). Reduce the buffer to format the "cpXXX" string (Windows locale encoding).
* bpo-34403: On HP-UX, force ASCII for C locale (GH-8969)Victor Stinner2018-08-283-52/+97
| | | | | | | | On HP-UX with C or POSIX locale, sys.getfilesystemencoding() now returns "ascii" instead of "roman8" (when the UTF-8 Mode is disabled and the C locale is not coerced). nl_langinfo(CODESET) announces "roman8" whereas it uses the Latin1 encoding in practice.
* bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972)Victor Stinner2018-08-282-5/+13
| | | | | | | | | | * The UTF-8 Mode is now also enabled by the "POSIX" locale, not only by the "C" locale. * On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if the LC_CTYPE locale is "C". * test_utf8_mode.test_cmd_line() checks also that the command line arguments are decoded from UTF-8 when the the UTF-8 Mode is enabled with POSIX locale or C locale.
* bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)Alexey Izbyshev2018-08-261-0/+1
|
* bpo-34492: Python/coreconfig.c: Fix _Py_wstrlist_copy() (GH-8910)Alexey Izbyshev2018-08-241-1/+4
| | | | | | | bpo-34492: Python/coreconfig.c: Add missing NULL check to _Py_wstrlist_copy(). Fix _Py_wstrlist_clear() call on a wrong list. Reported by Svace static analyzer.
* closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in ↵Alexey Izbyshev2018-08-241-0/+5
| | | | | builtin_sum_impl() (GH-8872) Reported by Svace static analyzer.
* bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). ↵Alexey Izbyshev2018-08-221-0/+2
| | | | | (GH-8852) Reported by Svace static analyzer.
* bpo-34170: _PyCoreConfig_Read() don't replace coerce_c_locale (GH-8658)Victor Stinner2018-08-032-17/+17
| | | | If coerce_c_locale is already set (>= 0), use its value: don't override it.
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-0310-67/+75
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.