summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38234: Py_Initialize() sets global path configuration (GH-16421)Victor Stinner2019-09-262-9/+24
| | | | | | * 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().
* bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402)Victor Stinner2019-09-261-5/+28
| | | | | | | | | | | | * 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.
* bpo-38234: Py_SetPath() uses the program full path (GH-16357)Victor Stinner2019-09-241-4/+7
| | | | | | | 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().
* bpo-38234: Fix _PyConfig_InitPathConfig() (GH-16335)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.
* bpo-38236: Fix init_dump_ascii_wstr() (GH-16333)Victor Stinner2019-09-231-0/+1
| | | Add missing "return;" (to not dereference NULL pointer).
* bpo-38236: Dump path config at first import error (GH-16300)Victor Stinner2019-09-231-2/+97
| | | | Python now dumps path configuration if it fails to import the Python codecs of the filesystem and stdio encodings.
* Shorter docstring (GH-16322)Raymond Hettinger2019-09-212-4/+4
|
* bpo-38237: Make pow's arguments have more descriptive names and be keyword ↵Ammar Askar2019-09-212-26/+32
| | | | | | | | | | | | passable (GH-16302) Edit: `math.pow` changes removed on Mark's request. https://bugs.python.org/issue38237 Automerge-Triggered-By: @rhettinger
* bpo-38234: Fix PyConfig_Read() when Py_SetPath() was called (GH-16298)Victor Stinner2019-09-201-0/+7
| | | | | | * 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).
* bpo-38234: Remove _PyPathConfig.dll_path (GH-16307)Victor Stinner2019-09-202-64/+45
| | | | | | | | | 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.
* bpo-38140: Make dict and weakref offsets opaque for C heap types (#16076)Eddie Elizondo2019-09-191-2/+7
| | | | | | * Make dict and weakref offsets opaque for C heap types * Add news
* bpo-38070: Py_FatalError() logs runtime state (GH-16246)Victor Stinner2019-09-171-26/+59
|
* bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245)Victor Stinner2019-09-171-3/+8
| | | | | | Add _PyRuntimeState.preinitializing field: set to 1 while Py_PreInitialize() is running. _PyRuntimeState: rename also pre_initialized field to preinitialized.
* bpo-38070: _Py_DumpTraceback() writes <no Python frame> (GH-16244)Victor Stinner2019-09-171-5/+8
| | | | | When a Python thread has no frame, _Py_DumpTraceback() and _Py_DumpTracebackThreads() now write "<no Python frame>", rather than writing nothing.
* Fix leaks in Python-ast.c (#16127)Eddie Elizondo2019-09-141-1/+5
|
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-146-13/+13
| | | | | | | (GH-13933) 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.
* Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)Greg Price2019-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | All call sites pass NULL for `recode_encoding`, so this path is completely untested. That's been true since before Python 3.0. It adds significant complexity to this logic, so it's best to take it out. All call sites now have a literal NULL, and that's been true since commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at the call site in Python/ast.c where we're parsing a bytes literal. But even before then, that condition `foo` had been a constant since unadorned string literals started meaning Unicode, in commit 572dbf8f1 aka v3.0a1~1035 . The `unicode` parameter is already unused, so mark it as unused too. The code that acted on it was also taken out before Python 3.0, in commit 8d30cc014 aka v3.0a1~1031 . The function (PyBytes_DecodeEscape) is exposed in the API, but it's never been documented.
* bpo-38138: Fix memory leak introduced by interned strings (GH-16053)Dino Viehland2019-09-121-0/+1
| | | | | | | | | | | Interned string needs to be decref'd https://bugs.python.org/issue38138 Automerge-Triggered-By: @matrixise
* Revert "Fix depth-first-search computation in compile.c (GH-16042)" (GH-16050)T. Wouters2019-09-121-24/+30
| | | | | This reverts commit 355f3e1e5caf16198255df573a1f5e8b98b30105. bpo-38135
* Fix depth-first-search computation in compile.c (GH-16042)Mark Shannon2019-09-121-30/+24
|
* bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993)Jason R. Coombs2019-09-121-1032/+912
| | | | | | * bpo-38121: Sync importlib.metadata with 0.22 backport * 📜🤖 Added by blurb_it.
* closes bpo-38124: Fix bounds check in PyState_AddModule. (GH-16007)Benjamin Peterson2019-09-111-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.
* bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)Dino Viehland2019-09-111-1388/+2462
| | | Summary: This mostly migrates Python-ast.c to PEP384 and removes all statics from the whole file. This modifies the generator itself that generates the Python-ast.c. It leaves in the usage of _PyObject_LookupAttr even though it's not fully PEP384 compatible (this could always be shimmed in by anyone who needs it).
* bpo-35923: Update the BuiltinImporter to use loader._ORIGIN instead of a ↵Dong-hee Na2019-09-111-754/+755
| | | | | | hard-coded value (GH-15651)
* bpo-38113: Update Python/ast.c to PEP-384 (GH-15975)Dino Viehland2019-09-111-4/+3
| | | | | | | | | | Removes statics for better subinterpreter support and moves to _PyType_Name https://bugs.python.org/issue38113 Automerge-Triggered-By: @tiran
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895)Raymond Hettinger2019-09-112-7/+7
| | | | | | | | * bpo-38096: Clean up the "struct sequence" / "named tuple" docs * Fix remaining occurrences of "struct sequence" * Repair a user visible docstring
* bpo-35943: Prevent PyImport_GetModule() from returning a ↵Joannah Nanjekye2019-09-111-23/+46
| | | | partially-initialized module (GH-15057)
* bpo-37151: remove special case for PyCFunction from PyObject_Call (GH-14684)Jeroen Demeyer2019-09-111-1/+1
| | | | | | | bpo-37151: remove special case for PyCFunction from PyObject_Call Alse, make the undocumented function PyCFunction_Call an alias of PyObject_Call and deprecate it.
* bpo-37409: fix relative import with no parent (#14956)Ben Lewis2019-09-111-11/+13
| | | | | | | | | | | | | Relative imports use resolve_name to get the absolute target name, which first seeks the current module's absolute package name from the globals: If __package__ (and __spec__.parent) are missing then import uses __name__, truncating the last segment if the module is a submodule rather than a package __init__.py (which it guesses from whether __path__ is defined). The __name__ attempt should fail if there is no parent package (top level modules), if __name__ is '__main__' (-m entry points), or both (scripts). That is, if both __name__ has no subcomponents and the module does not seem to be a package __init__ module then import should fail.
* bpo-37752: Delete redundant Py_CHARMASK in normalizestring() (GH-15095)Jordon Xu2019-09-103-7/+7
|
* bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840)Jason R. Coombs2019-09-101-613/+612
| | | https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21
* bpo-38090: Fix reference leak in ceval.c (GH-15848)Pablo Galindo2019-09-101-1/+0
|
* bpo-36781: Optimize sum() for bools. (#13074)Serhiy Storchaka2019-09-101-2/+2
| | | | | | | | * Optimize sum() for bools. * Fix sum([], False). * Add a NEWS entry.
* bpo-38068: Clean up gettimeofday configure logic. (GH-15775)Benjamin Peterson2019-09-102-12/+1
| | | Assume gettimeofday exists and takes two arguments.
* bpo-38083: Minor improvements in asdl_c.py and Python-ast.c. (GH-15824)Serhiy Storchaka2019-09-101-131/+307
| | | | | * Use the const qualifier for constant C strings. * Intern field and attribute names. * Temporary incref a borrowed reference to a list item.
* bpo-20490: Improve circular import error message (GH-15308)Anthony Sottile2019-09-091-4/+11
|
* bpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)Joannah Nanjekye2019-09-061-5/+0
| | | | | Remove PyGen_NeedsFinalizing(): it was not documented, tested or used anywhere within CPython after the implementation of PEP 442.
* bpo-37878: Remove PyThreadState_DeleteCurrent() function (GH-15315)Joannah Nanjekye2019-09-051-9/+3
| | | | | | | * Rename PyThreadState_DeleteCurrent() to _PyThreadState_DeleteCurrent() * Move it to the internal C API Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-012-15/+9
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)Serhiy Storchaka2019-09-012-14/+8
| | | Only AttributeError should be silenced.
* Fix typos mostly in comments, docs and test names (GH-15209)Min ho Kim2019-08-302-3/+3
|
* bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592)Sergey Fedoseev2019-08-301-4/+0
|
* bpo-37034: Display argument name on errors with keyword arguments with ↵Rémi Lapeyre2019-08-296-33/+27
| | | | Argument Clinic. (GH-13593)
* bpo-37947: Avoid double-decrement in symtable recursion counting (GH-15593)Nick Coghlan2019-08-291-4/+14
| | | | | | | | | With `symtable_visit_expr` now correctly adjusting the recursion depth for named expressions, `symtable_handle_namedexpr` should be leaving it alone. Also adds a new check to `PySymtable_BuildObject` that raises `SystemError` if a successful first symbol analysis pass fails to keep the stack depth accounting clean.
* bpo-23878: Remove an unneeded fseek() call in _Py_FindEnvConfigValue() ↵Zackery Spytz2019-08-281-1/+0
| | | | (GH-15424)
* Fix unused variable and signed/unsigned warnings (GH-15537)Raymond Hettinger2019-08-272-3/+3
|
* Make PyXXX_Fini() functions private (GH-15531)Victor Stinner2019-08-261-12/+12
| | | | | For example, rename PyTuple_Fini() to _PyTuple_Fini(). These functions are only declared in the internal C API.
* bpo-37954: Fix reference leak in the symtable (GH-15514)Pablo Galindo2019-08-261-1/+3
|
* bpo-37947: Adjust correctly the recursion level in symtable for named ↵Pablo Galindo2019-08-261-1/+3
| | | | expressions (GH-15499)
* bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15131)Nick Coghlan2019-08-251-24/+97
| | | | | | | | | | | | | | | - drop TargetScopeError in favour of raising SyntaxError directly as per the updated PEP 572 - comprehension iteration variables are explicitly local, but named expression targets in comprehensions are nonlocal or global. Raise SyntaxError as specified in PEP 572 - named expression targets in the outermost iterable of a comprehension have an ambiguous target scope. Avoid resolving that question now by raising SyntaxError. PEP 572 originally required this only for cases where the bound name conflicts with the iteration variable in the comprehension, but CPython can't easily restrict the exception to that case (as it doesn't know the target variable names when visiting the outermost iterator expression)