Guido van Rossum
baf29638da
Shut up warnings about hex()/oct() that can't be avoided.
2002-08-12 15:16:20 +00:00
Guido van Rossum
1ae4c3d0d8
Avoid warnings about <<. external_attr is now an unsigned long.
2002-08-12 15:15:51 +00:00
Tim Peters
5f7617b5f6
Fixed misspelling in comment.
2002-08-11 18:28:09 +00:00
Ka-Ping Yee
45daeb093f
Extend stripid() to handle strings ending in more than one '>'.
...
Add resolve() to handle looking up objects and names (fix SF bug 586931).
Add a nicer error message when given a filename that doesn't exist.
2002-08-11 15:11:33 +00:00
Marc-André Lemburg
cc8764ca9d
Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.
...
u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.
Closes SF bug #593581 .
2002-08-11 12:23:04 +00:00
Tim Peters
d92ae840e9
test_saveall(): Another small simplification; plus s/l/L/g.
...
test_del(), test_del_newclass(): No need to use apply() in these.
2002-08-11 04:15:09 +00:00
Tim Peters
a1ad3f08ad
And one more simplification to test_saveall().
2002-08-10 21:32:16 +00:00
Tim Peters
4803c126a6
test_saveall(): Simplified a little, given that we only expect one item
...
in gc.garbage (so no need to loop looking for it -- it's there or it's
not).
2002-08-10 21:29:56 +00:00
Tim Peters
c708c0a8c4
If any trash happened to be sitting around waiting to get collected at
...
the time it's called, test_saveall() made it look a leak, triggering
bogus warnings from regrtest's -l (findleaks) mode.
2002-08-10 21:20:54 +00:00
Guido van Rossum
40af889081
Disallow class assignment completely unless both old and new are heap
...
types. This prevents nonsense like 2.__class__ = bool or
True.__class__ = int.
2002-08-10 05:42:07 +00:00
Guido van Rossum
dd8ddacd94
Fix a typo in the mktemp -> mkstemp patch.
2002-08-10 00:17:59 +00:00
Fred Drake
56d1266193
Add tests for weakref support for generator-iterators.
...
Part of fixing SF bug #591704 .
2002-08-09 18:37:10 +00:00
Tim Peters
ca3ac7f639
There's no distinction among 'user', 'group' and 'world' permissions
...
on Win32, so tests that assume there are such distinctions can't
pass. Fiddled them to work.
2002-08-09 18:13:51 +00:00
Tim Peters
a0d55de877
Whitespace normalization.
2002-08-09 18:01:01 +00:00
Guido van Rossum
4aa21aa5b3
Test finalizers and GC from inside __del__ for new classes.
2002-08-09 17:38:16 +00:00
Guido van Rossum
3b0a3293c3
Massive changes from SF 589982 (tempfile.py rewrite, by Zack
...
Weinberg). This changes all uses of deprecated tempfile functions to
the recommended ones.
2002-08-09 16:38:32 +00:00
Guido van Rossum
0e54871f82
Check-in of the most essential parts of SF 589982 (tempfile.py
...
rewrite, by Zack Weinberg). This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.
This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.
2002-08-09 16:14:33 +00:00
Guido van Rossum
0f5f0b8057
Test for Neil's fix to correctly invoke __rmul__.
2002-08-09 16:11:37 +00:00
Guido van Rossum
f36921c4b0
Unicode replace() method with empty pattern argument should fail, like
...
it does for 8-bit strings.
2002-08-09 15:36:48 +00:00
Fred Drake
a350270302
New entries to track the DOM API growth. These match names exposed in
...
PyXML 0.8.
2002-08-09 14:57:55 +00:00
Steve Purcell
dc391a67e3
Fix to ensure consistent 'repr' and 'str' results between Python
...
versions, since 'repr(new_style_class) != repr(classic_class)'.
Suggested by Jeremy Hylton.
2002-08-09 09:46:23 +00:00
Raymond Hettinger
c35491ee3a
Moved inplace add and multiply methods from UserString to MutableString.
...
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
2002-08-09 01:37:06 +00:00
Raymond Hettinger
8da9da0ccc
Revised the test suite for 'contains' to use the test() function argument
...
rather than vereq(). While it was effectively testing regular strings, it
ignored the test() function argument when called by test_userstring.py.
2002-08-09 00:43:38 +00:00
Guido van Rossum
e531e296fa
testSendAll(): loop until all data is read; this was necessary at
...
least on OS/2 (see note on SF patch 555085 by A I MacIntyre) but
looks like the test *could* fail on any other platform too -- there's
no guarantee that recv() reads all data.
2002-08-08 20:28:34 +00:00
Tim Peters
469cdad822
Whitespace normalization.
2002-08-08 20:19:19 +00:00
Tim Peters
d7e8a0dd37
Delete junk attributes left behind by _socketobject class construction.
2002-08-08 20:07:03 +00:00
Guido van Rossum
715f970969
The _socketobject class has no need for a __del__ method: all it did was
...
to delete the reference to self._sock, and the regular destructor will
do that just fine. This made some hacks in close() unnecessary.
The _fileobject class still has a __del__ method, because it must flush.
2002-08-08 18:11:36 +00:00
Guido van Rossum
48b7969af8
OK, one more hack: speed up the case of readline() in unbuffered mode.
...
This is important IMO because httplib reads the headers this way.
2002-08-08 17:34:19 +00:00
Guido van Rossum
fb3deec2fc
Another refactoring of read() and readline(), this time based on the
...
observation that _rbuf could never have more than one string in it.
So make _rbuf a string. The code branches for size<0 and size>=0
are completely separate now, both in read() and in readline().
I checked for tabs this time. :-)
2002-08-08 17:16:09 +00:00
Guido van Rossum
de7cadec54
Extend __all__ with the exports list of the _ssl module.
2002-08-08 15:25:28 +00:00
Guido van Rossum
7c3b6347e5
Oops, stupid tabs. Sorry again.
2002-08-08 15:22:12 +00:00
Guido van Rossum
c18993f84a
Another refactoring. Changed 'socket' from being a factory function
...
to being a new-style class, to be more similar to the socket class
in the _socket module; it is now the same as the _socketobject class.
Added __slots__. Added docstrings, copied from the real socket class
where possible.
The _fileobject class is now also a new-style class with __slots__
(though without docstrings). The mode, name, softspace, bufsize and
closed attributes are properly supported (closed as a property; name
as a class attributes; the softspace, mode and bufsize as slots).
2002-08-08 15:16:20 +00:00
Steve Purcell
824574d3d4
Add module-wide "__metaclass__ = type", as requested by Jim Fulton.
...
(Synched from pyunit CVS)
2002-08-08 13:38:02 +00:00
Guido van Rossum
443fec3dd9
Major restructuring of _fileobject. Hopefully several things now work
...
correctly (the test at least succeed, but they don't test everything yet).
Also fix a performance problem in read(-1): in unbuffered mode, this would
read 1 byte at a time. Since we're reading until EOF, that doesn't make
sense. Use the default buffer size if _rbufsize is <= 1.
2002-08-08 01:02:16 +00:00
Guido van Rossum
8c94383fa8
Replace docstrings on test functions witrh comments -- then unittest
...
prints function and module names, which is more informative now that
we repeat some tests in slightly modified subclasses.
Add a test for read() until EOF.
Add test suites for line-buffered (bufsize==1) and a small custom
buffer size (bufsize==2).
Restructure testUnbufferedRead() somewhat to avoid a potentially
infinite loop.
2002-08-08 01:00:28 +00:00
Guido van Rossum
9ed5ae7331
Replace tabs with spaces. (Sorry!)
2002-08-07 19:03:35 +00:00
Guido van Rossum
10e3f411b0
Tighten the unbuffered readline test to distinguish between the two lines.
2002-08-07 19:02:49 +00:00
Guido van Rossum
3c8dd0c6e7
Simplify heapreplace() -- there's no need for an explicit test for
...
empty heap, since heap[0] raises the appropriate IndexError already.
2002-08-07 18:58:11 +00:00
Guido van Rossum
29bf9157ec
Oops. I accidentally commented out some tests.
2002-08-07 16:03:06 +00:00
Guido van Rossum
e9f6614ea3
"Unbuffered" mode of class _fileobject wasn't actually unbuffered,
...
and this broke a Zope "pipelining" test which read multiple responses
from the same connection (this attaches a new file object to the
socket for each response). Added a test for this too.
(I want to do some code cleanup too, but I thought I'd first fix
the problem with as little code as possible, and add a unit test
for this case. So that's what this checkin is about.)
2002-08-07 15:46:19 +00:00
Raymond Hettinger
ca84d65ca7
Expanded the unittests for the new width sensitive PyUnicode_Contains().
2002-08-06 23:08:51 +00:00
Guido van Rossum
2d702465b3
Add testcase for SF bug 574207 (chained __slots__ dealloc segfault).
...
Fix forthcoming.
2002-08-06 21:28:28 +00:00
Barry Warsaw
e06741704e
Added a test for PyUnicode_Contains() taking into account the width of
...
Py_UNICODE.
2002-08-06 19:03:56 +00:00
Guido van Rossum
fce538c31e
Add a coding cookie, because of the møøse quote.
2002-08-06 17:29:38 +00:00
Guido van Rossum
0855dd8938
Bump the LOOPS count. 50,000 iterations takes about 5 seconds on my
...
machine -- that feels just right.
2002-08-06 17:21:20 +00:00
Guido van Rossum
8ee5243434
Mark xreadlines deprecated. Don't use f.xreadlines() in test_iter.py.
2002-08-06 17:14:04 +00:00
Guido van Rossum
97c5fccd77
Remove mention of deprecated xreadlines method.
2002-08-06 17:03:25 +00:00
Barry Warsaw
817918cc3c
Committing patch #591250 which provides "str1 in str2" when str1 is a
...
string of longer than 1 character.
2002-08-06 16:58:21 +00:00
Guido van Rossum
3c668c1256
Add next and __iter__ to the list of file methods that should raise
...
ValueError when called for a closed file.
2002-08-06 15:58:24 +00:00
Fred Drake
63c4220f61
We only need to check for StopIteration here.
2002-08-05 22:16:40 +00:00