summaryrefslogtreecommitdiffstats
path: root/Modules/_io
Commit message (Collapse)AuthorAgeFilesLines
* gh-106320: Remove private pylifecycle.h functions (#106400)Victor Stinner2023-07-041-0/+1
| | | | | | | Remove private pylifecycle.h functions: move them to the internal C API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No longer export most of these functions. Move _testcapi.test_atexit() to _testinternalcapi.
* gh-106320: Remove private _PyErr C API functions (#106356)Victor Stinner2023-07-031-0/+1
| | | | Remove private _PyErr C API functions: move them to the internal C API (pycore_pyerrors.h).
* gh-106320: Use _PyInterpreterState_GET() (#106336)Victor Stinner2023-07-021-1/+1
| | | | Replace PyInterpreterState_Get() with inlined _PyInterpreterState_GET().
* gh-104922: remove PY_SSIZE_T_CLEAN (#106315)Inada Naoki2023-07-027-7/+0
|
* Remove private _PyCodec_Lookup() function (#106269)Victor Stinner2023-06-301-0/+1
| | | | | | | | | | | | | | | Remove the following private functions of the C API: * _PyCodecInfo_GetIncrementalDecoder() * _PyCodecInfo_GetIncrementalEncoder() * _PyCodec_DecodeText() * _PyCodec_EncodeText() * _PyCodec_Forget() * _PyCodec_Lookup() * _PyCodec_LookupTextEncoding() Move these functions to a new pycore_codecs.h internal header file. These functions are no longer exported.
* gh-106084: Remove _PyObject_CallMethod() function (#106159)Victor Stinner2023-06-272-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the following private functions from the public C API: * _Py_CheckFunctionResult() * _PyObject_CallMethod() * _PyObject_CallMethodId() * _PyObject_CallMethodIdNoArgs() * _PyObject_CallMethodIdObjArgs() * _PyObject_CallMethodIdOneArg() * _PyObject_MakeTpCall() * _PyObject_VectorcallMethodId() * _PyStack_AsDict() Move these functions to the internal C API (pycore_call.h). No longer export the following functions: * _PyObject_Call() * _PyObject_CallMethod() * _PyObject_CallMethodId() * _PyObject_CallMethodIdObjArgs() * _PyObject_Call_Prepend() * _PyObject_FastCallDictTstate() * _PyStack_AsDict() The following functions are still exported for stdlib shared extensions: * _Py_CheckFunctionResult() * _PyObject_MakeTpCall() Mark the following internal functions as extern: * _PyStack_UnpackDict() * _PyStack_UnpackDict_Free() * _PyStack_UnpackDict_FreeNoDecRef()
* gh-92536: Remove PyUnicode_READY() calls (#105210)Victor Stinner2023-06-012-18/+1
| | | | Since Python 3.12, PyUnicode_READY() does nothing and always returns 0.
* gh-92536: Argument Clinic no longer emits PyUnicode_READY() (#105208)Victor Stinner2023-06-012-8/+2
| | | | | | Since Python 3.12, PyUnicode_READY() does nothing and always returns 0. Argument Clinic now also checks for .cpp files (PC/_wmimodule.cpp).
* gh-105156: Deprecate the old Py_UNICODE type in C API (#105157)Victor Stinner2023-06-011-1/+1
| | | | | | | | Deprecate the old Py_UNICODE and PY_UNICODE_TYPE types in the C API: use wchar_t instead. Replace Py_UNICODE with wchar_t in multiple C files. Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* gh-62948: IOBase finalizer logs close() errors (#105104)Victor Stinner2023-05-311-12/+0
|
* GH-104510: Fix refleaks in `_io` base types (#104516)Kumar Aditya2023-05-163-26/+6
|
* gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization ↵Eric Snow2023-05-151-1/+2
| | | | | (gh-104437) With the move to a per-interpreter GIL, this check slipped through the cracks.
* gh-101819: Fix _io clinic input for unused base class method stubs (#104418)Erlend E. Aasland2023-05-156-109/+168
| | | | | | When preparing the _io extension module for isolation, many methods were adapted to Argument Clinic. Some of these used the '*args: object' signature, which is incorrect. These are now corrected to an exact signature, and marked unused, since they are stub methods.
* gh-101819: Isolate `_io` (#101948)Erlend E. Aasland2023-05-159-346/+198
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-101819: Prepare _io._IOBase for module state (#104386)Erlend E. Aasland2023-05-124-11/+21
| | | | - Add PyIOBase_Type to _io module state - Pass defining class to _io._IOBase.fileno
* gh-101819: Fix inverted debug preprocessor check in winconsoleio.c (#104388)Erlend E. Aasland2023-05-111-1/+1
|
* gh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic ↵Erlend E. Aasland2023-05-112-22/+135
| | | | (#104384)
* gh-101819: Adapt _io._Buffered* methods to Argument Clinic (#104367)Erlend E. Aasland2023-05-112-56/+328
|
* gh-101819: Refactor `_io` futher in preparation for module isolation (#104369)Erlend E. Aasland2023-05-115-116/+268
|
* gh-101819: Adapt _io.TextIOBase methods to Argument Clinic (#104383)Erlend E. Aasland2023-05-112-40/+233
|
* gh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (#104355)Erlend E. Aasland2023-05-102-44/+236
| | | | Make sure the defining class is passed to all methods, so we can easily fetch module state from them in the future.
* gh-101819: Clean up _io windows console io after gh-104197 (#104354)Erlend E. Aasland2023-05-103-3/+3
|
* gh-101819: Harden _io init (#104352)Erlend E. Aasland2023-05-101-3/+4
| | | Fix potential refleak if PyModule_AddObject() fails.
* gh-101819: Refactor _io in preparation for module isolation (#104334)Erlend E. Aasland2023-05-093-42/+80
| | | | | | | | | | - Replace query with parameter in bufferediobase_unsupported() - Replace query with parameter in iobase_unsupported() - Hide delegate: Add method wrapper for _PyIOBase_check_seekable - Hide delegate: Add method wraper for _PyIOBase_check_readable - Hide delegate: Add method wraper for _PyIOBase_check_writable - Replace query with parameter in _PyIOBase_check_seekable() - Replace query with parameter in _PyIOBase_check_readable() - Replace query with parameter in _PyIOBase_check_writable()
* gh-101819: Port _io.PyBytesIOBuffer_Type to heap type (#104264)Erlend E. Aasland2023-05-073-50/+29
|
* gh-101819: Adapt _io.PyWindowsConsoleIO_Type to heap type (#104197)Erlend E. Aasland2023-05-073-69/+51
|
* gh-101819: Port _io.PyIncrementalNewlineDecoder_Type to heap type (#104249)Erlend E. Aasland2023-05-073-47/+42
|
* gh-101819: Remove unused 'locale_module' from _io state (#104246)Erlend E. Aasland2023-05-062-5/+0
| | | | The locale module reference was introduced by 932ff8368 in 2013, and rendered unused by 710e82630 (gh-23050) in 2020.
* gh-101819: Prepare to modernize the _io extension (#104178)Victor Stinner2023-05-059-37/+92
| | | | | | | | | | | | | | | | | | | | | * Add references to static types to _PyIO_State: * PyBufferedIOBase_Type * PyBytesIOBuffer_Type * PyIncrementalNewlineDecoder_Type * PyRawIOBase_Type * PyTextIOBase_Type * Add the defining class to methods: * _io.BytesIO.getbuffer() * _io.FileIO.close() * Add get_io_state_by_cls() function. * Add state parameter to _textiowrapper_decode() * _io_TextIOWrapper___init__() now sets self->state before calling _textiowrapper_set_decoder(). Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-94673: Properly Initialize and Finalize Static Builtin Types for Each ↵Eric Snow2023-05-021-6/+2
| | | | | Interpreter (gh-104072) Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
* gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)Eric Snow2023-04-271-6/+4
| | | There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.
* gh-103617: Fix compiler warning in _iomodule.c (#103618)Erlend E. Aasland2023-04-191-2/+3
|
* gh-94673: Isolate the _io module to Each Interpreter (gh-102663)Eric Snow2023-03-211-8/+32
| | | | | Aside from sys and builtins, _io is the only core builtin module that hasn't been ported to multi-phase init. We may do so later (e.g. gh-101948), but in the meantime we must at least take care of the module's static types properly. (This came up while working on gh-101660.) https://github.com/python/cpython/issues/94673
* gh-102255: Improve build support for Windows API partitions (GH-102256)Max Bachmann2023-03-095-29/+33
| | | | | Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs). CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes. `MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
* gh-102507 Remove invisible pagebreak characters (#102531)JosephSBoyle2023-03-081-3/+0
| | | Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-02-246-71/+77
| | | | (in Modules/) (#102196)
* gh-101819: Adapt _io types to heap types, batch 1 (GH-101949)Erlend E. Aasland2023-02-208-469/+373
| | | | | Adapt StringIO, TextIOWrapper, FileIO, Buffered*, and BytesIO types. Automerge-Triggered-By: GH:erlend-aasland
* gh-101819: Remove _PyWindowsConsoleIO_Type from the Windows DLL (GH-101904)Erlend E. Aasland2023-02-152-7/+1
| | | Automerge-Triggered-By: GH:erlend-aasland
* gh-101819: Remove _testcapi dependencies on specific _io symbols (#101918)Erlend E. Aasland2023-02-151-10/+2
|
* GH-101228: Fix typo in docstring for read method of `_io.TextIOWrapper` ↵Partha P. Mukherjee2023-02-091-3/+3
| | | | class (#101227)
* gh-101409: Improve generated clinic code for self type checks (#101411)Erlend E. Aasland2023-01-311-3/+4
|
* gh-101469: Optimise get_io_state() by using _PyModule_GetState() (GH-101470)Erlend E. Aasland2023-01-311-1/+2
| | | Automerge-Triggered-By: GH:erlend-aasland
* gh-82052: Don't send partial UTF-8 sequences to the Windows API (GH-101103)Paul Moore2023-01-171-1/+16
| | | Don't send partial UTF-8 sequences to the Windows API
* gh-81057: Move More Globals to _PyRuntimeState (gh-100092)Eric Snow2022-12-071-12/+12
| | | https://github.com/python/cpython/issues/81057
* bpo-15999: Accept arbitrary values for boolean parameters. (#15609)Serhiy Storchaka2022-12-038-37/+36
| | | builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
* gh-99845: Use size_t type in __sizeof__() methods (#99846)Victor Stinner2022-11-302-12/+9
| | | | | | | | The implementation of __sizeof__() methods using _PyObject_SIZE() now use an unsigned type (size_t) to compute the size, rather than a signed type (Py_ssize_t). Cast explicitly signed (Py_ssize_t) values to unsigned type (Py_ssize_t).
* bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (#18640)Zackery Spytz2022-11-281-8/+20
| | | | Co-authored-by: Oren Milman <orenmn@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-38031: Fix a possible assertion failure in _io.FileIO() (#GH-5688)Zackery Spytz2022-11-251-1/+5
|
* gh-99537: Use Py_SETREF(var, NULL) in C code (#99687)Victor Stinner2022-11-231-2/+1
| | | Replace "Py_DECREF(var); var = NULL;" with "Py_SETREF(var, NULL);".
* gh-99537: Use Py_SETREF() function in C code (#99656)Victor Stinner2022-11-222-8/+4
| | | | | | | | | | | | | | | Fix potential race condition in code patterns: * Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);" * Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);" * Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);" Other changes: * Replace "old = var; var = new; Py_DECREF(var)" with "Py_SETREF(var, new);" * Replace "old = var; var = new; Py_XDECREF(var)" with "Py_XSETREF(var, new);" * And remove the "old" variable.