summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* [3.8] bpo-39427: Document -X opt options in the CLI --help and the man page ↵Pablo Galindo2020-02-231-1/+32
| | | | | | | | | | (GH-18131) (GH-18133) https://bugs.python.org/issue39427 Automerge-Triggered-By: @pablogsal (cherry picked from commit 41f0ef6abbd304409c55612a08788cdd59fbc8a3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.8] closes bpo-39630: Update pointers to string literals to be const char ↵Benjamin Peterson2020-02-142-2/+2
| | | | | | | | *. (GH-18511) (cherry picked from commit 7386a70746cf9aaf2d95db75d9201fb124f085df) Co-authored-by: Andy Lester <andy@petdance.com>
* bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)Miss Islington (bot)2020-02-121-18/+18
| | | | | (cherry picked from commit 6e619c48b8e804ece9521453fc8da0640a04d5b1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Miss Islington (bot)2020-02-122-2/+2
| | | | | | | | | | | | | | | | | | gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts (cherry picked from commit e6be9b59a911626d6597fe148c32f0342bd2bd24) Co-authored-by: Andy Lester <andy@petdance.com>
* [3.8] bpo-39579: Fix Attribute end_col_offset to point at the current node ↵Lysandros Nikolaou2020-02-081-2/+3
| | | | | | | | | | | | | | | (GH-18405) (GH-18408) (cherry picked from commit d2e1098641f98594702ef29049c3c4a3f394786f) https://bugs.python.org/issue39579 Automerge-Triggered-By: @gvanrossum
* Fix compiler warning on Windows (GH-18012)Miss Islington (bot)2020-01-151-1/+1
| | | | | | | | | | | Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be811fa7d an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning. (cherry picked from commit e92d39303feb1d3b4194c6a8275b1fc63b2153b2) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* [3.8] bpo-39033: Fix NameError in zipimport during hash validation ↵Karthikeyan Singaravelan2020-01-141-271/+269
| | | | | | | | | | | (GH-17588) (GH-17642) Fix `NameError` in `zipimport` during hash validation and add a regression test. (cherry picked from commit 79f02fee1a542c440fd906fd54154c73fc0f8235) https://bugs.python.org/issue39033
* bpo-39235: Fix end location for genexp in call args (GH-17925)Miss Islington (bot)2020-01-091-8/+8
| | | | | | | | The fix changes copy_location() to require an extra node from which to extract the end location, and fixing all 5 call sites. https://bugs.python.org/issue39235 (cherry picked from commit a796d8ef9dd1af65f7e4d7a857b56f35b7cb6e78) Co-authored-by: Guido van Rossum <guido@python.org>
* bpo-29778: Fix incorrect NULL check in _PyPathConfig_InitDLLPath() (GH-17818)Miss Islington (bot)2020-01-061-1/+1
| | | | | (cherry picked from commit 7b79dc9200a19ecbac667111dffd58e314be02a8) Co-authored-by: Anthony Wee <awee@box.com>
* Fix constant folding optimization for positional only arguments (GH-17837)Miss Islington (bot)2020-01-051-0/+1
| | | | | (cherry picked from commit b121a4a45ff4bab8812a9b26ceffe5ad642f5d5a) Co-authored-by: Anthony Sottile <asottile@umich.edu>
* Fix SystemError when nested function has annotation on positional-only ↵Miss Islington (bot)2020-01-051-0/+2
| | | | | | | argument (GH-17826) (cherry picked from commit ec007cb43faf5f33d06efbc28152c7fdcb2edb9c) Co-authored-by: Anthony Sottile <asottile@umich.edu>
* Bring Python into the next decade. (GH-17801)Miss Islington (bot)2020-01-031-1/+1
| | | | | (cherry picked from commit 946b29ea0b3b386ed05e87e60b8617c9dc19cd53) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-39176: Improve error message for 'named assignment' (GH-17777) (GH-17778)Miss Islington (bot)2020-01-011-1/+1
| | | | | | | | (cherry picked from commit 37143a8e3b2e9245d52f4ddebbdd1c6121c96884) Co-authored-by: Ned Batchelder <ned@nedbatchelder.com> Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* closes bpo-37446: resolve undefined behavior in Python/hamt.c (GH-17727)Miss Islington (bot)2019-12-311-1/+1
| | | | | (cherry picked from commit d0c92e81aa2171228a23cb2bed36f7dab975257d) Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
* [3.8] bpo-39080: Starred Expression's column offset fix when inside a CALL ↵Pablo Galindo2019-12-181-1/+1
| | | | | | | | | | | | | | | (GH-17645) (GH-17649) … Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 50d4f12958bf806a4e1a1021d70cfd5d448c5cba) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> https://bugs.python.org/issue39080
* The comment in ast_for_namedexpr shouldn't include if_stmt (GH-17586)Miss Islington (bot)2019-12-151-3/+1
| | | | | | Automerge-Triggered-By: @gvanrossum (cherry picked from commit b08d3f71beab59653edfbbcf7b92a7bc8050d6b8) Co-authored-by: Guido van Rossum <guido@python.org>
* Fix elif start column offset when there is an else following (GH-17596) ↵Miss Islington (bot)2019-12-141-2/+2
| | | | | | | (GH-17600) (cherry picked from commit 5936a4ce914d42af97b9238e5090dedc8d5b0bd2) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* Add PYTHONUTF8 to commandline usage. (GH-17587)Miss Islington (bot)2019-12-141-0/+1
| | | | | | Co-Authored-By: Victor Stinner <vstinner@python.org> (cherry picked from commit 95826c773a9004fc5b3c89de55f800504685ab21) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-39031: Include elif keyword when producing lineno/col-offset info for ↵Miss Islington (bot)2019-12-131-2/+2
| | | | | | | | | | | | if_stmt (GH-17582) (GH-17589) When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node. https://bugs.python.org/issue39031 Automerge-Triggered-By: @pablogsal (cherry picked from commit 025a602af7ee284d8db6955c26016f3f27d35536) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-39008: Require Py_ssize_t for PySys_Audit formats rather than raise a ↵Miss Islington (bot)2019-12-091-1/+1
| | | | | | | deprecation warning (GH-17540) (cherry picked from commit b8cbe74c3498c617f0e73fd0cdc5c07f2c532092) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)Miss Islington (bot)2019-12-081-3/+4
| | | | | | | | | | now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. https://bugs.python.org/issue38979 Automerge-Triggered-By: @asvetlov (cherry picked from commit 28c91631c24e53713ad0e8a2bbae716373f5e53d) Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
* bpo-38920: Add audit hooks for when sys.excepthook and sys.unraisablehook ↵Steve Dower2019-11-283-33/+51
| | | | | are invoked (GH-17392) Also fixes some potential segfaults in unraisable hook handling.
* bpo-38823: Fix refleak in marshal init error path (GH-17260)Miss Islington (bot)2019-11-201-1/+4
| | | | | (cherry picked from commit 33b671e72450bf4b5a946ce0dde6b7fe21150108) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* closes bpo-37633: Reëxport some function compatibility wrappers for macros ↵Miss Islington (bot)2019-11-051-16/+16
| | | | | | | in ``pythonrun.h``. (GH-17056) (cherry picked from commit 62161ce989d7d4fe2b0e6899a54da20feeddc798) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-38640: Allow break and continue in always false while loops (GH-16992)Miss Skeleton (bot)2019-10-301-0/+8
| | | | | (cherry picked from commit 6c3e66a34b95fff07df0ad5086104dd637a091ce) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-38535: Fix positions for AST nodes for calls without arguments in ↵Miss Skeleton (bot)2019-10-261-2/+4
| | | | | | | decorators. (GH-16861) (cherry picked from commit 26ae9f6d3d755734c9f371b9356325afe5764813) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix typo in formatter_unicode (GH-16831)Miss Skeleton (bot)2019-10-251-1/+1
| | | | | | numbers's -> number's (cherry picked from commit 7320ec05f72fc27b25789fe76f8297644e7e7e0a) Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
* bpo-38540: Fix possible leak in PyArg_Parse for "esGH-" and "etGH-". (GH-16869)Miss Skeleton (bot)2019-10-211-2/+26
| | | | | (cherry picked from commit 5bc6a7c06eda20ba131ecba6752be0506d310181) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Typo fix - implemention should be implementation (GH-16806)Miss Islington (bot)2019-10-151-1/+1
| | | | | (cherry picked from commit 2798b60c55619d8981288b69c20ba4a09efc7b0b) Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
* bpo-38469: Handle named expression scope with global/nonlocal keywords ↵Miss Islington (bot)2019-10-141-3/+9
| | | | | | | | (GH-16755) (#16760) The symbol table handing of PEP572's assignment expressions is not resolving correctly the scope of some variables in presence of global/nonlocal keywords in conjunction with comprehensions. (cherry picked from commit fd5c414880b2e05720b9cf14ab0b0d7ae2b7d925) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Correct signature of __build_class__ (GH-16735)Miss Islington (bot)2019-10-131-1/+1
| | | | | (cherry picked from commit e3babbd03cd2bcb3c85deabae3bc6976aa95a3c3) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.8] Typo fix: "throuhgh" should be "through". (GH-16713)Benjamin Peterson2019-10-111-1/+1
| | | | | (cherry picked from commit a8e0d3141e271b3c0fbb7399a911f0c3aa567e30) Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
* bpo-38425: Fix ‘res’ may be used uninitialized warning (GH-16688)Miss Islington (bot)2019-10-101-1/+2
| | | | | (cherry picked from commit a05fcd3c7adf6e3a0944da8cf80a3346882e9b3b) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* Typo fix: "empy" should be "empty". (GH-16666)Miss Islington (bot)2019-10-091-1/+1
| | | | | (cherry picked from commit 01171ebd966b0cd6352057799ad876dd1e07942e) Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
* Fix typo in _warnings.warn_explicit() docstring (GH-16625)Miss Islington (bot)2019-10-081-1/+1
| | | | | (cherry picked from commit 5dfbb4d50333e7a91fc0cd8c03a2f2f2cf56dbd9) Co-authored-by: Hansraj Das <raj.das.136@gmail.com>
* bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)Miss Islington (bot)2019-10-015-54/+13
| | | | | | | PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no longer return PyStatus: they cannot fail anymore. (cherry picked from commit 8462a4936b3a551dc546a6adea04a70b0a07ca67) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-38304: Remove PyConfig.struct_size (GH-16500)Victor Stinner2019-09-306-114/+12
| | | | | For now, we'll rely on the fact that the config structures aren't covered by the stable ABI. We may revisit this in the future if we further explore the idea of offering a stable embedding API.
* bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)Miss Islington (bot)2019-09-293-45/+85
| | | | | | | | | | | | Fix warnings options priority: PyConfig.warnoptions has the highest priority, as stated in the PEP 587. * Document options order in PyConfig.warnoptions documentation. * Make PyWideStringList_INIT macro private: replace "Py" prefix with "_Py". * test_embed: add test_init_warnoptions(). (cherry picked from commit fb4ae152a9930f0e00cae8b2807f534058cf341a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-38304: Add PyConfig.struct_size (GH-16451) (GH-16453)Victor Stinner2019-09-286-28/+175
| | | | | | | | | | | | | | | | | | | Add a new struct_size field to PyPreConfig and PyConfig structures to allow to modify these structures in the future without breaking the backward compatibility. * Replace private _config_version field with public struct_size field in PyPreConfig and PyConfig. * Public PyPreConfig_InitIsolatedConfig() and PyPreConfig_InitPythonConfig() return type becomes PyStatus, instead of void. * Internal _PyConfig_InitCompatConfig(), _PyPreConfig_InitCompatConfig(), _PyPreConfig_InitFromConfig(), _PyPreConfig_InitFromPreConfig() return type becomes PyStatus, instead of void. * Remove _Py_CONFIG_VERSION * Update the Initialization Configuration documentation. (cherry picked from commit 441b10cf2855955c86565f8d59e72c2efc0f0a57)
* [3.8] bpo-38234: Backport init path config changes from master (GH-16423)Victor Stinner2019-09-262-18/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-38234: Py_SetPath() uses the program full path (GH-16357) Py_SetPath() now sets sys.executable to the program full path (Py_GetProgramFullPath()), rather than to the program name (Py_GetProgramName()). Fix also memory leaks in pathconfig_set_from_config(). (cherry picked from commit 1ce152a42eaa917d7763bce93f1e1ca72530d7ca) * bpo-38234: Add tests for Python init path config (GH-16358) (cherry picked from commit bb6bf7d342b4503a6227fd209fac934905b6a1aa) * bpo-38234: test_embed: test pyvenv.cfg and pybuilddir.txt (GH-16366) Add test_init_pybuilddir() and test_init_pyvenv_cfg() to test_embed to test pyvenv.cfg and pybuilddir.txt configuration files. Fix sysconfig._generate_posix_vars(): pybuilddir.txt uses UTF-8 encoding, not ASCII. (cherry picked from commit 52ad33abbfb6637d74932617c7013bae0ccf6e32) * bpo-38234: Cleanup getpath.c (GH-16367) * search_for_prefix() directly calls reduce() if found is greater than 0. * Add calculate_pybuilddir() subfunction. * search_for_prefix(): add path string buffer for readability. * Fix some error handling code paths: release resources on error. * calculate_read_pyenv(): rename tmpbuffer to filename. * test.pythoninfo now also logs windows.dll_path (cherry picked from commit 221fd84703c545408bbb4a6e0b58459651331f5c) * bpo-38234: Fix test_embed pathconfig tests (GH-16390) bpo-38234: On macOS and FreeBSD, the temporary directory can be symbolic link. For example, /tmp can be a symbolic link to /var/tmp. Call realpath() to resolve all symbolic links. (cherry picked from commit 00508a7407d7d300b487532e2271534b20e378a7) * bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402) * Add test_embed.test_init_setpath_config(): test Py_SetPath() with PyConfig. * test_init_setpath() and test_init_setpythonhome() no longer call Py_SetProgramName(), but use the default program name. * _PyPathConfig: isolated, site_import and base_executable fields are now only available on Windows. * If executable is set explicitly in the configuration, ignore calculated base_executable: _PyConfig_InitPathConfig() copies executable to base_executable. * Complete path config documentation. (cherry picked from commit 8bf39b606ef7b02c0279a80789f3c4824b0da5e9) * bpo-38234: Complete init config documentation (GH-16404) (cherry picked from commit 88feaecd46a8f427e30ef7ad8cfcddfe392a2402) * bpo-38234: Fix test_embed.test_init_setpath_config() on FreeBSD (GH-16406) Explicitly preinitializes with a Python preconfiguration to avoid Py_SetPath() implicit preinitialization with a compat preconfiguration. Fix also test_init_setpath() and test_init_setpythonhome() on macOS: use self.test_exe as the executable (and base_executable), rather than shutil.which('python3'). (cherry picked from commit 49d99f01e6e51acec5ca57a02e857f0796bc418b) * bpo-38234: Py_Initialize() sets global path configuration (GH-16421) * Py_InitializeFromConfig() now writes PyConfig path configuration to the global path configuration (_Py_path_config). * Add test_embed.test_get_pathconfig(). * Fix typo in _PyWideStringList_Join(). (cherry picked from commit 12f2f177fc483723406d7917194e7f655a20631b)
* bpo-38234: Fix _PyConfig_InitPathConfig() (GH-16335) (GH-16336)Victor Stinner2019-09-231-149/+166
| | | | | | | | | | | | | | | | | | * _PyConfig_InitPathConfig() now starts by copying the global path configuration, and then override values set in PyConfig. * _PyPathConfig_Calculate() implementations no longer override _PyPathConfig fields which are already computed. For example, if _PyPathConfig.prefix is not NULL, leave it unchanged. * If Py_SetPath() has been called, _PyConfig_InitPathConfig() doesn't call _PyPathConfig_Calculate() anymore. * _PyPathConfig_Calculate() no longer uses PyConfig, except to initialize PyCalculatePath structure. * pathconfig_calculate(): remove useless temporary "_PyPathConfig new_config" variable. * calculate_module_search_path(): remove hack to workaround memory allocation failure, call Py_FatalError() instead. * Fix get_program_full_path(): handle memory allocation failure. (cherry picked from commit 9c42f8cda552694f3b47d6388d4ae84d61731872)
* bpo-38236: Dump path config at first import error (GH-16300) (GH-16332)Victor Stinner2019-09-232-4/+101
| | | | | | Python now dumps path configuration if it fails to import the Python codecs of the filesystem and stdio encodings. (cherry picked from commit fcdb027234566c4d506d6d753c7d5638490fb088)
* bpo-38237: Shorter docstring (GH-16322) (GH-16323)Miss Islington (bot)2019-09-212-4/+4
| | | | | (cherry picked from commit b104ecbbafc14f9ca0c8371963c45dca893f6b75) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
* bpo-38237: Let pow() support keyword arguments (GH-16302) (GH-16320)Miss Islington (bot)2019-09-212-26/+32
| | | Backported with release manager approval
* [3.8] bpo-38234: Fix PyConfig_Read() when Py_SetPath() was called (GH-16298) ↵Victor Stinner2019-09-212-66/+56
| | | | | | | | | | | | | | | | | | | | | | | | | (GH-16313) * bpo-38234: Remove _PyPathConfig.dll_path (GH-16307) The DLL path is not computed from any user configuration and cannot be configured by PyConfig. Instead, add a new _Py_dll_path global variable. Remove _PyConfig_SetPathConfig(): replaced with _PyPathConfig_Init(). Py_Initialize() now longer sets the "global path configuration", but only initialize _Py_dll_path. (cherry picked from commit c422167749f92d4170203e996a2c619c818335ea) * bpo-38234: Fix PyConfig_Read() when Py_SetPath() was called (GH-16298) * If Py_SetPath() has been called, _PyConfig_InitPathConfig() now uses its value. * Py_Initialize() now longer copies path configuration from PyConfig to the global path configuration (_Py_path_config). (cherry picked from commit e267793aa4101b2771ed0e66aaff5743d23f59af)
* [3.8] bpo-38070: Py_FatalError() logs runtime state (GH-16258)Victor Stinner2019-09-182-34/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-38070: _Py_DumpTraceback() writes <no Python frame> (GH-16244) When a Python thread has no frame, _Py_DumpTraceback() and _Py_DumpTracebackThreads() now write "<no Python frame>", rather than writing nothing. (cherry picked from commit 8fa3e1740b3f03ea65ddb68411c2238c5f98eec2) * bpo-38070: Enhance _PyObject_Dump() (GH-16243) _PyObject_Dump() now dumps the object address for freed objects and objects with ob_type=NULL. (cherry picked from commit b39afb78768418d9405c4b528c80fa968ccc974d) * bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245) Add _PyRuntimeState.preinitializing field: set to 1 while Py_PreInitialize() is running. _PyRuntimeState: rename also pre_initialized field to preinitialized. (cherry picked from commit d3b904144e86e2442961de6a7dccecbe133d5c6d) * bpo-38070: Py_FatalError() logs runtime state (GH-16246) (cherry picked from commit 1ce16fb0977283ae42a9f8917bbca5f44aa69324)
* [3.8] bpo-37206: Unrepresentable default values no longer represented as ↵Serhiy Storchaka2019-09-146-13/+13
| | | | | | | | | | None. (GH-13933) (GH-16141) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all. (cherry picked from commit 279f44678c8b84a183f9eeb85e0b086228154497) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.8] bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993) ↵Jason R. Coombs2019-09-121-1019/+900
| | | | | | | | | | (GH-16064) * bpo-38121: Sync importlib.metadata with 0.22 backport * 📜🤖 Added by blurb_it.. (cherry picked from commit 8ed6503eca4e3ea4949479d8d7fd9ffd54f81038) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895) ↵Paul Ganssle2019-09-122-7/+7
| | | | (GH-15961)
* closes bpo-38124: Fix bounds check in PyState_AddModule. (GH-16007)Miss Islington (bot)2019-09-121-8/+6
| | | | | | | | The >=, checking whether a module index was in already in the module-by-index list, needed to be strict. Also, fold nested ifs into one and fix some bad spacing. (cherry picked from commit 39de95b746c990e6a2fe9af5fad01747f58b2e5f) Co-authored-by: Benjamin Peterson <benjamin@python.org>