summaryrefslogtreecommitdiffstats
path: root/Modules/_io/iobase.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-101819: Prepare _io._IOBase for module state (#104386)Erlend E. Aasland2023-05-121-4/+6
| | | | - Add PyIOBase_Type to _io module state - Pass defining class to _io._IOBase.fileno
* gh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic ↵Erlend E. Aasland2023-05-111-21/+34
| | | | (#104384)
* gh-101819: Refactor _io in preparation for module isolation (#104334)Erlend E. Aasland2023-05-091-16/+38
| | | | | | | | | | - 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-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-02-241-7/+5
| | | | (in Modules/) (#102196)
* gh-99300: Use Py_NewRef() in Modules/ directory (#99467)Victor Stinner2022-11-141-4/+2
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
* bpo-25415: Remove confusing sentence from IOBase docstrings (PR-31631)slateny2022-03-041-2/+1
|
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-231-13/+13
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-081-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-42161: Modules/ uses _PyLong_GetZero() and _PyLong_GetOne() (GH-22998)Victor Stinner2020-10-271-1/+2
| | | | | | Use _PyLong_GetZero() and _PyLong_GetOne() in Modules/ directory. _cursesmodule.c and zoneinfo.c are now built with Py_BUILD_CORE_MODULE macro defined.
* bpo-40170: Use inline _PyType_HasFeature() function (GH-22375)Victor Stinner2020-09-231-1/+2
| | | | | Use _PyType_HasFeature() in the _io module and in structseq implementation. Replace PyType_HasFeature() opaque function call with _PyType_HasFeature() inlined function.
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-1/+1
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)Victor Stinner2020-04-131-2/+1
| | | | | | | | Don't access PyInterpreterState.config member directly anymore, but use new functions: * _PyInterpreterState_GetConfig() * _PyInterpreterState_SetConfig() * _Py_GetConfig()
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)Jeroen Demeyer2019-07-081-9/+8
|
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-1/+1
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-4/+4
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-32388: Remove cross-version binary compatibility requirement in tp_flags ↵Antoine Pitrou2019-05-291-2/+2
| | | | | | | | (GH-4944) It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags. This will reduce the risk of running out of bits in the 32-bit tp_flags value.
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a whole new documentation page: "Python Initialization Configuration" * PyWideStringList_Append() return type is now PyStatus, instead of int * PyInterpreterState_New() now calls PyConfig_Clear() if PyConfig_InitPythonConfig() fails. * Rename files: * Python/coreconfig.c => Python/initconfig.c * Include/cpython/coreconfig.h => Include/cpython/initconfig.h * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h * Rename structures * _PyCoreConfig => PyConfig * _PyPreConfig => PyPreConfig * _PyInitError => PyStatus * _PyWstrList => PyWideStringList * Rename PyConfig fields: * use_module_search_paths => module_search_paths_set * module_search_path_env => pythonpath_env * Rename PyStatus field: _func => func * PyInterpreterState: rename core_config field to config * Rename macros and functions: * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv() * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv() * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString() * _PyInitError_Failed() => PyStatus_Exception() * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx * _Py_UnixMain() => Py_BytesMain() * _Py_ExitInitError() => Py_ExitStatusException() * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs() * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs() * _Py_PreInitialize() => Py_PreInitialize() * _Py_RunMain() => Py_RunMain() * _Py_InitializeFromConfig() => Py_InitializeFromConfig() * _Py_INIT_XXX() => _PyStatus_XXX() * _Py_INIT_FAILED() => _PyStatus_EXCEPTION() * Rename 'err' PyStatus variables to 'status' * Convert RUN_CODE() macro to config_run_code() static inline function * Remove functions: * _Py_InitializeFromArgs() * _Py_InitializeFromWideArgs() * _PyInterpreterState_GetCoreConfig()
* bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)Marcin Niemira2019-04-221-1/+6
|
* bpo-18748: io.IOBase destructor now logs close() errors in dev mode (GH-12786)Victor Stinner2019-04-121-3/+15
| | | | | In development mode (-X dev) and in debug build, the io.IOBase destructor now logs close() exceptions. These exceptions are silent by default in release mode.
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an ↵Zackery Spytz2018-07-171-5/+7
| | | | exception set (GH-8282)
* bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code ↵Serhiy Storchaka2018-01-251-25/+13
| | | | | (GH-5222) Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
* bpo-31572: Get rid of PyObject_HasAttr() and _PyObject_HasAttrId() in the ↵Serhiy Storchaka2018-01-161-34/+74
| | | | _io module. (#3726)
* bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096)Serhiy Storchaka2017-04-191-4/+9
| | | | | | raised an error. Replace them with using concrete types API that never fails if appropriate.
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-2/+2
|
* bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is ↵Xiang Zhang2017-04-151-8/+17
| | | | present (#1130)
* bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)Serhiy Storchaka2017-03-301-11/+4
| | | if pass `accept={int, NoneType}`.
* bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ↵Serhiy Storchaka2017-03-211-1/+1
| | | | (#748)
* Use _PyObject_CallMethodIdObjArgs() in _ioVictor Stinner2016-12-091-1/+2
| | | | | | | | | Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|
* Issue #20699: Merge io bytes-like fixes from 3.5Martin Panter2016-05-281-2/+3
|\
| * Issue #20699: Document that “io” methods accept bytes-like objectsMartin Panter2016-05-281-2/+3
| | | | | | | | | | | | | | | | This matches the usage of ZipFile and BufferedWriter. This still requires return values to be bytes() objects. Also document and test that the write() methods should only access their argument before they return.
* | Issue #22854: Merge UnsupportedOperation fixes from 3.5Martin Panter2016-03-311-8/+8
|\ \ | |/
| * Issue #22854: Clarify documentation about UnsupportedOperation and add testsMartin Panter2016-03-311-8/+8
| | | | | | | | | | Also change BufferedReader.writable() and BufferedWriter.readable() to always return False.
* | cleanup iobase.cVictor Stinner2016-03-191-1/+1
|/ | | | casting iobase_finalize to destructor is not needed
* Issue #9858: Add missing method stubs to _io.RawIOBase. Patch by Laura ↵Antoine Pitrou2015-05-201-0/+16
| | | | Rupprecht.
* Issue #20175: Converted the _io module to Argument Clinic.Serhiy Storchaka2015-04-161-94/+154
|
* #15840: make docs consistent by saying operations on closed files raise ↵Andrew Kuchling2014-04-161-2/+2
| | | | | | | | | | | | ValueError. Patch by Caelyn McAulay. Neither Caelyn nor I could find any cases in 2.7 or 3.4/5 where an operation on a closed stream raised IOError; generally the C implementations have a macro to check for the stream being closed, and these macros all raised ValueError. If we find any, a new bug should be opened.
* Issue #20037: Avoid crashes when doing text I/O late at interpreter shutdown.Antoine Pitrou2013-12-211-1/+3
|
* Issue #19515: Remove identifiers duplicated in the same file.Victor Stinner2013-11-121-3/+2
| | | | Patch written by Andrei Dorian Duma.
* Issue #19437: Fix _io._IOBase.close(), handle _PyObject_SetAttrId() failureVictor Stinner2013-11-071-3/+8
|
* Issue #18408: Fix iobase_readline(), handle PyByteArray_Resize() failureVictor Stinner2013-10-291-5/+8
|
* Fix use of uninitialized scalar variable, see 3f994367a979Christian Heimes2013-07-301-1/+3
| | | | CID 1058763
* Issue #18112: PEP 442 implementation (safe object finalization).Antoine Pitrou2013-07-301-40/+52
|
* Merge 3.2, Issue #17047: remove doubled words found in 2.7 to 3.4Terry Jan Reedy2013-03-111-1/+1
|\ | | | | | | Modules/*, as reported by Serhiy Storchaka and Matthew Barnett.
| * Issue #17047: remove doubled words found in 2.7 to 3.4 Modules/*,Terry Jan Reedy2013-03-111-1/+1
| | | | | | | | as reported by Serhiy Storchaka and Matthew Barnett.
* | Additional fix for issue #12268: The io module file object write methods noGregory P. Smith2013-02-011-1/+4
|\ \ | |/ | | | | longer abort early when a write system call is interrupted (EINTR).
| * Additional fix for Issue #12268: The io module file object writelines() ↵Gregory P. Smith2013-02-011-1/+4
| | | | | | | | methods no longer abort early when one of its write system calls is interrupted (EINTR).
* | #15796: merge with 3.2.Ezio Melotti2012-09-181-1/+1
|\ \ | |/