Commit Graph

19 Commits

Author SHA1 Message Date
Neal Norwitz eb08df2931 Remove a bogus comment based on the code above. 2007-08-16 05:18:31 +00:00
Neal Norwitz 88b44da944 Cleanup a little.
Use bit fields for flags to reduce memory usage.
Return booleans where they are documented.  Although a boolean for
seekable seems a bit odd when it can be unknown.  Add a comment about this.
2007-08-12 17:23:54 +00:00
Neal Norwitz 3c8ba93e0b Py_ssize_t requires "n" format, this fixes most of the 64-bit only failures. 2007-08-08 04:36:17 +00:00
Martin v. Löwis 9f2e346911 Merged revisions 56467-56482 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

................
  r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines

  Merged revisions 56466-56476 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines

    PEP 3123: Provide forward compatibility with Python 3.0, while keeping
    backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
    PyVarObject_HEAD_INIT.
  ........
................
  r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines

  PEP 3123: Use proper C inheritance for PyObject.
................
  r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines

  Add longintrepr.h to Python.h, so that the compiler can
  see that PyFalse is really some kind of PyObject*.
................
  r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines

  Qualify SHIFT, MASK, BASE.
................
  r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines

  Correctly refer to _ob_next.
................
2007-07-21 17:22:18 +00:00
Thomas Heller fdeee3a6cd Second part of sf# 1752225: On windows, emulate ftruncate with Win32
api functions. Code from fileobject.c, patch by Amaury Forgeot d'Arc.

This patch also changes:

The return value of the native ftruncate function is checked for '!=
0' instead of '< 0' as before.

fileio_seekable returns bool now instead of an int.
2007-07-12 11:21:36 +00:00
Thomas Heller af2be262af First part of sf# 1752225: Support for wide filenames on Windows.
Patch by Amaury Forgeot d'Arc.
2007-07-12 11:03:13 +00:00
Thomas Heller c6a55ee2a5 See SF# 1751801: Windows: Add the _fileio builtin module, and undefine
HAVE_FTRUNCATE because ftruncate does not exist on Windows.
2007-07-11 12:45:46 +00:00
Guido van Rossum 7165cb1a48 Made test_file pass. This meant adding support for read(-1) and read()
to even the most basic file object (I also added readall() which may
be a better API).  Also, not all the tests requiring specific failure
modes could be saved.  And there were the usual str/bytes issues.
I made sure test_io.py still passes (io.py is now most thoroughly
tested by combining test_file.py and test_io.py).
2007-07-10 06:54:34 +00:00
Guido van Rossum c43e79f3c8 Fix a buch of shallow test failures.
Note: in test_fileinput.py, two tests are disabled until I figure out how
to replace these.
2007-06-18 18:26:36 +00:00
Walter Dörwald 0e41148c4b Use O_APPEND flag instead of seeking, when append
mode is specified.
2007-06-06 16:55:38 +00:00
Walter Dörwald 3a77c7ab16 If append mode is specified seek to the end of the file.
Add a test to test_fileio.py for this.
2007-06-06 16:31:14 +00:00
Guido van Rossum c2f93dc2e4 Remove native popen() and fdopen(), replacing them with subprocess calls.
Fix a path to an assert in fileio_read().
Some misc tweaks.
2007-05-24 00:50:02 +00:00
Walter Dörwald 1ab8330827 Add functions PyUnicode_Append() and PyUnicode_AppendAndDel() that mirror
PyString_Concat() and PyString_ConcatAndDel() (the name PyUnicode_Concat()
was already taken).

Change PyObject_Repr() to always return a unicode object.

Update all repr implementations to return unicode objects.

Add a function PyObject_ReprStr8() that calls PyObject_Repr() and converts
the result to an 8bit string.

Use PyObject_ReprStr8() where using PyObject_Repr() can't be done
straightforward.
2007-05-18 17:15:44 +00:00
Guido van Rossum dc0b1a1069 Make a few more tests pass with the new I/O library.
Fix the truncate() semantics -- it should not affect the current position.
Switch wave.py/chunk.py to struct.unpack_from() to support bytes.
Don't use writelines() on binary files (test_fileinput.py).
2007-04-12 22:55:07 +00:00
Guido van Rossum 8742977b33 truncate() returns the new size and position.
write() returns the number of bytes/characters written/buffered.
FileIO.close() calls self.flush().
Implement readinto() for buffered readers.
Tests th check all these.
Test proper behavior of __enter__/__exit__.
2007-04-10 21:06:59 +00:00
Guido van Rossum 53807dabf0 Implement long positioning (Unix only, probably).
Etc., etc.
2007-04-10 19:01:47 +00:00
Guido van Rossum b04281592e Make it possible to instantiate a _FileIO() with an integer file descriptor
instead of a filename.
Add a 'closed' attribute.
2007-04-08 17:44:42 +00:00
Collin Winter af334387d1 Add a missing forward declaration for PyFileIO_Type. The _fileio module now compiles with --with-pydebug. 2007-03-08 21:46:15 +00:00
Guido van Rossum a9e2024b84 Check in Daniel Stutzbach's _fileio.c and test_fileio.py
(see SF#1671314) with small tweaks.
The io module now uses this instead of its own implementation
of the FileIO class, if it can import _fileio.
2007-03-08 00:43:48 +00:00