summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25749)Victor Stinner2021-04-301-27/+4
| | | | | | | The PyStdPrinter_Type type now uses the Py_TPFLAGS_DISALLOW_INSTANTIATION flag to disallow instantiation, rather than seting a tp_init method which always fail. Write also unit tests for PyStdPrinter_Type.
* bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for ↵Serhiy Storchaka2020-10-091-0/+11
| | | | "fildes". (GH-22620)
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-1/+1
|
* bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. ↵Serhiy Storchaka2020-04-121-1/+1
| | | | (GH-19472)
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-39573: Use Py_REFCNT() macro (GH-18388)Victor Stinner2020-02-061-1/+1
| | | | Replace direct acccess to PyObject.ob_refcnt with usage of the Py_REFCNT() macro.
* bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)Hai Shi2020-01-301-2/+2
| | | Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-011-2/+2
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)Serhiy Storchaka2019-09-011-2/+4
| | | Only AttributeError should be silenced.
* bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)Jeroen Demeyer2019-07-081-1/+1
|
* 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-2/+2
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-1/+69
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). ↵sth2019-03-101-1/+1
| | | | (GH-12252)
* bpo-35713: Split _Py_InitializeCore into subfunctions (GH-11650)Victor Stinner2019-01-221-2/+6
| | | | | | | | | | | | | | * Split _Py_InitializeCore_impl() into subfunctions: add multiple pycore_init_xxx() functions * Preliminary sys.stderr is now set earlier to get an usable sys.stderr ealier. * Move code into _Py_Initialize_ReconfigureCore() to be able to call it from _Py_InitializeCore(). * Split _PyExc_Init(): create a new _PyBuiltins_AddExceptions() function. * Call _PyExc_Init() earlier in _Py_InitializeCore_impl() and new_interpreter() to get working exceptions earlier. * _Py_ReadyTypes() now returns _PyInitError rather than calling Py_FatalError(). * Misc code cleanup
* bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)Gregory P. Smith2018-11-131-1/+1
| | | | Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER. Project based C Preprocessor namespacing at its finest. :P
* Disable getc_unlocked() with MemorySanitizer. (GH-10499)Gregory P. Smith2018-11-131-1/+2
| | | | clang's MemorySanitizer understand getc() but does not understand getc_unlocked(). Workaround: Don't use it on msan builds.
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-3/+3
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* bpo-29548: Fix some inefficient call API usage (GH-97)INADA Naoki2017-02-161-27/+14
|
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-2/+1
| | | | possible. Patch is writen with Coccinelle.
* Issue #28858: Remove _PyObject_CallArg1() macroVictor Stinner2016-12-051-1/+1
| | | | | | | | | | | Replace _PyObject_CallArg1(func, arg) with PyObject_CallFunctionObjArgs(func, arg, NULL) Using the _PyObject_CallArg1() macro increases the usage of the C stack, which was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this issue.
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-5/+3
| | | | UTF-8 represenatation of Unicode objects.
* Rename _PyObject_FastCall() to _PyObject_FastCallDict()Victor Stinner2016-08-221-1/+1
| | | | | | | | Issue #27809: * Rename _PyObject_FastCall() function to _PyObject_FastCallDict() * Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1() macros calling _PyObject_FastCallDict()
* PyFile_WriteObject() now uses fast callVictor Stinner2016-08-191-9/+2
| | | | | Issue #27128: PyFile_WriteObject() now calls _PyObject_FastCall() to avoid the creation of a temporary tuple.
* (Merge 3.4) Issue #25182: Fix compilation on WindowsVictor Stinner2015-09-301-3/+6
|\
| * Issue #25182: Fix compilation on WindowsVictor Stinner2015-09-301-3/+6
| | | | | | | | Restore also errno value before calling PyErr_SetFromErrno().
* | Issue #25182: The stdprinter (used as sys.stderr before the io module isSerhiy Storchaka2015-09-301-4/+21
|\ \ | |/ | | | | imported at startup) now uses the backslashreplace error handler.
| * Issue #25182: The stdprinter (used as sys.stderr before the io module isSerhiy Storchaka2015-09-301-6/+22
| | | | | | | | imported at startup) now uses the backslashreplace error handler.
* | stdprinter_write(): mention the encodingVictor Stinner2015-03-241-3/+4
| |
* | Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handleVictor Stinner2015-03-191-17/+6
|/ | | | | | | | EINTR error and special cases for Windows. These functions now truncate the length to PY_SSIZE_T_MAX to have a portable and reliable behaviour. For example, read() result is undefined if counter is greater than PY_SSIZE_T_MAX on Linux.
* Issue #1772673: The type of `char*` arguments now changed to `const char*`.Serhiy Storchaka2013-10-191-2/+2
|
* Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-2/+2
|\ | | | | | | error messages and comments.
| * Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-2/+2
| | | | | | | | error messages and comments.
| * Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-191-2/+2
| |\ | | | | | | | | | | | | | | | when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
| | * Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-191-2/+2
| | | | | | | | | | | | | | | | | | when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
* | | If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified.Victor Stinner2013-06-241-1/+1
| | |
* | | Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-141-2/+2
|/ / | | | | | | when result of PyLong_AsLong() narrowed to int without checks.
* | Rename _Py_identifier to _Py_IDENTIFIER.Martin v. Löwis2011-10-141-4/+4
| |
* | Use identifier API for PyObject_GetAttrString.Martin v. Löwis2011-10-101-3/+7
| |
* | Add API for static strings, primarily good for identifiers.Martin v. Löwis2011-10-091-1/+2
| | | | | | | | Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
* | Implement PEP 393.Martin v. Löwis2011-09-281-11/+6
| |
* | Issue #8914: fix various warnings from the Clang static analyzer v254.Brett Cannon2011-02-221-2/+2
|/
* Issue #9015, #9611: stdprinter.write() clamps the length to 2^31-1 on WindowsVictor Stinner2011-01-041-2/+8
|
* Issue #9425: PyFile_FromFd() ignores the name argumentVictor Stinner2010-08-131-11/+3
| | | | | This function is only by imp.find_module() which does return the filename in a separated variable.
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-372/+372
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* PyFile_FromFd() uses PyUnicode_DecodeFSDefault() instead ofVictor Stinner2010-04-301-1/+1
| | | | | PyUnicode_FromString() to support surrogates in the filename and use the right encoding
* Issue #1717: rename tp_compare to tp_reserved. I'll change theMark Dickinson2009-02-021-1/+1
| | | | | type of tp_compare in a separate commit, for ease of reversion should things go wrong.
* Make stdprinter_write static.Martin v. Löwis2008-06-131-1/+1
|
* Renamed PyString to PyBytesChristian Heimes2008-05-261-6/+6
|
* Add an errors parameter to open() and TextIOWrapper() to specify error handling.Guido van Rossum2007-12-031-3/+4
|