Commit Graph

35240 Commits

Author SHA1 Message Date
Georg Brandl 316414e435 Fix typo. 2007-10-30 17:42:20 +00:00
Guido van Rossum 2dced8b602 Patch 1329 (partial) by Christian Heimes.
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.)
2007-10-30 17:27:30 +00:00
Martin v. Löwis 2673a57234 Bug #1356: Avoid using the C99 keyword 'restrict'. 2007-10-29 19:54:24 +00:00
Guido van Rossum 6203d8fa11 Patch 1341 by Amaury Forgeot d'Arc.
This patch corrects test_fileinput on Windows: when redirecting stdout,
os.open should be given O_BINARY, because the file descriptor is then
wrapped in a text-mode file; os.fdopen(fd, "w").
2007-10-29 17:39:59 +00:00
Fred Drake 3db4686b61 fix typo 2007-10-29 16:56:50 +00:00
Guido van Rossum 5d21255968 Issue 1340 by Amaury Forgeot d'Arc (with help from Christian Heimes,
and my own interpretation).
Don't pass the newline= flag to StringIO in SpooledTemporaryFile.
This avoids doubling newlines when the file is rolled over.
2007-10-29 16:42:51 +00:00
Neal Norwitz 1b16ca4ef1 URLError now takes only a single parameter. This was causing
errors in test_urllib2net on the MIPS buildbot.
2007-10-27 17:25:12 +00:00
Neal Norwitz 96bf3cc3fc Get a bunch of tests working on Mac OS. I suspect that a bunch of the
ord()s in Lib/plat-mac/ic.py need to be removed.
2007-10-27 06:04:52 +00:00
Neal Norwitz 3d7a90dea1 Get the locale and pwd tests working on the Solaris box where there
are some unicode values used.  I'm not sure if this is the correct
on all operating systems, but this works on Linux w/o unicode.
2007-10-27 05:40:06 +00:00
Neal Norwitz 8866e0ab58 Try to get this test to pass on Win64 by making clean for ssize_t 2007-10-27 04:01:17 +00:00
Neal Norwitz bed678449f Get rid of more uses of string and use unicode 2007-10-27 04:00:45 +00:00
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