summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-108717: Speedup `os.DirEntry.is_junction` function (#108718)Nikita Sobolev2023-09-062-13/+7
|
* gh-108294: Add error handling for time.sleep audit event (GH-108363)Petr Viktorin2023-09-051-1/+3
| | | | | I've also cleaned the tests up a bit to make this easier to test.
* gh-106320: Remove private _PyErr_WriteUnraisableMsg() (#108863)Victor Stinner2023-09-0410-70/+76
| | | | | | Move the private _PyErr_WriteUnraisableMsg() functions to the internal C API (pycore_pyerrors.h). Move write_unraisable_exc() from _testcapi to _testinternalcapi.
* Revert "gh-46376: Return existing pointer when possible in ctypes (#1… ↵Victor Stinner2023-09-041-35/+0
| | | | | | | | (#108688) This reverts commit 08447b5deb47e2a0df87fa0a0576d300e5c909b4. Revert also _ctypes.c changes of the PyDict_ContainsString() change, commit 67266266469fe0e817736227f39537182534c1a5.
* gh-108765: Python.h no longer includes <ctype.h> (#108831)Victor Stinner2023-09-037-44/+57
| | | | | | | | | | | | | | | | | | | | | | | Remove <ctype.h> in C files which don't use it; only sre.c and _decimal.c still use it. Remove _PY_PORT_CTYPE_UTF8_ISSUE code from pyport.h: * Code added by commit b5047fd01948ab108edcc1b3c2c901d915814cfd in 2004 for MacOSX and FreeBSD. * Test removed by commit 52ddaefb6bab1a74ecffe8519c02735794ebfbe1 in 2007, since Python str type now uses locale independent functions like Py_ISALPHA() and Py_TOLOWER() and the Unicode database. Modules/_sre/sre.c replaces _PY_PORT_CTYPE_UTF8_ISSUE with new functions: sre_isalnum(), sre_tolower(), sre_toupper(). Remove unused includes: * _localemodule.c: remove <stdio.h>. * getargs.c: remove <float.h>. * dynload_win.c: remove <direct.h>, it no longer calls _getcwd() since commit fb1f68ed7cc1536482d1debd70a53c5442135fe2 (in 2001).
* gh-108494: Argument Clinic: inline parsing code for positional-only ↵Serhiy Storchaka2023-09-0310-41/+51
| | | | parameters in the limited C API (GH-108622)
* gh-102837: improve test coverage for math module (#102523)Sergey B Kirpichev2023-09-031-10/+7
| | | | | | | | - input checks for math_1(L989), math_1a(L1023), math_2(L1064,L1071), hypot(L2682), log(L2307), ldexp(L2168), ceil(L1165), floor(L1236,L1239) and dist(L2587,L2588,L2628). - drop inaccessible "if" branch (L3518) in perm_comb_small() - improve fsum coverage for exceptional cases (L1433,L1438,L1451,L1497), ditto fmod(L2378) - rewrite modf to fix inaccessible case(L2229), ditto for pow(L2988) (all line numbers are wrt the main branch at 5e6661bce9)
* gh-108765: include <unistd.h> in termios.c on Solaris (#108825)Jakub Kulík2023-09-021-0/+3
|
* gh-63760: Don't declare gethostname() on Solaris (#108817)Victor Stinner2023-09-021-5/+0
| | | | | | | | | | | | | Since 2005, Solaris defines gethostname(). socketmodule.c no longer has to define gethostname() for Solaris. Oracle Solaris and OpenSolaris have patches to remove the gethostname() definition in Python: * https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch * https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch * https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* gh-108765: multiprocessing.h includes <unistd.h> (#108823)Victor Stinner2023-09-021-0/+4
|
* gh-108765: Python.h no longer includes <sys/time.h> (#108775)Victor Stinner2023-09-027-18/+24
| | | | | | | | | Python.h no longer includes <time.h>, <sys/select.h> and <sys/time.h> standard header files. * Add <time.h> include to xxsubtype.c. * Add <sys/time.h> include to posixmodule.c and semaphore.c. * readline.c includes <sys/select.h> instead of <sys/time.h>. * resource.c no longer includes <time.h> and <sys/time.h>.
* gh-108765: Python.h no longer includes <unistd.h> (#108783)Victor Stinner2023-09-0210-30/+35
|
* gh-108765: Remove old prototypes from pyport.h (#108782)Victor Stinner2023-09-023-4/+22
| | | | | | | Move prototypes of gethostname(), _getpty() and struct termios from pyport.h to the C code using them: posixmodule.c, socketmodule.c and termios.c. Replace "#ifdef SOLARIS" with "#ifdef __sun".
* gh-108777: Split _PyTime tests from _testinternalcapi.c (gh-108787)Sam Gross2023-09-026-262/+306
|
* Add Modules/_testcapi/util.h header (GH-108774)Serhiy Storchaka2023-09-016-93/+48
| | | It contains common macros used in C API tests.
* gh-108767: Replace ctype.h functions with pyctype.h functions (#108772)Victor Stinner2023-09-013-9/+10
| | | | | | | | | | | | | | Replace <ctype.h> locale dependent functions with Python "pyctype.h" locale independent functions: * Replace isalpha() with Py_ISALPHA(). * Replace isdigit() with Py_ISDIGIT(). * Replace isxdigit() with Py_ISXDIGIT(). * Replace tolower() with Py_TOLOWER(). Leave Modules/_sre/sre.c unchanged, it uses locale dependent functions on purpose. Include explicitly <ctype.h> in _decimal.c to get isascii().
* gh-106320: Remove private _PyLong_Sign() (#108743)Victor Stinner2023-09-012-0/+6
| | | | | | Move the private _PyLong_Sign() and _PyLong_NumBits() functions to the internal C API (pycore_long.h). Modules/_testcapi/long.c now uses the internal C API.
* gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)Victor Stinner2023-08-3193-508/+246
| | | | | | | | | | | | | | | | | | | | Argument Clinic now only includes pycore_gc.h if PyGC_Head is needed, and only includes pycore_runtime.h if _Py_ID() is needed. * Add 'condition' optional argument to Clinic.add_include(). * deprecate_keyword_use() includes pycore_runtime.h when using the _PyID() function. * Fix rendering of includes: comments start at the column 35. * Mark PC/clinic/_wmimodule.cpp.h and "Objects/stringlib/clinic/*.h.h" header files as generated in .gitattributes. Effects: * 42 header files generated by AC no longer include the internal C API, instead of 4 header files before. For example, Modules/clinic/_abc.c.h no longer includes the internal C API. * Fix _testclinic_depr.c.h: it now always includes pycore_runtime.h to get _Py_ID().
* gh-108337: Add pyatomic.h header (#108701)Victor Stinner2023-08-314-1/+185
| | | | | | | | This adds a new header that provides atomic operations on common data types. The intention is that this will be exposed through Python.h, although that is not the case yet. The only immediate use is in the test file. Co-authored-by: Sam Gross <colesbury@gmail.com>
* gh-108634: Py_TRACE_REFS uses a hash table (#108663)Victor Stinner2023-08-311-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python built with "configure --with-trace-refs" (tracing references) is now ABI compatible with Python release build and debug build. Moreover, it now also supports the Limited API. Change Py_TRACE_REFS build: * Remove _PyObject_EXTRA_INIT macro. * The PyObject structure no longer has two extra members (_ob_prev and _ob_next). * Use a hash table (_Py_hashtable_t) to trace references (all objects): PyInterpreterState.object_state.refchain. * Py_TRACE_REFS build is now ABI compatible with release build and debug build. * Limited C API extensions can now be built with Py_TRACE_REFS: xxlimited, xxlimited_35, _testclinic_limited. * No longer rename PyModule_Create2() and PyModule_FromDefAndSpec2() functions to PyModule_Create2TraceRefs() and PyModule_FromDefAndSpec2TraceRefs(). * _Py_PrintReferenceAddresses() is now called before finalize_interp_delete() which deletes the refchain hash table. * test_tracemalloc find_trace() now also filters by size to ignore the memory allocated by _PyRefchain_Trace(). Test changes for Py_TRACE_REFS: * Add test.support.Py_TRACE_REFS constant. * Add test_sys.test_getobjects() to test sys.getobjects() function. * test_exceptions skips test_recursion_normalizing_with_no_memory() and test_memory_error_in_PyErr_PrintEx() if Python is built with Py_TRACE_REFS. * test_repl skips test_no_memory(). * test_capi skisp test_set_nomemory().
* gh-106320: winconsoleio.c includes pycore_pyerrors.h (#108720)Victor Stinner2023-08-311-0/+1
| | | | | Fix compiler warning: warning C4013: '_PyErr_ChainExceptions1' undefined
* gh-106320: Remove private _PyErr_ChainExceptions() (#108713)Victor Stinner2023-08-3110-103/+119
| | | | | | | | | | | | | Remove _PyErr_ChainExceptions(), _PyErr_ChainExceptions1() and _PyErr_SetFromPyStatus() functions from the public C API. * Move the private _PyErr_ChainExceptions() and _PyErr_ChainExceptions1() function to the internal C API (pycore_pyerrors.h). * Move the private _PyErr_SetFromPyStatus() to the internal C API (pycore_initconfig.h). * No longer export the _PyErr_ChainExceptions() function. * Move run_in_subinterp_with_config() from _testcapi to _testinternalcapi.
* gh-108278: Deprecate passing the first param of sqlite3.Connection callback ↵Erlend E. Aasland2023-08-292-16/+111
| | | | | | | | | | | | APIs by keyword (#108632) Deprecate passing the callback callable by keyword for the following sqlite3.Connection APIs: - set_authorizer(authorizer_callback) - set_progress_handler(progress_handler, ...) - set_trace_callback(trace_callback) The affected parameters will become positional-only in Python 3.15.
* gh-107801: Improve the accuracy of io.IOBase.seek docs (#108268)Erlend E. Aasland2023-08-292-2/+9
| | | | | | | - Add param docstrings - Link to os.SEEK_* constants - Mention the return value in the initial paragraph Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-108623: Fix compile warning in `Modules/_multiprocessing/semaphore.c` ↵Nikita Sobolev2023-08-291-0/+5
| | | | (#108624)
* gh-108494: Don't build _testclinic_limited with TraceRefs (#108608)Victor Stinner2023-08-291-1/+1
| | | | | If Python is built with ./configure --with-trace-refs, don't build the _testclinic_limited extension. The limited C API (Py_LIMITED_API) is not compatible with Py_TRACE_REFS.
* gh-106320: Remove private pythonrun API (#108599)Victor Stinner2023-08-292-0/+2
| | | | | | | | | | | Remove these private functions from the public C API: * _PyRun_AnyFileObject() * _PyRun_InteractiveLoopObject() * _PyRun_SimpleFileObject() * _Py_SourceAsString() Move them to the internal C API: add a new pycore_pythonrun.h header file. No longer export these functions.
* gh-108240: Add pycore_capsule.h internal header file (#108596)Victor Stinner2023-08-291-0/+1
| | | | Move _PyCapsule_SetTraverse() definition to a new internal header file: pycore_capsule.h.
* gh-107149: Rename _PyUnstable_GetUnaryIntrinsicName() function (#108441)Victor Stinner2023-08-281-2/+2
| | | | | | * Rename _PyUnstable_GetUnaryIntrinsicName() to PyUnstable_GetUnaryIntrinsicName() * Rename _PyUnstable_GetBinaryIntrinsicName() to PyUnstable_GetBinaryIntrinsicName().
* gh-108278: Deprecate passing the three first params as keyword args for ↵Erlend E. Aasland2023-08-282-5/+60
| | | | | | | | | | | sqlite3 UDF creation APIs (#108281) Deprecate passing name, number of arguments, and the callable as keyword arguments, for the following sqlite3.Connection APIs: - create_function(name, nargs, callable, ...) - create_aggregate(name, nargs, callable) The affected parameters will become positional-only in Python 3.15.
* gh-108494: Argument Clinic: fix support of Limited C API (GH-108536)Serhiy Storchaka2023-08-285-5/+7
|
* gh-107801: Document io.TextIOWrapper.tell (#108265)Erlend E. Aasland2023-08-272-3/+12
|
* Clarify distinction between datetime module and class in deprecation ↵Clément Robert2023-08-271-4/+4
| | | | messages (GH-108073)
* gh-107913: Fix possible losses of OSError error codes (GH-107930)Serhiy Storchaka2023-08-2614-73/+122
| | | | | | Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be called immediately after using the C API which sets errno or the Windows error code.
* gh-107406: Add better `struct.Struct` repr (#107407)denballakh2023-08-261-0/+14
|
* gh-106320: Remove private AC converter functions (#108505)Victor Stinner2023-08-2628-24/+52
| | | | | | | | | | | | | | Move these private functions to the internal C API (pycore_abstract.h): * _Py_convert_optional_to_ssize_t() * _PyNumber_Index() Argument Clinic now emits #include "pycore_abstract.h" when these functions are used. The parser of the c-analyzer tool now uses a list of files which use the limited C API, rather than a list of files using the internal C API.
* gh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)Victor Stinner2023-08-267-5/+18
| | | | | | | | | Move the private _PyLong converter functions to the internal C API * _PyLong_FileDescriptor_Converter(): moved to pycore_fileutils.h * _PyLong_Size_t_Converter(): moved to pycore_long.h Argument Clinic now emits includes for pycore_fileutils.h and pycore_long.h when these functions are used.
* gh-106320: Remove private _PyLong converter functions (#108499)Victor Stinner2023-08-269-9/+20
| | | | | | | | | | | Move these private functions to the internal C API (pycore_long.h): * _PyLong_UnsignedInt_Converter() * _PyLong_UnsignedLongLong_Converter() * _PyLong_UnsignedLong_Converter() * _PyLong_UnsignedShort_Converter() Argument Clinic now emits #include "pycore_long.h" when these functions are used.
* gh-108494: AC supports pos-only args in limited C API (#108498)Victor Stinner2023-08-252-1/+51
| | | | AC now checks for "#define Py_LIMITED_API" pattern to use the limited C API.
* gh-108494: Argument Clinic partial supports of Limited C API (#108495)Victor Stinner2023-08-253-0/+123
| | | | | | | | | | Argument Clinic now has a partial support of the Limited API: * Add --limited option to clinic.c. * Add '_testclinic_limited' extension which is built with the limited C API version 3.13. * For now, hardcode in clinic.py that "_testclinic_limited.c" targets the limited C API.
* gh-106320: Remove private _PyTraceback functions (#108453)Victor Stinner2023-08-242-2/+5
| | | | | | Move private functions to the internal C API (pycore_traceback.h): * _Py_DisplaySourceLine() * _PyTraceback_Add()
* gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)Victor Stinner2023-08-2410-18/+18
| | | | | | Change generated by the command: sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \ $(find -name "*.c" -o -name "*.h")
* gh-108444: Argument Clinic uses PyLong_AsInt() (#108458)Victor Stinner2023-08-2453-356/+356
| | | | Argument Clinic now uses the new public PyLong_AsInt(), rather than the old name _PyLong_AsInt().
* gh-108444: Add PyLong_AsInt() public function (#108445)Victor Stinner2023-08-242-1/+34
| | | | | | * Rename _PyLong_AsInt() to PyLong_AsInt(). * Add documentation. * Add test. * For now, keep _PyLong_AsInt() as an alias to PyLong_AsInt().
* gh-106320: Remove private _PySys functions (#108452)Victor Stinner2023-08-244-1/+6
| | | | | | | | | | Move private functions to the internal C API (pycore_sysmodule.h): * _PySys_GetAttr() * _PySys_GetSizeOf() No longer export most of these functions. Fix also a typo in Include/cpython/optimizer.h: add a missing space.
* gh-106320: Remove private _PyDict functions (#108449)Victor Stinner2023-08-248-23/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Move private functions to the internal C API (pycore_dict.h): * _PyDictView_Intersect() * _PyDictView_New() * _PyDict_ContainsId() * _PyDict_DelItemId() * _PyDict_DelItem_KnownHash() * _PyDict_GetItemIdWithError() * _PyDict_GetItem_KnownHash() * _PyDict_HasSplitTable() * _PyDict_NewPresized() * _PyDict_Next() * _PyDict_Pop() * _PyDict_SetItemId() * _PyDict_SetItem_KnownHash() * _PyDict_SizeOf() No longer export most of these functions. Move also the _PyDictViewObject structure to the internal C API. Move dict_getitem_knownhash() function from _testcapi to the _testinternalcapi extension. Update test_capi.test_dict for this change.
* gh-106320: Remove private _PyEval function (#108433)Victor Stinner2023-08-245-0/+5
| | | | | | | | | | | | | | Move private _PyEval functions to the internal C API (pycore_ceval.h): * _PyEval_GetBuiltin() * _PyEval_GetBuiltinId() * _PyEval_GetSwitchInterval() * _PyEval_MakePendingCalls() * _PyEval_SetProfile() * _PyEval_SetSwitchInterval() * _PyEval_SetTrace() No longer export most of these functions.
* gh-107178: Remove _testcapi.test_dict_capi() (#108436)Victor Stinner2023-08-241-191/+0
| | | | The new _testcapi.test_dict tests are more complete, _testcapi.test_dict_capi() became redundant.
* gh-106320: Remove private _PyContext_NewHamtForTests() (#108434)Victor Stinner2023-08-242-9/+10
| | | Move the function to the internal C API.
* gh-106320: Remove private PyLong C API functions (#108429)Victor Stinner2023-08-247-4/+14
| | | | | | | | | | | | | | | | Remove private PyLong C API functions: * _PyLong_AsByteArray() * _PyLong_DivmodNear() * _PyLong_Format() * _PyLong_Frexp() * _PyLong_FromByteArray() * _PyLong_FromBytes() * _PyLong_GCD() * _PyLong_Lshift() * _PyLong_Rshift() Move these functions to the internal C API. No longer export _PyLong_FromBytes() function.