Guido van Rossum [Thu, 25 Oct 2007 23:47:33 +0000 (23:47 +0000)]
Patch # 1302 by Christian Heimes (with some love from me :-).
The patch fixes the output for profile and cProfile. Another patch from
Alexandre and me added additional calls to the UTF-8 codec.
Guido van Rossum [Thu, 25 Oct 2007 23:21:03 +0000 (23:21 +0000)]
Patch # 1323 by Amaury Forgeot d'Arc.
This patch corrects a problem in test_file.py on Windows:
f.truncate() seeks to the truncation point, but does not empty the
buffers. In the test, f.tell() returns -1...
Guido van Rossum [Wed, 24 Oct 2007 21:13:09 +0000 (21:13 +0000)]
Fix a broken format in a PyErr_Format() call: %lx is not supported.
(It's still technically broken since the va_args code assumes %x is
an int while we're passing a long, but that's mostly theoretical,
and it's done all over the place.)
Guido van Rossum [Wed, 24 Oct 2007 18:41:19 +0000 (18:41 +0000)]
Patch #1318 by Amaury Forgeot d'Arc.
Updates to ctypes for python 3.0 to make the tests pass.
Notable changes are:
- return bytes instead of str8
- integers in range(256) are accepted as "one char string":
libc.strchr("abcdef", 98) is now valid.
- directly use the wide-char version of the win32 function LoadLibrary.
Georg Brandl [Tue, 23 Oct 2007 06:52:59 +0000 (06:52 +0000)]
Patch #1071: Improve unicode.translate() so that you can pass unicode
characters as mapping keys and invalid mapping keys are recognized
and raise an error.
Brett Cannon [Mon, 22 Oct 2007 20:24:51 +0000 (20:24 +0000)]
Make str/str8 comparisons return True/False for !=/==.
Code that has been returning str8 becomes much more apparent thanks to this
(e.g., struct module returning str8 for all string-related formats or sqlite3
passing in str8 instances when converting objects that had a __conform__
method). One also has to watch out in C code when making a key from char *
using PyString in the C code but a str instance in Python code as that will not
longer compare equal.
Once str8 gains a constructor like the current bytes type then
test_modulefinder needs a cleanup as the fix is a little messy in that file.
Thanks goes to Thomas Lee for writing the patch for the change giving an
initial run-down of why most of the tests were failing.
Guido van Rossum [Mon, 22 Oct 2007 00:09:51 +0000 (00:09 +0000)]
Issue 1267, continued.
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.
Brett Cannon [Sat, 20 Oct 2007 03:46:49 +0000 (03:46 +0000)]
Fix PyTokenizer_FindEncoding() for OS X 10.4. Turns out that seeking to the
beginning of a file through a file pointer is not reflected when reading from a
file descriptor. Using both fflush() and fpurge() does not solve it. One must
use lseek() directly on the file descriptor to get the desired effect.
This might suggest that we standardize on either file pointers (FILE) or file
descriptors (int) for all C code used.
Guido van Rossum [Fri, 19 Oct 2007 23:16:50 +0000 (23:16 +0000)]
Patch 1267 by Christian Heimes.
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.
Gregory P. Smith [Tue, 16 Oct 2007 06:31:30 +0000 (06:31 +0000)]
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
to be called a buffer). Shares code with stringobject when possible.
Adds unit tests with common code that should be usable to test the PEPs
mutable buffer() and immutable bytes() types.
Guido van Rossum [Mon, 15 Oct 2007 02:52:41 +0000 (02:52 +0000)]
Patch #1272, by Christian Heimes and Alexandre Vassalotti.
Changes to make __file__ a proper Unicode object, using the default
filesystem encoding.
This is a bit tricky because the default filesystem encoding isn't
set by the time we import the first modules; at that point we fudge
things a bit. This is okay since __file__ isn't really used much
except for error reporting.
Tested on OSX and Linux only so far.
Remove the buffer API from PyUnicode as specified by PEP 3137. Also,
fix the error message of the 't' format unit, in getargs.c, so that it
asks for bytes, instead of string.
Gregory P. Smith [Sat, 13 Oct 2007 23:23:58 +0000 (23:23 +0000)]
Merge 58450: fix uncollectable reference caused by bsddb.db.DBShelf.append
Adds a DBShelf __repr__ method to not raise an exception when the DB is closed.
Eliminate use of PyBUF_CHARACTER flag which is no longer part of the buffer interface. Fix up array module to export the correct format for wide-builds.
Fix problems with memoryview object. There is still more to do to finish PEP 3118. The memory-view object needs to be fleshed out and the struct module needs to be modified.
Gregory P. Smith [Fri, 12 Oct 2007 19:13:19 +0000 (19:13 +0000)]
Merge r58434:
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
Guido van Rossum [Wed, 10 Oct 2007 21:38:59 +0000 (21:38 +0000)]
get rid of some more PyString uses.
Only the filename is still a PyString now.
(We'll need to deal with the default filesystem encoding to do it right.)
Guido van Rossum [Wed, 10 Oct 2007 18:44:39 +0000 (18:44 +0000)]
Fix an issue in PyTokenizer_RestoreEncoding() which was treating a PyBytes
object with PyString calls and not checking errors. This caused the display
of syntax errors to be deformed.
Neal Norwitz [Sun, 7 Oct 2007 19:26:50 +0000 (19:26 +0000)]
At least one of the buildbots was complaining about newview being used
without being initialized. Also make the code conform to the comment and
return the new object. This code needs a test!
str.join(...) now applies str() to the sequence elements if they're
not strings alraedy, except for bytes, which still raise TypeError
(for the same reasons why ""==b"" raises it).
Update the documentation of the open() builtin function a bit. I believe I
mostly got the distinction between text and binary modes correct, though
someone should proofread my writing. I also sort of guessed at the meaning
of the various index:: entries.
Reformat the open function text so it fits within 80 columns in preparation
for a bit of rewriting. Separating the reformatting from the rewriting
should make it easier for people to review the substantive changes.