Commit Graph

35229 Commits

Author SHA1 Message Date
Neal Norwitz 841e122f0e Get test_email to pass. There is a problem reading the data file and
making it unicode with the default encoding.  I'm not sure if this is
a problem in and of itself.  However, the test seems to be testing
something different, so at least get that working.  Need to revisit
the unicode problem.
2007-10-27 02:55:08 +00:00
Neal Norwitz efee9f5f1d Use unicode in more places. Fixes a problem with str8 + str in test. 2007-10-27 02:50:52 +00:00
Guido van Rossum ae404e2e0a Sort the method lists for str8 and bytes so differences are more apparent.
Changed bytes.fromhex to take a str argument, as the docstring promises.
Added str8.fromhex (untested so far).
2007-10-26 21:46:44 +00:00
Guido van Rossum a2074f0bd7 Kill PyString_Encode(), which isn't used anywhere.
(We should also kill the other PyString_ encode/decode APIs, but they
still have some users.)
2007-10-26 19:34:40 +00:00
Guido van Rossum 35d02c1649 Delete test_str.py. There's not much there I care about, and it is confused
about whether it's testing str8 or str...  The stuff that matters is already
tested in test_unicode.py anyway.
2007-10-26 18:43:10 +00:00
Guido van Rossum a5d2d5573a Patch 1335 by Christian Heimes.
Add a bytes iterator (copied from stringobject.c and reindented :-).
I (Guido) added a small change to _abcoll.py to remove the registration
of bytes as a virtual subtype of Iterator -- the presence of __iter__
will handle that now.
2007-10-26 17:39:48 +00:00
Guido van Rossum 57233cb3f9 Patch 1330 by Christian Heimes (with some TLC applied by myself).
Move most of the messiness with truncate() on Windows into _fileio.c.
Still keep the flush() call in io.py though.
2007-10-26 17:19:33 +00:00
Neal Norwitz 61ec0d3263 Fix some Py_ssize_t warnings on Win64 that were probably bugs 2007-10-26 06:44:10 +00:00
Neal Norwitz 56cdf686fc Try to fix some of the failing tests on Win64. PY_SSIZE_T_MAX (8 bytes)
is larger than what can fit into a long (4 bytes).  Hopefully this will
fix more problems than it creates.  There are many, many compile warnings
on Win64.  Each of these should be investigated to determine if they
are real problems or not.  Many of these presumably affect the trunk too.
2007-10-26 06:05:28 +00:00
Brett Cannon 37f7e6ebcb Add a missing news entry about how str8's constructor signature now matches the
bytes type.
2007-10-26 05:42:09 +00:00
Guido van Rossum c12a813aa7 Patch # 1331 by Christian Heimes.
The patch fixes some of the problems on Windows. It doesn't introduce
addition problems on Linux.
2007-10-26 04:29:23 +00:00
Guido van Rossum daa251ca09 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.
2007-10-25 23:47:33 +00:00
Guido van Rossum 79b79eeab2 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...
2007-10-25 23:21:03 +00:00
Guido van Rossum 687b9c0779 Patch 1318 by Christian Heimes: remove os.tmpnam(), os.tempnam(),
and os.tmpfile().
2007-10-25 23:18:51 +00:00
Georg Brandl edbcc1332f Remove a test case which is no longer valid. 2007-10-24 21:25:34 +00:00
Georg Brandl d2093f7793 Fix a refleak for `filename', introduced in rev. 58466.
Also remove an unnecessary incref/decref for `name'.
2007-10-24 21:14:07 +00:00
Guido van Rossum 5a2f7e60da 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.)
2007-10-24 21:13:09 +00:00
Guido van Rossum 52ddaefb6b Make test_locale pass by removing tests that were designed to handle
issues with <ctype.h> on various platforms.  We no longer use <ctype.h>.
2007-10-24 20:18:37 +00:00
Thomas Heller 39013cd4c0 A 'PyObject *' parameter in PyErr_Format must use %S parameter, not %s.
Added unittest for calling a function with paramflags.
2007-10-24 19:37:27 +00:00
Georg Brandl bd1c68c94f Patch #1303: Adapt str8 constructor to bytes (now buffer) one. 2007-10-24 18:55:37 +00:00
Guido van Rossum 97f9d4f312 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.
2007-10-24 18:41:19 +00:00
Guido van Rossum b98cda44b7 Patch #1314 by Christian Heimes.
Fix failing unittests for time and strptime on German and probably other
localized Windows installations.
2007-10-23 19:43:28 +00:00
Georg Brandl e1a0d11c5c #1316: remove redundant PyLong_Check calls when PyInt_Check was already called. 2007-10-23 19:24:22 +00:00
Georg Brandl 083bea49a8 Remove duplicate entry for PyObject_AsFileDescriptor. 2007-10-23 18:26:17 +00:00
Georg Brandl b6538a86ba Remove redundant PyInt/PyLong checks. 2007-10-23 18:25:20 +00:00
Georg Brandl d1cdf21cb9 Update Pygments version from externals. 2007-10-23 18:21:41 +00:00
Georg Brandl 7c67613bc7 Update w.r.t. PEP 3137. 2007-10-23 18:17:00 +00:00
Georg Brandl 94c2c75b5e 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.
2007-10-23 06:52:59 +00:00
Georg Brandl 3b8cb17695 #1061 (mainly by Thomas Wouters): use weak sets for abc caches. 2007-10-23 06:26:46 +00:00
Guido van Rossum b98dd2e5d2 Patch 1304, by Amaury Forgeot d'Arc.
Add md5module.c and sha1module.c to the project files,
and in some cases bytes_methods.c and related .h files.
2007-10-22 22:18:51 +00:00
Brett Cannon 4043001f5d 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.
2007-10-22 20:24:51 +00:00
Georg Brandl 6464d47195 In followup to #1310: Remove more exception indexing. 2007-10-22 16:16:13 +00:00
Guido van Rossum b8990aac3a ssue 1309: fix by Christian Heimes to be able to build on Windows. 2007-10-22 16:00:45 +00:00
Georg Brandl 7816e51427 Fix exception indexing. 2007-10-22 12:42:46 +00:00
Guido van Rossum 40d20bcf1f 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.
2007-10-22 00:09:51 +00:00
Brett Cannon c2954e5273 Make sure the malloc'ed string has space for the null byte. 2007-10-21 02:45:33 +00:00
Brett Cannon e453989f2e 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.
2007-10-20 03:46:49 +00:00
Brett Cannon 3bb42d9341 Fix a memory leak caused by PyTokenizer_FindEncoding() returning a char * that
was PyMem_MALLOC'ed.
2007-10-20 03:43:15 +00:00
Brett Cannon d5ec98c7fb Plug a memory leak where a struct tok_state was not being freed.
Also tweak a comparison that was going farther than needed.
2007-10-20 02:54:14 +00:00
Guido van Rossum 6643cb2a7a Tweak the version *string* to clarify that this isn't your father's 3.0a1. :-) 2007-10-20 00:05:19 +00:00
Guido van Rossum ce3a72aec6 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.
2007-10-19 23:16:50 +00:00
Guido van Rossum 75a902db78 Patch 1280, by Alexandre Vassalotti.
Make PyString's indexing and iteration return integers.
(I changed a few of Alexandre's decisions -- GvR.)
2007-10-19 22:06:24 +00:00
Guido van Rossum 21431e85d5 This is the uncontroversial half of patch 1263 by Thomas Lee:
changes to codecs.c and structmember.c to use PyUnicode instead of
PyString.
2007-10-19 21:48:41 +00:00
Gregory P. Smith 630e46424a Merge 58539: squelch the warning that this test is intended to raise. 2007-10-19 07:34:48 +00:00
Gregory P. Smith 66077d8e61 Merge 58532, 58533, 58534: bsddb.dbtables bug fixes - don't allow null bytes
in random rowid strings, pass txn using a keyword where possible.
2007-10-18 16:55:12 +00:00
Guido van Rossum 3172c5d263 Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
2007-10-16 18:12:55 +00:00
Gregory P. Smith 60d241f135 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.

 http://bugs.python.org/issue1261
2007-10-16 06:31:30 +00:00
Alexandre Vassalotti 3d2fd7f923 Fix a small typo in the comment of unicode_default_encoding[]. 2007-10-16 00:26:33 +00:00
Brett Cannon 7648ba83f2 Make the docstring for io.open() a raw string so that the explanation for the
'newline' argument is not a jumbled mess of newlines.
2007-10-15 20:52:41 +00:00
Neal Norwitz e20ad358fd Move decl so it compiles with C89. 2007-10-15 16:08:26 +00:00