summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35444: Fix error handling when fail to look up builtin "getattr". ↵Serhiy Storchaka2018-12-111-6/+2
| | | | | (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-113-8/+17
| | | | | | | | * 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-31374: expat doesn't include <pyconfig.h> on Windows (GH-11079)Miss Islington (bot)2018-12-101-1/+3
| | | | | (cherry picked from commit b6ef6f69a9afc979640a5f9883f799de1364bff7) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-31374: Include pyconfig.h earlier in expat (GH-11064)Miss Islington (bot)2018-12-101-0/+1
| | | | | | | | | Include <pyconfig.h> ealier in Modules/expat/xmltok.c to define properly _POSIX_C_SOURCE. Python defines _POSIX_C_SOURCE as 200809L, whereas <features.h> (included indirectly by <string.h>) defines _POSIX_C_SOURCE as 199506L. (cherry picked from commit cf247359d5b7082044eea1fa94b5211a172b1ff6) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-35050: AF_ALG length check off-by-one error (GH-10058) (GH-11069)Victor Stinner2018-12-101-3/+7
| | | | | | | | | The length check for AF_ALG salg_name and salg_type had a off-by-one error. The code assumed that both values are not necessarily NULL terminated. However the Kernel code for alg_bind() ensures that the last byte of both strings are NULL terminated. Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 2eb6ad8578fa9d764c21a92acd8e054e3202ad19)
* bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)Miss Islington (bot)2018-12-084-24/+15
| | | | | | | | | | | | 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>
* [3.7] bpo-22005: Fixed unpickling instances of datetime classes pickled by ↵Serhiy Storchaka2018-12-071-78/+169
| | | | | | | Python 2. (GH-11017) (GH-11022) encoding='latin1' should be used for successful decoding. (cherry picked from commit 8452ca15f41061c8a6297d7956df22ab476d4df4)
* bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. ↵Zackery Spytz2018-12-077-12/+39
| | | | | (GH-11015) (GH-11020) (cherry picked from commit 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9)
* bpo-35384: The repr of ctypes.CArgObject no longer fails for non-ascii ↵Miss Islington (bot)2018-12-061-4/+22
| | | | | | | character. (GH-10863) (cherry picked from commit 3ffa8b9ba190101f674a0e524e482a83ed09cccd) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-35310: Clear select() lists before returning upon EINTR (GH-10877)Miss Islington (bot)2018-12-051-0/+4
| | | | | | | | | select() calls are retried on EINTR (per PEP 475). However, if a timeout was provided and the deadline has passed after running the signal handlers, rlist, wlist and xlist should be cleared since select(2) left them unmodified. (cherry picked from commit 7f52415a6d4841d77d3b7853e83b25a22e0048dc) Co-authored-by: Oran Avraham <252748+oranav@users.noreply.github.com>
* bpo-34604: Use %R because of invisible characters or trailing whitespaces. ↵Serhiy Storchaka2018-12-052-2/+2
| | | | | | | (GH-9165). (GH-10947) (cherry picked from commit 34c7f0c04e2b4e715b2c3df1875af8939fbe7d0b) Co-authored-by: William Grzybowski <wg@FreeBSD.org>
* bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. ↵Serhiy Storchaka2018-12-051-17/+13
| | | | | | | (GH-8113). (GH-10946) (cherry picked from commit 5b25f1d03100e2283c1b129d461ba68ac0169a14) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* bpo-34987: Fix a possible null pointer dereference in _pickle.c's ↵Miss Islington (bot)2018-12-051-1/+4
| | | | | | | save_reduce(). (GH-9886) (cherry picked from commit 25d389789c59a52a31770f7c50ce9e02a8909190) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] bpo-35373: Fix PyInit_timezone() error handling (GH-10864)Victor Stinner2018-12-031-5/+24
| | | | | | | | | | | | | | | | | | * bpo-35373: Fix PyInit_timezone() error handling PyInit_timezone() now returns -1 at exit if an exception is raised. Check also explicitly PyUnicode_DecodeLocale() and Py_BuildValue() errors. * bpo-35373: Fix PyInit_time() error handling (GH-10865) * PyInit_time() now returns NULL if an exception is raised. * Rename PyInit_timezone() to init_timezone(). "PyInit_" prefix is a special prefix for function initializing a module. init_timezone() doesn't initialize a module and the function is not exported. (cherry picked from commit 3bb150d8148e3cc08418077a58f43e064b9fde61)
* bpo-10320: Replace nonstandard sprintf() length modifier in ctypes' ↵Miss Islington (bot)2018-12-031-1/+1
| | | | | | | | PyCArg_repr(). (GH-10853) Use "ll" instead of the nonstandard "q". (cherry picked from commit 062cbb67726f26794b1b461853e40696b4a0b220) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35371: Fix possible crash in os.utime() on Windows. (GH-10844)Miss Islington (bot)2018-12-011-22/+15
| | | | | (cherry picked from commit 32bc11c33cf5ccea165b5f4ac3799f02fdf9c76a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* get_gmtoff() now returns time_t (GH-10838) (GH-10839)Victor Stinner2018-12-011-9/+29
| | | | | | | | | get_gmtoff() now returns time_t instead of int to fix the following Visual Studio warning: Modules\timemodule.c(1183): warning C4244: 'return': conversion from 'time_t' to 'int', possible loss of data (cherry picked from commit 503ce5c482cb267b0770bc46c315d5cf822bdca9)
* bpo-35336: Fix PYTHONCOERCECLOCALE=1 (GH-10806) (GH-10813)Victor Stinner2018-11-301-2/+8
| | | | | | Fix PYTHONCOERCECLOCALE=1 environment variable: only coerce the C locale if the LC_CTYPE locale is "C". (cherry picked from commit 55e498058faf8c97840556f6d791c2c392732dc3)
* bpo-35356: Fix a possible reference leak in nis.maps(). (GH-10808)Miss Islington (bot)2018-11-301-0/+1
| | | | | (cherry picked from commit a2e3585e79c93b2372dbad46a744e28fcc6dad6d) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-33012: Fix signatures of METH_NOARGS functions. (GH-10736) (GH-10748)Serhiy Storchaka2018-11-273-12/+12
| | | | (cherry picked from commit 81524022d0c0df7a41f9b2b2df41e2ebe140e610)
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Miss Islington (bot)2018-11-2716-68/+68
| | | | | | Fix also return type for few other functions (clear, releasebuffer). (cherry picked from commit d4f9cf5545d6d8844e0726552ef2e366f5cc3abd) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* closes bpo-34212: Build core extension modules with Py_BUILD_CORE_BUILTIN. ↵Miss Islington (bot)2018-11-271-1/+1
| | | | | | | (GH-8712) (cherry picked from commit da324d53d420347344236ff64cf5eb9b675d6f86) Co-authored-by: E. M. Bray <erik.m.bray@gmail.com>
* bpo-35303: Fix a reference leak in _operator.c's methodcaller_repr(). (GH-10689)Miss Islington (bot)2018-11-231-0/+1
| | | | | (cherry picked from commit 5b83ef71d3060e1651d3680e805f13a1049c7d6d) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.7] bpo-35189: Retry fnctl calls on EINTR (GH-10413) (GH-10678)Victor Stinner2018-11-231-23/+32
| | | | | | | | | | | | | | | | | | | | | | | | | * bpo-35189: Fix eintr_tester.py (GH-10637) Call setitimer() before each test method, instead of once per test case, to ensure that signals are sent in each test method. Previously, only the first method of a testcase class got signals. Changes: * Replace setUpClass() with setUp() and replace tearDownClass() with tearDown(). * tearDown() now ensures that at least one signal has been sent. * Replace support.run_unittest() with unittest.main() which has a nicer CLI and automatically discover test cases. (cherry picked from commit aac1f81eef971876ba5b1673db9ce6620311c469) * bpo-35189: Retry fnctl calls on EINTR (GH-10413) Modify the following fnctl function to retry if interrupted by a signal (EINTR): flock, lockf, fnctl. (cherry picked from commit b409ffa848b280c1db1b4f450bfae14f263099ac) Co-Authored-By: nierob <nierob@users.noreply.github.com>
* bpo-24658: os.read() reuses _PY_READ_MAX (GH-10657)Miss Islington (bot)2018-11-221-5/+1
| | | | | | | | os_read_impl() now also truncates the size to _PY_READ_MAX on macOS, to avoid to allocate a larger buffer even if _Py_read() is limited to _PY_READ_MAX bytes (ex: INT_MAX on macOS). (cherry picked from commit 9a0d7a7648547ffb77144bf2480155f6d7940dea) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-28604: Fix localeconv() for different LC_MONETARY (GH-10606) (GH-10619)Victor Stinner2018-11-201-6/+85
| | | | | | | | | | | | | | | locale.localeconv() now sets temporarily the LC_CTYPE locale to the LC_MONETARY locale if the two locales are different and monetary strings are non-ASCII. This temporary change affects other threads. Changes: * locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode monetary fields. * Add LocaleInfo.grouping_buffer: copy localeconv() grouping string since it can be replaced anytime if a different thread calls localeconv(). (cherry picked from commit 02e6bf7f2025cddcbde6432f6b6396198ab313f4)
* bpo-35021: Fix assertion failures in _datetimemodule.c. (GH-10039)Miss Islington (bot)2018-11-201-48/+51
| | | | | | | | | | | Fixes assertion failures in _datetimemodule.c introduced in the previous fix (see bpo-31752). Rather of trying to handle an int subclass as exact int, let it to use overridden special methods, but check the result of divmod(). (cherry picked from commit 3ec0f495163da3b7a15deb2805cec48aed432f58) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34725: Adds _Py_SetProgramFullPath so embedders may override ↵Steve Dower2018-11-181-0/+26
| | | | sys.executable (GH-9861)
* Fix a possible reference leak in _socket.getaddrinfo(). (GH-10543)Miss Islington (bot)2018-11-151-2/+4
| | | | | | "single" needs to be decrefed if PyList_Append() fails. (cherry picked from commit 4c596d54aa6a55e9d2a3db78891e656ebbfb63c8) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35233: InitConfigTests tests more config vars (GH-10541) (GH-10546)Victor Stinner2018-11-141-103/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test_embed.InitConfigTests tests more configuration variables. Changes: * InitConfigTests tests more core configuration variables: * base_exec_prefix * base_prefix * exec_prefix * home * module_search_path_env * prefix * "_testembed init_from_config" tests more variables: * argv * warnoptions * xoptions * Py_HasFileSystemDefaultEncoding value is no longer tested since it depends on the LC_CTYPE locale and the platform. * InitConfigTests: add check_global_config(), check_core_config() and check_main_config() subfunctions to cleanup the code. Move also constants at the class level (ex: COPY_MAIN_CONFIG). * Use more macros in _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict() to reduce code duplication. * Other minor cleanups. (cherry picked from commit 01de89cb59107d4f889aa503a1c0350dae4aebaf)
* bpo-35233: Fix _PyMainInterpreterConfig_Copy() (GH-10537)Victor Stinner2018-11-141-13/+16
| | | | Fix _PyMainInterpreterConfig_Copy(): copy 'install_signal_handlers' attribute
* [3.7] bpo-35233: Rewrite test_embed.InitConfigTests (GH-10524) (GH-10529)Victor Stinner2018-11-142-2/+256
| | | | | | | | | | | | | | | | | | | | | * Add C functions: * _Py_GetGlobalVariablesAsDict() * _PyCoreConfig_AsDict() * _PyMainInterpreterConfig_AsDict() * Add new _testcapi methods: * get_global_config() * get_core_config() * get_main_config() * test.pythoninfo: get global, core and main configuration * _testembed now serializes global, core and main configurations using JSON to reuse _Py_GetGlobalVariablesAsDict(), _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict(), rather than duplicating code. * test_embed.InitConfigTests now test much more configuration variables
* bpo-29564:_PyMem_DumpTraceback() suggests enabling tracemalloc (GH-10510) ↵Victor Stinner2018-11-131-0/+6
| | | | | | | (GH-10517) If tracemalloc is not tracing Python memory allocations, _PyMem_DumpTraceback() now suggests to enable tracemalloc to get the traceback where the memory block has been allocated.
* bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)Miss Islington (bot)2018-11-132-4/+4
| | | | | | | Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER. Project based C Preprocessor namespacing at its finest. :P (cherry picked from commit 3015fb8ce4d25603434b9b44bb7effb98a481532) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.7] bpo-35214: Initial clang MemorySanitizer support (GH-10479) (GH-10492)Gregory P. Smith2018-11-123-1/+19
| | | | | | | | | | | | | | Adds configure flags for msan and ubsan builds to make it easier to enable. These also encode the detail that address sanitizer and memory sanitizer should disable pymalloc. Define MEMORY_SANITIZER when appropriate at build time and adds workarounds to existing code to mark things as initialized where the sanitizer is otherwise unable to determine that. This lets our build succeed under the memory sanitizer. not all tests pass without sanitizer failures yet but we're in pretty good shape after this. (cherry picked from commit 1584a0081500d35dc93ff88e5836df35faf3e3e2) Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google LLC]
* bpo-35194: Fix a wrong constant in cp932 codec (GH-10420)Miss Islington (bot)2018-11-091-1/+1
| | | | | | | | | | This typo doesn't affect the result because wrong bits are discarded on implicit conversion to unsigned char, but it trips UBSan with -fsanitize=implicit-integer-truncation. https://bugs.python.org/issue35194 (cherry picked from commit 7a69cf47a9bbc95f95fd67c982bff121b2a903cb) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↵Miss Islington (bot)2018-11-053-4/+4
| | | | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings. (cherry picked from commit 34fd4c20198dea6ab2fe8dc6d32d744d9bde868d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.7]bpo-29341: Backport b942707 3.7 (#10298)BNMetrics2018-11-022-31/+31
| | | | | | | Some methods in the os module can accept path-like objects. This is documented in the general documentation but not in the function docstrings. To keep both in sync, the docstrings need to be updated to reflect that path-like objects are also accepted.. (cherry picked from commit b942707fc23454a998323c17e30be78ff1a4f0e7) Co-authored-by: BNMetrics <luna@bnmetrics.com>
* closes bpo-35139: The `pyexpat` module's macros in `Modules/Setup` now match ↵Miss Islington (bot)2018-11-021-1/+1
| | | | | | | | `setup.py` (GH-10289) This could cause compile errors on macOS or other platforms. (cherry picked from commit 318ab63c01f5b8e7562b122ab5ba01258a51277b) Co-authored-by: Max Bélanger <aeromax@gmail.com>
* bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. ↵Miss Islington (bot)2018-10-311-1/+1
| | | | | | | | | (GH-10217) _io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range value to the bitwise struct field. (cherry picked from commit b08746bfdf64e55ce33516f2065fa2aa4f51be95) Co-authored-by: Xiang Zhang <angwerzx@126.com>
* Fix a possible "double decref" in termios.tcgetattr(). (GH-10194)Miss Islington (bot)2018-10-291-2/+2
| | | | | (cherry picked from commit 53835e92d315340444e3dd083b3f69a590b00e07) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35090: Fix potential division by zero in allocator wrappers (GH-10174)Miss Islington (bot)2018-10-283-5/+5
| | | | | | | | | | * Fix potential division by zero in BZ2_Malloc() * Avoid division by zero in PyLzma_Malloc() * Avoid division by zero and integer overflow in PyZlib_Malloc() Reported by Svace static analyzer. (cherry picked from commit 3d4fabb2a424cb04ae446ebe4428090c386f45a5) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128)Miss Islington (bot)2018-10-261-5/+5
| | | | | | | | | | | | | | | | Declare functions with EXTINLINE: * mpd_del() * mpd_uint_zero() * mpd_qresize() * mpd_qresize_zero() * mpd_minalloc() These functions are implemented with "inline" or "ALWAYS_INLINE", but declared without inline which cause linker error on Visual Studio in Debug mode when using /Ob1. (cherry picked from commit 3b1cba3701fd1321a9bdafa9e683f891369f0cfd) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-34794: Fix a leak in Tkinter. (GH-10025) (GH-10069)Miss Islington (bot)2018-10-231-3/+1
| | | | | | Based on the investigation by Xiang Zhang. (cherry picked from commit df13df41a25765d8a39a77220691698498e758d4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix error handling bugs in _elementtree.c. (GH-10060)Miss Islington (bot)2018-10-231-11/+11
| | | | | | | References could leak, NULL could be dereferenced, and the Expat parser could be double freed when some errors raised. (cherry picked from commit 9f3ed3e213b30059087d059a7d1d3b2527fa8654) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-34454: Clean up datetime.fromisoformat surrogate handling (GH-8959)Miss Islington (bot)2018-10-221-72/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use _PyUnicode_Copy in sanitize_isoformat_str * Use repr in fromisoformat error message This reverses commit 67b74a98b2 per Serhiy Storchaka's suggestion: I suggested to use %R in the error message because including the raw string can be confusing in the case of empty string, or string containing trailing whitespaces, invisible or unprintable characters. We agree that it is better to change both the C and pure Python versions to use repr. * Retain non-sanitized dtstr for error printing This does not create an extra string, it just holds on to a reference to the original input string for purposes of creating the error message. * PEP 7 fixes to from_isoformat * Separate handling of Unicode and other errors In the initial implementation, errors other than encoding errors would both raise an error indicating an invalid format, which would not be true for errors like MemoryError. * Drop needs_decref from _sanitize_isoformat_str Instead _sanitize_isoformat_str returns a new reference, even to the original string. (cherry picked from commit 3df85404d4bf420db3362eeae1345f2cad948a71) Co-authored-by: Paul Ganssle <pganssle@users.noreply.github.com>
* closes bpo-35025: Properly guard the `CLOCK_GETTIME` et al macros in ↵Miss Islington (bot)2018-10-211-0/+4
| | | | | | | | timemodule.c. (GH-9961) Guard the `CLOCK_GETTIME` et al macros in `timemodule` based on the availability of the parent functions (cherry picked from commit 94451182ccd6729c11338926d8a3d11645e86626) Co-authored-by: Max Bélanger <aeromax@gmail.com>
* bpo-32890, os: Use errno instead of GetLastError() in execve() and ↵Miss Islington (bot)2018-10-201-3/+15
| | | | | | | | | | | | | truncate() (GH-5784) path_error() uses GetLastError() on Windows, but some os functions are implemented via CRT APIs which report errors via errno. This may result in raising OSError with invalid error code (such as zero). Introduce posix_path_error() function and use it where appropriate. (cherry picked from commit 834603112e6ca35944dd21105b01fca562dc3241) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-20216: Correct docstrings of digest() methods in hashlib. (GH-9873) ↵Miss Islington (bot)2018-10-199-17/+17
| | | | | | | (GH-9971) (cherry picked from commit f192aeb95a139ede74d69e39c046c498ff288a37) Co-authored-by: Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) <srinivasreddy@users.noreply.github.com>
* bpo-34824: Fix a possible NULL pointer dereference in _ssl.c (GH-9606) (GH-9743)Miss Islington (bot)2018-10-191-2/+7
| | | | | | | | | On failure, _PyBytes_Resize() will deallocate the bytes object and set "result" to NULL. https://bugs.python.org/issue34824 (cherry picked from commit 365ad2ead5bbaf7a3b18648ffa36e819559d3f75) Co-authored-by: Zackery Spytz <zspytz@gmail.com>