summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
Commit message (Collapse)AuthorAgeFilesLines
* issue 4804: Provide checks for the format string of strftime, and for the ↵Kristján Valur Jónsson2009-02-041-1/+88
| | | | "mode" string of fopen on Windows. These strings are user provided from python and so we can avoid invoking the C runtime invalid parameter handler by first checking that they are valid.
* #4764 set IOError.filename when trying to open a directory on POSIX platformsBenjamin Peterson2008-12-291-2/+2
|
* #3965: on Windows, open() crashes if the filename or the mode is invalid,Amaury Forgeot d'Arc2008-09-251-4/+11
| | | | | | and if the filename is a unicode string. Reviewed by Martin von Loewis.
* Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,Martin v. Löwis2008-08-121-2/+16
| | | | | | | by denying s# to parse objects that have a releasebuffer procedure, and introducing s*. More module might need to get converted to use s*.
* More reverting of r63675 per the mailing list discussions. This restoresGregory P. Smith2008-06-101-3/+3
| | | | | occurances of PyBytes_ in the code to their original PyString_ names. The bytesobject.c file will be renamed back to stringobject.c in a future checkin.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-54/+54
| | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
* New environment variable PYTHONIOENCODING.Martin v. Löwis2008-06-011-3/+32
|
* Renamed PyString to PyBytesChristian Heimes2008-05-261-56/+56
|
* #2353: raise Py3k warning in file.xreadlines().Georg Brandl2008-05-171-3/+12
|
* A little reformating of Py3k warningsBenjamin Peterson2008-04-271-2/+3
|
* Use PyErr_WarnPy3k throughoutBenjamin Peterson2008-04-271-6/+2
|
* Make file objects as thread safe as the underlying libc FILE* implementation.Gregory P. Smith2008-04-061-81/+164
| | | | | | | | | | | close() will now raise an IOError if any operations on the file object are currently in progress in other threads. Most code was written by Antoine Pitrou (pitrou). Additional testing, documentation and test suite cleanup done by me (gregory.p.smith). Fixes issue 815646 and 595601 (as well as many other bugs and references to this problem dating back to the dawn of Python).
* #2348: add py3k warning for file.softspace.Georg Brandl2008-03-211-2/+34
|
* Remove all traces of HAVE_STRERROR.Brett Cannon2008-03-181-8/+0
| | | | | The removal of strerror.c led to the function check being removed from configure.in.
* Fix the IOError message text when opening a file with an invalid filename.Gregory P. Smith2008-03-181-2/+5
| | | | Error reported by Ilan Schnell.
* #2067: file.__exit__() now calls subclasses' close() method.Georg Brandl2008-02-231-2/+2
|
* static PyObject* variables should use PyString_InternFromString() instead of ↵Christian Heimes2008-01-281-1/+1
| | | | PyObject_FromString() to store a python string in a function level static var.
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-1/+1
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* Note that open() is the preferred way to open files (issue 1510).Skip Montanaro2007-12-081-1/+2
|
* Patch # 188 by Philip Jenvey.Guido van Rossum2007-09-221-0/+1
| | | | | Make tell() mark CRLF as a newline. With unit test.
* Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon2007-09-171-0/+2
| | | | | | PyObject_Print(). Closes issue #1164.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-3/+2
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Export function sanitize_the_mode from fileobject.c as ↵Kristján Valur Jónsson2007-04-261-8/+7
| | | | _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
* SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomizeThomas Wouters2007-01-231-0/+2
| | | | | | | | | | | When running the interpreter in an environment that would cause it to set stdout/stderr/stdin's encoding, having a sitecustomize that would replace them with something other than PyFile objects would crash the interpreter. Fix it by simply ignoring the encoding-setting for non-files. This could do with a test, but I can think of no maintainable and portable way to test this bug, short of adding a sitecustomize.py to the buildsystem and have it always run with it (hmmm....)
* Bug #1067760: Deprecate passing floats to file.seek.Martin v. Löwis2006-11-121-4/+17
|
* Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo2006-10-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests...
* Make sure memory is properly cleaned up in file_init.Brett Cannon2006-08-311-1/+1
| | | | Backport candidate.
* Fix a couple of ssize-t issues reported by Alexander Belopolsky on python-devNeal Norwitz2006-08-211-1/+1
|
* Stop INCREFing name, then checking if it's NULL. name (f_name) should neverNeal Norwitz2006-07-171-3/+6
| | | | | | be NULL so assert it. Fix one place where we could have passed NULL. Reported by Klocwork #66.
* Handle a NULL name properly.Neal Norwitz2006-07-161-3/+3
| | | | Reported by Klocwork #67
* Fix build problems with the platform SDK on windows. It is not sufficient ↵Kristján Valur Jónsson2006-07-031-1/+1
| | | | to test for the C compiler version when determining if we have the secure CRT from microsoft. Must test with an undocumented macro, __STDC_SECURE_LIB__ too.
* Fix the CRT argument error handling for VisualStudio .NET 2005. Install a ↵Kristján Valur Jónsson2006-06-121-1/+3
| | | | | | CRT error handler and disable the assertion for debug builds. This causes CRT to set errno to EINVAL. This update fixes crash cases in the test suite where the default CRT error handler would cause process exit.
* Patch #1495999: Part two of Windows CE changes.Martin v. Löwis2006-06-101-2/+2
| | | | | | - update header checks, using autoconf - provide dummies for getenv, environ, and GetVersion - adjust MSC_VER check in socketmodule.c
* Bug #1502805: don't alias file.__exit__ to file.close since theGeorg Brandl2006-06-081-1/+18
| | | | latter can return something that's true.
* Bug #1462152: file() now checks more thoroughly for invalid modeGeorg Brandl2006-05-181-35/+48
| | | | | strings and removes a possible "U" before passing the mode to the C library function.
* Get rid of __context__, per the latest changes to PEP 343 and python-devGuido van Rossum2006-05-021-5/+0
| | | | | | | | discussion. There are two places of documentation that still mention __context__: Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without spending a whole lot of time thinking about it; and whatsnew, which Andrew usually likes to change himself.
* SF #1479181: split open() and file() from being aliases for each other.Neal Norwitz2006-05-021-4/+0
|
* Replace INT_MAX with PY_SSIZE_T_MAX where string lengthMartin v. Löwis2006-04-131-4/+4
| | | | are concerned.
* spread the extern "C" { } magic pixie dust around. Python itself builds nowAnthony Baxter2006-04-131-0/+9
| | | | | using a C++ compiler. Still lots and lots of errors in the modules built by setup.py, and a bunch of warnings from g++ in the core.
* More C++-compliance. Note especially listobject.c - to get C++ to accept theAnthony Baxter2006-04-111-5/+6
| | | | | | | | | PyTypeObject structures, I had to make prototypes for the functions, and move the structure definition ahead of the functions. I'd dearly like a better way to do this - to change this would make for a massive set of changes to the codebase. There's still some warnings - this is purely to get rid of errors first.
* Bug #1177964: make file iterator raise MemoryError on too big filesGeorg Brandl2006-03-311-1/+2
|
* Remove unnecessary casts in type object initializers.Georg Brandl2006-03-301-1/+1
|
* Um, I thought I'd already checked this in.Guido van Rossum2006-03-101-26/+1
| | | | | | | Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
* Updates to the with-statement:Guido van Rossum2006-02-281-3/+37
| | | | | | | | | | | | | | | | - New semantics for __exit__() -- it must re-raise the exception if type is not None; the with-statement itself doesn't do this. (See the updated PEP for motivation.) - Added context managers to: - file - thread.LockType - threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore} - decimal.Context - Added contextlib.py, which defines @contextmanager, nested(), closing(). - Unit tests all around; bot no docs yet.
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-1/+1
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-14/+19
|
* SF patch #1397960: When mixing file-iteration andThomas Wouters2006-02-121-2/+39
| | | | | | | readline/readlines/read/readinto, loudly break by raising ValueError, rather than silently deliver data out of order or hitting EOF prematurely. Probably not a bugfix candidate, even though it affects no 'working' code.
* strlen() returns a size_t, get rid of 64-bit warningNeal Norwitz2006-01-081-1/+1
|
* Revert r41662 and the part of 41552 that originally caused the problemNeal Norwitz2005-12-151-7/+0
| | | | | (calling ftell(stdin) doesn't seem defined). So we won't test errors from ftell unless we can do it portably.
* Add a workaround for file.ftell() to raise IOError for ttys.Hye-Shik Chang2005-12-131-0/+7
| | | | | ftell(3) on BSD doesn't set errno even for ttys and returns useless values.