summaryrefslogtreecommitdiff
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* Drop confusing commented out code in pystrtod.c (GH-6072) (GH-9586)Victor Stinner2018-09-261-2/+0
| | | | | | | | | Fix the following warning: Python/pystrtod.c: In function 'format_float_short': Python/pystrtod.c:1007:13: warning: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] strncpy(p, "ERR", 3); (cherry picked from commit 9fb84157595a385f15799e5d0729c1e1b0ba9d38)
* bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473)Miss Islington (bot)2018-09-211-23/+62
| | | | | (cherry picked from commit 2ec872b31e25cee1f983fe07991fb53f3fd1cbac) Co-authored-by: Yury Selivanov <yury@magic.io>
* Revert "[3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion ↵Victor Stinner2018-09-191-2/+2
| | | | | off by default (GH-9379)" (GH-9416) This reverts commit 144f1e2c6f4a24bd288c045986842c65cc289684.
* [3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion off by ↵Victor Stinner2018-09-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default (GH-9379) * bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371) _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 "_"). (cherry picked from commit 188ebfa475a6f6aa2d0ea14ca8e1fbe7865b6d27) * bpo-34589: C locale coercion off by default (GH-9073) 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. (cherry picked from commit 7a0791b6992d420dc52536257f2f093851ed7215) * bpo-34589: Add -X coerce_c_locale command line option (GH-9378) Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538). (cherry picked from commit dbdee0073cf0b88fe541980ace1f650900f455cc)
* Make sure the line comes from the same node as the col offset. (GH-9189)Miss Islington (bot)2018-09-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to 90fc8980bbcc5c7dcced3627fe172b0bfd193a3b. <!-- Thanks for your contribution! Please read this comment in its entirety. It's quite important. GH- 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. GH- 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`. --> (cherry picked from commit d13e59c1b512069d90efe7ee9b613d3913e79c56) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* closes bpo-31902: Fix the col_offset attribute for ast.Async* nodes to point ↵Miss Islington (bot)2018-09-111-18/+21
| | | | | | | | to the "async" keyword. (GH-4175) Previously, col_offset points to the keyword after "async". (cherry picked from commit 90fc8980bbcc5c7dcced3627fe172b0bfd193a3b) Co-authored-by: guoci <zguoci@gmail.com>
* bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)Miss Islington (bot)2018-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. (cherry picked from commit d545869d084e70d4838310e79b52a25a72a1ca56) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* _Py_CoerceLegacyLocale() restores LC_CTYPE on fail (GH-9044) (GH-9046)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. (cherry picked from commit 8ea09110d413829f71d979d8c7073008cb87fb03)
* [3.7] bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986) (GH-8987)Victor Stinner2018-08-291-12/+34
| | | | | | | | | | | | | | | * bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986) 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. Fix the error handler of standard streams like sys.stdout: PYTHONIOENCODING=":" is now ignored instead of setting the error handler to "strict". (cherry picked from commit 315877dc361d554bec34b4b62c270479ad36a1be)
* bpo-34485: Fix _Py_InitializeCore() for C locale coercion (GH-8979) (GH-8981)Victor Stinner2018-08-291-4/+6
| | | | | | | | | | * _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. (cherry picked from commit 2c8ddcf4f14f3e4c87a6fe6678ab5ad09130c6ab)
* bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972) (GH-8974)Victor Stinner2018-08-281-1/+1
| | | | | | | | | | | | * 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. (cherry picked from commit 5cb258950ce9b69b1f65646431c464c0c17b1510)
* bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)Miss Islington (bot)2018-08-261-0/+1
| | | | | (cherry picked from commit a2eefa67542c25617a58c03a27c17fd48e2a0856) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in ↵Miss Islington (bot)2018-08-241-0/+5
| | | | | | | | builtin_sum_impl() (GH-8872) Reported by Svace static analyzer. (cherry picked from commit 2b824b2538c4a5f9f520c5de8a1eae5a0c181a94) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). ↵Miss Islington (bot)2018-08-221-0/+2
| | | | | | | | (GH-8852) Reported by Svace static analyzer. (cherry picked from commit 28853a249b1d0c890b7e9ca345290bb8c1756446) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* [3.7] bpo-34247: Fix Python 3.7 initialization (#8659)Victor Stinner2018-08-051-46/+110
| | | | | | | | | | | | | | | | | * -X dev: it is now possible to override the memory allocator using PYTHONMALLOC even if the developer mode is enabled. * Add _Py_InitializeFromConfig() * Add _Py_Initialize_ReadEnvVars() to set global configuration variables from environment variables * Fix the code to initialize Python: Py_Initialize() now also reads environment variables * _Py_InitializeCore() can now be called twice: the second call only replaces the configuration. * Write unit tests on Py_Initialize() and the different ways to configure Python * The isolated mode now always sets Py_IgnoreEnvironmentFlag and Py_NoUserSiteDirectory to 1. * pymain_read_conf() now saves/restores the configuration if the encoding changed
* bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. ↵Miss Islington (bot)2018-07-241-0/+4
| | | | | | | (GH-8262) (GH-8423) (cherry picked from commit aba24ff3601ddc86b85e01880a8be596fb799287) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34190: Fix reference leak in call_function() (GH-8413) (GH-8418)Miss Islington (bot)2018-07-231-5/+8
| | | | | (cherry picked from commit 147d95511f59cfdd2d522f9d736f2335457bae20) Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>
* bpo-34126: Fix crashes while profiling invalid calls. (GH-8300) (GH-8371)Miss Islington (bot)2018-07-211-4/+10
| | | | | (cherry picked from commit 56868f940e0cc0b35d33c0070107ff3bed2d8766) Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>
* bpo-34008: Allow to call Py_Main() after Py_Initialize() (GH-8043) (GH-8352)Miss Islington (bot)2018-07-211-3/+20
| | | | | | | | Py_Main() can again be called after Py_Initialize(), as in Python 3.6. The new configuration is ignored, except of _PyMainInterpreterConfig.argv which is used to update sys.argv. (cherry picked from commit fb47bca9ee2d07ce96df94b4e4abafd11826eb01) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-34087: Fix buffer overflow in int(s) and similar functions (GH-8274)Miss Islington (bot)2018-07-131-0/+2
| | | | | | | | | `_PyUnicode_TransformDecimalAndSpaceToASCII()` missed trailing NUL char. It caused buffer overflow in `_Py_string_to_number_with_underscores()`. This bug is introduced in 9b6c60cb. (cherry picked from commit 16dfca4d829e45f36e71bf43f83226659ce49315) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-34080: Fix a memory leak in the compiler. (GH-8222)Miss Islington (bot)2018-07-111-1/+1
| | | | | (cherry picked from commit 993030aac576710a46b3dd0b4864f819d4a94145) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-23927: Make getargs.c skipitem() skipping 'w*'. (GH-8192)Miss Islington (bot)2018-07-111-1/+3
| | | | | (cherry picked from commit 504373c59b48f1ea12132d515459022730db6047) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-22689: Copy the result of getenv() in sys_breakpointhook(). (GH-8194)Miss Islington (bot)2018-07-091-1/+14
| | | | | (cherry picked from commit f60bf0e168255b7675a4c049250ba6b202f8e647) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34066: Disabled interruption before SETUP_WITH and BEFORE_ASYNC_WITH. ↵Miss Islington (bot)2018-07-091-4/+11
| | | | | | | | | | (GH-8159) This will prevent emitting a resource warning when the execution was interrupted by Ctrl-C between calling open() and entering a 'with' block in "with open()". (cherry picked from commit 3f4d90d4d72921f16babd3f52d7df804916af224) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix GCC warning in Python/hamt.c (GH-7618)Miss Islington (bot)2018-07-061-1/+1
| | | | | (cherry picked from commit d8c3e820b4fcdc45b80ba47f615c95e99e2e931b) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-24596: Decref module in PyRun_SimpleFileExFlags() on SystemExit ↵Miss Islington (bot)2018-07-031-1/+2
| | | | | | | | | (GH-7918) (GH-8070) PyErr_Print() will not return when the exception is a SystemExit, so decref the __main__ module object in that case. (cherry picked from commit d8cba5d16f1333fd625726fc72e66afbd45b8d00) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-33985: Implement ContextVar.name attribute. (GH-7980)Miss Islington (bot)2018-06-281-0/+5
| | | | | (cherry picked from commit 41cb0baea96a80360971908a0bd79d9d40dd5e44) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33451: Close pyc files before calling PyEval_EvalCode() (GH-7884)Miss Islington (bot)2018-06-231-6/+9
| | | | | | Directly executed pyc files were being kept open longer than necessary. (cherry picked from commit ea737751b10fff752aafed0231e8a02b82ba365d) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-33932: Calling Py_Initialize() twice does nothing (GH-7845)Miss Islington (bot)2018-06-221-0/+5
| | | | | | | Calling Py_Initialize() twice does nothing, instead of failing with a fatal error: restore the Python 3.6 behaviour. (cherry picked from commit 209abf746985526bce255e2fba97d3246924885d) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33803: Fix a crash in hamt.c (GH-7504) (GH-7505)Miss Islington (bot)2018-06-071-0/+2
| | | | | (cherry picked from commit 378c53cc3187dba57c7560ccc2557f516c8a7bc8) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33720: Reduces maximum marshal recursion depth on release builds. (GH-7401)Miss Islington (bot)2018-06-041-1/+7
| | | | | (cherry picked from commit 2a4a62ba4ae770bbc7b7fdec0760031c83fe1f7b) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* bpo-31849: Fix warning in pyhash.c (GH-6799)Miss Islington (bot)2018-06-041-2/+2
| | | | | (cherry picked from commit a8eb58546b37a7cd5f332f019bb07388f5212c2d) Co-authored-by: A. Jesse Jiryu Davis <jesse@emptysquare.net>
* bpo-33677: Fix signatures of tp_clear handlers for AST and deque. (GH-7196)Miss Islington (bot)2018-05-301-1/+2
| | | | | (cherry picked from commit a5c42284e69fb309bdd17ee8c1c120d1be383012) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-32911: Revert bpo-29463. (GH-7121)Serhiy Storchaka2018-05-297-3266/+3220
| | | | | | | Remove the docstring attribute of AST types and restore docstring expression as a first stmt in their body. Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-33612: Remove PyThreadState_Clear() assertion (GH-7069) (GH-7074)Miss Islington (bot)2018-05-231-1/+0
| | | | | | | | bpo-25612, bpo-33612: Remove an assertion from PyThreadState_Clear() which failed at Python shutdown or on fork if a thread was running a generator. (cherry picked from commit b6dccf54fd3bac9c87348d96f9d6b571608c15bc) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* [3.7] bpo-33475: Fix and improve converting annotations to strings. ↵Serhiy Storchaka2018-05-202-537/+291
| | | | | | | (GH-6774). (GH-6927) (cherry picked from commit 64fddc423fcbe90b8088446c63385ec0aaf3077c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33509: Fix _warnings for module_globals=None (GH-6833)Miss Islington (bot)2018-05-151-1/+8
| | | | | | Don't crash on warnings.warn_explicit() if module_globals is not a dict. (cherry picked from commit b056562860c227bad2e0ba7cd3130e115c007768) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-32604: Remove xid registry. (#6813)Eric Snow2018-05-151-258/+0
| | | Remove the interpreters testing helper (and xid registry).
* bpo-28055: Fix unaligned accesses in siphash24(). (GH-6123)Miss Islington (bot)2018-05-131-13/+13
| | | | | | | | | | The hash implementation casts the input pointer to uint64_t* and directly reads from this, which may cause unaligned accesses. Use memcpy() instead so this code will not crash with SIGBUS on sparc. https://bugs.gentoo.org/show_bug.cgi?id=636400 (cherry picked from commit 1e2ec8a996daec65d8d5a3d43b66a9909c6d0653) Co-authored-by: Rolf Eike Beer <eike@sf-mail.de>
* [3.7] bpo-33363: raise SyntaxError for async for/with outside async ↵Zsolt Dollenstein2018-04-271-0/+7
| | | | functions (GH-6616). (GH-6619)
* bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564)Miss Islington (bot)2018-04-251-9/+24
| | | | | (cherry picked from commit e9d9494d6b2a5e0c2d48d22c7f0d5e95504b4f7e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33128 Fix duplicated call to importlib._install_external_importers ↵Miss Islington (bot)2018-04-241-5/+0
| | | | | | | | | | | | (GH-6273) External importers were being added in both phases of the import system initialisation. They're only supposed to be added in the second phase, after the import machinery has been appropriately configured. (cherry picked from commit 0977091dca59709864b14cfc129388f1f0de7bf7) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Spelling fixes to docs, docstrings, and comments (GH-6374)Miss Islington (bot)2018-04-202-3/+3
| | | | | (cherry picked from commit 61f82e0e337f971da57f8f513abfe693edf95aa5) Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
* [3.7] bpo-33169: Remove values of `None` from sys.path_importer_cache when ↵Brett Cannon2018-04-061-611/+614
| | | | | | invalidating caches (GH-6402) (GH-6403) An entry of None in sys.path_importer_cache represents a negative/missing finder for a path, so clearing it out makes sense. (cherry picked from commit 9e2be60634914f23db2ae5624e4acc9335bf5fea)
* [3.7] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6399)Miss Islington (bot)2018-04-061-1/+1
| | | | | (cherry picked from commit 3a9ccee0e5dbf7d67f5ab79f6095755969db117c) Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
* bpo-33231: Fix potential leak in normalizestring() (GH-6386)Miss Islington (bot)2018-04-061-2/+0
| | | | | (cherry picked from commit 0c1c4563a65ac451021d927058e4f25013934eb2) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-29922: Improve error messages in 'async with' (GH-6352)Miss Islington (bot)2018-04-041-0/+25
| | | | | | when __aenter__() or __aexit__() return non-awaitable object. (cherry picked from commit a68f2f0578bbf812fa2264d0e0bb388340d6e230) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33132: Fix more reference counting issues in the compiler. (GH-6323)Miss Islington (bot)2018-03-311-4/+2
| | | | | (cherry picked from commit aa8e51f5ebb2a71c76059f050de01fc3c985376a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33053: -m now adds *starting* directory to sys.path (GH-6231) (#6236)Nick Coghlan2018-03-251-9/+21
| | | | | | | | | | | | | | Historically, -m added the empty string as sys.path zero, meaning it resolved imports against the current working directory, the same way -c and the interactive prompt do. This changes the sys.path initialisation to add the *starting* working directory as sys.path[0] instead, such that changes to the working directory while the program is running will have no effect on imports when using the -m switch. (cherry picked from commit d5d9e02dd3c6df06a8dd9ce75ee9b52976420a8b)
* bpo-33042: Fix pre-initialization sys module configuration (GH-6157)Miss Islington (bot)2018-03-251-0/+162
| | | | | | | | | | | - new test case for pre-initialization of sys.warnoptions and sys._xoptions - restored ability to call these APIs prior to Py_Initialize - updated the docs for the affected APIs to make it clear they can be called before Py_Initialize - also enhanced the existing embedding test cases to check for expected settings in the sys module (cherry picked from commit bc77eff8b96be4f035e665ab35c1d06e22f46491) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>