summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). ↵Miss Islington (bot)2019-03-101-1/+1
| | | | | | | (GH-12252) (cherry picked from commit 8b91edadc06dcb0d391a65d1ecdf07dcb429df1b) Co-authored-by: sth <sth.dev@tejp.de>
* bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503)Miss Islington (bot)2018-11-121-1/+1
| | | | | | | Rename our new MEMORY_SANITIZER define to _Py_MEMORY_SANITIZER. Project based C Preprocessor namespacing at its finest. :P (cherry picked from commit 3015fb8ce4d25603434b9b44bb7effb98a481532) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* Disable getc_unlocked() with MemorySanitizer. (GH-10499)Miss Islington (bot)2018-11-121-1/+2
| | | | | | | clang's MemorySanitizer understand getc() but does not understand getc_unlocked(). Workaround: Don't use it on msan builds. (cherry picked from commit e6c77d8301ec1703abb755a7d3ce5bd8c999c082) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* 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-201-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-251-1/+1
| | |
* | | Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-151-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
|
* Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases ↵Christian Heimes2007-12-021-1/+1
| | | | in intobject.h
* Fix for #1415 pythonw.exe fails because std streams a missingChristian Heimes2007-11-131-1/+1
| | | | | | After a long discussion about the problem with Windows GUI apps Guido decided that sys.stdin, stdout and stderr should be None when the C runtime library returns invalid file descriptors for the standard streams. So far the only known cases are Windows GUI apps and scripts started with pythonw on Windows. The OS restrictions are tight enough to catch the problem on other OSes.
* Let's do as Guido says and return None instead of -1Christian Heimes2007-11-121-3/+2
|
* Stop Python code from instantiating a new stdprinter with sys.stderr.__class__()Christian Heimes2007-11-121-11/+90
| | | | Added some more methods and attributes to stdprinter to ease up debugging #1415 on Windows. It also makes the object more file like. Now it can be used as a working replacement for an io instance.
* Bug #1415Christian Heimes2007-11-101-2/+2
| | | | | | On Windows fileno(stdout) and fileno(stderr) can return an invalid file descriptor number (-2 on my machine). It happens only for pythonw.exe but not for python.exe. Catch the problem ASAP in PyFile_NewStdPrinter(). I've also removed the call to PyErr_BadInternalCall(). It was causing a seg fault because the exceptions aren't available yet.
* Merging the py3k-pep3137 branch back into the py3k branch.Guido van Rossum2007-11-061-1/+1
| | | | | | | | | | | | | | No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
* Minor correction to the stdprinter object.Guido van Rossum2007-10-301-2/+4
|
* Patch 1352 (continued in issue 1329) by Christian Heimes.Guido van Rossum2007-10-301-0/+118
| | | | | | Before sys.stderr is set to the proper thing, set it to a really simple file-like object that can print tracebacks using direct file descriptor I/O. This is handy for debugging.
* Patch 1329 (partial) by Christian Heimes.Guido van Rossum2007-10-301-3/+3
| | | | | | | | Add a closefd flag to open() which can be set to False to prevent closing the file descriptor when close() is called or when the object is destroyed. Useful to ensure that sys.std{in,out,err} keep their file descriptors open when Python is uninitialized. (This was always a feature in 2.x, it just wasn't implemented in 3.0 yet.)
* Remove redundant PyInt/PyLong checks.Georg Brandl2007-10-231-9/+2
|
* Issue 1267, continued.Guido van Rossum2007-10-221-11/+5
| | | | | | Additional patch by Christian Heimes to deal more cleanly with the FILE* vs file-descriptor issues. I cleaned up his code a bit, and moved the lseek() call into import.c.
* Patch 1267 by Christian Heimes.Guido van Rossum2007-10-191-9/+19
| | | | | | Move the initialization of sys.std{in,out,err} and __builtin__.open to C code. This solves the problem that "python -S" wouldn't work.
* PyFile_WriteObject() should use PyObject_Repr(), not _ReprStr8().Guido van Rossum2007-10-091-1/+1
|
* Kill execfile(), use exec() insteadNeal Norwitz2007-08-121-1/+1
|
* In PyFile_WriteString(), call PyUnicode_FromString() instead ofGuido van Rossum2007-08-091-1/+1
| | | | | PyString_FromString(). This is arguably more correct, even if it shouldn't matter much (all the input is likely to be ASCII).