summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* gh-111863: Rename `Py_NOGIL` to `Py_GIL_DISABLED` (#111864)Hugo van Kemenade2023-11-201-3/+3
| | | Rename Py_NOGIL to Py_GIL_DISABLED
* gh-112266: Remove `(if defined)` part from `__dict__` and `__weakref__` ↵Nikita Sobolev2023-11-191-4/+4
| | | | docstrings (#112268)
* gh-112026: Restore removed _PyDict_GetItemStringWithError() (#112119)Victor Stinner2023-11-151-0/+14
| | | | Restore the removed _PyDict_GetItemStringWithError() function. It is used by numpy.
* gh-96954: Fix `make regen-unicodedata` in out-of-tree builds (#112118)Miro Hrončok2023-11-151-1/+1
| | | | | | | | | This avoids: python3.13 Tools/unicode/makeunicodedata.py python3.13: can't open file '.../build/debug/Tools/unicode/makeunicodedata.py': [Errno 2] No such file or directory make: *** [Makefile:1498: regen-unicodedata] Error 2 Re-run `make regen-unicodedata` to update the script path in generated files.
* gh-112026: Restore removed private C API (#112115)Victor Stinner2023-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restore removed private C API functions, macros and structures which have no simple replacement for now: * _PyDict_GetItem_KnownHash() * _PyDict_NewPresized() * _PyHASH_BITS * _PyHASH_IMAG * _PyHASH_INF * _PyHASH_MODULUS * _PyHASH_MULTIPLIER * _PyLong_Copy() * _PyLong_FromDigits() * _PyLong_New() * _PyLong_Sign() * _PyObject_CallMethodId() * _PyObject_CallMethodNoArgs() * _PyObject_CallMethodOneArg() * _PyObject_CallOneArg() * _PyObject_EXTRA_INIT * _PyObject_FastCallDict() * _PyObject_GetAttrId() * _PyObject_Vectorcall() * _PyObject_VectorcallMethod() * _PyStack_AsDict() * _PyThread_CurrentFrames() * _PyUnicodeWriter structure * _PyUnicodeWriter_Dealloc() * _PyUnicodeWriter_Finish() * _PyUnicodeWriter_Init() * _PyUnicodeWriter_Prepare() * _PyUnicodeWriter_PrepareKind() * _PyUnicodeWriter_WriteASCIIString() * _PyUnicodeWriter_WriteChar() * _PyUnicodeWriter_WriteLatin1String() * _PyUnicodeWriter_WriteStr() * _PyUnicodeWriter_WriteSubstring() * _PyUnicode_AsString() * _PyUnicode_FromId() * _PyVectorcall_Function() * _Py_HashDouble() * _Py_HashPointer() * _Py_IDENTIFIER() * _Py_c_abs() * _Py_c_diff() * _Py_c_neg() * _Py_c_pow() * _Py_c_prod() * _Py_c_quot() * _Py_c_sum() * _Py_static_string() * _Py_static_string_init()
* gh-111906: Fix warnings during mimalloc build on FreeBSD (#111907)Furkan Onder2023-11-141-2/+2
| | | Fix `unused function` warnings during mimalloc build on FreeBSD.
* gh-111262: Add PyDict_Pop() function (#112028)Victor Stinner2023-11-143-40/+96
| | | | | | | _PyDict_Pop_KnownHash(): remove the default value and the return type becomes an int. Co-authored-by: Stefan Behnel <stefan_ml@behnel.de> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* gh-111789: Use PyDict_GetItemRef() in Objects/ (GH-111827)Serhiy Storchaka2023-11-145-120/+76
|
* gh-111138: Add PyList_Extend() and PyList_Clear() functions (#111862)Victor Stinner2023-11-132-122/+177
| | | | | | * Split list_extend() into two sub-functions: list_extend_fast() and list_extend_iter(). * list_inplace_concat() no longer has to call Py_DECREF() on the list_extend() result, since list_extend() now returns an int.
* gh-111999: Add signatures and improve docstrings for builtins (GH-112000)Serhiy Storchaka2023-11-136-27/+53
|
* gh-110481: fix 'unused function' warning for `is_shared_refcnt_dead`. ↵Sam Gross2023-11-101-4/+6
| | | | | | | (gh-111974) Fix 'unused function' warning for `is_shared_refcnt_dead`. The `is_shared_refcnt_dead` function is only used if `Py_REF_DEBUG` is set.
* Add private _PyUnicode_AsUTF8NoNUL() function (GH-111957)Serhiy Storchaka2023-11-101-0/+12
| | | | Like PyUnicode_AsUTF8(), but check for embedded null characters.
* Improve error message for "float modulo by zero" (#111685)Pavel Ovchinnikov2023-11-091-1/+1
|
* gh-111354: remove comparisons with enum values, variable reuse, unused ↵Irit Katriel2023-11-091-22/+14
| | | | imports in genobject.c (#111708)
* gh-111569: Implement Python critical section API (gh-111571)Sam Gross2023-11-081-1/+1
| | | | | | | | Critical sections are helpers to replace the global interpreter lock with finer grained locking. They provide similar guarantees to the GIL and avoid the deadlock risk that plain locking involves. Critical sections are implicitly ended whenever the GIL would be released. They are resumed when the GIL would be acquired. Nested critical sections behave as if the sections were interleaved.
* gh-110543: Fix CodeType.replace in presence of comprehensions (#110586)Jelle Zijlstra2023-11-081-0/+29
|
* gh-111089: Revert PyUnicode_AsUTF8() changes (#111833)Victor Stinner2023-11-077-29/+92
| | | | | | | | | | | | | | | | | | | | | * Revert "gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)" This reverts commit d9b606b3d04fc56fb0bcc479d7d6c14562edb5e2. * Revert "gh-111089: Use PyUnicode_AsUTF8() in getargs.c (#111620)" This reverts commit cde1071b2a72e8261ca66053ef61431b7f3a81fd. * Revert "gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)" This reverts commit d731579bfb9a497cfb0076cb6b221058a20088fe. * Revert "gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)" This reverts commit d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44. * Revert "gh-111089: Use PyUnicode_AsUTF8() in sqlite3 (#111122)" This reverts commit 37e4e20eaa8f27ada926d49e5971fecf0477ad26.
* gh-81137: deprecate assignment of code object to a function of a mismatched ↵Irit Katriel2023-11-071-0/+14
| | | | type (#111823)
* gh-106672: C API: Report indiscriminately ignored errors (GH-106674)Serhiy Storchaka2023-11-073-25/+69
| | | | | Functions which indiscriminately ignore all errors now report them as unraisable errors.
* gh-79932: raise exception if frame.clear() is called on a suspended frame ↵Irit Katriel2023-11-071-0/+7
| | | | (#111792)
* simplify code to pop exception in frame_setlineno (#111702)Irit Katriel2023-11-061-5/+2
|
* gh-111666: Speed up `BaseExceptionGroup.{derive,split,subgroup}` (#111667)Nikita Sobolev2023-11-041-20/+6
|
* gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C API ↵Victor Stinner2023-11-031-0/+8
| | | | | | | | (#111508) In the limited C API version 3.13, Py_SET_REFCNT() function is now implemented as an opaque function call. Add _Py_SetRefcnt() to the stable ABI.
* gh-103615: Use local events for opcode tracing (GH-109472)Tian Gao2023-11-031-1/+7
| | | | | | | * Use local monitoring for opcode trace * Remove f_opcode_trace_set * Add test for setting f_trace_opcodes after settrace
* gh-106168: Revert the "size before item" setting (#111683)scoder2023-11-031-1/+1
| | | | gh-106168: Update the size only after setting the item, to avoid temporary inconsistencies. Also remove the "what's new" sentence regarding the size setting since tuples cannot grow after allocation.
* gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and ↵Irit Katriel2023-11-032-25/+10
| | | | frame state (#111648)
* GH-109369 Add vectorcall to `PyLong_Type` (GH-111642)Mark Shannon2023-11-021-0/+25
|
* gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 ↵Irit Katriel2023-11-022-19/+11
| | | | (#111459)
* gh-108082: Use PyErr_FormatUnraisable() (GH-111580)Serhiy Storchaka2023-11-025-51/+19
| | | | | | Replace most of calls of _PyErr_WriteUnraisableMsg() and some calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable(). Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-111544: Fix mimalloc build on AIX (#111593)Ayappan Perumal2023-11-021-2/+2
|
* gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)Victor Stinner2023-11-015-89/+19
| | | | | | | Replace PyUnicode_AsUTF8AndSize() with PyUnicode_AsUTF8() to remove the explicit check for embedded null characters. The change avoids to have to include explicitly <string.h> to get the strlen() function when using a recent version of the limited C API.
* gh-90815: Exclude mimalloc .c files from Windows build (#111532)Dino Viehland2023-10-311-9/+10
| | | | * Don't include mimalloc .c's in Windows build * Fix warnings on Windows related to mimalloc
* gh-76785: Move the Cross-Interpreter Code to Its Own File (gh-111502)Eric Snow2023-10-301-0/+1
| | | This is partly to clear this stuff out of pystate.c, but also in preparation for moving some code out of _xxsubinterpretersmodule.c. This change also moves this stuff to the internal API (new: Include/internal/pycore_crossinterp.h). @vstinner did this previously and I undid it. Now I'm re-doing it. :/
* gh-90815: Fix mimalloc build on WASI (#111524)Victor Stinner2023-10-301-0/+1
| | | Include <unistd.h> to get sbrk() function.
* gh-90815: Fix _PyMem_MimallocEnabled() compiler warning (#111522)Victor Stinner2023-10-301-6/+6
| | | | | | Don't declare _PyMem_MimallocEnabled() if WITH_PYMALLOC macro is not defined (./configure --without-pymalloc). Fix also a typo in _PyInterpreterState_FinalizeAllocatedBlocks().
* gh-110481: Implement biased reference counting (gh-110764)Sam Gross2023-10-304-17/+132
|
* gh-90815: Add mimalloc memory allocator (#109914)Dino Viehland2023-10-3030-19/+13209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add mimalloc v2.12 Modified src/alloc.c to remove include of alloc-override.c and not compile new handler. Did not include the following files: - include/mimalloc-new-delete.h - include/mimalloc-override.h - src/alloc-override-osx.c - src/alloc-override.c - src/static.c - src/region.c mimalloc is thread safe and shares a single heap across all runtimes, therefore finalization and getting global allocated blocks across all runtimes is different. * mimalloc: minimal changes for use in Python: - remove debug spam for freeing large allocations - use same bytes (0xDD) for freed allocations in CPython and mimalloc This is important for the test_capi debug memory tests * Don't export mimalloc symbol in libpython. * Enable mimalloc as Python allocator option. * Add mimalloc MIT license. * Log mimalloc in Lib/test/pythoninfo.py. * Document new mimalloc support. * Use macro defs for exports as done in: https://github.com/python/cpython/pull/31164/ Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* GH-111339: Fix initialization and finalization of static optimizer types ↵Savannah Ostrowski2023-10-291-0/+6
| | | | (GH-111430)
* gh-89519: Remove classmethod descriptor chaining, deprecated since 3.11 ↵Raymond Hettinger2023-10-271-4/+0
| | | | (gh-110163)
* gh-111354: define names for RESUME oparg values (#111365)Irit Katriel2023-10-261-1/+2
|
* gh-109094: replace frame->prev_instr by frame->instr_ptr (#109095)Irit Katriel2023-10-263-9/+37
|
* gh-100762: Fix optimization in gen_close (#111069)Irit Katriel2023-10-251-2/+3
|
* GH-94438: Restore ability to jump over None tests (GH-111237)Savannah Ostrowski2023-10-241-0/+2
|
* gh-109894: Fix initialization of static `MemoryError` in subinterpreter ↵Radislav Chugunov2023-10-231-4/+0
| | | | | | | | | | | | (gh-110911) Fixes #109894 * set `interp.static_objects.last_resort_memory_error.args` to empty tuple to avoid crash on `PyErr_Display()` call * allow `_PyExc_InitGlobalObjects()` to be called on subinterpreter init --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-67565: Remove redundant C-contiguity checks (GH-105521)Furkan Onder2023-10-232-58/+2
| | | | Co-authored-by: Stefan Krah <skrah@bytereef.org>
* gh-111089: PyUnicode_AsUTF8AndSize() sets size on error (#111106)Victor Stinner2023-10-201-1/+8
| | | | On error, PyUnicode_AsUTF8AndSize() now sets the size argument to -1, to avoid undefined value.
* gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)Victor Stinner2023-10-202-3/+10
| | | | | | | | | * PyUnicode_AsUTF8() now raises an exception if the string contains embedded null characters. * Update related C API tests (test_capi.test_unicode). * type_new_set_doc() uses PyUnicode_AsUTF8AndSize() to silently truncate doc containing null bytes. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-110964: Remove private _PyArg functions (#110966)Victor Stinner2023-10-1730-26/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the following private functions and structures to pycore_modsupport.h internal C API: * _PyArg_BadArgument() * _PyArg_CheckPositional() * _PyArg_NoKeywords() * _PyArg_NoPositional() * _PyArg_ParseStack() * _PyArg_ParseStackAndKeywords() * _PyArg_Parser structure * _PyArg_UnpackKeywords() * _PyArg_UnpackKeywordsWithVararg() * _PyArg_UnpackStack() * _Py_ANY_VARARGS() Changes: * Python/getargs.h now includes pycore_modsupport.h to export functions. * clinic.py now adds pycore_modsupport.h when one of these functions is used. * Add pycore_modsupport.h includes when a C extension uses one of these functions. * Define Py_BUILD_CORE_MODULE in C extensions which now include directly or indirectly (via code generated by Argument Clinic) pycore_modsupport.h: * _csv * _curses_panel * _dbm * _gdbm * _multiprocessing.posixshmem * _sqlite.row * _statistics * grp * resource * syslog * _testcapi: bad_get() no longer uses METH_FASTCALL calling convention but METH_VARARGS. Replace _PyArg_UnpackStack() with PyArg_ParseTuple(). * _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined by _testcapi sub-modules which need the internal C API (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c, watchers.c. * Remove Include/cpython/modsupport.h header file. Include/modsupport.h no longer includes the removed header file. * Fix mypy clinic.py
* gh-110864: TypeVar constructor: Partially revert gh-110784, `constraints` ↵Nikita Sobolev2023-10-161-20/+14
| | | | cannot be `NULL` (#110922)
* gh-110907: AC: Disallow using `*` with vararg (#110908)Nikita Sobolev2023-10-162-4/+3
|