summaryrefslogtreecommitdiffstats
path: root/Modules/_io
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* gh-99300: Use Py_NewRef() in Modules/ directory (#99467)Victor Stinner2022-11-146-59/+30
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
* gh-83004: Clean up refleak in _io initialisation (#98840)Shantanu2022-11-031-3/+3
|
* gh-90928: Improve static initialization of keywords tuple in AC (#95907)Erlend E. Aasland2022-08-137-228/+98
|
* gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code ↵Eric Snow2022-08-118-21/+498
| | | | | | | | | | | | | | | | (gh-95860) We only statically initialize for core code and builtin modules. Extension modules still create the tuple at runtime. We'll solve that part of interpreter isolation separately. This change includes generated code. The non-generated changes are in: * Tools/clinic/clinic.py * Python/getargs.c * Include/cpython/modsupport.h * Makefile.pre.in (re-generate global strings after running clinic) * very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c All other changes are generated code (clinic, global strings).
* gh-95005: Replace PyAccu with PyUnicodeWriter (gh-95006)Aivars Kalvāns2022-07-271-14/+15
|
* GH-90699: fix ref counting of static immortal strings (gh-94850)Kumar Aditya2022-07-201-1/+1
|
* GH-94857: fix test_io refleak (GH-94858)Kumar Aditya2022-07-181-1/+6
|
* Fix typo in _io.TextIOWrapper Clinic input (#94037)fikotta2022-06-221-2/+2
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-84461: Silence some compiler warnings on WASM (GH-93978)Christian Heimes2022-06-201-1/+1
|
* gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537)Inada Naoki2022-05-121-9/+0
|
* gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210)Victor Stinner2022-05-038-40/+40
| | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func).
* gh-91952: Make TextIOWrapper.reconfigure() supports "locale" encoding (GH-91982)Inada Naoki2022-05-011-2/+10
|
* bpo-46712: share more global strings in deepfreeze (gh-32152)Kumar Aditya2022-04-191-0/+1
| | | (for gh-90868)
* gh-91526: io: Remove device encoding support from TextIOWrapper (GH-91529)Inada Naoki2022-04-191-50/+6
| | | | `TextIOWrapper.__init__()` called `os.device_encoding(file.fileno())` if fileno is 0-2 and encoding=None. But it is very rarely works, and never documented behavior.
* gh-91156: Fix `encoding="locale"` in UTF-8 mode (GH-70056)Inada Naoki2022-04-144-15/+23
|
* bpo-47000: Add `locale.getencoding()` (GH-32068)Inada Naoki2022-04-091-1/+7
|
* bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003)Inada Naoki2022-04-042-7/+16
| | | Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* bpo-25415: Remove confusing sentence from IOBase docstrings (PR-31631)slateny2022-03-042-3/+2
|
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-236-211/+69
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-086-160/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-46417: Clear _io module static objects at exit (GH-30807)Victor Stinner2022-01-221-44/+93
| | | | Add _PyIO_Fini() function, called by finalize_interp_clear(). It clears static objects used by the _io extension module.
* Remove unused variables. (GH-29231)Benjamin Peterson2021-10-261-5/+1
|
* bpo-45434: Move _Py_BEGIN_SUPPRESS_IPH to pycore_fileutils.h (GH-28922)Victor Stinner2021-10-132-2/+4
|
* bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)Victor Stinner2021-10-121-0/+1
| | | | | | | * Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().
* bpo-45439: Rename _PyObject_CallNoArg() to _PyObject_CallNoArgs() (GH-28891)Victor Stinner2021-10-111-1/+1
| | | | | Fix typo in the private _PyObject_CallNoArg() function name: rename it to _PyObject_CallNoArgs() to be consistent with the public function PyObject_CallNoArgs().
* bpo-44687: Ensure BufferedReader objects with unread buffers can peek even ↵AngstyDuck2021-10-011-3/+5
| | | | when the underlying file is closed (GH-28457)
* bpo-43413: Fix handling keyword arguments in subclasses of some buitin ↵Serhiy Storchaka2021-09-121-2/+3
| | | | | | | | classes (GH-26456) * Constructors of subclasses of some buitin classes (e.g. tuple, list, frozenset) no longer accept arbitrary keyword arguments. * Subclass of set can now define a __new__() method with additional keyword parameters without overriding also __init__().
* bpo-45094: Add Py_NO_INLINE macro (GH-28140)Victor Stinner2021-09-031-1/+1
| | | | | * Rename _Py_NO_INLINE macro to Py_NO_INLINE: make it public and document it. * Sort macros in the C API documentation.
* bpo-37330: open() no longer accept 'U' in file mode (GH-28118)Victor Stinner2021-09-022-29/+3
| | | | | open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3.
* bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection ↵Segev Finer2021-04-232-73/+73
| | | | | | | | (GH-1927) This works by not caching the handle and instead getting the handle from the file descriptor each time, so that if the actual handle changes by fd redirection closing/opening the console handle beneath our feet, we will keep working correctly.
* bpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)Inada Naoki2021-04-022-13/+17
| | | I forget to check PyErr_WarnEx() return value. But it will fail when -Werror is used.
* Revert "bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode ↵Inada Naoki2021-03-311-2/+1
| | | | | (GH-25103)" (#25108) This reverts commit ff3c9739bd69aa8b58007e63c9e40e6708b4761e.
* bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)Inada Naoki2021-03-311-1/+2
| | | | It make `encoding="locale"` usable everywhere `encoding=None` is allowed.