summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* [3.8] bpo-37409: fix relative import with no parent (GH-14956) (GH-15913)Brett Cannon2019-09-111-10/+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.. (cherry picked from commit 92420b3e679959a7d0ce875875601a4cee45231e) Co-authored-by: Ben Lewis <benjimin@users.noreply.github.com>
* [3.8] bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. ā†µJason R. Coombs2019-09-101-610/+609
| | | | | | | | (GH-15840) (#15861) https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21. (cherry picked from commit 17499d82702432955d8e442a1871ff276ca64bc5) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-38090: Fix reference leak in ceval.c (GH-15848)Miss Islington (bot)2019-09-101-1/+0
| | | | | (cherry picked from commit a511c7a4961a684db1f8d0ed438822d87d7d3dcf) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-20490: Improve circular import error message (GH-15308)Steve Dower2019-09-091-4/+11
|
* [3.8] bpo-37994: Fix silencing all errors if an attribute lookup fails. ā†µSerhiy Storchaka2019-09-012-14/+8
| | | | | | | (GH-15630) (GH-15635) Only AttributeError should be silenced. (cherry picked from commit 41c57b335330ff48af098d47e379e0f9ba09d233)
* Fix typos mostly in comments, docs and test names (GH-15209)Miss Islington (bot)2019-08-302-3/+3
| | | | | (cherry picked from commit 39d87b54715197ca9dcb6902bb43461c0ed701a2) Co-authored-by: Min ho Kim <minho42@gmail.com>
* bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592) (GH-15608)Miss Islington (bot)2019-08-301-4/+0
| | | | | (cherry picked from commit 6a650aaf7735e30636db2721247f317064c2cfd4) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* [3.8] bpo-37034: Display argument name on errors with keyword arguments with ā†µSerhiy Storchaka2019-08-296-33/+27
| | | | | | | Argument Clinic. (GH-13593). (GH-15599) (cherry picked from commit 4901fe274bc82b95dc89bcb3de8802a3dfedab32) Co-authored-by: RĆ©mi Lapeyre <remi.lapeyre@henki.fr>
* bpo-37947: Avoid double-decrement in symtable recursion counting (GH-15593)Miss Islington (bot)2019-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. (cherry picked from commit 06145230c833c3db5dab8858e11bcd550a37c57f) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
* bpo-18049: Define THREAD_STACK_SIZE for AIX to pass default recursion limit ā†µMiss Islington (bot)2019-08-291-0/+4
| | | | | | | | test (GH-15081) * Define THREAD_STACK_SIZE for AIX to pass default recursion limit test (cherry picked from commit 9670ce76b83bde950020f8d89c4d27168aaaf912) Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
* Fix unused variable and signed/unsigned warnings (GH-15537) (GH-15551)Miss Islington (bot)2019-08-272-3/+3
| | | | | (cherry picked from commit 0138c4ceab1e10d42d0aa962d2ae079b46da7671) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
* bpo-37954: Fix reference leak in the symtable (GH-15514)Miss Islington (bot)2019-08-261-1/+3
| | | | | (cherry picked from commit 4901dc46da5ecb131f8d902a0fbd704934f209e1) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.8] bpo-37947: Adjust correctly the recursion level in symtable for named ā†µPablo Galindo2019-08-261-1/+3
| | | | | | | expressions (GH-15499) (GH-15515) (cherry picked from commit 0e4ea16336685cf3fa353d8c54af59b45b2d5c33) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details ā†µNick Coghlan2019-08-251-24/+97
| | | | | | | | | | | | | | | | | | | (GH-15491) - 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) (cherry picked from commit 5dbe0f59b7a4f39c7c606b48056bc29e406ebf78)
* [3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)Raymond Hettinger2019-08-252-6/+12
| | | (cherry picked from commit aef9ad82f7f667cd001a7112d3bc636e918626f7)
* [3.8] bpo-37830: Fix compilation of break and continue in finally. ā†µSerhiy Storchaka2019-08-244-180/+224
| | | | | | | | | (GH-15320) (GH-15456) Fix compilation of "break" and "continue" in the "finally" block when the corresponding "try" block contains "return" with a non-constant value. (cherry picked from commit ef61c524ddeeb56da3858b86e349e7288d68178e)
* bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)Miss Islington (bot)2019-08-241-19/+1
| | | | | (cherry picked from commit 05f2d84cae4ba1ff15b7a1d0347305393f4bdcc5) Co-authored-by: Minmin Gong <gongminmin@msn.com>
* bpo-29535: Remove promize about hash randomization of datetime objects. ā†µMiss Islington (bot)2019-08-241-2/+2
| | | | | | | (GH-15269) (cherry picked from commit e9c90aa43144b0be1e4e393e8cb549573437a5da) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431) (GH-15435)Victor Stinner2019-08-232-31/+46
| | | | | | | | | | | | PyConfig_Read() is now responsible to handle early calls to PySys_AddXOption() and PySys_AddWarnOption(). Options added by PySys_AddXOption() are now handled the same way than PyConfig.xoptions and command line -X options. For example, PySys_AddXOption(L"faulthandler") enables faulthandler as expected. (cherry picked from commit 120b707a6d43452e067daa55a8fdca69f9424abc)
* bpo-37549: os.dup() fails for standard streams on Windows 7 (GH-15389)Miss Islington (bot)2019-08-231-1/+8
| | | | | (cherry picked from commit 5be666010e4df65dc4d831435cc92340ea369f94) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)Miss Islington (bot)2019-08-231-4/+25
| | | | | (cherry picked from commit 3842f2997fbd4dc840986aad2bb94656815e243b) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415) (GH-15420)Victor Stinner2019-08-231-1/+2
| | | | | | | | | | | | empty_argv is no longer static in Python 3.8, but it is declared in a temporary scope, whereas argv keeps a reference to it. empty_argv memory (allocated on the stack) is reused by make_sys_argv() code which is inlined when using gcc -O3. Define empty_argv in PySys_SetArgvEx() body, to ensure that it remains valid for the whole lifetime of the PySys_SetArgvEx() call. (cherry picked from commit c48682509dc49b43fe914fe6c502bc390345d1c2)
* bpo-37834: Normalise handling of reparse points on Windows (GH-15370)Steve Dower2019-08-211-1/+6
| | | | | | | | | | bpo-37834: Normalise handling of reparse points on Windows * ntpath.realpath() and nt.stat() will traverse all supported reparse points (previously was mixed) * nt.lstat() will let the OS traverse reparse points that are not name surrogates (previously would not traverse any reparse point) * nt.[l]stat() will only set S_IFLNK for symlinks (previous behaviour) * nt.readlink() will read destinations for symlinks and junction points only bpo-1311: os.path.exists('nul') now returns True on Windows * nt.stat('nul').st_mode is now S_IFCHR (previously was an error)
* bpo-36266: Add module name in ImportError when DLL not found on Windows ā†µMiss Islington (bot)2019-08-171-4/+4
| | | | | | | (GH-15180) (cherry picked from commit 24fe46081be3d1c01b3d21cb39bc3492ab4485a3) Co-authored-by: shireenrao <shireenrao@gmail.com>
* [3.8] bpo-32912: Revert SyntaxWarning on invalid escape sequences (GH-15142)Serhiy Storchaka2019-08-091-3/+3
| | | | | | | * bpo-32912: Revert warnings for invalid escape sequences. DeprecationWarning will continue to be emitted for invalid escape sequences in string and bytes literals in 3.8 just as it did in 3.7. SyntaxWarning may be emitted in the future. But per mailing list discussion, we don't yet know when because we haven't settled on how to do so in a non-disruptive manner.
* bpo-18049: Sync thread stack size to main thread size on macOS (GH-14748)Miss Islington (bot)2019-08-011-1/+2
| | | | | | | | | This changeset increases the default size of the stack for threads on macOS to the size of the stack of the main thread and reenables the relevant recursion test. (cherry picked from commit 1a057bab0f18d6ad843ce321d1d77a4819497ae4) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* bpo-37500: Make sure dead code does not generate bytecode but also detect ā†µMiss Islington (bot)2019-07-291-5/+64
| | | | | | | | | | | | | | syntax errors (GH-14612) https://bugs.python.org/issue37500 Add a new field to the compiler structure that allows to be configured so no bytecode is emitted. In this way is possible to detect errors by walking the nodes while preserving optimizations. https://bugs.python.org/issue37500 (cherry picked from commit 18c5f9d44dde37c0fae5585a604c6027825252d2) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-37697: Sync with importlib_metadata 0.19 (GH-14993) (GH-14995)Miss Islington (bot)2019-07-281-779/+796
| | | | | | | | | | * bpo-37697: Sync with importlib_metadata 0.19 * Run make regen-importlib * šŸ“œšŸ¤– Added by blurb_it. (cherry picked from commit 049460da9c7b5f51732e2966195c44713af9dc4c) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.8] bpo-36974: separate vectorcall functions for each calling convention ā†µJeroen Demeyer2019-07-231-8/+8
| | | | (GH-13781) (#14782)
* [3.8] Fix typos in docs, comments and test assert messages (GH-14872). (#14900)Kyle Stanley2019-07-221-1/+1
| | | | | (cherry picked from commit 96e12d5f4f3c5a20986566038ee763dff3c228a1) Co-authored-by: Min ho Kim <minho42@gmail.com>
* Adjust builtins.zip() docstring to better communicate its signature (GH-14833)Miss Islington (bot)2019-07-191-1/+1
| | | | | (cherry picked from commit af2f5b1723b95e45e1f15b5bd52102b7de560f7c) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* bpo-37593: Swap the positions of posonlyargs and args in the constructor of ā†µMiss Islington (bot)2019-07-143-145/+145
| | | | | | | | ast.parameters nodes (GH-14778) https://bugs.python.org/issue37593 (cherry picked from commit cd6e83b4810549c308ab2d7315dbab526e35ccf6) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-18374: fix wrong col_offset of some ast.BinOp instances (GH-14607)Miss Islington (bot)2019-07-081-1/+1
| | | | | | | | Nested BinOp instances (e.g. a+b+c) had a wrong col_offset for the second BinOp (e.g. 2 instead of 0 in the example). Fix it by using the correct st node to copy the line and col_offset from in ast.c. (cherry picked from commit 110a47c4f42cf4db88edc1876899fff8f05190fb) Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
* bpo-36763: Add PyConfig_SetWideStringList() (GH-14444)Miss Islington (bot)2019-07-011-1/+18
| | | | | (cherry picked from commit 36242fd871d0f0977e720d4fae5700774bd8c09a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37467: Fix PyErr_Display() for bytes filename (GH-14504)Miss Islington (bot)2019-07-011-1/+1
| | | | | | | | | | | | | | | | | Fix sys.excepthook() and PyErr_Display() if a filename is a bytes string. For example, for a SyntaxError exception where the filename attribute is a bytes string. Cleanup also test_sys: * Sort imports. * Rename numruns global var to INTERN_NUMRUNS. * Add DisplayHookTest and ExceptHookTest test case classes. * Don't save/restore sys.stdout and sys.displayhook using setUp()/tearDown(): do it in each test method. * Test error case (call hook with no argument) after the success case. (cherry picked from commit f9b7457bd7f438263e0d2dd1f70589ad56a2585e) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set ā†µMiss Islington (bot)2019-07-012-8/+6
| | | | | | | | PyCode_New as a compatibility wrapper (GH-13959) (#14505) Add PyCode_NewEx to be used internally and set PyCode_New as a compatibility wrapper (cherry picked from commit 4a2edc34a405150d0b23ecfdcb401e7cf59f4650) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-37369: Fix initialization of sys members when launched via an app ā†µSteve Dower2019-06-293-0/+35
| | | | | | container (GH-14467) sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
* bpo-37363: Add audit events for a range of modules (GH-14301)Miss Islington (bot)2019-06-241-0/+5
| | | | | (cherry picked from commit 60419a7e96577cf783b3b45bf3984f9fb0d7ddff) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-35224: Bump the pyc magic number by 1 instead of by 10 in last ā†µMiss Islington (bot)2019-06-231-1/+1
| | | | | | | modification (GH-14320) (cherry picked from commit b3ca7972c8d8c6479b6542ce28e0f7a6ebd5b8fe) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-35224: Bump the pyc magic number after the change in MAP_ADD (GH-14313)Miss Islington (bot)2019-06-221-121/+121
| | | | | (cherry picked from commit 663131a6e2c6c8b83e9f982d8c6ca38fc7c238b4) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>