summaryrefslogtreecommitdiff
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments. ↵Serhiy Storchaka2020-02-232-135/+110
| | | | | | | | | | | | | | | | (GH-18604) * bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments. * Simplify fast path. * Difine lcm() without arguments returning 1. * Apply suggestions from code review Co-Authored-By: Mark Dickinson <dickinsm@gmail.com> Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-35950: Raise UnsupportedOperation in BufferedReader.truncate() (GH-18586)Berker Peksag2020-02-211-5/+9
| | | | | | | | | | | | | | | The truncate() method of io.BufferedReader() should raise UnsupportedOperation when it is called on a read-only io.BufferedReader() instance. https://bugs.python.org/issue35950 Automerge-Triggered-By: @methane
* bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581)Stefan Krah2020-02-212-6/+210
|
* Use the new recommended number of repetitions in the refleak tests. (#18569)Stefan Krah2020-02-201-1/+1
|
* Update runall.bat to the latest Windows build system. (#18571)Stefan Krah2020-02-201-41/+59
|
* Valgrind no longer supports --db-attach=yes. (#18568)Stefan Krah2020-02-201-1/+1
|
* bpo-39479:Add math.lcm() function: Least Common Multiple (#18547)ananthan-1232020-02-192-1/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update math.rst * Update math.rst * updated whats new * Update test_math.py * Update mathmodule.c * Update mathmodule.c.h * Update ACKS * 📜🤖 Added by blurb_it. * Update 3.9.rst * Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst * Update math.rst * Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst * Update test_math.py * Update ACKS * Update mathmodule.c.h * Update mathmodule.c * Update mathmodule.c.h * Update mathmodule.c.h Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP ↵Hai Shi2020-02-181-21/+35
| | | | | 489) (GH-18050) https://bugs.python.org/issue1635741
* bpo-1635741: Port _abc extension to multiphase initialization (PEP 489) ↵Hai Shi2020-02-171-9/+18
| | | | (GH-18030)
* bpo-1635741: Port _contextvars module to multiphase initialization (PEP 489) ↵Hai Shi2020-02-171-26/+29
| | | | (GH-18374)
* bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)Dong-hee Na2020-02-1727-43/+43
|
* bpo-1635741: Port _crypt extension module to multiphase initialization (PEP ↵Hai Shi2020-02-171-3/+6
| | | | 489) (GH-18404)
* bpo-39573: Update clinic to use Py_IS_TYPE() function (GH-18507)Dong-hee Na2020-02-142-6/+6
|
* bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`, ↵Saiyang Gou2020-02-135-17/+180
| | | | `resource`, `shutil`, `signal`, `syslog` (GH-18407)
* closes bpo-39621: Make buf arg to md5_compress be const. (GH-18497)Andy Lester2020-02-121-2/+2
|
* bpo-35081: Move dtoa.h header to the internal C API (GH-18489)Victor Stinner2020-02-123-2/+4
| | | | | | | Move the dtoa.h header file to the internal C API as pycore_dtoa.h: it only contains private functions (prefixed by "_Py"). The math and cmath modules must now be compiled with the Py_BUILD_CORE macro defined.
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Andy Lester2020-02-111-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
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-1128-115/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-1635741: Port _codecs extension module to multiphase initialization (PEP ↵Hai Shi2020-02-111-3/+7
| | | | | 489) (GH-18065) https://bugs.python.org/issue1635741
* bpo-39590: make deque.__contains__ and deque.count hold strong references ↵sweeneyde2020-02-091-0/+4
| | | | (GH-18421)
* bpo-39573: Use Py_TYPE() macro in ctypes.h (GH-18411)Dong-hee Na2020-02-091-2/+2
|
* bpo-39573: Use Py_SET_SIZE() function (GH-18402)Victor Stinner2020-02-076-28/+30
| | | | Replace direct acccess to PyVarObject.ob_size with usage of the Py_SET_SIZE() function.
* bpo-39573: Add Py_SET_TYPE() function (GH-18394)Victor Stinner2020-02-0715-36/+47
| | | Add Py_SET_TYPE() function to set the type of an object.
* bpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393)Victor Stinner2020-02-0726-40/+40
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-39573: Add Py_SET_REFCNT() function (GH-18389)Victor Stinner2020-02-071-7/+8
| | | | Add a Py_SET_REFCNT() function to set the reference counter of an object.
* bpo-39573: Use Py_REFCNT() macro (GH-18388)Victor Stinner2020-02-072-9/+11
| | | | Replace direct acccess to PyObject.ob_refcnt with usage of the Py_REFCNT() macro.
* bpo-39184: Add audit events to command execution functions in os and pty ↵Saiyang Gou2020-02-051-7/+42
| | | | modules (GH-17824)
* bpo-39542: Make _Py_NewReference() opaque in C API (GH-18346)Victor Stinner2020-02-051-0/+1
| | | | | | | | | | _Py_NewReference() becomes a regular opaque function, rather than a static inline function in the C API (object.h), to better hide implementation details. Move _Py_tracemalloc_config from public pymem.h to internal pycore_pymem.h header. Make _Py_AddToAllObjects() private.
* closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)Philipp Gesang2020-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | When called on a closed object, readinto() segfaults on account of a write to a freed buffer: ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==220553== Access not within mapped region at address 0x2A ==220553== at 0x48408A0: memmove (vg_replace_strmem.c:1272) ==220553== by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972) ==220553== by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053) ==220553== by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253) Reproducer: reader = open ("/dev/zero", "rb") _void = reader.read (42) reader.close () reader.readinto (bytearray (42)) ### BANG! The problem exists since 2012 when commit dc469454ec added code to free the read buffer on close(). Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
* bpo-39542: Simplify _Py_NewReference() (GH-18332)Victor Stinner2020-02-031-3/+5
| | | | | | | | | * Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify directly _Py_RefTotal. * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS macro is not defined. * Remove _Py_NewReference() implementation from object.c: unify the two implementations in object.h inline function. * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-031-10/+0
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-39492: Fix a reference cycle between reducer_override and a Pickler ↵Pierre Glaser2020-02-021-4/+18
| | | | | | | | | | | | instance (GH-18266) This also needs a backport to 3.8 https://bugs.python.org/issue39492 Automerge-Triggered-By: @pitrou
* bpo-39496: Remove redundant checks from _sqlite/cursor.c (GH-18270)Alex Henrie2020-02-011-20/+6
|
* bpo-39511: Fix multiprocessing semlock_acquire() (GH-18298)Victor Stinner2020-02-011-10/+11
| | | | The Python C API must not be used when the GIL is released: only access Py_None when the GIL is hold.
* bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError() (GH-18278)Victor Stinner2020-01-301-15/+1
| | | | | | | | | Add _Py_NO_RETURN to functions calling Py_FatalError(): * _PyObject_AssertFailed() * dummy_dealloc() * faulthandler_fatal_error_thread() * none_dealloc() * notimplemented_dealloc()
* bpo-39497: Remove unused variable from pysqlite_cursor_executescript (GH-18271)Alex Henrie2020-01-301-3/+0
|
* bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)Victor Stinner2020-01-301-5/+0
| | | The binascii.crc_hqx() function is no longer deprecated.
* bpo-39494: Remove extra null terminators from kwlist vars (GH-18267)Alex Henrie2020-01-302-3/+3
|
* bpo-39393: Misleading error message on dependent DLL resolution failure ↵Zackery Spytz2020-01-281-2/+3
| | | | (GH-18093)
* bpo-38631: Avoid Py_FatalError() in GC collect() (GH-18164)Victor Stinner2020-01-241-7/+1
| | | | | | | collect() should not get an exception, but it does, logging the exception is enough. Override sys.unraisablehook to decide how to handle unraisable exceptions. Py_FatalError() should be avoided whenever possible.
* bpo-39395: putenv() and unsetenv() always available (GH-18135)Victor Stinner2020-01-242-84/+9
| | | | | | | | The os.putenv() and os.unsetenv() functions are now always available. On non-Windows platforms, Python now requires setenv() and unsetenv() functions to build. Remove putenv_dict from posixmodule.c: it's not longer needed.
* bpo-39413: Implement os.unsetenv() on Windows (GH-18163)Victor Stinner2020-01-242-41/+108
| | | The os.unsetenv() function is now also available on Windows.
* bpo-39426: Fix outdated default and highest protocols in docs (GH-18154)Mark Dickinson2020-01-242-16/+18
| | | | | | Some portions of the pickle documentation hadn't been updated for the pickle protocol changes in Python 3.8 (new protocol 5, default protocol 4). This PR fixes those docs. https://bugs.python.org/issue39426
* bpo-39421: Fix posible crash in heapq with custom comparison operators ↵Pablo Galindo2020-01-231-9/+26
| | | | | | | | | | (GH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators
* bpo-39406: Implement os.putenv() with setenv() if available (GH-18128)Victor Stinner2020-01-222-23/+25
| | | | | If setenv() C function is available, os.putenv() is now implemented with setenv() instead of putenv(), so Python doesn't have to handle the environment variable memory.
* bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)Victor Stinner2020-01-221-2/+6
| | | | Windows: _wputenv(env) copies the *env* string and doesn't require the caller to manage the variable memory.
* Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)Victor Stinner2020-01-222-84/+4
| | | This reverts commit 56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8.
* bpo-39353: Deprecate the binhex module (GH-18025)Victor Stinner2020-01-222-12/+32
| | | | | | | | Deprecate binhex4 and hexbin4 standards. Deprecate the binhex module and the following binascii functions: * b2a_hqx(), a2b_hqx() * rlecode_hqx(), rledecode_hqx() * crc_hqx()
* bpo-39406: Add PY_PUTENV_DICT macro to posixmodule.c (GH-18106)Victor Stinner2020-01-211-15/+37
| | | Rename posix_putenv_garbage to putenv_dict.
* bpo-39413: Implement os.unsetenv() on Windows (GH-18104)Victor Stinner2020-01-212-4/+82
| | | | | The os.unsetenv() function is now also available on Windows. It is implemented with SetEnvironmentVariableW(name, NULL).