summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* 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-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>
* [3.7] bpo-38535: Fix positions for AST nodes for calls without arguments in ↵Serhiy Storchaka2019-10-261-2/+3
| | | | | | decorators. (GH-16861). (GH-16930) (cherry picked from commit 26ae9f6d3d755734c9f371b9356325afe5764813)
* 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: Revert a warning if PY_SSIZE_T_CLEAN is not defined. (GH-16876)Serhiy Storchaka2019-10-211-13/+1
|
* 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>
* Typo fix: "throuhgh" should be "through". (GH-16704)Miss Islington (bot)2019-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-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895) ↵Paul Ganssle2019-09-122-7/+7
| | | | (GH-15962)
* 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)Miss Islington (bot)2019-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> (cherry picked from commit 0a6693a469cfb1dd5c8048d8cb4231a7b5883251) Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com>
* 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>
* 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>
* [3.7] bpo-37500: Revert commit 85ed1712e428f93408f56fc684816f9a85b0ebc0 ↵Pablo Galindo2019-07-052-15/+9
| | | | | (GH-14605) https://bugs.python.org/issue37500
* bpo-37467: Fix PyErr_Display() for bytes filename (GH-14504) (GH-14515)Victor Stinner2019-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)
* bpo-37369: Fixes path for sys.executable when running from the Microsoft ↵Steve Dower2019-06-281-2/+12
| | | | Store (GH-14450)
* bpo-37267: Do not check for FILE_TYPE_CHAR in os.dup() on Windows (GH-14051) ↵Miss Islington (bot)2019-06-171-12/+5
| | | | | | | | | (GH-14141) On Windows, os.dup() no longer creates an inheritable fd when handling a character file. (cherry picked from commit 28fca0c422b425a6be43be31add0a5328c16b0b8) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-37289: Remove 'if False' handling in the peephole optimizer (GH-14099) ↵Miss Islington (bot)2019-06-151-9/+3
| | | | | | | (GH-14111) (cherry picked from commit 7a68f8c28bb78d957555a5001dac4df6345434a0) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.7] bpo-37269: Correctly optimise conditionals with constant booleans ↵Pablo Galindo2019-06-141-0/+5
| | | | | | | | | | | | | (GH-14071) (GH-14073) Fix a regression introduced by af8646c8054d0f4180a2013383039b6a472f9698 that was causing code of the form: if True and False: do_something() to be optimized incorrectly, eliminating the block.. (cherry picked from commit 05f831865545b08c9a21cfb7773af58b76ec64cb) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-36829: Enhance PyErr_WriteUnraisable() (GH-13487)Victor Stinner2019-05-221-53/+84
| | | | | | | | | | | | PyErr_WriteUnraisable() now displays the exception even if displaying the traceback failed. Moreover, hold a strong reference to sys.stderr while using it. Document that an exception must be set when calling PyErr_WriteUnraisable(), but don't add an assertion to check it at runtime. Cleanup: use longer names for variables and create write_unraisable_exc_file() subfunction.
* bpo-1875: Raise SyntaxError in invalid blocks that will be optimised away ↵Miss Islington (bot)2019-05-172-9/+16
| | | | | | | | | | (GH-13332) Move the check for dead conditionals (if 0) to the peephole optimizer and make sure that the code block is still compiled to report any existing syntax errors within. (cherry picked from commit af8646c8054d0f4180a2013383039b6a472f9698) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-36791: Safer detection of integer overflow in sum(). (GH-13080)Miss Islington (bot)2019-05-121-3/+5
| | | | | (cherry picked from commit 29500737d45cbca9604d9ce845fb2acc3f531401) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.7] bpo-34408: Prevent a null pointer dereference and resource leakage in ↵Pablo Galindo2019-05-101-6/+10
| | | | | | | | | | `PyInterpreterState_New()` (GH-8767) (GH-13237) * 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. (cherry picked from commit 95d630e) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.7] bpo-9566: Fix compiler warnings on Windows (GH-12920)Victor Stinner2019-04-232-22/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-9566: Fix compiler warnings in gcmodule.c (GH-11010) Change PyDTrace_GC_DONE() argument type from int to Py_ssize_t. (cherry picked from commit edad38e3e05586ba58291f47756eb3fb808f5577) * bpo-30465: Fix C downcast warning on Windows in ast.c (#6593) ast.c: fstring_fix_node_location() downcasts a pointer difference to a C int. Replace int with Py_ssize_t to fix the compiler warning. (cherry picked from commit fb7e7992beec7f76cc2db77ab6ce1e86446bfccf) * bpo-9566: Fix compiler warnings in peephole.c (GH-10652) (cherry picked from commit 028f0ef4f3111d2b3fc5b971642e337ba7990873) * bpo-27645, sqlite: Fix integer overflow on sleep (#6594) Use the _PyTime_t type and round away from zero (ROUND_UP, _PyTime_ROUND_TIMEOUT) the sleep duration, when converting a Python object to seconds and then to milliseconds. Raise an OverflowError in case of overflow. Previously the (int)double conversion rounded towards zero (ROUND_DOWN). (cherry picked from commit ca405017d5e776a2e3d9291236e62d2e09489dd2)
* bpo-32849: Fix is_valid_fd() on FreeBSD (GH-12852) (GH-12863)Miss Islington (bot)2019-04-171-15/+23
| | | | | | | | | | Fix Python Initialization code on FreeBSD to detect properly when stdin file descriptor (fd 0) is invalid. On FreeBSD, fstat() must be used to check if stdin (fd 0) is valid. dup(0) doesn't fail if stdin is invalid in some cases. (cherry picked from commit 3092d6b2630e4d2bd200fbc3231c27a7cba4d6b2) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)Miss Islington (bot)2019-03-254-11/+24
|
* bpo-35284: Fix the error handling in the compiler's compiler_call(). ↵Zackery Spytz2019-03-221-3/+5
| | | | | | | (GH-10625) (GH-12496) compiler_call() needs to check if an error occurred during the maybe_optimize_method_call() call. (cherry picked from commit 97f5de01adf993aee17dcd26e22ae421d013f372)
* bpo-36236: Handle removed cwd at Python init (GH-12450)Victor Stinner2019-03-192-5/+13
| | | | At Python initialization, the current directory is no longer prepended to sys.path if it has been removed.
* bpo-36262: Fix _Py_dg_strtod() memory leak (goto undfl) (GH-12276) (GH-12331)Victor Stinner2019-03-141-54/+25
| | | | | | | | | | | | | | Fix an unlikely memory leak on conversion from string to float in the function _Py_dg_strtod() used by float(str), complex(str), pickle.load(), marshal.load(), etc. Fix an unlikely memory leak in _Py_dg_strtod() on "undfl:" label: rewrite memory management in this function to always release all memory before exiting the function. Initialize variables to NULL, and set them to NULL after calling Bfree() at the "cont:" label. Note: Bfree(NULL) is well defined: it does nothing. (cherry picked from commit 9776b0636ae39668d3ce1c006d4be01dad01bf9f)
* [3.7] bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264). ↵Serhiy Storchaka2019-03-144-9/+9
| | | | | | | (GH-12322) (cherry picked from commit d53fe5f407ff4b529628b01a1bcbf21a6aad5c3a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33316: PyThread_release_lock always fails (GH-6541)Miss Islington (bot)2019-02-021-2/+3
| | | | | | Use correct interpretation of return value from APIs. (cherry picked from commit 05e922136a3286893bd489a8f2ecfa0dba4da368) Co-authored-by: native-api <ivan_pozdeev@mail.ru>
* bpo-35742: Fix test_envar_unimportable in test_builtin. (GH-11561)Miss Islington (bot)2019-01-151-10/+15
| | | | | | | | Handle the case of an empty module name in PYTHONBREAKPOINT. Fixes a regression introduced in bpo-34756. (cherry picked from commit 3607ef43c4a1a24d44f39ff54a77fc0af5bfa09a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34756: Silence only ImportError and AttributeError in ↵Miss Islington (bot)2019-01-141-0/+6
| | | | | | | sys.breakpointhook(). (GH-9457) (cherry picked from commit 6fe9c446f8302553952f63fc6d96be4dfa48ceba) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35470: Fix a reference counting bug in ↵Miss Islington (bot)2019-01-101-1/+0
| | | | | | | _PyImport_FindExtensionObjectEx(). (GH-11128) (cherry picked from commit 89c4f90df97f6039325e354167e8f507bf199fd9) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] Bump copyright years to 2019. (GH-11406)Benjamin Peterson2019-01-021-1/+1
| | | (cherry picked from commit 9a69ae8a78785105ded02b083b2e5cd2dd939307)
* bpo-35550: Fix incorrect Solaris define guards (GH-11275)Miss Islington (bot)2018-12-311-2/+2
| | | | | | | | | | Python source code uses on several places ifdef sun or defined(sun) without the underscores, which is not standard compliant and shouldn't be used. Defines should check for __sun instead. Reference: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_systemGH-Solaris https://bugs.python.org/issue35550 (cherry picked from commit 6f9bc72c79c3262e5d0f2c0e96b016477399cfb1) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* bpo-35444: Fix error handling when fail to look up builtin "getattr". ↵Serhiy Storchaka2018-12-111-0/+14
| | | | | (GH-11047) (GH-11107) (cherry picked from commit bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d)
* bpo-35454: Fix miscellaneous minor issues in error handling. (GH-11077)Miss Islington (bot)2018-12-115-6/+18
| | | | | | | | * bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference. (cherry picked from commit 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (GH-11075)Miss Islington (bot)2018-12-101-1/+2
| | | | | (cherry picked from commit dffccc6b594951fc798973e521da205785823f0f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35451: Fix reference counting for sys.warnoptions and sys._xoptions. ↵Miss Islington (bot)2018-12-101-2/+0
| | | | | | | (GH-11063) (cherry picked from commit 72ff7b4c000f7b8199231a0eb1ca4b119fab40a5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)Miss Islington (bot)2018-12-082-3/+3
| | | | | | | | | | | | In _localemodule.c and selectmodule.c, remove dead code that would cause double decrefs if run. In addition, replace PyList_SetItem() with PyList_SET_ITEM() in cases where a new list is populated and there is no possibility of an error. In addition, check if the list changed size in the loop in array_array_fromlist(). (cherry picked from commit 99d56b53560b3867844472ae381fb3f858760621) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. ↵Zackery Spytz2018-12-073-3/+12
| | | | | (GH-11015) (GH-11020) (cherry picked from commit 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9)
* bpo-35414: Add a missing Py_INCREF(Py_None) in PyState_RemoveModule(). ↵Miss Islington (bot)2018-12-051-0/+1
| | | | | | | (GH-10914) (cherry picked from commit 2a893430c9c8378cbdfac95895a64fa07aaff9ed) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-33015: Fix UB in pthread PyThread_start_new_thread (GH-6008)Miss Islington (bot)2018-11-301-4/+36
| | | | | | | | | | Fix an undefined behaviour in the pthread implementation of PyThread_start_new_thread(): add a function wrapper to always return NULL. Add pythread_callback struct and pythread_wrapper() to thread_pthread.h. (cherry picked from commit 9eea6eaf23067880f4af3a130e3f67c9812e2f30) Co-authored-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Miss Islington (bot)2018-11-272-3/+4
| | | | | | Fix also return type for few other functions (clear, releasebuffer). (cherry picked from commit d4f9cf5545d6d8844e0726552ef2e366f5cc3abd) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623) (GH-10718)Victor Stinner2018-11-261-18/+22
| | | | | | | | | | Fix str.format(), float.__format__() and complex.__format__() methods for non-ASCII decimal point when using the "n" formatter. Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires a _PyUnicodeWriter object for the buffer and a Python str object for digits. (cherry picked from commit 59423e3ddd736387cef8f7632c71954c1859bed0)
* bpo-34523: Fix C locale coercion on FreeBSD CURRENT (GH-10672) (GH-10673)Victor Stinner2018-11-232-4/+19
| | | | | | | | | | bpo-34523, bpo-35290: C locale coercion now resets the Python internal "force ASCII" mode. This change fix the filesystem encoding on FreeBSD CURRENT, which has a new "C.UTF-8" locale, when the UTF-8 mode is disabled. Add _Py_ResetForceASCII(): _Py_SetLocaleFromEnv() now calls it. (cherry picked from commit 353933e712b6c7f7ba9a9a50bd5bd472db7c35d0)